Skip to content

Commit 579b2fb

Browse files
committed
Update K64F linker scripts for bootloader support
Add MBED_APP_START and MBED_APP_SIZE to the K64F's linker script so the start and size of an image can be specified. This allows the ROM to be split into a bootloader region and an application region.
1 parent aa6d673 commit 579b2fb

File tree

3 files changed

+37
-13
lines changed

3 files changed

+37
-13
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,22 @@
6060
#define __ram_vector_table_size__ 0x00000000
6161
#endif
6262

63-
#define m_interrupts_start 0x00000000
63+
#if !defined(MBED_APP_START)
64+
#define MBED_APP_START 0
65+
#endif
66+
67+
#if !defined(MBED_APP_SIZE)
68+
#define MBED_APP_SIZE 0x100000
69+
#endif
70+
71+
#define m_interrupts_start MBED_APP_START
6472
#define m_interrupts_size 0x00000400
6573

66-
#define m_flash_config_start 0x00000400
74+
#define m_flash_config_start MBED_APP_START + 0x400
6775
#define m_flash_config_size 0x00000010
6876

69-
#define m_text_start 0x00000410
70-
#define m_text_size 0x000FFBF0
77+
#define m_text_start MBED_APP_START + 0x410
78+
#define m_text_size MBED_APP_SIZE - 0x410
7179

7280
#define m_interrupts_ram_start 0x1FFF0000
7381
#define m_interrupts_ram_size __ram_vector_table_size__

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,24 @@ __stack_size__ = 0x400;
6363
* heap and the page heap in uVisor applications. */
6464
__heap_size__ = 0x6000;
6565

66+
#if !defined(MBED_APP_START)
67+
#define MBED_APP_START 0
68+
#endif
69+
70+
#if !defined(MBED_APP_SIZE)
71+
#define MBED_APP_SIZE 0x100000
72+
#endif
73+
6674
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
6775
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
6876
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
6977

7078
/* Specify the memory areas */
7179
MEMORY
7280
{
73-
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
74-
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
75-
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0
81+
m_interrupts (RX) : ORIGIN = MBED_APP_START, LENGTH = 0x400
82+
m_flash_config (RX) : ORIGIN = MBED_APP_START + 0x400, LENGTH = 0x10
83+
m_text (RX) : ORIGIN = MBED_APP_START + 0x410, LENGTH = MBED_APP_SIZE - 0x410
7684
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
7785
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00030000
7886
}

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_IAR/MK64FN1M0xxx12.icf

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,25 @@ define symbol __ram_vector_table__ = 1;
5353
define symbol __stack_size__=0x8000;
5454
define symbol __heap_size__=0x10000;
5555

56+
if (!isdefinedsymbol(MBED_APP_START)) {
57+
define symbol MBED_APP_START = 0;
58+
}
59+
60+
if (!isdefinedsymbol(MBED_APP_SIZE)) {
61+
define symbol MBED_APP_SIZE = 0x100000;
62+
}
63+
5664
define symbol __ram_vector_table_size__ = isdefinedsymbol(__ram_vector_table__) ? 0x00000400 : 0;
5765
define symbol __ram_vector_table_offset__ = isdefinedsymbol(__ram_vector_table__) ? 0x000003FF : 0;
5866

59-
define symbol m_interrupts_start = 0x00000000;
60-
define symbol m_interrupts_end = 0x000003FF;
67+
define symbol m_interrupts_start = MBED_APP_START;
68+
define symbol m_interrupts_end = MBED_APP_START + 0x3FF;
6169

62-
define symbol m_flash_config_start = 0x00000400;
63-
define symbol m_flash_config_end = 0x0000040F;
70+
define symbol m_flash_config_start = MBED_APP_START + 0x400;
71+
define symbol m_flash_config_end = MBED_APP_START + 0x40F;
6472

65-
define symbol m_text_start = 0x00000410;
66-
define symbol m_text_end = 0x000FFFFF;
73+
define symbol m_text_start = MBED_APP_START + 0x410;
74+
define symbol m_text_end = MBED_APP_START + MBED_APP_SIZE - 1;
6775

6876
define symbol m_interrupts_ram_start = 0x1FFF0000;
6977
define symbol m_interrupts_ram_end = 0x1FFF0000 + __ram_vector_table_offset__;

0 commit comments

Comments
 (0)