cancel
Showing results for 
Search instead for 
Did you mean: 

Facing unknown runtime error

SSaiy.1
Associate III

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

3 REPLIES 3
Bob S
Principal

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.

SSaiy.1
Associate III

Hi @Bob S, could you please help me fixing this issue.

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.