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

Creating a "system" static lib

Hi,

I'm working on a project where I need for some reason to create a "system" static lib.

What I mean by "system" is a lib where all nrf_driver, startup file, etc are grouped in a single .a file.

This will be later used by arm-none-eabi-gcc to compile a single main.c file and linked with the static lib.

To test this I used the 'uart' example :

cd $(UART_EXAMPLE_ARMGCC)
make VERBOSE=1
mv _build/nrf52840_xxaa/main.c.o ..     // So that main.c.o is not integrated in the static lib
arm-none-eabi-ar rcs _build/libnrf52.a _build/nrf52840_xxaa/*.o
arm-none-eabi-gcc -O3 -g3 -mthumb -mabi=aapcs -L ../../../../../../components/toolchain/gcc -Tuart_gcc_nrf52.ld -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs _build/main.c.o _build/libnrf52.a -o _build/nrf52840_xxaa.out
arm-none-eabi-objcopy -O ihex _build/nrf52840_xxaa.out _build/nrf52840_xxaa.hex
nrfjprog -f NRF52 --program nrf52840_xxaa.hex --chiperase -r
The 'arm-none-eabi-gcc' line is juste the same line prompted when the 'make VERBOSE=1' but i replaced the .in file (listing all objects) by the main.c.o and libnrf52.a
The problem  I have is that there is no output on the uart.
I tried the same process with the blinky example and it works great.
I also tried to replace libnrf52.a with all the .o objects files and it works great.
So the problem comes from the library creation step but I don't know what's wrong with it.
So my question is do you have any idea why it is not working for the uart example ?
Any advice would be appreciated :)
Thanks
Related