Migration to NCS 3.2.4 causes pthread_attr_t error and RAM overflow with Picolibc

Hi Nordic team,

We are currently migrating our project from nRF Connect SDK v3.1.1 to v3.2.4 on the nRF9160.

Our application was working without issues on v3.1.1. After upgrading to NCS 3.2.4, we encountered the following compilation error:

In file included from C:/ncs/v3.2.4/zephyr/include/zephyr/posix/time.h:62,
from C:/ncs/v3.2.4/nrf/lib/date_time/date_time_modem.c:9:
C:/ncs/v3.2.4/zephyr/include/zephyr/posix/signal.h:102:9: error: unknown type name 'pthread_attr_t'
102 | pthread_attr_t *sigev_notify_attributes;

After investigation, we determined that this issue is related to NEWLIB_LIBC no longer being supported in NCS 3.2.4. To resolve this, we switched to Picolibc.

However, enabling Picolibc introduced a new problem:

c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr\zephyr_pre0.elf section `noinit' will not fit in region `RAM'
c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: region `RAM' overflowed by 55008 bytes

This is significantly beyond our available memory budget and prevents the application from running.

We are enabling picolib using the following configs 

CONFIG_PICOLIBC=y

CONFIG_COMMON_LIBC_MALLOC=y

CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=512

Any guidance or best practices for handling this migration would be greatly appreciated.

Thanks!

Parents Reply Children
  • Hi,

    Okay thanks for trying it out. To help diagnose the RAM overflow, can you please share:

    - Output of 'west build -t ram_report'
    - The value of CONFIG_HEAP_MEM_POOL_SIZE from build/zephyr/.config

    Best Regards,
    Syed Maysum

  • Sorry for the late reply, 
    - CONFIG_HEAP_MEM_POOL_SIZE = 4096 in the build/relay/zephyr/.config file

    - The build is not successful in ncs 3.2.4 so i get this error when i try to generate a ram_report

    west build: running target ram_report
    [0/18] Performing build step for 'tfm'
    ninja: no work to do.
    [2/8] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/Github/RelayLwM2MClient/relay/build_v3_release/relay/zephyr/zephyr_pre0.map
    cmd.exe /C "cd . && C:\ncs\toolchains\fd21892d0f\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 -Os @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf -Lc:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main/nofp -lc -lgcc && cmd.exe /C "cd /D C:\Github\RelayLwM2MClient\relay\build_v3_release\relay\zephyr && C:\ncs\toolchains\fd21892d0f\opt\bin\cmake.exe -E true""
    c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr\zephyr_pre0.elf section `noinit' will not fit in region `RAM'
    c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: region `RAM' overflowed by 56400 bytes
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\fd21892d0f\opt\bin\cmake.EXE' --build 'c:\Github\RelayLwM2MClient\relay\build_v3_release\relay' --target ram_report

    - I can however generate a ram_report for ncs 3.1.1 (without POSIX and PICOLib configurations), here is the report from NCS 3.1.1

     5140.ram_report.txt

Related