[SOLVED] Flash placement

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Flash placement

    I have to put a variable (4 byte) on a specific place in flash e.g. 0x21000.
    So I learned so far, that I have to create a seperate section in flash_placement.xml and use the __Attribute(section"....").
    So far, so good.
    The problem is, that I want to use the whole flash. So is it possible to define sections around which will fill seamlessly the space around the placed section?
    Is it possible that the linker uses automatically 2 sections for code, e.g. .text .text2 without defining the functions placed in each section manually?

    The other option I saw in the linker description is the following:

    Source Code

    1. unsigned char __attribute((section(".ARM.__at_0x400"))) aConfig[32]


    but this does not seem to work


    The third option could be writing an own linker script with:
    2.5.1 Placement by linker script
    place at address 0x400 { symbol aConfig };

    But how can I use a custom linker script with SES?


    Can anyone help me?
  • Hello,

    Thank you for your inquiry.
    Is your variable referenced in your code? If not the compiler will usually optimize the variable away.
    To counter this we recommend declaring the variable as volatile.
    Does that work?
    More information about linking variables/functions in Embedded Studio can be found either Offline in the Embedded Studio help or online: studio.segger.com/ide_section_placement.htm

    EDIT: The two proposed options you mentioned are currently not supported by the gcc linker that is used in Embedded Studio.
    However we are currently working on our own linker which should be available with the next Embedded Studio release version which then can be used in the two ways you described.
    For now we recommend using the linker as documented on the webpage I linked.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.