Loading...
 
Skip to main content

System Workbench for STM32


Printf via SWV doesn't print anything

Tunisia

>> That was really helpful. I soldered and make the change to the linker script and YES! it is working fine.
Good to hear that

>> Now I read a lot about semihosting. What is the difference between the ITM and semihosting. Could you point me in the right direction by explaining or giving me the links of resources?
Check these links : Semihosting, ITM

>> Is semihosting possible in System WorkBench? or Is there any available methodology presently available where we can see the output in openOCD terminal?
Yes, it is possible
In Debug configuration > Startup Tab , add this :

Copy to clipboard
monitor arm semihosting enable

and in Project, Properties, C/C++ Build, Settings, MCU GCC Linker, Miscellaneous, Linker flags,

Copy to clipboard
-specs=nosys.specs -specs=nano.specs -specs=rdimon.specs -lc -lrdimon

since you have used rdimon.specs, you don't need to use syscalls.c
And finally in your code, you have only to call the initialize_monitor_handles in the begin of the main routine

Copy to clipboard
#include <stdio.h> #include <stdlib.h> # …. extern void initialise_monitor_handles(void); int main(void) { initialise_monitor_handles(); printf("Hello !\n"); HAL_Init(); SystemClock_Config(); puts("Check your openocd console.\n"); printf("This works too\n"); //…………… }