I am using Renesas CPU that s5d9,I want to create bootloader to use. Now I'm encountering a problem
this is my architecture
#define APP_START_ADDR 0x00020000
static void execute_user_code(uint32_t address)
{
main_fnptr *p_jump_to_app; // Function pointer main that will be used to jump to application
__disable_irq();
/* Disable the stack monitor */
R_SPMON->MSPMPUPT = 0xA500; /* Enable access to Main Stack Pointer Monitor Access Control Register */
R_SPMON->PSPMPUPT = 0xA500; /* Enable access to Process Stack Pointer Monitor Access Control Register */
R_SPMON->MSPMPUCTL_b.ENABLE = 0; /* disable the Main stack monitor */
R_SPMON->PSPMPUCTL_b.ENABLE = 0; /* disable the Process stack monitor */
SysTick->CTRL = 0; /* Disable the systick timer */
NVIC_DisableIRQ ( SysTick_IRQn ); /* Disable the systick timer IRQ */
NVIC_ClearPendingIRQ( SysTick_IRQn ); /* Clear any pending systick timer IRQ */
R_USBFS->SYSCFG = 0; /* Disable USB FS */
R_USBFS->DVSTCTR0 = 0;
R_USBFS->INTENB0 = 0;
R_USBFS->INTENB1 = 0;
R_USBFS->INTSTS0 = 0;
R_USBFS->INTSTS1 = 0;
R_USBFS->BRDYENB = 0;
R_USBFS->NRDYENB = 0;
R_USBFS->BEMPENB = 0;
R_USBFS->USBADDR = 0;
R_USBFS->DPUSR0R = 0;
R_USBFS->DPUSR1R = 0;
R_ELC_Disable();
/*
* Clear all interrupts!
*
*/
for (uint32_t i = 0; i<96; i++)
R_ICU->IELSRn[i] = 0;
}
for (uint32_t i = 0; i<8; i++)
NVIC->ICER[i] = 0xFFFFFFFF;
NVIC->ICPR[i] = 0xFFFFFFFF;
for (uint32_t i = 0; i<16; i++)
R_ICU->IRQCRn[i] = 0;
/* Ensure that when we jump we're using the Main Stack Pointer */
// __set_CONTROL(0);
p_jump_to_app = (main_fnptr*)(address+4);
SCB->VTOR = (address & 0x1FFFFF80);
__DSB();
__set_CONTROL(0);
/** Set stack here. */
__set_MSP(*((uint32_t*)(address)));
/** Jump to image*/
(*p_jump_to_app)();
execute_user_code(APP_START_ADDR);
it will stop in __set_MSP(*((uint32_t*)(address)));
This is the error shown by the debuggerI couldn't solve this problem.
please help, thanks a lot.