Getting ITM to work on STM32F4

Open source ARM Debugger

Moderator: phalanx

Post Reply
Posts: 1
Joined: Sun Sep 07, 2014 7:50 pm

Getting ITM to work on STM32F4

Post by elpatolocosisi » Sun Sep 07, 2014 8:05 pm

Hello everyone, I hope someone can help me out here.
I have a STM32F4Discovery board, have been developing for it recently and now decided to incorporate ITM debugging into my projects, pretty much printf() redirection. The thing is, I can't seem to get it to work at all.
Lets start from the beginning, I'm running Archlinux, not using any kind of IDE and debugging with gdb. In order to start with this I decided to download openOCD, it seems to be running fine:

Code: Select all

$ openocd 
Open On-Chip Debugger 0.8.0 (2014-04-29-15:41)
Licensed under GNU GPL v2
For bug reports, read
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.862617
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
which is what I expected. For the configuration I'm using board/stm32f4discovery.cfg.
After this, 'telnet localhost 4444' and gdb onto 3333 work perfectly, I can debug my code as usual and everything behaves just fine.

However, I don't get any kind of output out of the ITM debugging interface... I call ITM_SendChar() within my code (either directly or through printf()/puts()) and nothing happens. Stepping line by line I can see the it seems not to be enabled, where it checks agains ITM->TER and ITM->TCR both are at 0 (zero) and I can't seem to figure out how to change that.

Is there anything I should be doing? Maybe something I'm skipping when initializing openOCD or something?
I'd really appreciate it if someone could help me out with this, it's been driving me crazy for a couple of days now and I'm at my wits end =P


Post Reply