CUSTOM LINKER FILE ERROR

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CUSTOM LINKER FILE ERROR

700 Views
DungManhNguyen
Contributor I

I am testing my bootloader project, 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.

Tags (2)
0 Kudos
Reply
2 Replies

660 Views
DungManhNguyen
Contributor I

Thanks I found out what cause the error. The debugger, when using IDE to debug a program with offset different than 0x00, it the set SCB->VTOR to OFFSET shifted right by 7. But in my own Bootloader when i jump to application: SCB->VTOR = OFFSET. works perfectly fine. I am using MKL46Z256.

0 Kudos
Reply

669 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi @DungManhNguyen 

Please let us know your chip part number thus we can assign right engineer for your issue.

Thanks,

Jun Zhang

0 Kudos
Reply