Linking a complete Folder into a specific region

Showing results for 
Search instead for 
Did you mean: 

Linking a complete Folder into a specific region

Contributor I

Hello there,

I am currently working as a student trainee. There I have to program a bootloader application for the LPC4312 controller.

My problem is the following. The bootloader is, together with a communication program, in one project. Those two projects share some libraries and functions. But these shared libraries and functions are placed in the region which I am overwriting with my bootloader application. Obviously I am getting a Hard_fault_error with my bootloader after I deleted functions, which I have to use with the bootloader. 

Therefore my plan is to put all functions I need within my bootloader application into a specific folder of the project.

My question is, as I have never worked with linker scripts, is it possible to link this specific folder into the protected region of the bootloader? And if it is possible, how?

Before I tried to make a copy of every function I need and place it manually into the bootloader region, but this was tedious, because there where just far too many functions which where all connected inside one another.

I hope I was able to accuratly express the situation.

Best regards


Labels (1)
1 Reply

Contributor II


I would avoid linking the application to the bootloader. How do you ensure that the API matches? You would need a kind of dynamic linker to be compatible with the current bootloader version.

What you can do is link the application as a separate application. And Link the common o-files as a static library. The entry point of the application can be kept fixed.

This reduces the API dependencies between bootloader and application to the entry point.

If you really want to move the sections and not change the source I would try to rename the sections with objcopy and locate them explicitly in the linker script. The API problem is not solved through this though....

Another idea is to link only the bootloader and expose the functions of the bootloader through an array of function pointer, which are const and can be mapped from the application. So that in the appkiapplia you have to only set this pointer to that array. If you keep this array compatible it will work.

You can get an idea how to do this from the usb rom API.