Merging S19 Files


If using a bootloader with an application, one thing is to to merge the bootloader with the application into a single file. I do this with the ‘SRecord’ tool like this:

srec_cat bootloader.s19 application.s19 -o merged.s19
Combining S19 Files

Combining S19 Files

Continue reading

Are ARM CMSIS-Pack the Future of Software Components?


I’m using Processor Expert components for nearly every Freescale (now NXP) projects: for S08, S12, ColdFire, DSC and especially all the different NXP Kinetis devices. Not only because it makes software development fast and easy and allows re-use of software, but as well because Processor Expert has a good way to pack and distribute software components. Unfortunately Processor Expert is not any more included for the new Kinetis devices (see “First NXP Kinetis SDK Release: SDK V2.0 with Online On-Demand Package Builder“). So I have looked into an alternative and hopefully vendor neutral way to build and distribute software packages using CMSIS-Pack.

CMSIS-PACK in Eclipse

CMSIS-Pack in Eclipse

Continue reading

Renaming Eclipse CDT Projects


When I create a project in Eclipse (e.g. in Kinetis Design Studio with the GNU ARM Eclipse plugins), I have to specify the name of the project during creation time:

Project Name in Eclipse

Project Name in Eclipse

But what if I change my mind later on and want to use a different name? How to rename the project?

Continue reading

Preprocessor Listing for GNU gcc with GNU ARM Eclipse Plugins


In case there are problems with the C/C++ preprocessor, it is useful to generate the compiler preprocessor listing. Here is how to create a preprocessor listing with GNU gcc compiler and the GNU ARM Eclipse plugins in Eclipse:

Preprocessor Listing in Eclipse

Preprocessor Listing in Eclipse

Continue reading

GNU gcc printf() and BuiltIn Optimizations


Readers of my blog know: I’m not a fan of printf(), and I think for many good reasons. Still printf() is widely used, and the GNU gcc tries to optimize things. This is observed with a simple example: If I’m writing

printf("a");

Then the code produced (ARM Cortex-M0+ with GNU ARM Embedded 4.9 2015q2 gives:

movs r0, #97    ; 0x61
bl 0xa98

Instead of calling printf(), it is calling putchar()! Why is that?

PutChar instead of Printf

PutChar instead of Printf

Continue reading

Segger SystemView: Realtime Analysis and Visualization for FreeRTOS


One of the most important aspects for developing complex realtime applications is get insights into what is going on the target. Segger just has released a free tool which gives an incredible useful insight view and visualization:

Segger System View for FreeRTOS

Segger System View for FreeRTOS

Continue reading

An Introduction to Kinetis Design Studio for Mac OS X


I don’t own a Mac computer, and I try to keep my tutorials as multi-host-platform as possible. So it is always cool to see if someone else posts a nice tutorial on a different host machine: For all Mac (and as well non Mac) users, have a look at this tutorial Nash Reilly has posted: “An Introduction to Freescale’s Kinetis Design Studio.”

added_C_cross_compile_includes

It nicely explains downloading and installing KDS with the Kinetis SDK and then run a ‘hello world’ program on the hardware.

And very worthwhile to check out Nash’s other articles here too: http://www.allaboutcircuits.com/author/nash-reilly

Happy Nashing 🙂

Linking additional Object Files with GNU Linker


Sometimes I need to link an object file (e.g. bootloader.o) to my application, and I do not want to build it, or I do not have the sources to build it. There is a simple way with the GNU ARM Eclipse plugins to link extra object files:

Other Objects for GNU Linker

Other Objects for GNU Linker

Continue reading

Aligning S19 Records to 64-bit Boundaries


Many tool chains and linker are able to produce S19 files, such as with the GNU tools it is the ‘objcopy‘ which does this job (see “Binary (and S19) Files for the mbed Bootloader with Eclipse and GNU ARM Eclipse Plugins“). But these tools usually cannot handle the special cases. For example on the Freescale Kinetis K64F my serial bootloader (see “Serial Bootloader for the Freedom Board with Processor Expert“) had a problem with these lines in the S19 file:

Not aligned S19 file entries

Not aligned S19 file entries

Continue reading

Using Precompiled Headers with GNU gcc in Eclipse


Some of my robotics projects take a rather long time do a full build. When I developed applications with Visual C++ on the host, using precompiled headers gave me a big boost in compilation speed. I was looking for the same in similar with GNU and gcc, and as expected: gcc does support precompiled headers too. And indeed, I was able to cut down compilation time by 30% :-). So this post is about how to use gcc with precompiled headers in Eclipse/CDT to give my builds a boost.

using precompiled header

using precompiled header

Continue reading

Going to Mars: Building a DIY Eclipse IDE for ARM Embedded Microcontrollers


