cancel
Showing results for 
Search instead for 
Did you mean: 

printf to IDE console?

I'd like to be able to printf into IDE console during debug. I'm using Atollic 9.1, Nucleus F413 board with Segger debug programmed into onboard debug interface. I followed the instructions here:

http://blog.atollic.com/cortex-m-debugging-printf-redirection-to-a-debugger-console-using-swv/itm-part-1

Nothing happens when I printf: The debugger never hits a breakpoint in the modified _write in syscalls.

What am I doing wrong?

Thanks!

Best Regards, Dave

12 REPLIES 12

You have to understand that You have multiple problems. I provided information for solving one of them. printf() not calling _write() is one problem and not being able to receive data sent by ITM_SendChar() is another completely separate problem.

As You have flashed J-Link firmware, You can try J-Link SWO Viewer from Segger. It is very simple and therefore easy to get to some functional starting point in using SWO pin.

At least 3 problems, as clearly listed above...

Hi Dave,

I had the same issue. printf works if I use some short string to print, not more then 5 characters approximately. Longer string cause error

seems there is unexpected use of malloc behind the call...

I found the help here:

https://www.freertos.org/FreeRTOS_Support_Forum_Archive/December_2016/freertos_sprintf_f_corrupts_stack_8fbac97dj.html

implement Your own malloc fanctions.

void *malloc( size_t xBytes )

{

return pvPortMalloc( xBytes );

}

void free( void *pvBuffer )

{

vPortFree( pvBuffer );

}

Peter