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


C code executing out of order

I noticed this on a more complicated project so I went back to blinky. I ran the debugger and it halts at the start of main. When I step in it first executes the GPIO_Init() whihc is the third instruction down, then steps back up to the system clock init (1st call in main), and then steps to a HAL_??? call. Is there a switch causing some sort of optimization that would cause this?

-Greg

For debugging you should set optimisation to -Og

Harry


-Solved-
Thanks for the reply. That is the fix. Interesting that AC6 does not initially set that when the build type is set to Debug. The default is -Os.

For those who are new the settings can be found by a right click on the Project and selecting “Properties” in the pull down menu (Hot key short cut with the project highlighted Alt+Enter). Expand the “C/C++ Build” tree and select “Settings”. Going to the right in the “Tool Settings” tab expand the “MCU GCC Compiler” tree and select “Optimization”. going to the right find the “Optimization Level” and use the pull down arrow to select “Optimize for Debug (-Og)”.


France

Hi Greg,

If your optimizing setup is -Os by default, that means that, probably, you created your project through CubeMX; if you created it directly in System Workbench you would be using -Og, that yield less optimized but simpler to debug code.

Bernard (Ac6)


 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs