ChibiOS support for ITM on STM32F207 Cortex M3?

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
obe1line
Posts: 2
Joined: Fri Jan 25, 2013 7:42 am

ChibiOS support for ITM on STM32F207 Cortex M3?

Post by obe1line »

I have an STM32F207 and previously used semihosting to output debug information via the CodeSourcery libraries on bare-metal.
The UART output is not an option since all of the pins are in use, but enabling the ITM an using the trace facility with OpenOCD looks like an option.

Is there anyone that has used the ITM facility of the Cortex M3 with ChibiOS, or have come across any useful links ?

Thanks,
Chris
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS support for ITM on STM32F207 Cortex M3?

Post by Giovanni »

Hi,

I never attempted that, if it works a device driver wrapping ITM could be created.

Giovanni
obe1line
Posts: 2
Joined: Fri Jan 25, 2013 7:42 am

Re: ChibiOS support for ITM on STM32F207 Cortex M3?

Post by obe1line »

No problem,
I will keep you posted. Should get time this week to look into it.

Chris
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: ChibiOS support for ITM on STM32F207 Cortex M3?

Post by russian »

I wonder if anyone has managed to initialize ITM / use ITM_SendChar within a ChibiOS env?
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: ChibiOS support for ITM on STM32F207 Cortex M3?

Post by russian »

Still wondering how to get ITM_SendChar work within ChibiOS.

Without ChibiOS one does not really need to initialize anything. Here is a _complete_ example which successfully blinks an LED and sends debug via serial for me:

Code: Select all

void SWV_puts(const char *s )
{
    while (*s) ITM_SendChar(*s++);

}
int main(void) {
   SysTick_Config(SystemCoreClock / 1000); // 1 ms in each tick

   STM_EVAL_LEDInit(LED5);

   while (1) {
      SWV_puts("hello from stm32f4\n");

      STM_EVAL_LEDToggle(LED5);
      Delay(200);
   }
   return 0;
}


but same SWV_puts("hello from stm32f4\n") does not send same debug from under ChibiOS, so I guess ChibiOS is interfering somehow :)
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS support for ITM on STM32F207 Cortex M3?

Post by Giovanni »

It shouldn't interfere, the only thing ChibiOS port does is to enable the DWT counter.

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: ChibiOS support for ITM on STM32F207 Cortex M3?

Post by russian »

As usual I am my own biggest enemy - I was using pin PB3 (SWO) for something else. Once I've stopped using pin PB3 for spi clock, I got SWO functioning. Sorry.
Post Reply