AnsweredAssumed Answered

HEX file larger than memory

Question asked by Martin Dušek on Jan 20, 2020
Latest reply on Jan 21, 2020 by Martin Dušek


I built release configuration of MKL25Z4 freedom_bootloader in NXP_Kinetis_Bootloader_2_0_0. The only change I did was modification of linker script:


m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000100
m_bootloader_config (RX) : ORIGIN = 0x000003C0, LENGTH = 0x00000040
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x00007BF0
m_data (RW) : ORIGIN = 0x1FFFF000, LENGTH = 0x00004000


I enabled hex file creation and print of program size after build.


I got:


text data bss dec hex filename
30788 2288 6336 39412 99f4 freedom_bootloader.elf


The hex file ends with:




You can see that there is 0x8000 (0x8ED0 etc) region occupied with some data in the hex file even though the program should end on 0x7FFF address as defined in linker script.


Can you please advise how to fix this? I don't want KDS to generate larger images that what fits regions defined in my .ld file.