cancel
Showing results for 
Search instead for 
Did you mean: 

Hardfault :STM32H750 Customer Bootloader Jump to Application

Andex
Associate II

Hello everyone:

I have a problem with my project.

My project is to use STM32H750UBKx  + Keil MDK5 IDE to design.
The customer bootloader runs in Flash, and The application runs in Quad SPI NOR Flash (or SRAM).

Problem: When I execute the code "JumpToApplication();", it will be "Hardfault"

Thanks!

more information:

0. I have checked that the data in the SRAM(0x30000000) is the same as the bin content compiled by my application.

1. The fault reporter(debug):
error..png
2.My Bootloader code are:

void RunApplication(void)
{
    extern volatile uint8_t arrAppBuff[100 * 1024];
    MemCpy((uint8_t *)arrAppBuff, (uint8_t *)0x90000000, 100*1024);

    uint32_t nAppAddr = 0x30000000;
    uint32_t  JumpAddress = *(__IO uint32_t*)((nAppAddr) + 4);
    pFunction JumpToApplication = (pFunction)JumpAddress;
    printf("Jump!\n");

    HAL_RCC_DeInit();
    HAL_DeInit();
    SysTick->CTRL = 0; 
    SysTick->LOAD = 0;     
    SysTick->VAL = 0; 
    
    SCB->VTOR = (nAppAddr);
    __set_PRIMASK(1);
    __set_MSP(*(__IO uint32_t*)(nAppAddr));
    __set_CONTROL(0);

    JumpToApplication();  
}

 3. Application code:

int main(void)
{
    __disable_irq();
    SCB->VTOR = 0x30000000;
    __enable_irq();
    SCB_EnableICache();
    SCB_EnableDCache();
    HAL_Init();
    SystemClock_Config();
    PeriphCommonClock_Config();
}

4. Application 's  scatter file:

LR_IROM1 0x30000000 0x00048000  {    ; load region size_region
  ER_IROM1 0x30000000 0x00048000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
   .ANY (+XO)
  }

  RW_IRAM_DTCM 0x20000000 0x00020000  {  ; 128k
   .ANY (+RW +ZI)
   ;* (.ram.tcm)
   * (.DTCMshared, +Last)  
  }
  RW_IRAM_AXI 0x24000000 0x0007C000  {   ;512k - 16k = 496k
   .ANY (+RW +ZI)
   * (.sram123_shared, +Last) 
  }

    RW_IRAM4 0x38000000 0x00010000  {      ;64k
   .ANY (+RW +ZI)
  }
}

 

1 ACCEPTED SOLUTION

Accepted Solutions
Andex
Associate II

LOL, The reason is my customer bootloader is use "V6.16 ARM compiler", and the application uses "V5.06 ARM compiler".

Boot compiler:

Andex_0-1689647228200.png

App compiler:

Andex_1-1689647296292.png

 

View solution in original post

3 REPLIES 3
Pavel A.
Evangelist III

Looks like jump to 0 (corrupted pointers or variables on stack?). Try to debug, single step from your bootloader to few first instructions of the app reset handler.

Andex
Associate II

LOL, The reason is my customer bootloader is use "V6.16 ARM compiler", and the application uses "V5.06 ARM compiler".

Boot compiler:

Andex_0-1689647228200.png

App compiler:

Andex_1-1689647296292.png

 

Piranha
Chief II