S32K34 jumping from bootloader to application causes hard fault.

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

S32K34 jumping from bootloader to application causes hard fault.

Jump to solution
1,581 Views
HemantKapoor
Contributor II

Hello All,

I have spent days looking into the issue. So I have a custom bootloader which checks for integrity of application and jumps there.

However everytime I execute jump routine it causes hard fault.
Can you please look into below code and guide me to what I am missing:

1. Boot linker file snippet:

 

MEMORY 
{         
    int_flash               : ORIGIN = 0x00400000, LENGTH = 0x0010000    /* 4096K - 176K (sBAF + HSE)*/
    int_itcm                : ORIGIN = 0x00000000, LENGTH = 0x00010000    /* 32K */
    int_dtcm                : ORIGIN = 0x20000000, LENGTH = 0x00020000    /* 64K */
    int_sram                : ORIGIN = 0x20400000, LENGTH = 0x0002DF00    /* 183.9K */
    int_sram_fls_rsv        : ORIGIN = 0x2042DF00, LENGTH = 0x00000100    /* 0.1K */
    int_sram_stack_c0       : ORIGIN = 0x2042E000, LENGTH = 0x00001000    /* 4KB  */
    int_sram_stack_c1       : ORIGIN = 0x2042F000, LENGTH = 0x00001000    /* 4KB  */
    int_sram_no_cacheable   : ORIGIN = 0x20430000, LENGTH = 0x0000FF00    /* 64KB, needs to include int_results  */
    int_sram_results        : ORIGIN = 0x2043FF00, LENGTH = 0x00000100
    int_sram_shareable      : ORIGIN = 0x20440000, LENGTH = 0x00004000    /* 16KB */
    ram_rsvd2               : ORIGIN = 0x20444000, LENGTH = 0             /* End of SRAM */
}

 

 

2. Application Linker file snippet:

 

MEMORY 
{         
    int_flash               : ORIGIN = 0x00410400, LENGTH = 0x0007FC00     /* 511K - 176K (sBAF + HSE)*/
    int_itcm                : ORIGIN = 0x00000000, LENGTH = 0x00010000    /* 32K */
    int_dtcm                : ORIGIN = 0x20000000, LENGTH = 0x00020000    /* 64K */
    int_sram                : ORIGIN = 0x20400000, LENGTH = 0x0002DF00    /* 183.9K */
    int_sram_fls_rsv        : ORIGIN = 0x2042DF00, LENGTH = 0x00000100    /* 0.1K */
    int_sram_stack_c0       : ORIGIN = 0x2042E000, LENGTH = 0x00001000    /* 4KB  */
    int_sram_stack_c1       : ORIGIN = 0x2042F000, LENGTH = 0x00001000    /* 4KB  */
    int_sram_no_cacheable   : ORIGIN = 0x20430000, LENGTH = 0x0000FF00    /* 64KB, needs to include int_results  */
    int_sram_results        : ORIGIN = 0x2043FF00, LENGTH = 0x00000100
    int_sram_shareable      : ORIGIN = 0x20440000, LENGTH = 0x00004000    /* 16KB */
    ram_rsvd2               : ORIGIN = 0x20444000, LENGTH = 0             /* End of SRAM */
}

 

 

3. Jump to application routine

 

void startApplication(unsigned long app_link_location)

{
	S32_SCB->VTOR=(uint32_t)(app_link_location);
	AppAddr resetHandle = (AppAddr)(app_link_location+4);
}

 

 

4. Calling:

 

startApplication(0x00411400U);

 

 

Thanks for reading.

0 Kudos
Reply
1 Solution
1,544 Views
HemantKapoor
Contributor II

Sorry for the delayed response... There was GPT interrupt which was enabled in bootloader and whilst jumping to application I was getting hard fault as interrupt wasn't serviced.

So disabling interrupt before jumping worked.

View solution in original post

0 Kudos
Reply
2 Replies
1,553 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Hemant,

I deleted my previous post, it seems you are referring to interrupt vector table, not to boot header address.

If you step the asm code, where does it crash exactly? Which instruction?

Regards,

Lukas

0 Kudos
Reply
1,545 Views
HemantKapoor
Contributor II

Sorry for the delayed response... There was GPT interrupt which was enabled in bootloader and whilst jumping to application I was getting hard fault as interrupt wasn't serviced.

So disabling interrupt before jumping worked.

0 Kudos
Reply