diff --git a/source/hic_hal/freescale/kinetis.ld b/source/hic_hal/freescale/kinetis.ld index 6e94bfcd7..e07b3ce0a 100644 --- a/source/hic_hal/freescale/kinetis.ld +++ b/source/hic_hal/freescale/kinetis.ld @@ -34,8 +34,12 @@ STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : DAPLINK_STACK_SIZE; MEMORY { m_interrupts (RX) : ORIGIN = DAPLINK_ROM_APP_START, LENGTH = 0x400 +#if defined(DAPLINK_BL) m_flash_config (RX) : ORIGIN = DAPLINK_ROM_APP_START + 0x400, LENGTH = 0x10 m_text (RX) : ORIGIN = DAPLINK_ROM_APP_START + 0x410, LENGTH = DAPLINK_ROM_APP_SIZE - 0x410 +#else + m_text (RX) : ORIGIN = DAPLINK_ROM_APP_START + 0x400, LENGTH = DAPLINK_ROM_APP_SIZE - 0x400 +#endif m_cfgrom (RW) : ORIGIN = DAPLINK_ROM_CONFIG_USER_START, LENGTH = DAPLINK_ROM_CONFIG_USER_SIZE m_data (RW) : ORIGIN = DAPLINK_RAM_APP_START, LENGTH = DAPLINK_RAM_APP_SIZE m_cfgram (RW) : ORIGIN = DAPLINK_RAM_SHARED_START, LENGTH = DAPLINK_RAM_SHARED_SIZE @@ -54,12 +58,14 @@ SECTIONS . += LENGTH(m_interrupts) - (. - ORIGIN(m_interrupts)); /* pad out to end of m_interrupts */ } > m_interrupts +#if defined(DAPLINK_BL) .flash_config : { . = ALIGN(4); KEEP(*(.FlashConfig)) /* Flash Configuration Field (FCF) */ . = ALIGN(4); } > m_flash_config +#endif /* The program code and other data goes into internal flash */ .text : diff --git a/source/hic_hal/freescale/kl27z/armcc/startup_MKL27Z4.s b/source/hic_hal/freescale/kl27z/armcc/startup_MKL27Z4.s index e4e9836f7..35200769d 100644 --- a/source/hic_hal/freescale/kl27z/armcc/startup_MKL27Z4.s +++ b/source/hic_hal/freescale/kl27z/armcc/startup_MKL27Z4.s @@ -308,16 +308,14 @@ FSEC EQU 0xFE ; ; - #if defined(DAPLINK_IF) - AREA |.ARM.__at_0x8400|, CODE, READONLY - #else + #if defined(DAPLINK_BL) AREA |.ARM.__at_0x400 |, CODE, READONLY - #endif DCB BackDoorK0, BackDoorK1, BackDoorK2, BackDoorK3 DCB BackDoorK4, BackDoorK5, BackDoorK6, BackDoorK7 DCB FPROT3 , FPROT2 , FPROT1 , FPROT0 DCB FSEC , FOPT , 0xFF , 0xFF + #endif AREA |.text|, CODE, READONLY diff --git a/source/hic_hal/freescale/kl27z/gcc/startup_MKL27Z4.S b/source/hic_hal/freescale/kl27z/gcc/startup_MKL27Z4.S index 4af4c146c..5f4a0d557 100644 --- a/source/hic_hal/freescale/kl27z/gcc/startup_MKL27Z4.S +++ b/source/hic_hal/freescale/kl27z/gcc/startup_MKL27Z4.S @@ -78,9 +78,8 @@ __isr_vector: #if defined(DAPLINK_BL) /* TODO: Bootloader Configuration Area (BCA) used by Kinetis ROM Bootloader */ -#endif -/* Flash Configuration */ + /* Flash Configuration */ .section .FlashConfig, "a" #if defined(MICROBIT_LOCK_BOOTLOADER) /* Backdoor Comparison Key: "MICROBIT" */ @@ -130,7 +129,8 @@ __isr_vector: .byte 0x3B /* 2 reserved bytes */ .byte 0xFF, 0xFF -#endif +#endif /* MICROBIT_LOCK_BOOTLOADER */ +#endif /* DAPLINK_BL */ .text .thumb