TruePERSPECTIVES_logo.png

How to debug FreeRTOS and OpenRTOS applications [application note]

Posted by Magnus Unemyr on Jun 4, 2015 9:37:00 AM

FreeRTOS is one of the most popular real-time operating systems in recent years. (OpenRTOS is technically identical to FreeRTOS but is sold as a commercial product.)

Many Cortex-M developers adding FreeRTOS to their STM32, LPC or EFM32 projects. But what about tool support? Professional developers need professional compiler and debugger IDEs and kernel-aware debug support for FreeRTOS in the IDE. We have written an application note about using this feature in the TrueSTUDIO IDE.

Read More

Topics: ARM Cortex, Debugging, Atollic TrueSTUDIO, RTOS

Read our free eBook on how to develop interrupt handlers for Cortex-M devices

Posted by Magnus Unemyr on May 27, 2015 11:42:01 AM

Embedded development is a lot more complicated than PC development; the main reason being the low abstraction level and the tight relation to the hardware implementation. One particular pain point for new or inexperienced embedded developers is interrupt handling.

Interrupts are events generated by the hardware. Common causes for interrupts being triggered may be timers that expire, communications interfaces that receive data bytes, DMA transfers being completed, and so on.  The question then becomes how to develop interrupt handlers using the GNU/GCC compiler for popular Cortex-M devices like STM32, Kinetis, LPC or EFM32? Read our free eBook to learn more!

Read More

Topics: ARM Cortex, GNU tools (GCC/GDB), Embedded Software Development

Learn more on Cortex-M hard fault exception analysis [video tutorial]

Posted by Magnus Unemyr on May 13, 2015 1:18:46 PM

Our free hard fault exception crash analyzis video tutorial will teach you how to analyse and fix Cortex-M system crashes which can be very difficult and time consuming. Hard faults can occur due to division by zero, stack overruns, pointer errors etc.

By using the methods and tools outlined in this video, the root cause and location of hardfault system crashes in popular Cortex-M based microcontrollers like STM32, Kinetis, LPC etc. can be easily identified in seconds, rather than hours.

Read More

Topics: ARM Cortex, Debugging, Atollic TrueSTUDIO

12 great tools and techniques for STM32 developers

Posted by Magnus Unemyr on May 13, 2015 12:35:00 PM

Are you a skilled embedded developer, creating great software for STM32? You are in good company. If so, this blog article is for you. I have collected a number of tools and techniques that can be used to help you write STM32 software in an even better way, launching your embedded product more timely and of higher quality.

What does it take to write great STM32 software? Naturally, you need to know C or C++ and possibly a tad bit of assembler as well. You also need to know your target device and its device driver libraries as well. STMicroelectronics will provide information on this. But when what? What are the “secret” techniques used by really skilled STM32 developers? What tips and tricks do they want to keep to themselves?

Read More

Topics: ARM Cortex, Software quality, Debugging, Embedded Software Development

Using GNU GCC on ARM Cortex devices: Placing code and data on special memory addresses using the GNU LD linker

Posted by Magnus Unemyr on May 7, 2015 10:04:00 AM

Many modern microcontroller devices have more than one memory region, and you may want to locate code or data on fixed memory addresses in any of those memory regions, for various reasons. It is possible to use the linker script in the TrueSTUDIO C/C++ IDE and other GNU/GCC-based ARM Cortex-M development tools to precisely place the code in different memory areas.

To do that modify the .ld-linker script file memory regions. Here is an example of a linker script file containing the following memory areas:

Read More

Topics: ARM Cortex, GNU tools (GCC/GDB), Atollic TrueSTUDIO

Get your first grip on Cortex-M7 - attend our free workshop in Munich (Germany) on 20th of May!

Posted by Magnus Unemyr on May 6, 2015 2:32:17 PM

During this free half-day Cortex-M7 and TrueSTUDIO development technical training seminar in Munich (Germany) you will get more insights into STMicroelectronics STM32 microcontroller architecture with a focus on the new STM32F7 family and experience firsthand how a modern and well-integrated IDE with additional features can support embedded developers in important areas such as advanced debugging, code and complexity management, team collaboration, and software quality.

The seminar consists for the most of hands-on exercises. Each participant will receive a 60 days time-limited version of Atollic TrueSTUDIO Professional. By deploying methods and tools outlined in this workshop, you and your team are more likely to deliver high-quality software on time and within budget.

Read More

Topics: Events, ARM Cortex, Atollic TrueSTUDIO

What you need to know about debugging interrupts and exceptions on Cortex-M devices

Posted by Magnus Unemyr on Apr 28, 2015 11:20:34 AM

Any Cortex-M developer have likely struggled with getting interrupts to work, or tried to debug them. Getting it all hooked up can be rather tricky, from getting a correctly defined interrupt vector table linked on the right memory addresses, to enabling interrupts properly, and then processing them in an interrupt handler. It all involves advanced topics like linker configuration files, SFR register bit field configuration and manipulation, interrupt #pragmas, possibly inline assembly and more.

So how do you go about analyzing and debugging the behavior of your interrupts and exceptions on a Cortex-M device like STM32, Kinetis, LPC or EFM32? Interrupts and exceptions are by definition asynchronous to the execution flow of your application software and it can be very difficult to visualize interrupt behavior, and debug the same. So what is a Cortex-M developer to do? As it so happens, the Cortex-M core has brilliant hardware support for visualizing and debugging interrupt behavior. This is how to use it.

