This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

STM32: Scatter File, Bit and No Initialization Variables

Using a STM32F103ZE processor

Using the following Include and Scatter files, bit and no initialization variables can be allocated and the space used is automatically adjusted.

There is a problem when the Internal RAM overflows, a warning is issued.

If the size of the Bits and InternalRAM sections are fixed the overflow is moved to the ExternalRAM section automatically.

Is there some way to get the overflow to be automatically moved to the ExternalRAM section without fixing the size of the Bit section?

Include File:

#define dBit      __attribute__((section("BitSection"))) long
#define dNoInit   __attribute__((section("NoInitializationSection"), zero_init))

Scatter-Loading Description File:

LR_IROM1 0x08000000 0x00080000
{
   ER_IROM1 0x08000000 0x00080000
   {
      * (RESET, +First)
      *(InRoot$$Sections)
      .ANY (+RO)
   }
   Bits 0x22000000 (0x00010000 * 4)
   { ; Bit data
      *(BitSection).ANY (+RW +ZI)
   }
   InternalRAM (0x20000000 + ((((ImageLength(Bits) / 4) + 7) / 8 + 0x07) AND ~0x07)) UNINIT
   { ; Skip Bit band
      .ANY2 (+RW +ZI)
      *(InternalRAM_Section).ANY (+RW +ZI)
   }
   DoNotUse1 0x20010000 EMPTY 0x08
   {
   }
   Nonvolatile 0x68000000 UNINIT 0x00080000
   {
      *(NoInitializationSection).ANY (+ZI)
   }
   ExternalRAM ((ImageLimit(Nonvolatile) + 0x07) AND ~0x07)
   {
      .ANY1 (+RW +ZI)
   }
   DoNotUse2 0x68080000 EMPTY 0x08
   {
   }
}