TruePERSPECTIVES_logo.png

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

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

Read the GNU compiler runtime library API documentation using mouse hover in the editor

Posted by Magnus Unemyr on Apr 16, 2015 12:23:00 PM

High-end ECLIPSE-based embedded IDE’s extend standard ECLIPSE in many ways, and one nice extension added to the Atollic TrueSTUDIO IDE for ARM Cortex devices is the capability to view the GNU compiler runtime library manual as tooltips by hovering with the mouse over the runtime library function call in the editor.

Perhaps you are uncertain on the parameter list in a function call to the runtime library, or perhaps you can’t remember the type of the return code. By positioning the mouse over the function call in the C/C++ editor, Atollic TrueSTUDIO will show a tooltip with the API reference manual for that particular function in the GNU compiler runtime library:

Read More

Topics: ECLIPSE, GNU tools (GCC/GDB), Atollic TrueSTUDIO, Embedded Software Development

Top reasons why the embedded industry standardize on ARM processors, the GNU compiler and the Eclipse IDE

Posted by Magnus Unemyr on Apr 14, 2015 3:05:00 PM

It is currently a very strong trend in the embedded industry to standardize on ARM Cortex devices, the GNU gcc compiler (with its accompanying gdb debugger), and the Eclipse IDE. I call the ARM, GNU and ECLIPSE combo “AGE”.

What are the driving factors for this strong trend? And what are the benefits for embedded developers to jump on the ARM Cortex, GNU gcc/gdb and Eclipse train? In my opinion, there are many benefits that provide embedded developers with great advantages.

Read More

Topics: ECLIPSE, ARM Cortex, GNU tools (GCC/GDB), Debugging, Atollic TrueSTUDIO, Embedded Software Development, Project migration

Optimizing code-size with the GNU gcc compiler for STM32 and other ARM Cortex-M targets

Posted by Magnus Unemyr on Apr 13, 2015 12:05:32 PM

The discussion of code size has been a never ending story in the embedded compiler industry for decades. During many years, the code size of compilers was the only real differentiator, and code size measurements were publicly used in magazine advertisements as well. Remember the times of the 8051? Embedded compiler vendors have even modified their tools to detect when official benchmark test suites were compiled and generated hand optimized machine code in those cases, to produce “incredible” numbers for marketing use in “competitor comparisons”. Go figure.

Luckily, most embedded compilers in use today are of very high quality, and produce code size of very small size difference in real-life projects (the GNU compiler is a good example of this). Still some compiler vendors use misleading figures in their marketing, but that is of little practical consequence in real life for most customers.

Read More

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

Meet STM32F7 – The new Cortex-M7 based STM32 family

Posted by Magnus Unemyr on Apr 10, 2015 11:49:00 AM

The new ARM Cortex-M7 processor core is the most recent and highest performance of the different microcontroller cores in the ARM Cortex-M family. And as such, it outperforms for example the Cortex-M3 and Cortex-M4 on performance, while maintaining backwards compatibility.

Many semiconductor manufacturers have announced new Cortex-M7 devices, and one of the first out is STMicroelectronics, adding new Cortex-M7 devices to their STM32 family. The Cortex-M7 version of STM32 is called STM32F7, runs at 200MHz and initially coming with 512KB or 1MB of Flash memory and 320KB of RAM. And so, what can STM32 developers expect, when equipping their coming designs with the more powerful STM32F7?

Read More

Topics: ECLIPSE, ARM Cortex, GNU tools (GCC/GDB), Atollic TrueSTUDIO, SEGGER J-Link, ST-LINK

Cortex-M debugging: Measure execution time using SWV/ITM

Posted by Magnus Unemyr on Apr 10, 2015 10:22:00 AM

By now, I have written a large number of blog articles highlighting the advanced debugger capabilities offered by the Serial Wire Viewer (SWV) real-time event- and data tracing, available in Cortex-M devices, such as STM32 from STMicroelectronics, Kinetis from Freescale, LPC from NXP, etc. In this blog article, I will mention how the Instrumentation Trace Macrocell (ITM), which is part of SWV, can be used to measure the execution time of any-sized and any-partitioned blocks of code.

For example, you may want to know what the execution time is of a while{} loop. Or how long it takes from the user press the “Heat” button until the oven reaches a certain temperature in the code (perhaps detected by an if{} statement code line), or how long time it takes to execute 15 sequential lines  of code in a function. All these time measurement use cases, and more, can easily be accommodated using SWV/ITM in Cortex-M based devices, such as the widely popular STM32 or Kinetis microcontroller families.

Read More

Topics: ECLIPSE, ARM Cortex, GNU tools (GCC/GDB), Debugging, Atollic TrueSTUDIO, SEGGER J-Link, ST-LINK

