From 6a5d4d4f6a0c816a71cccd07b74750aab356c50f Mon Sep 17 00:00:00 2001
From: Daniele Cattaneo <daniele.cattaneo@alice.it>
Date: Thu, 5 Apr 2018 17:09:53 +0200
Subject: [PATCH] Fix a bug occurring when compiling part of Miosix with LLVM
 where _etext develops an offset with respect to the load address of .data

---
 miosix/arch/arm7_lpc2000/lpc2138_miosix_board/miosix.ld       | 4 +---
 .../efm32_1M+128k_rom_usbbootloader.ld                        | 4 +---
 .../cortexM3_stm32/stm32f100c8_microboard/stm32_63k+8k_rom.ld | 4 +---
 .../stm32f100cb_tempsensor/stm32_127k+8k_rom.ld               | 4 +---
 .../stm32f100rb_stm32vldiscovery/stm32_128k+8k_rom.ld         | 4 +---
 .../stm32f100rc_solertegiard/stm32_256k+24k_rom.ld            | 4 +---
 .../cortexM3_stm32/stm32f103c8_breakout/stm32_64k+20k_rom.ld  | 4 +---
 .../stm32f103cb_als_mainboard_rev2/stm32_128k+20k_rom.ld      | 4 +---
 .../cortexM3_stm32/stm32f103ve_mp3v2/stm32_512k+64k_ram.ld    | 4 +---
 .../cortexM3_stm32/stm32f103ve_mp3v2/stm32_512k+64k_rom.ld    | 4 +---
 .../stm32f103ve_strive_mini/stm32_512k+64k_rom.ld             | 4 +---
 .../stm32f103ze_redbull_v2/stm32_512k+64k_rom.ld              | 4 +---
 .../stm32f103ze_stm3210e-eval/stm32_512k+64k_all_in_xram.ld   | 4 +---
 .../stm32f103ze_stm3210e-eval/stm32_512k+64k_rom.ld           | 4 +---
 .../stm32f103ze_stm3210e-eval/stm32_512k+64k_xram.ld          | 4 +---
 .../cortexM3_stm32f2/stm32f205_generic/stm32_1m+128k_rom.ld   | 4 +---
 .../stm32f205rc_skyward_stormtrooper/stm32_512k+128k_rom.ld   | 4 +---
 .../stm32f205rg_sony-newman/stm32_1M+128k_rom.ld              | 4 +---
 .../stm32f207ig_stm3220g-eval/stm32_1m+128k_all_in_xram.ld    | 4 +---
 .../stm32_1m+128k_all_in_xram_processes.ld                    | 4 +---
 .../stm32f207ig_stm3220g-eval/stm32_1m+128k_rom.ld            | 4 +---
 .../stm32f207ig_stm3220g-eval/stm32_1m+128k_xram.ld           | 4 +---
 .../stm32f207ze_als_camboard/stm32_1m+128k_rom.ld             | 4 +---
 .../stm32f207zg_EthBoardV2/stm32_1m+128k_code_in_xram.ld      | 4 +---
 .../stm32f207zg_EthBoardV2/stm32_1m+128k_rom.ld               | 4 +---
 .../stm32l151c8_als_mainboard/stm32_64k+10k_rom.ld            | 4 +---
 .../cortexM4_stm32f4/stm32f401re_nucleo/stm32_512k+96k_rom.ld | 4 +---
 .../stm32f401vc_stm32f4discovery/stm32_256k+64k_rom.ld        | 4 +---
 .../stm32f407vg_bitsboard/stm32_1m+192k_rom.ld                | 4 +---
 .../stm32f407vg_stm32f4discovery/stm32_1m+192k_ram.ld         | 4 +---
 .../stm32f407vg_stm32f4discovery/stm32_1m+192k_rom.ld         | 4 +---
 .../stm32_1m+192k_rom_processes.ld                            | 4 +---
 .../stm32f407vg_thermal_test_chip/stm32_1m+192k_rom.ld        | 4 +---
 .../stm32f411re_nucleo/stm32_512k+128k_rom.ld                 | 4 +---
 .../stm32f429zi_oledboard2/stm32_2m+256k_rom.ld               | 4 +---
 .../stm32f429zi_oledboard2/stm32_2m+6m_xram.ld                | 4 +---
 .../stm32f429zi_oledboard2/stm32_2m+8m_xram.ld                | 4 +---
 .../stm32f429zi_skyward_anakin/stm32_2m+256k_rom.ld           | 4 +---
 .../stm32f429zi_skyward_anakin/stm32_2m+8m_xram.ld            | 4 +---
 .../stm32f429zi_skyward_homeone/stm32_2m+256k_rom.ld          | 4 +---
 .../stm32f429zi_skyward_homeone/stm32_2m+8m_xram.ld           | 4 +---
 .../stm32f429zi_stm32f4discovery/stm32_2m+256k_rom.ld         | 4 +---
 .../stm32f429zi_stm32f4discovery/stm32_2m+6m_xram.ld          | 4 +---
 .../stm32f429zi_stm32f4discovery/stm32_2m+8m_xram.ld          | 4 +---
 .../stm32f469ni_stm32f469i-disco/stm32_2m+12m_xram.ld         | 4 +---
 .../stm32f469ni_stm32f469i-disco/stm32_2m+16m_xram.ld         | 4 +---
 .../stm32f469ni_stm32f469i-disco/stm32_2m+384k_rom.ld         | 4 +---
 .../stm32f746zg_nucleo/stm32_1024k+256k_rom.ld                | 4 +---
 .../cortexM7_stm32h7/stm32h753xi_eval/stm32_2m+512k_rom.ld    | 4 +---
 49 files changed, 49 insertions(+), 147 deletions(-)

