s32k how to change the application to be loaded by a bootloader?

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

s32k how to change the application to be loaded by a bootloader?

1,135 Views
momo12
Contributor III

Hi 

I have a project (generated with processor expert) which is running fine. Now I want to prepair my project to be loaded by a bootloader. I just shifted the addresses in linker description file by 0x20k. See below. After this change nothing works. All sort of erros. I cant set a breakpoint startup.c where VTOR is written to. 

What am I missing?

before

  /* Flash */   
m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400   
m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010   
m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0 
after: 
/* Flash */   
m_interrupts          (RX)  : ORIGIN = 0x00020000, LENGTH = 0x00000400   
m_flash_config        (RX)  : ORIGIN = 0x00020400, LENGTH = 0x00000010   
m_text                (RX)  : ORIGIN = 0x00020410, LENGTH = 0x0005FBF0

Tags (1)
0 Kudos
1 Reply

641 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi,

I'm not sure if your problems are in the application project or in the bootloader ptoject.

After you changed the m_interrupts address in your application project the MCU reset occurs because the stack pointer and reset vector are expected always at the address 0x0 and 0x4.

If you want to run the application project you should make a change below:

m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400   
m_flash_config        (RX)  : ORIGIN = 0x00020400, LENGTH = 0x00000010   
m_text                (RX)  : ORIGIN = 0x00020410, LENGTH = 0x0005FBF0

or changes described in this thread: s32k boot problem 

However, in the case when you want to prepare the application for the bootloader my recommendation is:

- After is application worked as you want, just change the linker file as you do above and generate S record using the Build option.

- After that, you can load your application (S record) by the bootloader. Your application will start loaded at the address 0x20000.

I assume the bootloader starts at the address 0x00000000. 

From the bootloader can be jumped to the application using function below :

void startApplication(uint32_t app_link_location){

__asm("cpsid i");

S32K_SBC->VTOR=(uint32_t)(app_link_location);
asm(" ldr sp, [r0,#0]");
asm(" ldr pc, [r0,#4]");
}

I hope it helps you,

Best regards,

Diana

0 Kudos