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


Printf support for semihosting/ITM debugging for float variables.

Hello,

I have compiled and tested my code using the System Workbench and works well. However the printf for the float does not work, and gives either a long random number or -0.0000.

Any linker directives should I add to support it? The “-u _printf_float” and the “- -specs = nano.specs” inside don’t work at all too.

Thanks for the opinion.

by default printf and all flavor (aka vsprintf etc..) come without support for float on the std lib ther’s may be some some option or over lib that enabel or add float support

Hello,

However, there is no extra option on enabing floats on that stdlib.

Will there be future updates to support floating point for printf?


France

Hello all,

Looking at this problem, we just discover it was probably due to a small glitch in the linker script provided by ST. There was, near the beginning of the fine a line that reads
_estack = 0x2000FFFF;    /* end of RAM */
This should be, in fact, a byte higher, just after the end of the RAM area, that is:
_estack = 0x20010000;    /* end of RAM */

The problem is that the original setup creates a stack pointer that is not 8-byte aligned, thus causing problems when storing double values in the stack or passing them as parameters.

Editing the linker script shoul correct the problem, so keep us informed. Anyway the correction will be in the next update, due beginning of August.

Bernard


Hello Bernard,

Thanks for the help. I have suspected that there’s an error in the linker directive earlier, but I do not have enough knowledge to modify it. :-)

I got the printfs working for the floats if I used the supplied GCC’s linker scripts and initialization code ones, but I have to set up the tool chain manually. Luckily there is the OpenSTM32, so I can develop the firmware easier.

By the way, could you add the “Enable float for printf” and the “Enable Semihosting” and/or “Enable SWO” checkboxes in the “Project Options”? This allows the programmer to decide whether he/she wants to enable these in the project.


How did you make the printf work ? Did you use the Liviu Ionescu trace library ?

I cannot get sprintf to work with floats either.

I checked the linker script and the _estack is fine

_estack = 0x20020000; /* end of RAM */

I am using an M4 and have the Hard FPU selected.

How do I enable printf with float?


Hi all,

I am also having issues with printf and sprintf. The codebase which I am using was generated using cubemx for the MCU STM32F103VET. When I use printf in my code Execution is jumping to hard fault handler. Also seeing some weird memory overflow kind of behavior with sprintf.

But these two functions are working well in the firmware (generated by using cubemx) for STM32F103RB.

Are there any issues in the linker script of the STM32F103VET project?


 

Newest Forum Posts

  1. Монтаж камина с грилем в Москве - установка и барбекю by KpddomErorb, 2025-05-10 18:28
  2. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  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. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  9. Build a project in "release" mode by tang, 2025-02-20 10:36
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35

Last-Modified Blogs