stm32_flash: Add a section for EEPROM data.
authorsjlongland <sjlongland@01035d8c-6547-0410-b346-abe4f91aad63>
Sat, 26 Sep 2015 02:57:32 +0000 (02:57 +0000)
committersjlongland <sjlongland@01035d8c-6547-0410-b346-abe4f91aad63>
Sat, 26 Sep 2015 02:57:32 +0000 (02:57 +0000)
This allocates a few sectors of flash for the following purposes:
- Sector 0: ISR vector data.  (This gets mapped to address 0; so we have
  no choice, the ISR data *must* reside here.)
- Sector 1..3: Virtual EEPROM.  We'll stash our configuration parameters
  here.  We have 48kB available.
- Sector 4.. onwards: Program data

Credit: clive1, ST e2e Communities.
https://my.st.com/public/STe2ecommunities/mcu/_layouts/st/getshorturl.aspx?List={697285D7-A9CA-445D-B16C-F23BF0E3B1A3}&ItemId=24079

git-svn-id: https://svn.code.sf.net/p/freetel/code@2390 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/stm32/stm32_flash.ld

index 6822ffad624523fe2698d4e590b9f90414902a44..09acaf3f71af3c3ee07dddadfa684a9b15e2fecb 100644 (file)
@@ -10,8 +10,15 @@ _Min_Stack_Size = 0x400; /* required amount of stack */
 /* Specify the memory areas */
 MEMORY
 {
-  FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 1024K
+  /* ISR vectors *must* be placed here as they get mapped to address 0 */
+  VECTOR (rx)     : ORIGIN = 0x08000000, LENGTH = 16K
+  /* Virtual EEPROM area, we use the remaining 16kB blocks for this. */
+  EEPROM (rx)     : ORIGIN = 0x08004000, LENGTH = 48K
+  /* The rest of flash is used for program data */
+  FLASH (rx)      : ORIGIN = 0x08010000, LENGTH = 960K
+  /* Memory area */
   RAM (rwx)       : ORIGIN = 0x20000000, LENGTH = 128K
+  /* Core Coupled Memory */
   CCM (rwx)       : ORIGIN = 0x10000000, LENGTH = 64K
 }
 
@@ -22,7 +29,16 @@ SECTIONS
     . = ALIGN(4);
     KEEP(*(.isr_vector))
     . = ALIGN(4);
-  } >FLASH
+  } >VECTOR
+
+
+  .eeprom :
+  {
+    . = ALIGN(4);
+    *(.eeprom)         /* special section for persistent data */
+    . = ALIGN(4);
+  } >EEPROM
+
 
   .text :
   {
@@ -33,7 +49,7 @@ SECTIONS
     *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
     *(.glue_7)         /* glue arm to thumb code */
     *(.glue_7t)        /* glue thumb to arm code */
-       *(.eh_frame)
+    *(.eh_frame)
 
     KEEP (*(.init))
     KEEP (*(.fini))