Skip to content

Commit 76930c0

Browse files
committed
KW41Z: Add Bootloader support
Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent cb49241 commit 76930c0

File tree

4 files changed

+54
-18
lines changed

4 files changed

+54
-18
lines changed

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW41Z/device/TOOLCHAIN_ARM_STD/MKW41Z512xxx4.sct

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,26 @@
5151
#define __ram_vector_table_size__ 0x00000000
5252
#endif
5353

54-
#define m_interrupts_start 0x00000000
54+
#if !defined(MBED_APP_START)
55+
#define MBED_APP_START 0
56+
#endif
57+
58+
#if !defined(MBED_APP_SIZE)
59+
#define MBED_APP_SIZE 0x80000
60+
#endif
61+
62+
#if !defined(MBED_BOOT_STACK_SIZE)
63+
#define MBED_BOOT_STACK_SIZE 0x400
64+
#endif
65+
66+
#define m_interrupts_start MBED_APP_START
5567
#define m_interrupts_size 0x00000200
5668

57-
#define m_flash_config_start 0x00000400
69+
#define m_flash_config_start MBED_APP_START + 0x400
5870
#define m_flash_config_size 0x00000010
5971

60-
#define m_text_start 0x00000410
61-
#define m_text_size 0x0007FBF0
72+
#define m_text_start MBED_APP_START + 0x410
73+
#define m_text_size MBED_APP_SIZE - 0x410
6274

6375
#define m_interrupts_ram_start 0x1FFF8000
6476
#define m_interrupts_ram_size __ram_vector_table_size__
@@ -70,7 +82,7 @@
7082
#if (defined(__stack_size__))
7183
#define Stack_Size __stack_size__
7284
#else
73-
#define Stack_Size 0x0400
85+
#define Stack_Size MBED_BOOT_STACK_SIZE
7486
#endif
7587

7688
#if (defined(__heap_size__))

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW41Z/device/TOOLCHAIN_GCC_ARM/MKW41Z512xxx4.ld

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,21 @@ ENTRY(Reset_Handler)
4848

4949
__ram_vector_table__ = 1;
5050

51+
#if !defined(MBED_APP_START)
52+
#define MBED_APP_START 0
53+
#endif
54+
55+
#if !defined(MBED_APP_SIZE)
56+
#define MBED_APP_SIZE 0x80000
57+
#endif
58+
59+
#if !defined(MBED_BOOT_STACK_SIZE)
60+
#define MBED_BOOT_STACK_SIZE 0x400
61+
#endif
62+
5163
/* With the RTOS in use, this does not affect the main stack size. The size of
5264
* the stack where main runs is determined via the RTOS. */
53-
__stack_size__ = 0x400;
65+
__stack_size__ = MBED_BOOT_STACK_SIZE;
5466

5567
__heap_size__ = 0x6000;
5668

@@ -61,9 +73,9 @@ M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0200 : 0x0;
6173
/* Specify the memory areas */
6274
MEMORY
6375
{
64-
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000200
65-
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
66-
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0
76+
m_interrupts (RX) : ORIGIN = MBED_APP_START, LENGTH = 0x00000200
77+
m_flash_config (RX) : ORIGIN = MBED_APP_START + 0x400, LENGTH = 0x00000010
78+
m_text (RX) : ORIGIN = MBED_APP_START + 0x410, LENGTH = MBED_APP_SIZE - 0x410
6779
m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00020000
6880
}
6981

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW41Z/device/TOOLCHAIN_IAR/MKW41Z512xxx4.icf

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,32 @@
4444
*/
4545
define symbol __ram_vector_table__ = 1;
4646

47-
/* Heap 1/4 of ram and stack 1/8 */
48-
define symbol __stack_size__=0x4000;
47+
if (!isdefinedsymbol(MBED_APP_START)) {
48+
define symbol MBED_APP_START = 0;
49+
}
50+
51+
if (!isdefinedsymbol(MBED_APP_SIZE)) {
52+
define symbol MBED_APP_SIZE = 0x80000;
53+
}
54+
55+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
56+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
57+
}
58+
59+
define symbol __stack_size__=MBED_BOOT_STACK_SIZE;
4960
define symbol __heap_size__=0x8000;
5061

5162
define symbol __ram_vector_table_size__ = isdefinedsymbol(__ram_vector_table__) ? 0x00000200 : 0;
5263
define symbol __ram_vector_table_offset__ = isdefinedsymbol(__ram_vector_table__) ? 0x000001FF : 0;
5364

54-
define symbol m_interrupts_start = 0x00000000;
55-
define symbol m_interrupts_end = 0x000001FF;
65+
define symbol m_interrupts_start = MBED_APP_START;
66+
define symbol m_interrupts_end = MBED_APP_START + 0x1FF;
5667

57-
define symbol m_flash_config_start = 0x00000400;
58-
define symbol m_flash_config_end = 0x0000040F;
68+
define symbol m_flash_config_start = MBED_APP_START + 0x400;
69+
define symbol m_flash_config_end = MBED_APP_START + 0x40F;
5970

60-
define symbol m_text_start = 0x00000410;
61-
define symbol m_text_end = 0x0007FFFF;
71+
define symbol m_text_start = MBED_APP_START + 0x410;
72+
define symbol m_text_end = MBED_APP_START + MBED_APP_SIZE - 1;
6273

6374
define symbol m_interrupts_ram_start = 0x1FFF8000;
6475
define symbol m_interrupts_ram_end = 0x1FFF8000 + __ram_vector_table_offset__;

targets/targets.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,8 @@
616616
"detect_code": ["0201"],
617617
"device_has": ["USTICKER", "LPTICKER", "RTC", "ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "TRNG", "STDIO_MESSAGES", "FLASH"],
618618
"release_versions": ["2", "5"],
619-
"device_name": "MKW41Z512xxx4"
619+
"device_name": "MKW41Z512xxx4",
620+
"bootloader_supported": true
620621
},
621622
"MCU_K24F1M": {
622623
"core": "Cortex-M4F",

0 commit comments

Comments
 (0)