title: RAM section is part of the binary firmware
body: <p>I am trying to use a custom RAM section to be able to pass information across reboot. This section will not be erased at boot and so the variables placed in this section will be kept across reboots (if there is no alimentation loss of course).</p>
  
  <p>I use GNU toolchain and a Cortex-M0 (STM32) MCU</p>
  
  <p>So I added in the linker script a new memory area before RAM :</p>
  
  <pre><code>RAM_PERSIST (xrw) : ORIGIN = 0x20000000, LENGTH = 0x0040
  RAM (xrw)         : ORIGIN = 0x20000040, LENGTH = 0x0FD0
  </code></pre>
  
  <p>Then a section to go in there :</p>
  
  <pre><code>.pds :
  {
    KEEP(*(.pds))
  } &gt;RAM_PERSIST
  </code></pre>
  
  <p>Finally in the C code, I declare some data in this section :</p>
  
  <pre><code>data_t __attribute((section(".pds")) data;
  </code></pre>
  
  <p>I does compile but I could not upload the generated binary on my target. Using objdump I discovered that my firmware got a new section ".sec2" beginning at 0x20000000 :</p>
  
  <pre><code>&gt; (...)/arm-none-eabi-objdump -s ./obj/firmware.hex | tail
   8006d20 f8bc08bc 9e467047 f8b5c046 f8bc08bc  .....FpG...F....
   8006d30 9e467047 e9000008 c1000008 00127a00  .FpG..........z.
   8006d40 19000000 e0930400 409c0000 400d0300  ........@...@...
   8006d50 c0c62d00 30750000 ffffffff 01000000  ..-.0u..........
   8006d60 04000000                             ....
  Contents of section .sec2:
   20000000 00000000 00000000 00000000 00000000  ................
   20000010 00000000 00000000 00000000 00000000  ................
   20000020 00000000 00000000 00000000 00000000  ................
   20000030 00000000 00000000 00000000 00000000  ................
  </code></pre>
  
  <p>So I think I have to tell the linker this section is not in the flash so must not be part of the firmware.</p>
  
  <p>Am I right ? If so, how to do that ?</p>
  
  <p>Thanks by advance.</p>