Percepio, a member of the ST Partner Program, uses the cloud to report remotely a bug that’s plaguing a product in the field. We thus wanted to shine a light on the Percepio DevAlert, formerly Device Firmware Monitor, to better understand its impact on IoT devices and the various advantages that such a solution brings to companies. Developers can use that report to fix the problem with an over-the-air update before consumers even encounter any issue, in some cases. It’s interesting to note that Percepio used ST’s B-L475E-IOT01A Discovery kit for IoT as a reference for their project. We thus sat down with Johan Kraft, CEO, and founder of Percepio, as well as Mike Skrtic, his Vice President of Sales and Marketing, to better understand the solution and its importance in the STM32 ecosystem.
Since the first official “bug” in 1947, caused by a moth lodged into a hardware relay inside Harvard’s Mark II electromechanical computer, errors and glitches continue to plague code around the world. A 2002 study by the U.S. Department of Commerce’s National Institute of Standards and Technology (NIST) established that bugs cost the U.S. economy about 60 billion dollars annually. More recently, a paper published in 2016 by The Journal of Systems and Software1 showed that a lot of bugs, especially those with more than two conditions, avoided internal testing procedures. Put simply, developers could have caught them before releasing their program, but they didn’t have the testing protocols to spot them. After all, as programs get increasingly complex, testing for every single use case and code branch is often impossible. A tool like Percepio DevAlert (DevAlert) is thus a solution to this problem.
The Unobtrusiveness of Percepio DevAlert, From Small Memory Size to Great STM32 Support
To take advantage of Percepio DevAlert, developers call APIs that generate an alert when a glitch occurs. The alert includes the error code and messages as well as any other information that developers want to use, such as specific values and the recording of a trace, which is a special log detailing the program’s execution. Programmers can then use Percepio’s Tracealyzer to analyze the recorded trace and determine what went wrong. One significant advantage of such an approach is that the API call can take place within the code that handles existing errors or exceptions. The tool is thus relatively straightforward because it doesn’t necessitate a rewrite of existing code, but relatively simple API calls in places that already handle errors.
Percepio DevAlert supports all STM32 microcontrollers using a Cortex-M and runs on Amazon’s FreeRTOS. Additionally, using the trace recorder only requires a few kilobytes of RAM, and a system can transfer this data to the Flash if the bug leads to a hard reboot. As Johan and Mike explained,
“Developers can allocate various memory sizes to the trace recorder that will report the bug. After ten years of work, we were able to greatly optimize our solution to only use between four bytes to 12 bytes per event, with a majority only requiring four to eight bytes. Comparatively, a similar trace recorder from our competitors requires between 16 KB and 32 KB of memory.”
It not only means that Percepio’s solution can fit in a lot of systems, including those with very tight memory constraints but that storing hundreds or thousands of events is reasonable. Developers can thus have a comprehensive analysis of their program and figure out how to optimize it.
The Practicality of Percepio DevAlert, From STM32CubeIDE to the User Experience
One way to quickly test Percepio DevAlert is to use the B-L475E-IOT01A Discovery kit. As Johan and Mike told us,
“The STM32L4 Discovery kit IoT node is reliable and works well with FreeRTOS. The board also offers STLINK, which we support, and debugging connectors to make troubleshooting easier.
The company supported the STLINK-V3 as soon as it launched last year, thus ensuring their customers get to enjoy the faster speeds and new features, such as the snapshot mode. Additionally, Percepio went a step further by providing an Eclipse plugin for STM32CubeIDE, our first free IDE with STM32CubeMX integrated. The plugin makes it easier to use Tracealyzer within the development environment. DevAlert also uses the AWS infrastructure to help engineers keep track of bugs or specific information, opening the system to more than just error detection.
Percepio uses the cloud to sort bugs out using a “Classification Engine.” Before the information reaches the developer, the company processes it to highlight any new or potentially important issues. It can also use the cloud to track certain sensor information, just like a regular IoT platform. It’s highly essential because developers can monitor specific sensor values to see if there are unforeseen conditions that could damage their system. Similarly, they can even track how the user interacts with a product. For instance, programmers could detect if people press a button either accidentally or because there’s a flaw in the interface. Testing every edge case and unexpected user behavior in the lab is mostly impossible. The feedback from the Percepio DevAlert can thus offer information that teams would not be able to get any other way.