PVS-Studio is a static code analyzer detecting errors and potential vulnerabilities in the code of applications written in C, C++, and C#. We've been entertaining the readers of our blog for a long time by checking various open-source projects and commenting on the bugs found. Now our articles have every chance to become even more interesting because PVS-Studio can now check the code of embedded devices. We have added support for a few ARM compilers, which I talk about in detail below. Bugs in embedded devices and robots could be more of a spectacle than bugs in regular applications. When showing up in such devices, bugs don't simply cause a program to crash or hang, or display an image incorrectly; they make Wi-Fi kettles go mad and boil the water until it's all gone and the thermostat trips. That is, bugs tend to be more interesting and creepy in the world of embedded systems.


My most spectacular bug

I've made a lot of coding mistakes over my programming career. Those errors were, however, somewhat dull. They just made programs misbehave or dereference a null pointer, and so on. Yes, those were true bugs that needed fixing. But the most impressive error I've ever made was when I was tinkering with my homemade robots.

I'm just a layman in robotics, and I've built all my machines just for the sake of fun and experiment. Among others, I've built four small remotely controlled robots that could play robot football and "catch the mouse". Without going into detail, they could do the following: move on their wheels, hit the ball, grasp with their claws, make sounds, and flash their LEDs. Here's a photo of one of those things as proof:


This bot is based on the ATmega8A microcontroller (8 Kbyte Flash, 512 byte EEPROM, 1 Kbyte RAM). In the first version of the firmware, one of the microcontroller timers would generate an interrupt whose handler was reading the commands transmitted from the remote control. A command received was written to a FIFO buffer from which it would then be retrieved and executed in the main program loop. Those commands were: move forward/backward; turn left/right; move forward turning slightly to the left; grasp the mouse; hit the ball; etc.

My implementation was actually too complicated. I got rid of the FIFO buffer later and rewrote the entire program in a simpler and neater form.

Now imagine me uploading the new firmware to the microcontroller, switching the robot on, and... The bot suddenly starts living on its own!


Here it is, moving across the floor chaotically, snapping its claw, hitting an invisible ball, flashing its lights. The funniest thing is that I don't even know why. There's simply no code in its firmware, I believe, that would make it do all these things.

It was the strongest impression of a software bug I've ever had over all my years as a programmer. It's one thing having a program crash because of a stack overflow, and quite another seeing a crazy robot rushing about, a robot built by you, without your having a slightest idea of how that could become possible. I wish I was smart enough at the time to take a video of the happening, with my facial expression in the background :).

It didn't take me long to figure out that I had made one of the most classic programming mistakes, namely forgetting to initialize the variable storing the number of unprocessed commands in the FIFO buffer. The robot started executing a random sequence of commands, reading the data from the buffer, as well as from beyond it.

Why am I telling you this? Well, I just wanted to show you that bugs in microcontroller firmware could be more dramatic than those in regular applications, and I hope you will also enjoy my other articles to come. Now, let's get back to the subject of this one, which is the release of the new PVS-Studio version.

Read more - https://www.viva64.com/en/b/0561/
Kate Milovidova 5 march 2018, 7:42

MSL Curiosity did the most detailed geological research on Mars

Chemistry & Mineralogy X-Ray Diffraction is one of the most accurate methods of mineralogical analysis. Due to this method it is possible to find out the mineral composition, not the chemical. For example, diamond and graphite are identical in terms of chemistry, but the different formation conditions affected the crystal lattice structure and radically changed the mineral nature. The purpose of Curiosity was just to determine what conditions led to the mineral formation on Mars in the past.

BumBum 15 november 2012, 16:00

Racing simulator experts know that the computer always uses the ideal trajectory, and it does not make any mistakes, but this is only in the game. What about the real life?
Pirat 12 november 2012, 19:48

This cyberplatform is able to carry up to 9 grams of useful load.

Let’s take a look at a caterpillar. At some point it turns into a butterfly. Here is a simple question, namely is it possible to give it the synthetic components that allow building a cyborg-insect? Answer would be yes it is. Michel Maharbiz, associate professor did it.
BumBum 2 may 2012, 15:50

imageI want to have a robot! It would entertain me ...dance ...cook ... and clean for me. While you are continuing to dream, I am going to talk about the wonderful robot that now you can buy at a reasonable price, and at the same time we will look into the over mentioned things, which the robot could do, namely dancing, entertaining, and washing socks. This robot is named Bioloid. It is made by Robotis Korean Company. This Bioloid has an interesting peculiarity, namely using its kit of parts you can build different types of robots, starting from a simple lift gate and finishing with a dinosaur robot or an android. In fact, you can build your own unique robots.
Pirat 10 april 2012, 13:07

The technological progress is moving from the futuristic androids to more practical developments.

A few days ago, Boston Dynamics that is a maker of the Big Dog has posted a video on internet about another project - Petman. Previously, it has already been written about it, however the development of this project had not been finished in that time. What we see now is truly amazing.

Here is some information about the project:

Petman is an anthropomorphic robot for testing chemical protection clothing that are being used by the U.S. Army. In contrast to the previous suit testers, which had a limited set of motions and had to be supported mechanically, Petman will balance itself and move freely; walking, crawling and doing a variety of suit-stressing calisthenics during exposure to chemical warfare agents. Petman will also simulate human physiology within the protective suit by controlling temperature, humidity and sweating when necessary, all to provide realistic test conditions.
Papay 18 november 2011, 10:37


The last few weeks were marked by two major robot exhibitions in Asia that were held one after another. It all has begun with the Korea’s Robot World 2011 exhibition and ended with Japan’s IREX 2011. There were shown amazing prototypes despite the fact that android- engineering is only a small part of the Asian (and global) robotics technology.
BumBum 16 november 2011, 16:48

Fully automated minibuses (pods) were launched at the Heathrow Airport:
• Their speed is at up to 40 kilometers per hour.
• Carrying capacity of one pod is four passengers.
• They have fully automatic operation.
• The pods are at 70% more efficient than cars, and at 50% that usual buses.
• More than 100 000 people have been used this transport since April.


It is recommended to see a video, this was a project at that time and now, it is a reality.
Here is a link to the video and article how it works now.
BumBum 20 october 2011, 12:36