Hi everyone,
I'm struggling to end a bootloader project. Specificaly, I struggle to perform a clean jump to application after flashing it.
Bootloader Project
In the bootloader project, I'm flashing the application based on a .s19 file generated by IAR in the Application Project. I want the bootloader to jump to a specific address (0x6000 in my case) to run the application. The flashing is OK, I read data from 0x6000 until the end and I am able to flash it. So I don't think the issue is coming from the bootloader project.
Application Project
By itself, the application project is working. Then I convert it to a .s19 file that I use to send data to the bootloader. I modified the linker file to make sure everything is above address 0x6000. But when I'm look at the .s19 file, there is still data remaining below this address.
I was advised to check my Interrupt Vector table and to create a Virtual Interrupt Vector Table referring to the real one. The thing is, I really don't know how to do this in IAR (Version 7). I have seen other project using an irq_table.s87 file but I haven't this in my project, only a .xcl file for the linker.
Thanks in advance for your help, I hope I gave you enough information
Have a good day !
The RL78 does not support relocating the interrupt vectors, any interrupt will vector to the lower 64KB of the code-flash (due to only 16-bit intr vectors). As such, where the interrupt processing needs to go has to be handled in software by some method.
If your boot-loader doesn't use any interrupts, the solution is pretty easy - vector to a long-jump that resides somewhere in the application.
If the boot-loader uses an interrupt, the ISR will need to check something to decide whether to handle the ISR in the boot-loader's code or the application's code.
Hello JimB and thanks for your answer.
Both the bootloader and the application are using interruptions.
If I understood you correctly, I need to define a handler for every type of interruptions in the bootloader. And each time and interruption occures, I check if I'm running the bootloader or the application and I forward the interruption into the handler of the bootloader or the application. Am I right?
Or do you have an example showing how to control the ISR to handle boot code or app code? (I can easily get a flag from the flash to check whether am I in the boot or the app).
This topic is a little blurry for me, sorry if it basic questions
Thanks !
EDIT : I went through this documentation : https://www.renesas.com/jp/ja/document/apn/rl78-dual-image-bootloader-example . I understand theorically what to do but in the practice I don't know how to implement it. I checked 3.4 Vector Table and 3.5 ISR Processing
Hi, dear Lazy Dridri.
Please check the post blow, it might clarify the topic.
https://community.renesas.com/mcu-mpu/rl78/f/rl78-forum/31553/2-project-codes-to-be-placed-in-the-same-rl78g23/112182#112182If you needed further assistant let us know. and about the linker, please clarify the compiler that you are using in IAR. I hope you find that useful.
Best regards.
If this response or any other user's response answers your concern, kindly verify the answer. Thank you!
Renesas Engineering Community Moderatorhttps://community.renesas.com/https://academy.renesas.com/https://en-support.renesas.com/knowledgeBase/
Hello Hossein and thanks for your answer
I read this thread but it seems like it handle the update of the bootloader itself, not the application. So I still have an issue when dealing with an interruption, it always goes back to the bootloader, even if I'm in the application. Because I can't swap full application with bootloader I believe.
I'm using IAR Embedded Workbench 7.0.5.3137
Ok I may have undestand why the boot swap is useful in my case thanks to this post : https://community.renesas.com/mcu-mpu/rl78/f/rl78-forum/29913/rl78-l13-bootloader-jump-to-app-problem/110915#110915
So, I'll try this :
This way, when I want to update application, I can swap again both boot to use the one of the bootloader.
Might not be that clear but I'll try this and keep you update. Do you think this process can make the job?
The boot swap is to be used to update the existing boot cluster area with a new boot cluster. It is not used to swap the application with the boot cluster. The boot cluster always exists at 0x0000 0000.
Ok I see. Then I really don't know how to make sure interrupts are connected to application when I'm running the application and connected to the bootloader when I'm running the bootloader.
Do I need to hardcode an interrupt handler like this?
if(Interrupt_X) { if(is_running_boot) Boot_Interrupt_X(); else App_Interrupt_X(); } else if(Interrupt_Y) { ... } ...
Do you need to have the same interrupts on both bootloader and application with different functionality ?
It is the same interruption with the same functionality.
For example, I have this interrupt :
#pragma vector = INTTM00_vect static __interrupt void TM00_isr (void) { Schedule = 1; TMIF00 = 0; }
It is the same in the bootloader AND in the application. But when I start application from bootloader, it seems like we the interruption is calling the bootloader
All interrupts are always handled by the vector table which resides at the boot cluster, this cannot be changed. Please see section 4 of this app note:
https://www.renesas.com/us/en/document/apn/rl78-bootloader-one-image-r11an0470eu0100-rev100