STM32 debugging using the ST-LINK debug probe from STMicroelectronics

Posted by Magnus Unemyr on Apr 9, 2015 9:40:00 AM

Many STM32 developers use ST-LINK as their JTAG/debug probe. In particular, it is soldered onto many STM32 starter kits and evaluation boards, including the STM32 Discovery Kits and Nucleo boards. But it is also offered as a low-cost stand-alone JTAG/debugger probe as well.

So what debugging capabilities can you expect when hooking up the C/C++ debugger in your IDE to your STM32 board using the ST-LINK JTAG/debug probe? Considering its price, it is a very useful and convenient debug solution, but it also doesn’t offer the performance or all of the more advanced capabilities of for example the SEGGER J-Link or J-Trace debug probes.

Read More

Topics: ECLIPSE, ARM Cortex, GNU tools (GCC/GDB), Debugging, Atollic TrueSTUDIO, ST-LINK

Using GNU gcc/gdb and ECLIPSE with ARM Cortex devices: Is free tools right for you?

Posted by Magnus Unemyr on Apr 8, 2015 11:59:00 AM

As the embedded industry now standardize on the GNU C/C++ tools (gcc compiler and gdb debugger) and the ECLIPSE IDE, more tool options have become available in the last year or two. In particular, free or low-cost Eclipse/GNU tools are widely available on the market for Cortex-M devices like STM32, Kinetis and LPC. Also available are high-end Eclipse/GNU tools like Atollic TrueSTUDIO, supporting the same devices with many commercial add-ons. And so, which one to choose?

A question is if the free tools really are free, and if they offer what you need? Factors to consider are out-of-the-box experience, quality and support options, as well as productivity and functionality, and managing project risks. Different development teams may well have different priorities and answer to these questions. Let’s see what factors there are to consider.

Read More

Topics: ECLIPSE, ARM Cortex, GNU tools (GCC/GDB), Debugging, Atollic TrueSTUDIO, SEGGER J-Link, RTOS, ST-LINK

Cortex-M debugging: Performance optimization using SWV statistical profiling

Posted by Magnus Unemyr on Apr 8, 2015 8:00:00 AM

So, where do you hang out? Or rather, where do you spend your time? While this question may appear a bit personal, it is a valid question in terms of embedded software. Knowing where your application spends most time executing is the first step in efficient speed optimizations. Profiling your application to understand where it spends most of the time, is the best way to optimize performance the most, with the least efforts.

Say for example that your application spends 95% of the time in 3 C-functions, and the remaining 5% in another 125 C-functions. Then it is quite obvious you should spend your optimization efforts in the 3 functions that use most of the CPU time. While this 95% in 3 functions/5% in 125 functions ratio may appear to be a rigged and fairly extreme example, it really isn’t that uncommon. Usually, only a few C-functions use most of the CPU cycles. By analyzing what C-functions steal most of the CPU cycles, you know where to optimize for best results.

Read More

Topics: ECLIPSE, ARM Cortex, GNU tools (GCC/GDB), Debugging, Atollic TrueSTUDIO, SEGGER J-Link, ST-LINK

What is the best tool for professional STM32 development?

Posted by Magnus Unemyr on Apr 7, 2015 12:58:00 PM

I often get questions on what tool to choose for embedded development; and after a number of years in this industry I have learnt that no tool fits all, and that many developers have very different opinions on what is important. Additionally, different developers have different needs and skill levels too.

Having said that, I have also seen a large number of development projects and learnt what is important for most embedded developers, and how to approach the tool selection process. Last week, I again got the question on what embedded tools are best from a company looking for STM32 development tools. That triggered me to take a step back and think about how to select the right tools (for STM32, or any other ARM Cortex device like Freescale Kinetis or NXP LPC for that matter) from a slightly more philosophical point of view.

Read More

Topics: ECLIPSE, ARM Cortex, GNU tools (GCC/GDB), Software quality, Debugging, RTOS, Embedded Software Development

Cortex-M debugging: Oscilloscope style graphical data plot in real-time

Posted by Magnus Unemyr on Apr 7, 2015 9:35:00 AM

In my previous blog articles on Cortex-M Serial Wire Viewer data tracing, I have outlined how you can exploit real-time variable watch and Memory access history trace log capabilities in popular Cortex-M devices like STM32, Kinetis or LPC.

This blog article will extend upon this and show how you can visualize variable values graphically in real-time, using an “oscilloscope style” data plot graph as the Cortex-M target system executes at full speed.This gives developers instant and highly visual feedback, non-intrusively, from running target systems.

Read More

Topics: ECLIPSE, ARM Cortex, GNU tools (GCC/GDB), Debugging, SEGGER J-Link, ST-LINK