Jump to GD32F303 System Memory

51 Views Asked by At

There were many example codes for downloading firmware by jumping into System Momory with ST32 products. I've tried and am satisfied and in use.

However, there are few example codes for GD32 products. And it doesn't work well.

Please tell me where to modify.

When I ran the code below, I expected to jump into System Memory, but it didn't work.

I don't think it's a hardware problem because it works well when Boot1 is called High.

#define boot_addr  0x1FFFF000   
void ResetToSysBoot(void)
{
    void (*SysMemBootJump)(void);
    
    bspDeInit();
    
//    SCB->VTOR = boot_addr;
    
    SysMemBootJump = (void (*)(void)) (*((uint32_t *)(boot_addr +4)));
    __set_MSP(*(uint32_t *)boot_addr);
    
    SysMemBootJump();    
}

void bspDeInit(void)
{
//UartPC_Init(); 
//  HAL_RCC_DeInit();
//  HAL_DeInit();
  
  rcu_deinit();

  SysTick->CTRL = 0;
  SysTick->LOAD = 0;
  SysTick->VAL = 0;
  
// Disable Interrupts
//
//  for (int i=0; i<8; i++)
//  {
//    NVIC->ICER[i] = 0xFFFFFFFF;
//    __DSB();
//    __ISB();
//  }
  __disable_irq();

}
0

There are 0 best solutions below