[riot-notifications] [RIOT-OS/RIOT] ldscripts: move .noinit section behind .bss section (#11591)

benpicco notifications at github.com
Mon May 27 18:16:34 CEST 2019

### Contribution description
If the `.noinit` section starts at the beginning of the RAM, a bootloader that is unaware of it will clear it.
Instead, move it behind the `.bss` section, hoping that a bootloader will always use less `.bss` memory than RIOT proper.

I would much rather have placed the `.noinit` section at a defined place, e.g. the end of RAM.
However, it does not seem possible as there is no way to get the size of an *input section* without first placing it into an *output section*. If an input section is placed into multiple output sections (so we could place it in a dummy section just to get the size), the first one is the one that counts.

### Testing procedure
int main(void)
    static uint32_t counter __attribute__((section(".noinit")));
    static uint32_t magic __attribute__((section(".noinit")));

    if (magic != 0xdeadbeef) {
        magic  = 0xdeadbeef;
        counter = 0;

    printf("count: %lu\n", ++counter);

    return 0;

The counter should increment with every reset, even when e.g. an Arduino Bootloader is being used.

### Issues/PRs references
@keestux  noticed the issue in #11520

You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * ldscripts: move .noinit section behind .bss section

-- File Changes --

    M cpu/cortexm_common/ldscripts/cortexm_base.ld (22)
    M cpu/lpc2387/ldscripts/lpc2387.ld (25)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190527/faf22ad7/attachment.html>

More information about the notifications mailing list