After i use bootloader to flash my application, it can jump into application from bootloader. But the interrupt can't work in my application. When i test my application independently without bootloader, the interrupt can work. I have remap the interrupt vector table before jump into my application.
S32_SCB->VTOR = (uint32_t)0x8000;
I'm in the process of writing the boot loader and once I'll finish it ,I'll provide you with the project.
Just to understand your question. You have a boot loader at location 0x0000 and the APP at 0x8000
is that correct?
If YES THEN YOU'D JUMP TO 0X8004 which is the address of the App's reset handler, and you 've already moved the Vector table to location 0x8000 before you jump, and you've enabled the interrupts somewhere in initialization in the main() and yet it is not working.
if all that is true , fundamentally the interrupts should work.
Do you have 2 linker scripts, one for BOOT and one for APP?
Will these generate 2 separate binary image?
Could you merge these 2 image into 1 and flash it just to see if it works that way?
Sorry for too many Questions and no solid answers.
I have application and bootloader as separate project for MK22 series controller, ofcourse two linker files. When i am jumping to application location from bootloader, application is not executed. Tried many methods read here in forum.
Please guide me. If you have completed with your project of bootloader, can you please share the files? that will be a great help!!! Want to know linker files are problem or jump code.
Also one method in which its jumping to application but interrupts are not working. Getting confused a lot. Kindly help.
Also after dumping the new code through the bootloader, jumping to application directly possible? or reset is required?
Sorry for a belated response,
Unfortunately I have not been able to start the Boot Loader project yet as I've been busy with the other aspects of the project.
Let me ask you the following questions:
Where is the start Address of your application?
How do you jump there from the boot loader?
do you load the VTOR register with the offset ( start of app)before you jump to the Application?
To answer your question about if it is possible to jump to App directly from the Boot Loader,
Yes it is possible however this is done via a soft reset first, meaning that once you're done writing the app image, you generate a soft reset and then you end up in the Boot and there checking if a valid APP exists if so then you Jump there. they do it this way to make certain that the processor start from a reset state where every thing supposed to be at a safe state.
Hope this help.
I have solved that problem. I just add the definition of SysTick_Handler to my project, then the interrupt LPIT0_Ch0_IRQ can work. But i don't know why.
Now i encounter another question. I use Porcessor Expert to generate code for bootloader and application. But it can't initialize the module(like clock, pin, flexcan, etc) that have initialized in the bootloader, if it does, it will enter into HardFault handler.
When I add the lpuart module to the MATLAB model, it runs correctly, including LPIT0_Ch0_IRQ interrupt。
but once I remove lpuart module, the application in 0x00020000 offset is error, it dead in DefaultISR.
I think the was startup_S32K146.s bug, S32K144.s is OK.
When you say:
"When i test my application independently without bootloader" and the statement S32_SCB->VTOR = (uint32_t)0x8000;
is in your boot loader, do you flash your application starting at 0x8000?
If so there is nothing in there, there is no interrupt vector. You move the vector in the boot and if there is no boot the vector table will not move.
If this is the case I suggest placing S32_SCB->VTOR = (uint32_t)0x8000; in your start up code for the application.
If however you flash the boot at 0x00 and at the same time the app is flashed at 0x8000, then when you jump to app from boot the vector table should be placed at 0x8000.
I hope this help.
Thanks for your reply!
When i say:
"When i test my application independently without bootloader", i means i flash my application starting at 0x0, and the interrupt vector table starting at 0x0. And it does work.
Can you provide me simple projects for both bootloader and application?