Integrate picolibc into STM32 FreeRTOS

456 Views Asked by At

I'm trying to set up a build environment for STM32F4 with picolibc and ran into a problem:

Subprojects drivers : YES freertos : YES picolibc : YES 5 warnings
User defined options Cross files: cross file.txt stm32 chip : STM32F411RE
Found ninja-1.10.1 at /usr/bin/ninja ninja: Entering directory 'builddir' [1133/1135] Linking target Main-STM32F411RE.elf FAILED: Main-STM32F411RE.elf arm-none-eabi-gcc -o Main-STM32F411RE.elf Main-STM32F411RE.elf.p/platform stm32f411re start startup stm32f411retx.s.o Main-STM32F411RE.elf.p/platform stm32f41 ire Src freertos.c.o Main-STM32F411RE.elf.p/platform stm32f411re Src main.c.o Main-STM32F411RE.elf.p/platform stm32f411re Src stm32f4xx hal msp.c.o Main-STM32F 411RE.elf.p/platform stm32f411re Src system stm32f4xx.c.o Main-STM32F411RE.elf.p/platform stm32f411re Src stm32f4xx it.c.o Main-STM32F411RE.elf.p/platform stm3 2f411re Src syscalls.c.o Main-STM32F411RE.elf.p/platform stm32f411re Src sysmem.c.o Main-STM32F411RE.elf.p/platform stm32f411re Src stm32f4xx hal timebase tim. c.o -Wl,--as-needed Wl, no undefined -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Wl,--start-group lib/picolibc/newlib/libc.a lib/picolibc/new lib/libm.a lib/drivers/libdrivers.a lib/freertos/libfreertos.a -Wl,--library-path=../platform/stm32f411re -Wl,-TSTM32F411RETX FLASH.ld Wl, gc sections -Wl,-M ap=map.map,--cref -uexception table -nostartfiles -nostdlib -nostdinc -lgcc -Wl,--end-group /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: cannot find libc.a collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.

The project can be compiled and executed without picolibc. I think the problem came from newlib, so I tried to add following: link_args += '-nostdinc', but this does not disable newlib.

1

There are 1 best solutions below

0
Unknows On

Update:

For disabling Newlib by setting, #define cconfigUSE_NEWLIB_REENTRANT to "0" in the FreeRTOSConfig.h(CMSIS_V2) file to solve the problem.