This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

undefined reference to `__heap_lock' linking issue in Segger Embedded Studio

I made some changes in mesh light_switch_client example code and tried to build it in SES, it passed compiling, but stucked at linking:

Building ‘light_switch_client_nrf52832_xxAA_s132_6.0.0’ from solution ‘light_switch_client_nrf52832_xxAA_s132_6.0.0’ in configuration ‘Debug’
Generating linker script ‘light_switch_client_nrf52832_xxAA_s132_6.0.0.ld’
Linking light_switch_client_nrf52832_xxAA_s132_6.0.0.elf
E:/SEGGER/SEGGER Embedded Studio 3.12/lib/libc_v7em_fpv4_sp_d16_hard_t_le_eabi.a(libc2.o): In function `malloc':
libc2.c:(.text.libc.malloc+0xe): undefined reference to `__heap_lock'
libc2.c:(.text.libc.malloc+0x3a): undefined reference to `__heap_unlock'
libc2.c:(.text.libc.malloc+0x74): undefined reference to `__heap_unlock'
libc2.c:(.text.libc.malloc+0x7e): undefined reference to `__heap_unlock'
E:/SEGGER/SEGGER Embedded Studio 3.12/lib/libc_v7em_fpv4_sp_d16_hard_t_le_eabi.a(libc2.o): In function `free':
libc2.c:(.text.libc.free+0x8): undefined reference to `__heap_lock'
libc2.c:(.text.libc.free+0x76): undefined reference to `__heap_unlock'
Build failed

I checked linker script file light_switch_client_nrf52832_xxAA_s132_6.0.0.ld, and noticed something different than before:

__HEAPSIZE__ = 1024;
    __STACKSIZE_ABT__ = 0;
    __STACKSIZE_FIQ__ = 0;
    __STACKSIZE_IRQ__ = 0;
__STACKSIZE_PROCESS__ = 0;
    __STACKSIZE_SVC__ = 0;
    __STACKSIZE_UND__ = 0;
__STACKSIZE__ = 2048;

Tabed lines are newly added.

Any ideas on what's going on?

Parents
  • It looks like to be a memory issue, so I changed the doubtful define of CLIENT_MODEL_INSTANCE_COUNT back to 2 (used to be 3), but still have same link errors.

    Then, I change it back to 3, and use release mode of building, ( instead of debug mode ), then it passed the building, no link error appear any more.

    Though, there must be something wrong in SES, hopefully, there's an answer here one day.

Reply
  • It looks like to be a memory issue, so I changed the doubtful define of CLIENT_MODEL_INSTANCE_COUNT back to 2 (used to be 3), but still have same link errors.

    Then, I change it back to 3, and use release mode of building, ( instead of debug mode ), then it passed the building, no link error appear any more.

    Though, there must be something wrong in SES, hopefully, there's an answer here one day.

Children
No Data
Related