FreeRTOS and Semihosting issues

Semihosting is a way of providing missing I/O resources to the development platform. Most popular use of it is as debug output console using standard printf(). Turns out, there are some certain limitations to it.

In the project I'm working on, I'm using USB virtual communications port (VCP), in essence, virtual serial port over USB, to dump both - the actual data and some debug information. For some reason, which I haven't figured out yet, USB connection is glitching - Windos successfully enumerates it as a serial port, but I'm unable to connect to it most of the time. Have to re-plug the connector for it to start to work properly. Due to this nuisance, I decided to try to use semihosting for debug info output.

To do that, one has to replace linker specs with rdimon.specs, declare extern void initialise_monitor_handles(void); and call it in main. More information can be obtained in this post.
It does indeed work with JLink on my custom STM32F427 board, but starts to hang up. Essentially, whenever osDelay() function is called, execution never returns to the calling task. Well, not always, but quite a few times. Which might lead to deadlocks and other fun things.
As it turns out, FreeRTOS systick handler does not get called and due to that the delay never returns. Some discussion of this topic is available on FreeRTOS support forums.  Last post points to a solution which did not work for me, even with removing of re-declarations of Systick_handler and other cleanup. I guess I'll get back to debugging my USB connection.

No comments:

Post a Comment