diff --git a/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/flash_config.c b/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/flash_config.c index 09886dece6..e0f5a5bd7d 100644 --- a/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/flash_config.c +++ b/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/flash_config.c @@ -15,7 +15,7 @@ __attribute__((section(".boot_hdr.ivt"))) * IVT Data *************************************/ const ivt image_vector_table = { - IVT_HEADER, /* IVT Header */ + 0x432000D1, /* Teensy bootloader looks for this value*/ IMAGE_ENTRY_ADDRESS, /* Image Entry Function */ IVT_RSVD, /* Reserved = 0 */ (uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */ @@ -25,13 +25,15 @@ const ivt image_vector_table = { IVT_RSVD /* Reserved = 0 */ }; +extern unsigned long _flashimagelen; + __attribute__((section(".boot_hdr.boot_data"))) /************************************* * Boot Data *************************************/ const BOOT_DATA_T boot_data = { FLASH_BASE, /* boot start location */ - FLASH_SIZE, /* size */ + (uint32_t)&_flashimagelen, /* actual size of image */ PLUGIN_FLAG, /* Plugin flag*/ 0xFFFFFFFF /* empty - extra data word */ }; diff --git a/ports/mimxrt10xx/boards/teensy40/flash_config.c b/ports/mimxrt10xx/boards/teensy40/flash_config.c index 3f4ab0271d..d878124b40 100644 --- a/ports/mimxrt10xx/boards/teensy40/flash_config.c +++ b/ports/mimxrt10xx/boards/teensy40/flash_config.c @@ -15,7 +15,7 @@ __attribute__((section(".boot_hdr.ivt"))) * IVT Data *************************************/ const ivt image_vector_table = { - IVT_HEADER, /* IVT Header */ + 0x432000D1, /* Teensy bootloader looks for this value*/ IMAGE_ENTRY_ADDRESS, /* Image Entry Function */ IVT_RSVD, /* Reserved = 0 */ (uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */ @@ -25,13 +25,15 @@ const ivt image_vector_table = { IVT_RSVD /* Reserved = 0 */ }; +extern unsigned long _flashimagelen; + __attribute__((section(".boot_hdr.boot_data"))) /************************************* * Boot Data *************************************/ const BOOT_DATA_T boot_data = { FLASH_BASE, /* boot start location */ - FLASH_SIZE, /* size */ + (uint32_t)&_flashimagelen, /* actual size of image */ PLUGIN_FLAG, /* Plugin flag*/ 0xFFFFFFFF /* empty - extra data word */ }; diff --git a/ports/mimxrt10xx/boards/teensy41/flash_config.c b/ports/mimxrt10xx/boards/teensy41/flash_config.c index 09886dece6..e0f5a5bd7d 100644 --- a/ports/mimxrt10xx/boards/teensy41/flash_config.c +++ b/ports/mimxrt10xx/boards/teensy41/flash_config.c @@ -15,7 +15,7 @@ __attribute__((section(".boot_hdr.ivt"))) * IVT Data *************************************/ const ivt image_vector_table = { - IVT_HEADER, /* IVT Header */ + 0x432000D1, /* Teensy bootloader looks for this value*/ IMAGE_ENTRY_ADDRESS, /* Image Entry Function */ IVT_RSVD, /* Reserved = 0 */ (uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */ @@ -25,13 +25,15 @@ const ivt image_vector_table = { IVT_RSVD /* Reserved = 0 */ }; +extern unsigned long _flashimagelen; + __attribute__((section(".boot_hdr.boot_data"))) /************************************* * Boot Data *************************************/ const BOOT_DATA_T boot_data = { FLASH_BASE, /* boot start location */ - FLASH_SIZE, /* size */ + (uint32_t)&_flashimagelen, /* actual size of image */ PLUGIN_FLAG, /* Plugin flag*/ 0xFFFFFFFF /* empty - extra data word */ }; diff --git a/ports/mimxrt10xx/linking/common.ld b/ports/mimxrt10xx/linking/common.ld index 44e8d537c4..b6f1acc8d0 100644 --- a/ports/mimxrt10xx/linking/common.ld +++ b/ports/mimxrt10xx/linking/common.ld @@ -74,7 +74,6 @@ SECTIONS _etext = .; /* define a global symbol at end of code */ __etext = .; /* define a global symbol at end of code */ } > FLASH_FIRMWARE - _ld_filesystem_start = ORIGIN(FLASH_FATFS); _ld_filesystem_end = _ld_filesystem_start + LENGTH(FLASH_FATFS); @@ -127,6 +126,8 @@ SECTIONS _ld_dtcm_data_flash_copy = LOADADDR(.dtcm_data); _ld_dtcm_data_size = SIZEOF(.dtcm_data); + _flashimagelen = _ld_dtcm_data_flash_copy + _ld_dtcm_data_size - flash_config_location; + .dtcm_bss : { . = ALIGN(4);