Skip to main content
a239955_stm1
Associate II
June 3, 2014
Question

Semihosting in Eclipse or retargeting printf

Posted on June 03, 2014 at 09:43

Hi,

I am trying to debug some very simple code for STM32F0Discovery using Eclipse, 

ARM arm-none-eabi-gdb compiler and OpenOCD debuger.

I could build and debug my cods and now I am trying to use printf to see some variables on the screen. CoIDE has this nice semihosting which without using USART, sends printf output on the screen. I tried to use the semihosting library files with eclips to do the same. I could enable  semihosting in Eclipse but nothing showed up on the screen! I guess the problem was SH_DoCommand

http://techwithdave.blogspot.ca/2013/04/hello-world-tutorial-for-stm-discovery.html

Then I tried to use USART_Printf example from STM32F0xx_StdPeriph_Examples.

I got errors regarding _read and _write and so many errors like that. I tried to fix the errors by adding newlib_stubs.c as in 

https://sites.google.com/site/stm32discovery/open-source-development-with-the-stm32-discovery/getting-newlib-to-work-with-stm32-and-code-sourcery-lite-eabi

After small changes in the code I couldn't debug the code!

I have also tried to add 

--specs=rdimon.specs   -Wl,--start-group -lgcc -lc -lm -lrdimon -Wl,--end-group

flags to the linker but still nothing on the screen!

Any Idea?

Thanks

Ali

#stm32f0 #printf #discovery
This topic has been closed for replies.

11 replies

Justyn B
Associate
February 10, 2015
Posted on February 10, 2015 at 16:27

The GNU ARM Eclipse plugins (http://gnuarmeclipse.livius.net) include templates which have a custom semihosting implementation, and provide trace_printf.

They work with the STM32F0, but don't use the ITM when on this platform.

Also available separately on github:

https://github.com/justyn/semihosting-cortexm-uos