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


malloc fails on NucleoSTM32F030R8

I have started a small project, using 2 UARTS by interruption, in order to learn STM32 Núcleo technology.

The target being used is a NucleoBoard STM32F030R8, having the project under Eclipse and AC6 addin

This device has 8k of internal RAM and my program is using less then 256Ram.
Heap is set as 0x200 and stack as 0x400.

When malloc function is called, with 17 bytes as parameter, it always returns NULL.
I have no access to malloc code in stdlib, but it calls _sbrk in the syscals.c
Debuging the call of malloc, at the first time it calls the _sbrk, the incr param is 32 and the second time it is 3808.

Not sure if the problem is a missing parameter in order to use malloc function.
How can I identify the stdlib version being used ?
Has someone had success on using malloc to STM32F030R8 ? If affirmative, I would need to migrate the stdlib to the one in success case or it is a missing parameter issue ?

I have attempted to use the solution proposed in topic “malloc heap issue with CubeMX Project” from this forum with no success either.
Please anyone has a solution, or should I implement the full malloc and free routine from scratch ?

I have written malloc and free routines from scratch and it has worked, but carries some issues what is better recommended not to use them:
1) The payload for mapping each portion of memory is around 40 bytes. It means only long data makes sense to be alocated;
2) The area previously occupied by a malloc that has been already freed will only be reused when the furthers malloc being freed. It really works as a stack with holes in the middle. For solving it, it would be require to segment the memory, what would increase even more the payload.

In order to solve my problem I have moved to a fixed data in a array, using a ring concept


 

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