Semi Hosting with Nucleo L476RG
We are checking the Nucleo-L476RG board with STLink and the Open STM32 in eclipse.
We think to be able to use printf will be very important for our development and therfore we are trying to do it.
I have checked the forum because there are a lot of information about this question and we have done some test without success.
What we have done:
added “-specs=rdimon.specs -lc -lrdimon” to (Project -> Properties -> C/C++ Build -> Settings -> MCU GCC Linker -> Linker flags)
added monitor arm semihosting enable to Debug configurations
added extern void initialise_monitor_handles(void); above main
added initialise_monitor_handles(); at the beggening og main function
With this configuration if we use printf the program goes to a fault routine, it seems printf is not working right
If we use puts no error but nothing is sent to the OCD console.
In the Cube MX I have generated the code with the 3 options in the SYS item: Disable/serial wire/trace SW and the results are the same.
I have read in the forum about use freopen(“/dev/semihosting”,”w”,stdout); I have checked and now printf doesn’t produce an error but I haven’t yet a single line while debuging in the OCD console.
Could anybody help me with this question? I am new with ST and I am locked with this question.
Thanks in advance.
After doing some more tests I have discovered the problem is in relation with FreeRtos. I forgot to explain the printf was in a FeeRtos task.
If at least a printf is done in the main before starting the scheduler, printf in the freeRtos tasks work perfectly; I don’t know exactly the reason but it is in this way.