Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Semihosting causes crash when not running in the debugger...

I’m using an STM32L476 and configured my project for semihosting, with a call to initialise_monitor_handles() and a simple printf statement. When I Debug the program runs just fine, but when I Run the whole program doesn’t seem to do anything. I can comment out the initialise_monitor_handles() and printf and the program works just fine.

I don’t care about seeing any output when not running in the debugger, but I want the program to at least work. Is there a way to detect at runtime that I’m running in the debugger so I can skip those lines or are they supposed to work when running outside the debugger, but I have something missing? There is only one run configuration for both debug and run.

Tunisia

Hi Charles,

It is quite normal that your program that uses semihostion cannot run without attached debugger.

ARM wrote:

What is semihosting?
Semihosting is a mechanism that enables code running on an ARM target to communicate and use the Input/Output facilities on a host computer that is running a debugger.


In fact, the _write routine of rdimon library generate software BKPT instructions handled by the debug agent (here openocd) .

Generally when we need to use semihosting for debugging and we need to have a release version for standalone running purpose we manage to create two different configrations :

  1. Release Configuration : in which we link against nosys.specs or you add syscalls.c
  2. Debug Configuration : in which we link against rdimon.specs, and we add a symbole (define) named DEBUG


In your source code initialise_monitor_handles() should appear within #ifdef DEBUG .... #endif


Regards,
Tarek


 

Newest Forum Posts

  1. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  2. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  3. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  4. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  5. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  6. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  8. Build a project in "release" mode by tang, 2025-02-20 10:36
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35
  10. Fail to debug in Win 11 C/C++ by mortenlund, 2024-12-26 20:27

Last-Modified Blogs