[ABANDONED] RAM Memory Segment Program Section size ignored?

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

  • [ABANDONED] RAM Memory Segment Program Section size ignored?

    Hi, first time posting here.

    I have reserved a section in my RAM memory segment called 'my_non_init' (as highlighted in the screenshot attached) and gave it a size of 0x1000.
    1. A size of 0x1000 stands for 4096 bytes, right?
    2. Since I have reserved 4096 bytes (4kB) but the Memory View shows 24.1kB, why don't I get a compilation error?
    It is essential for me to know the amount of bytes needed/reserved to be able to block the same amount of non initialized memory in the bootloader.

    Thanks!
    Images
    • Untitled.png

      89.61 kB, 1,454×445, viewed 294 times
  • Hi,

    in Embedded Studio V5 the size attribute defined the minimum size of a section.
    If you would have placed less than 0x1000 bytes into this section, it would have been expanded.

    See line 6 of the generated linker script:

    Source Code

    1. __my_non_init_load_start__ = ALIGN(__non_init_end__ , 4);
    2. .my_non_init ALIGN(__non_init_end__ , 4) (NOLOAD) : AT(ALIGN(__non_init_end__ , 4))
    3. {
    4. __my_non_init_start__ = .;
    5. *(.my_non_init .my_non_init.*)
    6. . = ALIGN(MAX(__my_non_init_start__ + 0x1000 , .), 4);
    7. }
    8. __my_non_init_end__ = __my_non_init_start__ + SIZEOF(.my_non_init);
    9. __my_non_init_size__ = SIZEOF(.my_non_init);
    10. __my_non_init_load_end__ = __my_non_init_end__;
    11. . = ASSERT(__my_non_init_start__ == __my_non_init_end__ || (__my_non_init_end__ - __RAM1_segment_start__) <= __RAM1_segment_size__ , "error: .my_non_init is too large to fit in RAM1 memory segment");
    Display All

    Embedded Studio V6.32 adds an additional assert to also make the attribute the maximum size of a section:

    Source Code

    1. . = ASSERT(__my_non_init_size__ <= 0x1000 , "error: .my_non_init is larger than specified size");
    If that is the behavior you would expect, you could upgrade to the latest version of Embedded Studio, or change your project to use a custom linker script which includes the additional assert.

    - Johannes
    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.