Skip to content

Commit ac45aac

Browse files
authored
Merge pull request #13832 from moshe-shahar/fix-gcc-non-contiguous
Fix GCC_ARM non-contiguous FW for `K64F` and `K66F`
2 parents b9daf3f + ca39f95 commit ac45aac

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/device/TOOLCHAIN_ARM_STD/MK66FN2M0xxx18.sct

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454

5555
#if !defined(MBED_APP_START)
5656
#define MBED_APP_START 0
57+
#elif MBED_APP_START > 0 && MBED_APP_START < 0x410
58+
#error MBED_APP_START too small and will overwrite interrupts and flash config
5759
#endif
5860

5961
#if !defined(MBED_APP_SIZE)
@@ -63,12 +65,21 @@
6365
#define m_interrupts_start MBED_APP_START
6466
#define m_interrupts_size 0x00000400
6567

68+
#if MBED_APP_START == 0
69+
6670
#define m_flash_config_start MBED_APP_START + 0x400
6771
#define m_flash_config_size 0x00000010
6872

6973
#define m_text_start MBED_APP_START + 0x410
7074
#define m_text_size MBED_APP_SIZE - 0x410
7175

76+
#else
77+
78+
#define m_text_start MBED_APP_START + 0x400
79+
#define m_text_size MBED_APP_SIZE - 0x400
80+
81+
#endif
82+
7283
#define m_interrupts_ram_start 0x1FFF0000
7384
#define m_interrupts_ram_size __ram_vector_table_size__
7485

@@ -100,9 +111,11 @@ LR_IROM1 m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; lo
100111
VECTOR_ROM m_interrupts_start m_interrupts_size { ; load address = execution address
101112
* (RESET,+FIRST)
102113
}
114+
#if MBED_APP_START == 0
103115
ER_m_flash_config m_flash_config_start FIXED m_flash_config_size { ; load address = execution address
104116
* (FlashConfig)
105117
}
118+
#endif
106119
ER_IROM1 m_text_start m_text_size { ; load address = execution address
107120
* (InRoot$$Sections)
108121
.ANY (+RO)

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/device/TOOLCHAIN_GCC_ARM/MK66FN2M0xxx18.ld

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ __stack_size__ = MBED_CONF_TARGET_BOOT_STACK_SIZE;
5959

6060
#if !defined(MBED_APP_START)
6161
#define MBED_APP_START 0
62+
#elif MBED_APP_START > 0 && MBED_APP_START < 0x410
63+
#error MBED_APP_START too small and will overwrite interrupts and flash config
6264
#endif
6365

6466
#if !defined(MBED_APP_SIZE)
@@ -72,9 +74,13 @@ M_CRASH_DATA_RAM_SIZE = 0x100;
7274
/* Specify the memory areas */
7375
MEMORY
7476
{
77+
#if MBED_APP_START == 0
7578
m_interrupts (RX) : ORIGIN = MBED_APP_START, LENGTH = 0x400
7679
m_flash_config (RX) : ORIGIN = MBED_APP_START + 0x400, LENGTH = 0x10
7780
m_text (RX) : ORIGIN = MBED_APP_START + 0x410, LENGTH = MBED_APP_SIZE - 0x410
81+
#else
82+
m_text (RX) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
83+
#endif
7884
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
7985
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00030000
8086
}
@@ -89,6 +95,7 @@ SECTIONS
8995
. = ALIGN(8);
9096
KEEP(*(.isr_vector)) /* Startup code */
9197
. = ALIGN(8);
98+
#if MBED_APP_START == 0
9299
} > m_interrupts
93100

94101
.flash_config :
@@ -97,8 +104,9 @@ SECTIONS
97104
KEEP(*(.FlashConfig)) /* Flash Configuration Field (FCF) */
98105
. = ALIGN(8);
99106
} > m_flash_config
100-
101-
/* The program code and other data goes into internal flash */
107+
#else
108+
} > m_text
109+
#endif
102110
.text :
103111
{
104112
. = ALIGN(8);

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_ARM_STD/MK64FN1M0xxx12.sct

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@
5757
#endif
5858

5959
#if !defined(MBED_APP_START)
60+
6061
#define MBED_APP_START 0
62+
#elif MBED_APP_START > 0 && MBED_APP_START < 0x410
63+
#error MBED_APP_START too small and will overwrite interrupts and flash config
6164
#endif
6265

6366
#if !defined(MBED_APP_SIZE)
@@ -75,12 +78,21 @@
7578
#define m_interrupts_start MBED_APP_START
7679
#define m_interrupts_size 0x00000400
7780

81+
#if MBED_APP_START == 0
82+
7883
#define m_flash_config_start MBED_APP_START + 0x400
7984
#define m_flash_config_size 0x00000010
8085

8186
#define m_text_start MBED_APP_START + 0x410
8287
#define m_text_size MBED_APP_SIZE - 0x410
8388

89+
#else
90+
91+
#define m_text_start MBED_APP_START + 0x400
92+
#define m_text_size MBED_APP_SIZE - 0x400
93+
94+
#endif
95+
8496
#define m_interrupts_ram_start 0x1FFF0000
8597
#define m_interrupts_ram_size __ram_vector_table_size__
8698

@@ -104,9 +116,11 @@ LR_IROM1 m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; load
104116
VECTOR_ROM m_interrupts_start m_interrupts_size { ; load address = execution address
105117
* (RESET,+FIRST)
106118
}
119+
#if MBED_APP_START == 0
107120
ER_m_flash_config m_flash_config_start FIXED m_flash_config_size { ; load address = execution address
108121
* (FlashConfig)
109122
}
123+
#endif
110124
ER_IROM1 m_text_start m_text_size { ; load address = execution address
111125
* (InRoot$$Sections)
112126
.ANY (+RO)

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ __ram_vector_table__ = 1;
5555

5656
#if !defined(MBED_APP_START)
5757
#define MBED_APP_START 0
58+
#elif MBED_APP_START > 0 && MBED_APP_START < 0x410
59+
#error MBED_APP_START too small and will overwrite interrupts and flash config
5860
#endif
5961

6062
#if !defined(MBED_APP_SIZE)
@@ -74,9 +76,13 @@ M_CRASH_DATA_RAM_SIZE = 0x100;
7476
/* Specify the memory areas */
7577
MEMORY
7678
{
79+
#if MBED_APP_START == 0
7780
m_interrupts (RX) : ORIGIN = MBED_APP_START, LENGTH = 0x400
7881
m_flash_config (RX) : ORIGIN = MBED_APP_START + 0x400, LENGTH = 0x10
7982
m_text (RX) : ORIGIN = MBED_APP_START + 0x410, LENGTH = MBED_APP_SIZE - 0x410
83+
#else
84+
m_text (RX) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
85+
#endif
8086
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
8187
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00030000
8288
}
@@ -91,6 +97,7 @@ SECTIONS
9197
. = ALIGN(8);
9298
KEEP(*(.isr_vector)) /* Startup code */
9399
. = ALIGN(8);
100+
#if MBED_APP_START == 0
94101
} > m_interrupts
95102

96103
.flash_config :
@@ -99,7 +106,9 @@ SECTIONS
99106
KEEP(*(.FlashConfig)) /* Flash Configuration Field (FCF) */
100107
. = ALIGN(8);
101108
} > m_flash_config
102-
109+
#else
110+
} > m_text
111+
#endif
103112
.text :
104113
{
105114

0 commit comments

Comments
 (0)