K64F, K66F - Remove flash_config area if MBED_APP_START isn't zero

This will also fix GCC_ARM non-contiguous FW:
Issue: https://github.com/ARMmbed/mbed-os/issues/13831
pull/13832/head
Moshe Shahar 2020-10-29 11:36:36 +02:00
parent 66c05ddbf8
commit e70ee75a6e
4 changed files with 46 additions and 3 deletions

View File

@ -54,6 +54,8 @@
#if !defined(MBED_APP_START)
#define MBED_APP_START 0
#elif MBED_APP_START < 0x400
#error MBED_APP_START too small and will overwrite flash config
#endif
#if !defined(MBED_APP_SIZE)
@ -63,12 +65,21 @@
#define m_interrupts_start MBED_APP_START
#define m_interrupts_size 0x00000400
#if MBED_APP_SIZE == 0
#define m_flash_config_start MBED_APP_START + 0x400
#define m_flash_config_size 0x00000010
#define m_text_start MBED_APP_START + 0x410
#define m_text_size MBED_APP_SIZE - 0x410
#else
#define m_text_start MBED_APP_START + 0x400
#define m_text_size MBED_APP_SIZE - 0x400
#endif
#define m_interrupts_ram_start 0x1FFF0000
#define m_interrupts_ram_size __ram_vector_table_size__
@ -100,9 +111,11 @@ LR_IROM1 m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; lo
VECTOR_ROM m_interrupts_start m_interrupts_size { ; load address = execution address
* (RESET,+FIRST)
}
#if MBED_APP_SIZE == 0
ER_m_flash_config m_flash_config_start FIXED m_flash_config_size { ; load address = execution address
* (FlashConfig)
}
#endif
ER_IROM1 m_text_start m_text_size { ; load address = execution address
* (InRoot$$Sections)
.ANY (+RO)

View File

@ -59,6 +59,8 @@ __stack_size__ = MBED_CONF_TARGET_BOOT_STACK_SIZE;
#if !defined(MBED_APP_START)
#define MBED_APP_START 0
#elif MBED_APP_START < 0x400
#error MBED_APP_START too small and will overwrite flash config
#endif
#if !defined(MBED_APP_SIZE)
@ -72,9 +74,13 @@ M_CRASH_DATA_RAM_SIZE = 0x100;
/* Specify the memory areas */
MEMORY
{
#if MBED_APP_SIZE == 0
m_interrupts (RX) : ORIGIN = MBED_APP_START, LENGTH = 0x400
m_flash_config (RX) : ORIGIN = MBED_APP_START + 0x400, LENGTH = 0x10
m_text (RX) : ORIGIN = MBED_APP_START + 0x410, LENGTH = MBED_APP_SIZE - 0x410
#else
m_text (RX) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
#endif
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00030000
}
@ -89,6 +95,7 @@ SECTIONS
. = ALIGN(8);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(8);
#if MBED_APP_SIZE == 0
} > m_interrupts
.flash_config :
@ -97,8 +104,9 @@ SECTIONS
KEEP(*(.FlashConfig)) /* Flash Configuration Field (FCF) */
. = ALIGN(8);
} > m_flash_config
/* The program code and other data goes into internal flash */
#else
} > m_text
#endif
.text :
{
. = ALIGN(8);

View File

@ -58,6 +58,8 @@
#if !defined(MBED_APP_START)
#define MBED_APP_START 0
#elif MBED_APP_START < 0x400
#error MBED_APP_START too small and will overwrite flash config
#endif
#if !defined(MBED_APP_SIZE)
@ -75,12 +77,21 @@
#define m_interrupts_start MBED_APP_START
#define m_interrupts_size 0x00000400
#if MBED_APP_SIZE == 0
#define m_flash_config_start MBED_APP_START + 0x400
#define m_flash_config_size 0x00000010
#define m_text_start MBED_APP_START + 0x410
#define m_text_size MBED_APP_SIZE - 0x410
#else
#define m_text_start MBED_APP_START + 0x400
#define m_text_size MBED_APP_SIZE - 0x400
#endif
#define m_interrupts_ram_start 0x1FFF0000
#define m_interrupts_ram_size __ram_vector_table_size__
@ -104,9 +115,11 @@ LR_IROM1 m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; load
VECTOR_ROM m_interrupts_start m_interrupts_size { ; load address = execution address
* (RESET,+FIRST)
}
#if MBED_APP_SIZE == 0
ER_m_flash_config m_flash_config_start FIXED m_flash_config_size { ; load address = execution address
* (FlashConfig)
}
#endif
ER_IROM1 m_text_start m_text_size { ; load address = execution address
* (InRoot$$Sections)
.ANY (+RO)

View File

@ -55,6 +55,8 @@ __ram_vector_table__ = 1;
#if !defined(MBED_APP_START)
#define MBED_APP_START 0
#elif MBED_APP_START < 0x400
#error MBED_APP_START too small and will overwrite flash config
#endif
#if !defined(MBED_APP_SIZE)
@ -74,9 +76,13 @@ M_CRASH_DATA_RAM_SIZE = 0x100;
/* Specify the memory areas */
MEMORY
{
#if MBED_APP_SIZE == 0
m_interrupts (RX) : ORIGIN = MBED_APP_START, LENGTH = 0x400
m_flash_config (RX) : ORIGIN = MBED_APP_START + 0x400, LENGTH = 0x10
m_text (RX) : ORIGIN = MBED_APP_START + 0x410, LENGTH = MBED_APP_SIZE - 0x410
#else
m_text (RX) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
#endif
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00030000
}
@ -91,6 +97,7 @@ SECTIONS
. = ALIGN(8);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(8);
#if MBED_APP_SIZE == 0
} > m_interrupts
.flash_config :
@ -99,7 +106,9 @@ SECTIONS
KEEP(*(.FlashConfig)) /* Flash Configuration Field (FCF) */
. = ALIGN(8);
} > m_flash_config
#else
} > m_text
#endif
.text :
{