]> granicus.if.org Git - esp-idf/commitdiff
esp32: put .data before .bss
authorIvan Grokhotkov <ivan@espressif.com>
Fri, 6 Jan 2017 05:03:07 +0000 (13:03 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Fri, 6 Jan 2017 05:46:06 +0000 (13:46 +0800)
This change reduces chances that a large .bss segment will push .data all the way into
0x3ffe1320 — 0x3ffe5320 range where the bootloader stack is, creating a problem when
bootloader will be loading application into memory.
With this change, .data would need to be at least 200k big to cause problems.

components/esp32/ld/esp32.common.ld

index 09b7634445ccfc21a9cacb70ef2d648bac82f782..c199a41d3d2aa8c240cc3b51af3c997aaa71a3d6 100644 (file)
@@ -85,6 +85,27 @@ SECTIONS
     _iram_text_end = ABSOLUTE(.);
   } > iram0_0_seg
 
+  .dram0.data :
+  {
+    _data_start = ABSOLUTE(.);
+    KEEP(*(.data))
+    KEEP(*(.data.*))
+    KEEP(*(.gnu.linkonce.d.*))
+    KEEP(*(.data1))
+    KEEP(*(.sdata))
+    KEEP(*(.sdata.*))
+    KEEP(*(.gnu.linkonce.s.*))
+    KEEP(*(.sdata2))
+    KEEP(*(.sdata2.*))
+    KEEP(*(.gnu.linkonce.s2.*))
+    KEEP(*(.jcr))
+    *(.dram1 .dram1.*)
+    *libesp32.a:panic.o(.rodata .rodata.*)
+    _data_end = ABSOLUTE(.);
+    . = ALIGN(4);
+    _heap_start = ABSOLUTE(.);
+  } >dram0_0_seg
+
   /* Shared RAM */
   .dram0.bss (NOLOAD) :
   {
@@ -108,27 +129,6 @@ SECTIONS
     _bss_end = ABSOLUTE(.);
   } >dram0_0_seg
 
-  .dram0.data :
-  {
-    _data_start = ABSOLUTE(.);
-    *(.data)
-    *(.data.*)
-    *(.gnu.linkonce.d.*)
-    *(.data1)
-    *(.sdata)
-    *(.sdata.*)
-    *(.gnu.linkonce.s.*)
-    *(.sdata2)
-    *(.sdata2.*)
-    *(.gnu.linkonce.s2.*)
-    *(.jcr)
-    *(.dram1 .dram1.*)
-    *libesp32.a:panic.o(.rodata .rodata.*)
-    _data_end = ABSOLUTE(.);
-    . = ALIGN(4);
-    _heap_start = ABSOLUTE(.);
-  } >dram0_0_seg
-
   .flash.rodata :
   {
     _rodata_start = ABSOLUTE(.);