2022-11-25 06:35 AM
I'm using Keil (Scatter file, not lnker) and I have a bootloader and a place for two images (one active and other is for the over the air update).
i use Cortex M0 processor where there is no Vector Table Offset Register and i used to copy the vector table from flash to sram.
The problem here:
1. I do the ota update using the application and not using the bootloader.
2. I build the firmware for a specific location and when the ota update is happening the active application (which is in slot A) is downloading the new image in Slot B (but the image is built using the linker script for slot A).
3. When I jump from bootloader to app using the function pointer (I see the function ptr is holding the right address.)
4. But when jumping it is creating a hard fault.
5. So the image built for a specific place should only be used there? Can't I use it for other slots (I also look for page alignment)? if not what can be the possible reason for hard fault?
Solved! Go to Solution.
2022-11-25 06:56 AM
Clearer, but set flag in a memory is ? You only jump into slot B = cant work
You have two solution In point 6 copy B to A and jump
or build app for slot B
Try debug bootloader after OTA...
2022-11-25 06:42 AM
in Slot B (but the image is built using the linker script for slot A). Idea???
2022-11-25 06:49 AM
Since I have only one linker script. I build the image with the same.
For example:
I think this should be pretty clear (what I'm trying to do now).
2022-11-25 06:52 AM
Slot A: 0x08001800 (size 59 pages with each page of 2 kb)
slot B; 0x0801f000 (size 59 pages with the same page size)
using stm32f0xx
2022-11-25 06:56 AM
Clearer, but set flag in a memory is ? You only jump into slot B = cant work
You have two solution In point 6 copy B to A and jump
or build app for slot B
Try debug bootloader after OTA...
2022-11-25 07:07 AM
Okay, But I did one more thing.
Since new firmware vector table is pointing towards slot A's location, I copied the vector table to RAM and then added the offset value (slot B start - slot A start) and the jumped to the actual reset handler location directly. Even then it doesn't work.
I did debug after OTA (but anyways I think i should do some deeper investigation).
But are you sure that image build for a particular location using keil linker script can't be used for another location ?(they use the word scatter loading if you use scatter file).
2022-11-25 07:12 AM
The flag in memory..
This is a concept which I introduced for my project.
When there is a new firmware I set a variable as True when the OTA completes.
This flag is not specific to a particular controller (it is just a specific logic which I introduced). Since I'm not willing to update application using bootloader. I update the app using old active app and then set the flag in the specific section and the trigger a system reset.
Then bootloader has some if else which will see where to jump now.
if bl sees a new firmware in the slot B it jumps to slot B.
2022-11-25 07:13 AM
In the two point solution which you mentioned (the first one is a nice idea, now I hve to check how much ram is available) and second one is the solution which I have now, but not a practically good solution.
2022-11-25 10:32 AM
Yes cant be on another location
2022-11-25 12:41 PM
Can you elaborate a little on why it is not possible? Bcoz I can do some additional research for my Master Thesis.