Read More

Topics: ARM Cortex, Debugging, Atollic TrueSTUDIO, SEGGER J-Link, ST-LINK

How to develop and debug BOOTLOADER + APPLICATION systems on ARM Cortex-M devices

Posted by Magnus Unemyr on Apr 27, 2015 4:21:00 PM

As we all painfully have come to learn - firmware is rarely bug-free and new requirements are usually added over time. And so there is a need for a method to upgrade the firmware of a shipped product when defects are found or new functionality is needed. From a logistics point of view, a product recall with a factory upgrade might not be a feasible option.

By separating the application logic from the booting process, developers can design a system that allows end-users or service technicians to upgrade the application software with a newer and presumably better version later on, without the need for recalls or factory upgrades. This can be done using a bootloader. But what is a bootloader and how is it implemented and debugged on an ARM Cortex-M device like STM32 or Kinetis? The post also links to a bootloader code example for STM32F4-Discovery.

Read More

Topics: ARM Cortex, Debugging, Atollic TrueSTUDIO, SEGGER J-Link, ST-LINK

How good is the GNU gcc C/C++ compiler as a tool for ARM Cortex-M development?

Posted by Magnus Unemyr on Apr 27, 2015 9:42:16 AM

The GNU gcc compiler is one of the most widely used C/C++ compilers in the world. It is the basic build tool for building all EmbeddedLinux and Android systems, as well as all desktop or server Linux operating systems and their applications. The GNU compiler is also used to build many commercial real-time operating systems, such as RTOS products from Enea, QNX, WindRiver and more.

And so it is safe to say it is very well proven in field. But how well does the GNU gcc compiler fit developers using ARM Cortex-M devices, for example STM32, Kinetis, EFM32 or LPC? And what capabilities and core support does it offer to ARM Cortex developers?

Read More

Topics: ARM Cortex, GNU tools (GCC/GDB), Atollic TrueSTUDIO

New whitepaper on ETM/ETB instruction tracing on Cortex-M devices

Posted by Magnus Unemyr on Apr 23, 2015 2:19:57 PM

As outlined in a recent blog article, ETM/ETB instruction tracing is the heavy artillery in Cortex-M debugging, and you may need it to solve that impossible "one million dollar bug", or if you cannot stop on breakpoints without damaging physical equipment, which can be the case in motor control applications for example.

Using ETM/ETB instruction tracing, you can record execution history for later analysis, and thus work out what the CPU did prior to the bug. To do that, you need an ETM-trace enabled debug probe, such as the SEGGER J-Trace, as well as a debugger IDE like Atollic TrueSTUDIO with trace support. For ETB, no particular trace-enabled debugger probe is needed, but the target device needs to have ETB on-chip. You can read more on ETM/ETB instruction tracing on Cortex-M devices like STM32, Kinetis or LPC in our new whitepaper.

Read More

Topics: ARM Cortex, Debugging, Atollic TrueSTUDIO, SEGGER J-Link

Why STM32 developers still need an SFR view to study the STM32 special function peripheral registers

Posted by Magnus Unemyr on Apr 20, 2015 11:08:55 AM

Writing device-drivers for microcontrollers like STM32 is very complicated if you haven’t written a few of them before; not only do you need to understand the peripheral module hardware and their special function registers (SFR’s), you also have to be an ace on the meaning of SFR bit-fields and bits, understand interrupt vector tables, #pragmas, inline assembly and other intricate things.

Not too many years ago, semiconductor vendors didn’t provide device-driver libraries with their microcontrollers, and so each customer had to write them from scratch. What a waste of engineering time and duplication of resources! Way too many years later, they started to ship static device driver libraries or device-driver generations tools to help struggling developers. STMicroelectronics for example provide both static STM32 device-driver libraries, as well as the STM32CubeMX device initialization tool. And so, with readymade device driver libraries available, do STM32 developers need to worry about SFR’s anymore? I’d say yes, for reasons outlined in this blog article.

Read More

Topics: ARM Cortex, Debugging, Atollic TrueSTUDIO, SEGGER J-Link, ST-LINK

Using SEGGER J-Trace to record and analyze execution history with ETM instruction tracing

Posted by Magnus Unemyr on Apr 16, 2015 2:02:00 PM

The Segger J-Link and other JTAG/debug probes (like ST-LINK for STM32 devices) offer great debugging capabilities on ARM Cortex-M devices, such as STM32, EFM32, XMC or Kinetis. Debugging techniques supported by J-Link and ST-LINK include for example hard fault crash analysis and real-time system analysis with event- and data tracing using the Serial Wire Viewer (SWV) interface.

This is great, but what if you are still stuck? Or perhaps you will damage physical H/W if you stop execution on a breakpoint, which can be the case in motor control applications. In such case, you may need to call for the heavy debugging artillery. For ARM Cortex developers, that means bringing in a debug probe that can record execution history for later analysis, using the ETM instruction trace interface from ARM. To do that, you need an ETM-trace enabled debug probe, such as the SEGGER J-Trace, as well as a debugger IDE like Atollic TrueSTUDIO with trace support..

Read More

Topics: ARM Cortex, Debugging, Atollic TrueSTUDIO, SEGGER J-Link