Skip to content

Commit

Permalink
kl27z_hic: Only add flash config data to DAPLink bootloader.
Browse files Browse the repository at this point in the history
This config data goes to addres 0x400 in flash, which corresponds
to the bootloader area.
Currently the Interface builds included the same data at
address 0x8400, which is unneccesary.
  • Loading branch information
microbit-carlos authored and mbrossard committed May 18, 2022
1 parent a968edc commit f5c5896
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 6 additions & 0 deletions source/hic_hal/freescale/kinetis.ld
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 :
Expand Down
6 changes: 2 additions & 4 deletions source/hic_hal/freescale/kl27z/armcc/startup_MKL27Z4.s
Original file line number Diff line number Diff line change
Expand Up @@ -308,16 +308,14 @@ FSEC EQU 0xFE
; </h>
; </h>

#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

Expand Down
6 changes: 3 additions & 3 deletions source/hic_hal/freescale/kl27z/gcc/startup_MKL27Z4.S
Original file line number Diff line number Diff line change
Expand Up @@ -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" */
Expand Down Expand Up @@ -130,7 +129,8 @@ __isr_vector:
.byte 0x3B
/* 2 reserved bytes */
.byte 0xFF, 0xFF
#endif
#endif /* MICROBIT_LOCK_BOOTLOADER */
#endif /* DAPLINK_BL */

.text
.thumb
Expand Down

0 comments on commit f5c5896

Please sign in to comment.