2024-04-08 06:04 AM
Getting this error "assertion "Balloc succeeded" failed: file "/build/gnu-tools-for-stm32_10.3-2021.10.20211105-1100/src/newlib/newlib/libc/stdlib/mprec.c", line 778" in runtime for stm32l452ret6p microcontroller. I am doing baremetal programming and using i2c, rtc, uart1, uart2, timer6 and timer2 peripherals. Not understanding what this error means. Also tried to find the file mentioned in the error message, no luck there also. please help with a solution.
Thanks and Regards,
Suhaib Saiyde
2024-04-08 09:56 AM
It means memory allocation failed. You can't find the file because it was one of the source files for newlib, which people typically only have as a pre-compiled library image.
2024-04-08 11:32 PM
Hi @Bob S, could you please help me fixing this issue.
2024-04-09 12:30 PM
You probably need to define your own heap functions, specifically _sbrk() or some related name in order for malloc() and related functions to work. You may be able to find examples on the web, or install CubeMX (if you don't already have it) and create a basic project. There should be a sysmem.c file you can clone.
You will need to make sure the heap code works with your linker file memory configuration.