diff --git a/miosix/arch/arm7_lpc2000/lpc2138_miosix_board/miosix.ld b/miosix/arch/arm7_lpc2000/lpc2138_miosix_board/miosix.ld
index af7c176e..a8dfede1 100644
--- a/miosix/arch/arm7_lpc2000/lpc2138_miosix_board/miosix.ld
+++ b/miosix/arch/arm7_lpc2000/lpc2138_miosix_board/miosix.ld
@@ -182,9 +182,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
     /* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -196,6 +193,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_efm32gg/efm32gg332f1024_wandstem/efm32_1M+128k_rom_usbbootloader.ld b/miosix/arch/cortexM3_efm32gg/efm32gg332f1024_wandstem/efm32_1M+128k_rom_usbbootloader.ld
index e619d563..03b686ab 100644
--- a/miosix/arch/cortexM3_efm32gg/efm32gg332f1024_wandstem/efm32_1M+128k_rom_usbbootloader.ld
+++ b/miosix/arch/cortexM3_efm32gg/efm32gg332f1024_wandstem/efm32_1M+128k_rom_usbbootloader.ld
@@ -125,9 +125,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -139,6 +136,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f100c8_microboard/stm32_63k+8k_rom.ld b/miosix/arch/cortexM3_stm32/stm32f100c8_microboard/stm32_63k+8k_rom.ld
index 5cca70ac..fbc362d4 100644
--- a/miosix/arch/cortexM3_stm32/stm32f100c8_microboard/stm32_63k+8k_rom.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f100c8_microboard/stm32_63k+8k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f100cb_tempsensor/stm32_127k+8k_rom.ld b/miosix/arch/cortexM3_stm32/stm32f100cb_tempsensor/stm32_127k+8k_rom.ld
index c684f603..1934a5ca 100644
--- a/miosix/arch/cortexM3_stm32/stm32f100cb_tempsensor/stm32_127k+8k_rom.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f100cb_tempsensor/stm32_127k+8k_rom.ld
@@ -142,9 +142,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -156,6 +153,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f100rb_stm32vldiscovery/stm32_128k+8k_rom.ld b/miosix/arch/cortexM3_stm32/stm32f100rb_stm32vldiscovery/stm32_128k+8k_rom.ld
index 8fc6fd93..40711f37 100644
--- a/miosix/arch/cortexM3_stm32/stm32f100rb_stm32vldiscovery/stm32_128k+8k_rom.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f100rb_stm32vldiscovery/stm32_128k+8k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f100rc_solertegiard/stm32_256k+24k_rom.ld b/miosix/arch/cortexM3_stm32/stm32f100rc_solertegiard/stm32_256k+24k_rom.ld
index f02ab166..af413015 100644
--- a/miosix/arch/cortexM3_stm32/stm32f100rc_solertegiard/stm32_256k+24k_rom.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f100rc_solertegiard/stm32_256k+24k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f103c8_breakout/stm32_64k+20k_rom.ld b/miosix/arch/cortexM3_stm32/stm32f103c8_breakout/stm32_64k+20k_rom.ld
index f36141c9..3affd0a0 100644
--- a/miosix/arch/cortexM3_stm32/stm32f103c8_breakout/stm32_64k+20k_rom.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f103c8_breakout/stm32_64k+20k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f103cb_als_mainboard_rev2/stm32_128k+20k_rom.ld b/miosix/arch/cortexM3_stm32/stm32f103cb_als_mainboard_rev2/stm32_128k+20k_rom.ld
index 2022d7db..40e9d54c 100644
--- a/miosix/arch/cortexM3_stm32/stm32f103cb_als_mainboard_rev2/stm32_128k+20k_rom.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f103cb_als_mainboard_rev2/stm32_128k+20k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f103ve_mp3v2/stm32_512k+64k_ram.ld b/miosix/arch/cortexM3_stm32/stm32f103ve_mp3v2/stm32_512k+64k_ram.ld
index 37e12192..0e516afe 100644
--- a/miosix/arch/cortexM3_stm32/stm32f103ve_mp3v2/stm32_512k+64k_ram.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f103ve_mp3v2/stm32_512k+64k_ram.ld
@@ -113,9 +113,6 @@ SECTIONS
     } > ram
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram */
     .data : ALIGN(8)
     {
@@ -126,6 +123,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f103ve_mp3v2/stm32_512k+64k_rom.ld b/miosix/arch/cortexM3_stm32/stm32f103ve_mp3v2/stm32_512k+64k_rom.ld
index 714abfea..017f9a8f 100644
--- a/miosix/arch/cortexM3_stm32/stm32f103ve_mp3v2/stm32_512k+64k_rom.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f103ve_mp3v2/stm32_512k+64k_rom.ld
@@ -142,9 +142,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -156,6 +153,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f103ve_strive_mini/stm32_512k+64k_rom.ld b/miosix/arch/cortexM3_stm32/stm32f103ve_strive_mini/stm32_512k+64k_rom.ld
index 53ff2940..67c801af 100644
--- a/miosix/arch/cortexM3_stm32/stm32f103ve_strive_mini/stm32_512k+64k_rom.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f103ve_strive_mini/stm32_512k+64k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f103ze_redbull_v2/stm32_512k+64k_rom.ld b/miosix/arch/cortexM3_stm32/stm32f103ze_redbull_v2/stm32_512k+64k_rom.ld
index 53ff2940..67c801af 100644
--- a/miosix/arch/cortexM3_stm32/stm32f103ze_redbull_v2/stm32_512k+64k_rom.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f103ze_redbull_v2/stm32_512k+64k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f103ze_stm3210e-eval/stm32_512k+64k_all_in_xram.ld b/miosix/arch/cortexM3_stm32/stm32f103ze_stm3210e-eval/stm32_512k+64k_all_in_xram.ld
index 1f213d41..80e2d6eb 100644
--- a/miosix/arch/cortexM3_stm32/stm32f103ze_stm3210e-eval/stm32_512k+64k_all_in_xram.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f103ze_stm3210e-eval/stm32_512k+64k_all_in_xram.ld
@@ -114,9 +114,6 @@ SECTIONS
     } > ram
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
     /* .data section: global variables go to ram */
     .data : ALIGN(8)
     {
@@ -127,6 +124,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f103ze_stm3210e-eval/stm32_512k+64k_rom.ld b/miosix/arch/cortexM3_stm32/stm32f103ze_stm3210e-eval/stm32_512k+64k_rom.ld
index 4fbecb9b..9f4ffe0d 100644
--- a/miosix/arch/cortexM3_stm32/stm32f103ze_stm3210e-eval/stm32_512k+64k_rom.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f103ze_stm3210e-eval/stm32_512k+64k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32/stm32f103ze_stm3210e-eval/stm32_512k+64k_xram.ld b/miosix/arch/cortexM3_stm32/stm32f103ze_stm3210e-eval/stm32_512k+64k_xram.ld
index efe4c0a4..5abc607a 100644
--- a/miosix/arch/cortexM3_stm32/stm32f103ze_stm3210e-eval/stm32_512k+64k_xram.ld
+++ b/miosix/arch/cortexM3_stm32/stm32f103ze_stm3210e-eval/stm32_512k+64k_xram.ld
@@ -142,9 +142,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -156,6 +153,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32f2/stm32f205_generic/stm32_1m+128k_rom.ld b/miosix/arch/cortexM3_stm32f2/stm32f205_generic/stm32_1m+128k_rom.ld
index 2b5498ed..e72e7644 100644
--- a/miosix/arch/cortexM3_stm32f2/stm32f205_generic/stm32_1m+128k_rom.ld
+++ b/miosix/arch/cortexM3_stm32f2/stm32f205_generic/stm32_1m+128k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32f2/stm32f205rc_skyward_stormtrooper/stm32_512k+128k_rom.ld b/miosix/arch/cortexM3_stm32f2/stm32f205rc_skyward_stormtrooper/stm32_512k+128k_rom.ld
index 9f09a9e5..62406d42 100644
--- a/miosix/arch/cortexM3_stm32f2/stm32f205rc_skyward_stormtrooper/stm32_512k+128k_rom.ld
+++ b/miosix/arch/cortexM3_stm32f2/stm32f205rc_skyward_stormtrooper/stm32_512k+128k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32f2/stm32f205rg_sony-newman/stm32_1M+128k_rom.ld b/miosix/arch/cortexM3_stm32f2/stm32f205rg_sony-newman/stm32_1M+128k_rom.ld
index 587f4e53..34220fdf 100644
--- a/miosix/arch/cortexM3_stm32f2/stm32f205rg_sony-newman/stm32_1M+128k_rom.ld
+++ b/miosix/arch/cortexM3_stm32f2/stm32f205rg_sony-newman/stm32_1M+128k_rom.ld
@@ -173,9 +173,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -187,6 +184,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_all_in_xram.ld b/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_all_in_xram.ld
index adde25b7..cda0e1ae 100644
--- a/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_all_in_xram.ld
+++ b/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_all_in_xram.ld
@@ -115,9 +115,6 @@ SECTIONS
     } > ram
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -129,6 +126,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_all_in_xram_processes.ld b/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_all_in_xram_processes.ld
index ed9326cb..78332e67 100644
--- a/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_all_in_xram_processes.ld
+++ b/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_all_in_xram_processes.ld
@@ -124,9 +124,6 @@ SECTIONS
     } > ram
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -138,6 +135,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_rom.ld b/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_rom.ld
index 2b5498ed..e72e7644 100644
--- a/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_rom.ld
+++ b/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_xram.ld b/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_xram.ld
index fb078c63..939c744d 100644
--- a/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_xram.ld
+++ b/miosix/arch/cortexM3_stm32f2/stm32f207ig_stm3220g-eval/stm32_1m+128k_xram.ld
@@ -142,9 +142,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -156,6 +153,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32f2/stm32f207ze_als_camboard/stm32_1m+128k_rom.ld b/miosix/arch/cortexM3_stm32f2/stm32f207ze_als_camboard/stm32_1m+128k_rom.ld
index 1c0f9243..1adf73d4 100644
--- a/miosix/arch/cortexM3_stm32f2/stm32f207ze_als_camboard/stm32_1m+128k_rom.ld
+++ b/miosix/arch/cortexM3_stm32f2/stm32f207ze_als_camboard/stm32_1m+128k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32f2/stm32f207zg_EthBoardV2/stm32_1m+128k_code_in_xram.ld b/miosix/arch/cortexM3_stm32f2/stm32f207zg_EthBoardV2/stm32_1m+128k_code_in_xram.ld
index 5e683c06..68084192 100644
--- a/miosix/arch/cortexM3_stm32f2/stm32f207zg_EthBoardV2/stm32_1m+128k_code_in_xram.ld
+++ b/miosix/arch/cortexM3_stm32f2/stm32f207zg_EthBoardV2/stm32_1m+128k_code_in_xram.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > xram
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > xram
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32f2/stm32f207zg_EthBoardV2/stm32_1m+128k_rom.ld b/miosix/arch/cortexM3_stm32f2/stm32f207zg_EthBoardV2/stm32_1m+128k_rom.ld
index 2b5498ed..e72e7644 100644
--- a/miosix/arch/cortexM3_stm32f2/stm32f207zg_EthBoardV2/stm32_1m+128k_rom.ld
+++ b/miosix/arch/cortexM3_stm32f2/stm32f207zg_EthBoardV2/stm32_1m+128k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM3_stm32l1/stm32l151c8_als_mainboard/stm32_64k+10k_rom.ld b/miosix/arch/cortexM3_stm32l1/stm32l151c8_als_mainboard/stm32_64k+10k_rom.ld
index 2468a791..208e7dfb 100644
--- a/miosix/arch/cortexM3_stm32l1/stm32l151c8_als_mainboard/stm32_64k+10k_rom.ld
+++ b/miosix/arch/cortexM3_stm32l1/stm32l151c8_als_mainboard/stm32_64k+10k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f401re_nucleo/stm32_512k+96k_rom.ld b/miosix/arch/cortexM4_stm32f4/stm32f401re_nucleo/stm32_512k+96k_rom.ld
index 5af6b90a..4849ba38 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f401re_nucleo/stm32_512k+96k_rom.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f401re_nucleo/stm32_512k+96k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f401vc_stm32f4discovery/stm32_256k+64k_rom.ld b/miosix/arch/cortexM4_stm32f4/stm32f401vc_stm32f4discovery/stm32_256k+64k_rom.ld
index 96c858c7..b6d7ac95 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f401vc_stm32f4discovery/stm32_256k+64k_rom.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f401vc_stm32f4discovery/stm32_256k+64k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f407vg_bitsboard/stm32_1m+192k_rom.ld b/miosix/arch/cortexM4_stm32f4/stm32f407vg_bitsboard/stm32_1m+192k_rom.ld
index b83253e1..8c0d0592 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f407vg_bitsboard/stm32_1m+192k_rom.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f407vg_bitsboard/stm32_1m+192k_rom.ld
@@ -151,9 +151,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -165,6 +162,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > smallram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32_1m+192k_ram.ld b/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32_1m+192k_ram.ld
index 046a7611..7ee6385a 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32_1m+192k_ram.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32_1m+192k_ram.ld
@@ -128,9 +128,6 @@ SECTIONS
     } > largeram
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram */
     .data : ALIGN(8)
     {
@@ -141,6 +138,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > largeram
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32_1m+192k_rom.ld b/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32_1m+192k_rom.ld
index b83253e1..8c0d0592 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32_1m+192k_rom.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32_1m+192k_rom.ld
@@ -151,9 +151,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -165,6 +162,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > smallram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32_1m+192k_rom_processes.ld b/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32_1m+192k_rom_processes.ld
index 47e71389..1d822401 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32_1m+192k_rom_processes.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32_1m+192k_rom_processes.ld
@@ -158,9 +158,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -172,6 +169,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > smallram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f407vg_thermal_test_chip/stm32_1m+192k_rom.ld b/miosix/arch/cortexM4_stm32f4/stm32f407vg_thermal_test_chip/stm32_1m+192k_rom.ld
index 960944d7..179737e3 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f407vg_thermal_test_chip/stm32_1m+192k_rom.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f407vg_thermal_test_chip/stm32_1m+192k_rom.ld
@@ -131,9 +131,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -145,6 +142,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > largeram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f411re_nucleo/stm32_512k+128k_rom.ld b/miosix/arch/cortexM4_stm32f4/stm32f411re_nucleo/stm32_512k+128k_rom.ld
index 1c0f9243..1adf73d4 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f411re_nucleo/stm32_512k+128k_rom.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f411re_nucleo/stm32_512k+128k_rom.ld
@@ -141,9 +141,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -155,6 +152,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f429zi_oledboard2/stm32_2m+256k_rom.ld b/miosix/arch/cortexM4_stm32f4/stm32f429zi_oledboard2/stm32_2m+256k_rom.ld
index 0924f0d5..e2425d26 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f429zi_oledboard2/stm32_2m+256k_rom.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f429zi_oledboard2/stm32_2m+256k_rom.ld
@@ -151,9 +151,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -165,6 +162,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > smallram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f429zi_oledboard2/stm32_2m+6m_xram.ld b/miosix/arch/cortexM4_stm32f4/stm32f429zi_oledboard2/stm32_2m+6m_xram.ld
index 49d21dba..b61f04ce 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f429zi_oledboard2/stm32_2m+6m_xram.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f429zi_oledboard2/stm32_2m+6m_xram.ld
@@ -154,9 +154,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -168,6 +165,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > xram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f429zi_oledboard2/stm32_2m+8m_xram.ld b/miosix/arch/cortexM4_stm32f4/stm32f429zi_oledboard2/stm32_2m+8m_xram.ld
index 27db7dd2..78fe5310 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f429zi_oledboard2/stm32_2m+8m_xram.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f429zi_oledboard2/stm32_2m+8m_xram.ld
@@ -148,9 +148,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -162,6 +159,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > xram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_anakin/stm32_2m+256k_rom.ld b/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_anakin/stm32_2m+256k_rom.ld
index 2d33bd9c..8fd1a460 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_anakin/stm32_2m+256k_rom.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_anakin/stm32_2m+256k_rom.ld
@@ -151,9 +151,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -165,6 +162,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > smallram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_anakin/stm32_2m+8m_xram.ld b/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_anakin/stm32_2m+8m_xram.ld
index d3fcd30d..13a231e1 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_anakin/stm32_2m+8m_xram.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_anakin/stm32_2m+8m_xram.ld
@@ -148,9 +148,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -162,6 +159,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > xram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_homeone/stm32_2m+256k_rom.ld b/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_homeone/stm32_2m+256k_rom.ld
index 187fddec..cfcc2ce5 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_homeone/stm32_2m+256k_rom.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_homeone/stm32_2m+256k_rom.ld
@@ -152,9 +152,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -166,6 +163,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > smallram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_homeone/stm32_2m+8m_xram.ld b/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_homeone/stm32_2m+8m_xram.ld
index c853c62f..b6a0d266 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_homeone/stm32_2m+8m_xram.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f429zi_skyward_homeone/stm32_2m+8m_xram.ld
@@ -149,9 +149,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -163,6 +160,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > xram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32_2m+256k_rom.ld b/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32_2m+256k_rom.ld
index 0924f0d5..e2425d26 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32_2m+256k_rom.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32_2m+256k_rom.ld
@@ -151,9 +151,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -165,6 +162,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > smallram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32_2m+6m_xram.ld b/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32_2m+6m_xram.ld
index 49d21dba..b61f04ce 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32_2m+6m_xram.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32_2m+6m_xram.ld
@@ -154,9 +154,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -168,6 +165,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > xram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32_2m+8m_xram.ld b/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32_2m+8m_xram.ld
index 27db7dd2..78fe5310 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32_2m+8m_xram.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32_2m+8m_xram.ld
@@ -148,9 +148,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -162,6 +159,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > xram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f469ni_stm32f469i-disco/stm32_2m+12m_xram.ld b/miosix/arch/cortexM4_stm32f4/stm32f469ni_stm32f469i-disco/stm32_2m+12m_xram.ld
index 527f7328..452e15ef 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f469ni_stm32f469i-disco/stm32_2m+12m_xram.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f469ni_stm32f469i-disco/stm32_2m+12m_xram.ld
@@ -154,9 +154,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -168,6 +165,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > xram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f469ni_stm32f469i-disco/stm32_2m+16m_xram.ld b/miosix/arch/cortexM4_stm32f4/stm32f469ni_stm32f469i-disco/stm32_2m+16m_xram.ld
index e84af80f..cd8c633c 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f469ni_stm32f469i-disco/stm32_2m+16m_xram.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f469ni_stm32f469i-disco/stm32_2m+16m_xram.ld
@@ -148,9 +148,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -162,6 +159,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > xram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM4_stm32f4/stm32f469ni_stm32f469i-disco/stm32_2m+384k_rom.ld b/miosix/arch/cortexM4_stm32f4/stm32f469ni_stm32f469i-disco/stm32_2m+384k_rom.ld
index 43191679..641526cd 100644
--- a/miosix/arch/cortexM4_stm32f4/stm32f469ni_stm32f469i-disco/stm32_2m+384k_rom.ld
+++ b/miosix/arch/cortexM4_stm32f4/stm32f469ni_stm32f469i-disco/stm32_2m+384k_rom.ld
@@ -151,9 +151,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -165,6 +162,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > smallram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM7_stm32f7/stm32f746zg_nucleo/stm32_1024k+256k_rom.ld b/miosix/arch/cortexM7_stm32f7/stm32f746zg_nucleo/stm32_1024k+256k_rom.ld
index 9c44df7f..ed31c59f 100644
--- a/miosix/arch/cortexM7_stm32f7/stm32f746zg_nucleo/stm32_1024k+256k_rom.ld
+++ b/miosix/arch/cortexM7_stm32f7/stm32f746zg_nucleo/stm32_1024k+256k_rom.ld
@@ -145,9 +145,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -159,6 +156,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
diff --git a/miosix/arch/cortexM7_stm32h7/stm32h753xi_eval/stm32_2m+512k_rom.ld b/miosix/arch/cortexM7_stm32h7/stm32h753xi_eval/stm32_2m+512k_rom.ld
index 11f5412d..47cf466f 100644
--- a/miosix/arch/cortexM7_stm32h7/stm32h753xi_eval/stm32_2m+512k_rom.ld
+++ b/miosix/arch/cortexM7_stm32h7/stm32h753xi_eval/stm32_2m+512k_rom.ld
@@ -138,9 +138,6 @@ SECTIONS
     } > flash
     __exidx_end = .;
 
-    . = ALIGN(8);
-    _etext = .;
-
 	/* .data section: global variables go to ram, but also store a copy to
        flash to initialize them */
     .data : ALIGN(8)
@@ -152,6 +149,7 @@ SECTIONS
         . = ALIGN(8);
         _edata = .;
     } > ram AT > flash
+    _etext = LOADADDR(.data);
 
     /* .bss section: uninitialized global variables go to ram */
     _bss_start = .;
-- 
GitLab