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

Is there a clear, simple explanation of how to setup the gcc linker scripts?

I've been trying to run some of the examples provided with the SDK's. Blinky is the only one I've gotten to work for sure. I think I haven't set up the linker scripts properly.

I've been looking at a couple linker scripts for nrf51822's. The number of sections change, the values to allocate rom and ram change. Is there a clear tutorial or document that explains the use and proper structure of these files? I understand the amount of rom and ram vary depending on the device and model. I need to understand how to properly allocate these resources.

What effects these allocations? For instance, does adding a library require a change the linker script?

Parents Reply
  • Thanks for your reply. i have found many .ld scripts to look at., Very few are well documented. I've had trouble getting examples to run, and several times it's because I picked the wrong .ld. Having one or two well documented examples would help me understand what i'm looking at when I open a .ld file. For instance few use .ld math. For instance:

    FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x40000 - 0x1b000 <- clearer to me
    vs

    FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x25000 <- where did this number come from?

    and .ld files for the same board and same soft device will have different values:

    RAM (rwx) :  ORIGIN = 0x20002bd8, LENGTH = 0x5428 <- sometimes it's this

    RAM (rwx) :  ORIGIN = 0x20001eb0, LENGTH = 0x6150 <- and sometimes this --- Why did this one need less RAM for the soft device ?

Children
Related