I've been trying to do software upgrade without a bootloader. I enabled the dual bank mode in BSP and successfully programmed the upper bank with the same application code. I then exported both banks' memory and made sure that the content of the lower bank and upper bank is identical. Then I did bank swap and upon successful bank swap, rebooted the board by calling:
But after reboot, the code is always stuck somewhere in SystemInit(). Here is the screen capture for the issue I have.
Do you use a RTOS in your project ?
Please make sure that no interrupts occur during the bank swap operation.
If an interrupt occurs during the code flash operation, then code flash will be accessed…
Which RA device are you using ?
Can you share the code that you use for bank swap ?
You can also use FSP APIs for this operation:
The board is the EK-RA6M5 board.
I use this code to do bank swap. I believe it's the same code as your code.
Can you make read out the memory starting at 0x0000_0000 and 0x0020_0000 and make sure they are identical ?
Yes, I did. They are identical.
If an interrupt occurs during the code flash operation, then code flash will be accessed to fetch the interrupt's starting address and an error will occur. The simplest work-around is to disable interrupts during code flash operations.
Hello as mentioned in the previous answer:
In case you have a FreeRTOS project for example it is stated in the documentation of flash_hp module that:
Also as mentioned in the thread here: https://community.renesas.com/mcu-mpu/ra/f/forum/28093/bankswap-function-not-work-in-freertos
The bank swap went through but when FreeRTOS is brought up in the other bank, the pending SysTick causes problem. So SysTick should be disabled as shown in the Forum thread.
/* Disable SysTick and clear its exception pending bit */SysTick->CTRL = 0 ;SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk ;
Please let us share with you two different projects which are for ra6m4,but you could easily modify them for RA6M5.
Test both of them in order to see the difference if SysTick is disabled or not.
Hope it helps.
Thanks for the info. I use azure-rtos in my project. I will take a look at the example projects and let you know what I find.