Startup Code within own library


I want to develop a target board specific peripheral driver library for a Cortex-M3 controller which can be used by several applications just referencing the BSP library in the project.

In a first step I was able to build a library, link it with a test application and execute the functions of the library. So everything works fine so far.

My test application consists only of a simple main function and the standard startup code of the controller. In a second step I tried to move the startup file of the test application to my library, because this item shall also be a standard part of the library

Rebuilding the test application I get the following error message:

.\Objects\COMMs-Board-BSP-Test.sct(8): error: L6236E: No section matches selector - no section to be FIRST/LAST.

As a scatter file I used the following definition:

LR_IROM1 0x00000000 0x00080000  {    ; load region size_region

  ER_IROM1 0x00000000 0x00080000  {  ; load address = execution address
   *.o (RESET, +First)
   .ANY (+RO)

  RW_IRAM1 0x1FFF0000 0x00010000  {  ; RW data
   .ANY (+RW +ZI)

I checked that the startup.o was part of my library (armar option --sizes), but it seems that the linker is not able to get the startup_K22.o file.

I tried to extract the startup.o from the library as described in your post

No I get the follwoing two errors

.\Objects\COMMs-Board-BSP-Test.axf: Error: L6218E: Undefined symbol __use_two_region_memory (referred from startup_K22.o).
.\Objects\COMMs-Board-BSP-Test.axf: Error: L6218E: Undefined symbol __initial_sp (referred from entry2.o).

The __initial_sp has been defined with the EXPORT directive in the startup file. How can I now solve this issues?

Best regards,

Parents Reply Children
No data
More questions in this forum