It has been a while since I published my ‘build my own DIY IDE’ (see “DIY Free Toolchain for Kinetis: Part 1 – GNU ARM Build Tools“). I have used that approaches in my classes successfully. Now a new semester is coming up, so time to update the instructions using the latest Eclipse IDE (Mars) and tools (GCC ARM Embedded (launchpad) with GNU ARM Eclipse).

Eclipse Mars Splash Screen

Eclipse Mars Splash Screen

Continue reading

Tutorial: Using GNU Profiling (gprof) with ARM Cortex-M


I have published a Sneak Preview how GNU gprof profiling looks for an embedded target ARM Cortex-M in an earlier post:

Freescale Kinetis Microcontroller Application Profiling

Freescale Kinetis Microcontroller Application Profiling

This tutorial explains how to profile an embedded application (no RTOS needed) on ARM Cortex-M devices with GNU gprof. Additionally I explain the inner workings to generate the data necessary for gprof.

Continue reading

Debugging STM32F103RB NUCLEO Board with Segger J-Link


The STMicroelectronics STM32F103 (ARM Cortex-M3) Nucleo boards include the on-board ST-Link v2 circuit which allows to debug the board. This circuit is similar to the OpenSDA circuit found on Freescale boards. Unlike the Freescale OpenSDA, the ST-Link is only the ST-Link: it is not possible to load a P&E Multilink or Segger J-Link or firmware on it. Luckily, the ST-Link has a SWD connector, but this connector is a non-standard one. So how can I debug that board with an Eclipse based environment with GNU ARM Eclipse plugins and a Segger J-Link?

Connected J-Link with Nucleo Board

Connected J-Link with Nucleo Board

Continue reading

GNU Static Stack Usage Analysis


Stack overflows are a big problem: If I see a system crash, the first thing usually is I try to increase the stack size to see if the problem goes away. The GNU linker can check if my global variables fit into RAM. But it cannot know how much stack I need. So how cool would it be to have a way to find out how much stack I need?

Static Stack Usage Analysis with GNU

Static Stack Usage Analysis with GNU

And indeed, this is possible with the GNU tools (e.g. I’m using it with the GNU ARM Embedded (launchpad) 4.8 and 4.9 compilers :-). But it seems that this ability is not widely known?

Continue reading

Sneak Preview: Profiling Bare Metal Microcontroller Applications with GNU gprof


I’m working on a conference paper and presentation, and tonight I had a break-through :-). So how cool is this: Profiling with GNU gprof a bare-metal embedded Cortex-M application (Freescale Kinetis K64F running the Freescale Kinetis SDK) in Eclipse:

Freescale Kinetis Microcontroller Application Profiling

Freescale Kinetis Microcontroller Application Profiling

Continue reading

Tutorial: Adafruit WS2812B NeoPixels with the Freescale FRDM-K64F Board – Part 4: Timer


This is Part 4 of a Mini Series. In Part 3, I described the software concepts (see “Tutorial: Adafruit WS2812B NeoPixels with the Freescale FRDM-K64F Board – Part 3: Concepts“). In this post I describe how to set-up the timer to trigger later DMA operations. The goal is to drive Adafruit’s NeoPixel (WS2812B) with the Freescale FRDM-K64F board:

NeoPixels with FRDM-K64F

NeoPixels with FRDM-K64F

Continue reading

Tutorial: Adafruit WS2812B NeoPixels with the Freescale FRDM-K64F Board – Part 2: Software Tools


This is Part 2 of a Mini Series. In Part 1, I described how to set up the hardware (see “Tutorial: Adafruit WS2812B NeoPixels with the Freescale FRDM-K64F Board – Part 1: Hardware“). Now it is time to have the software tools ready. In this post I describe to have the IDE (Freescale Kinetis Design Studio) with the Freescale SDK installed, along with the correct firmware on the FRDM-K64F Board. The goal is to drive Adafruit’s NeoPixel (WS2812B) with the Freescale FRDM-K64F board:

Freescale FRDM-K64F with NeoPixels

Freescale FRDM-K64F with NeoPixels

Continue reading

Using Kinetis Design Studio V3.0.0 with the Launchpad 4.9-2015-q2 Release


The Kinetis Design Studio v3.0.0 comes with the GNU/GCC ARM Embedded (launchpad) version 4.8-2014-q3. End of June 2015, ARM released a new version, the 4.9-2015-q1.So why not using that newer release?

Release GCC ARM Embedded 4.9 update 2

Release GCC ARM Embedded 4.9 update 2

  1. It comes with GDB version 7.8 and has the ‘return of function display’ feature.
  2. GDB has Phyton scripting support.
  3. It fixes that nasty GDB bug ‘breakpoint on removed code’ issue.

Is that already enough to make that switch?

Continue reading