Editing the XML linker script.

Hello,

I have been working on a project and it includes working on the linker script.

Now I don't have experience with linker scripts and online there are no simple explenations of adjusting this xml script.

I would like to take 1kb space from the total of 64kb RAM. I want to reserve this space and make a  "partition" out of it.

I have no idea what all the functions do in the linker script so can someone explain to me the most important ones and give an example of a fix for my problem?

I have made a beginning of a partition but I have put it in here so you might have a better understanding of what I am trying.

I am using the PCA10400 board. softdevice 132.

Parents Reply Children
  • Hey,

    • "alignment:  The required alignment of the program section; a decimal number specifying the byte alignment."

    Pretty vague, byte alignement from what?

    • "load:  If Yes, the section is loaded. If No, the section isn't loaded."

    What is loaded? When is a section loaded?

    • keep:  If Yes, the section will be kept even if none of the symbols are referenced by the rest of the program.

    Can you explain this one in different words? or with example?

    Now I have done this. Is this a valid region for my goal?

    I want to save sensor data there, copy and paste every few minutes. I don't want any other data to go in that region. This is so I can save my important data in RAM region 1 so I can dissable all other RAM regions when the chip is not powered.

  • Hi,

     

    Chriis said:
    Pretty vague, byte alignement from what?

    This follows the architecture. 4 bytes are normal on a 32 bit system.

    Chriis said:
    What is loaded? When is a section loaded?

    Should the data be initialized? Or should it not?

    Chriis said:
    Can you explain this one in different words? or with example?

    Global variables that are initialized will have the initial value loaded from flash into the RAM location.

    ie: uint32_t g_variable = 0xVALUE;

    The "0xVALUE" will then be loaded from a non-volatile area (Flash) into RAM in the boot-up sequence (start up files).

     

    More information about linker scripts and startup sequences can be found here: https://interrupt.memfault.com/blog/how-to-write-linker-scripts-for-firmware

    Chriis said:

    Now I have done this. Is this a valid region for my goal?

    I want to save sensor data there, copy and paste every few minutes. I don't want any other data to go in that region. This is so I can save my important data in RAM region 1 so I can dissable all other RAM regions when the chip is not powered.

    Do you have a hard requirement on where it should be located? if no, then just declare a buffer of your wanted size.

    If you need this data to be absolute located, please see the former link:

    Håkon Alseth said:

     

    Kind regards,

    Håkon

Related