Skip to main content
Visitor II
April 8, 2024
Question

Facing unknown runtime error

  • April 8, 2024
  • 2 replies
  • 1718 views

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

    This topic has been closed for replies.

    2 replies

    Super User
    April 8, 2024

    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.1Author
    Visitor II
    April 9, 2024

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

    Super User
    April 9, 2024

    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.