Sunday, February 10, 2013

Free Cortex debugger

Emulator company iSystem offers free Cortex debugger. There are couple of options on how to get it. Most intriguing is the DIY option. The design is similar to STM32F4-Discovery board. I successfully managed to make it with the actual Discovery board. Following is how.

To supply the board from device USB port the connection from PA9 to 5V is needed (red wire). Further the BOOT0 needs to be connected to 3V (brown wire) to boot the device in DFU mode after power on. Also, I had onboard debugger disabled.

Needed connections


With these connections I followed the official guide on how to program the initial firmware (with iTAG_Public.exe) to STM simulating J2 (see documentation) with brown wire. There were some problems programming it from 32bit virtual machine. It worked on my 64bit W7 machine. Debugging was later possible in virtual machine.

Debugger works with free iTAG winIDEA IDE. Updating the firmware with winIDEA worked as described.

Output debug signals can be found in iTAG schematics (also available). I connected them to other STM32F4-Discovery board and downloaded the RTOS winIDEA sample to target on the other board for test. Supply for target was taken from debugger board.

Debugger - target connection (BOOT wire removed)


Target details

Debugger details

Debugging in winIDEA
Links:
Some points:
  • Schematics, utility, gerber files, iTAG winIDEA IDE available for free online
  • No registration required
  • No download size limit
  • GCC 4.7.0 compiler build for ARM/Cortex projects included with winIDEA
  • No trace functionality
There are two optional connectors on the official iTAG board. They seem like analog and digital extension ports like on some professional tools the company offers. However there are no options to configure them. Also, the SWO signal is connected to UART Rx pin on the debugger. This could mean that SWO trace option was planed. Hopefully the functionality will come with updates.

Tuesday, February 5, 2013

Cortex debug condition assertion

Used to popular ASSERT(condition) macro? Code below stops on faulty condition when debugging Cortex CPU. BE CAREFUL: use code build with _DEBUG or DEBUG define when debugging  BUT DON'T use same code without debugger.

#if defined ( _DEBUG ) || defined ( DEBUG )
  #define ASSERT(expr) { if ( !(expr) ) { __ASM__(" bkpt #0"); } }
#else
  #define ASSERT(...) { }
#endif

Usage:
void someFunc(int inputParam)
{
  ASSERT( inputParam < 5 );  ///< execution will stop here if inputParam >= 5
  ...
}

Friday, February 1, 2013

Stellaris LaunchPad with external debugger

Finally a board with integrated debugger and an official option for external debugger. I'm talking about EK-LM4F120XL. To disable integrated debugger the EXT_DBG signal must be tied low. I'm doing extended debug connectivity options demonstrations. Find below photos for both standard JTAG and Cortex connectors in combination with JTAG and SWD debug protocol with parallel or serial trace and without it.

Cortex debug connector

JTAG debug protocol + parallel trace


JTAG debug protocol


SWD debug protocol + parallel trace


SWD debug protocol + serial trace


SWD debug protocol


Jtag debug connector

JTAG debug protocol


SWD debug protocol + serial trace


SWD debug protocol


Friday, January 25, 2013

Kinetis FRDM-KL25Z with external debugger

Here is how to attach external debugger to Kinetis CPU on FRDM-KL25Z board. Like we are used to by now the debug connector on the boards with an on-board debugger is used to connect the on-board debugger to board without it. Anyway the debug connector can be used as input when on-board debugger is put in reset. This is done with jumper on the other debug connector. I.e. on the debug connector for the on-board debugger (debugging a debugger - there's a thought for you :) ).



You might need to chip away a bit of debug connector housing due to C7.
Probably not if you are just using pinheader.