Code Coverage with gcov, launchpad tools and Eclipse Kinetis Design Studio V3.0.0

What makes Eclipse great: using open source tools there are a lot of tools and techniques available which usually are only provided for desktop development.

A while back I described how to do code coverage with Eclipse Kepler and the GNU ARM Embedded (launchpad) tools (see “Code Coverage for Embedded Target with Eclipse, gcc and gcov“). With Kinetis Design Studio out, time to do the same with that Eclipse distribution, especially as Freescale is now using the stock GNU ARM Embedded tools too.

Coverage with multiple Files

Coverage with multiple Files

Continue reading

Problem: undefined reference to ‘__end__’ if using Semihosting

In case you are running into the following GNU linker error about a missing __end__:

'Building target: MyProject.elf'
'Invoking: Cross ARM C++ Linker'
...
toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv6-m/rdimon-crt0.o: In function `_start':
(.text+0xdc): undefined reference to `__end__'
collect2.exe: error: ld returned 1 exit status
make: *** [MyProject.elf] Error 1
Failed link because missing __end__

Failed link because missing __end__

The GNU linker complains that rdimon-crt0.o needs the symbol __end__.  This symbol marks the end of the user data/RAM section, and is needed by the rdimon library specs which is used with semihosting.

Continue reading

Semihosting for Kinetis Design Studio V3.0.0 and GNU ARM Embedded (launchpad)

Freescale has released the v3.0.0 version of the Kinetis Design Studio: this one comes with a great positive change: instead of a custom toolchain, it is coming with the standard GNU ARM Embedded (launchpad) toolchain from ARM. Beside of better code density and less RAM needed, there is one change which affects semihosting. Previously, semihosting was enabled by default in the V2.0.0 libraries. Now semihosting needs to be turned on. This post is how to do this.

Semihosting Console with Output in Eclipse

Semihosting Console with Output in Eclipse

Continue reading

Solving “The connected emulator does not support serial wire output (SWO)” for Segger J-Link

SWO (Serial Wire Output) is a cool feature defined by ARM as part of the CoreSight debug block. However, not every debug connection supports SWO, as it requries extra pins routed from the microcontroller to the debug JTAG/SWD header.

If I’m using the Segger J-Link, and if my hardware does not support SWO, I will get a dialog telling me “The connected emulator does not support serial wire output (SWO).”

The connected emulator does not support serial wire output (SWO)

The connected emulator does not support serial wire output (SWO)

Continue reading

CodeRed Debug Perspective in Kinetis Design Studio

I very much liked the CodeRed Eclipse based IDE (see “Red Suite 5: Eclipse Juno, Processor Expert and unlimited FRDM-KL25Z“). But back in May 2013 CodeRed was acquired by NXP. I have not used much NXP devices for my projects, and as CodeRed was focusing on the NXP parts, CodeRed was not running daily on my desk any more :-(. Well, things might make a full back circle, as NXP announced back March 1st 2015 to acquire Freescale :-). And maybe as a taste how things might come out, the GNU ARM Eclipse plugin release from March 22nd 2015 includes a CodeRed debug view 🙂 🙂

CodeRed Debug Perspective in KDS

CodeRed Debug Perspective in KDS

That debug perspective mimics a CodeRed debug perspective. The advantage of this Eclipse perspective is that it works very well with small screens. This post is about adding this perspective to the recently release Kinetis Design Studio v3.0.0.

Continue reading

CRC Checksum Generation with ‘SRecord’ Tools for GNU and Eclipse

One of the things missing for Embedded in the GNU linker is that it cannot generate a CRC checksum. Luckily, there is the solution of using SRecord:

SRecord 1.64 Web Page
SRecord 1.64 Web Page
Continue reading

Proof of Concept: Open Source ARM SWD Debug and General Purpose Board

The Teensy is a great and tiny board (see “USB CDC with the Teensy 3.1 Board“), but it lacks real SWD/JTAG debugging capabilities (see “Hacking the Teensy V3.1 for SWD Debugging“). The Freescale Freedom boards are great, but for many applications too big, and have potentially too many components on it. So what about building a breadboard friendly tiny board which *has* SWD debugging ability *and* can be used to debug another boards?

So here is a working prototype based on the FRDM-K20D50M:

FRDM-K20D50M used as debug probe

FRDM-K20D50M used as debug probe

Continue reading

Poor Man’s Trace: Free-of-Charge Function Entry/Exit Trace with GNU Tools

There are cases where my application runs find for days, weeks or even months, but then from time to time there is an application crash. Yes, the watchdog will recover it, but still it would be good to know what happened? One solution would be to hook up a trace probe (like the one I have described in this post: “First Steps with the P&E Tracelink“). But having such a trace probe attached all the time is first not cheap and second not always possible. So what if the application would leave ‘breadcrumbs’ behind which would tell me the flow of the program leading to the problem? I have found a functionality in the GNU tools which seems not be widely known or use, but is incredibly helpful in such cases.

So what if I could get a log like this telling me which functions get called by whom?

{ 00000E88->00000DA0 ???->DEMO_Init
} 00000E88<-00000DA0 ???<-DEMO_Init
{ 00000E8C->00000D40 ???->DEMO_Run
 { 00000D62->00000CE8  DEMO_Run:0x0022->decide
  { 00000D0E->00000C60  decide:0x0026->calcValue
  } 00000D0E<-00000C60  decide:0x0026<-calcValue
  { 00000D16->00000CA0  decide:0x002E->getValue
   { 00000CC6->00000C60  getValue:0x0026->calcValue
   } 00000CC6<-00000C60  getValue:0x0026<-calcValue
  } 00000D16<-00000CA0  decide:0x002E<-getValue
 } 00000D62<-00000CE8  DEMO_Run:0x0022<-decide
 { 00000D62->00000CE8  DEMO_Run:0x0022->decide

Continue reading