MCU Espresso: Program behave unexpectedly when compiled using a different offset than 0x00

23 views Asked by At

I am testing my bootloader project for KL46, so i tried compiling some applications to specific addresses (0x20000) using my linker file. The linker files i used is exactly a copy from the one generated by MCU Espresso but only change the top definition part like this rather than starting flash from 0x00.

`>! MEMORY
>! {
>! Define each memory region */
>! PROGRAM_FLASH (rx) : ORIGIN = 0x20000, LENGTH = 0x7800 /* 256K bytes (alias Flash) */
>! SRAM (rwx) : ORIGIN = 0x1fffe000, LENGTH = 0x8000 /* 32K bytes (alias RAM) */
>! }
>!     __base_PROGRAM_FLASH = 0x20000 ; /* PROGRAM_FLASH */
>!     __base_Flash = 0x20000 ; /* Flash */
>!     __top_PROGRAM_FLASH = 0x20000 + 0x7800 ;
>!     __top_Flash = 0x20000 + 0x7800 ;
>!     __base_SRAM = 0x1fffe000 ; /* SRAM */
>!     __base_RAM = 0x1fffe000 ; /* RAM */
>!     __top_SRAM = 0x1fffe000 + 0x8000 ; /* 32K bytes */
>!     __top_RAM = 0x1fffe000 + 0x8000 ; /* 32K bytes */
>! `

Although the program compiled and ide flashed the program code correctly to 0x20000, when i debug it just jumping back and forth from Reset ISR to man and back to Reset. Please help me, i look into the assembly code and saw nothing wrong, do i need to change anything else in the linker file.

I was expecting it to run normally, i also checked the disassembly but i have no clue why it just jumping between main and Reset ISR

0

There are 0 answers