I have problem, I have to find a way to update code to my arm device without removing it, for that purpose I'll use serial communication. Does anyone have idea how to do it?
Thank You jensbauer. Is more clear to me now theoretically, that two application image is exactly what I wanted to do, but I'm new at controller programming and this is too abstractedly to me, does anybody has example code related with this topic?
I think that ARM should provide example code with updating, because is common and not unusual thing, and about that topic is so little information online. That is my suggestion.
Unfortunately I don't see how ARM could provide such code.
Bootloader is about:
Yes, and in addition, the vendor may choose different addresses for the Flash memory.
Some may use external memory, so it would be difficult for ARM to provide source-code that would work on all platforms.
The CRC and Adler routines would be generic, though, and the routine that performs the checks could take an address that points to SRAM and an address that points to Flash memory.
A number of routines would need to be supplied externálly, such as the routine that receives data and the routine that writes to Flash memory.
In short: Anything that contains hardware access would be vendor-specific and require a routine for each MCU type.
(I'll be off to vacation in one hour, so it might take a while before I am able to respond).
Having two application images uses the same theory that you would have with just one. Instead of having linker space carved out for bootloader and application, you now have space for boot-loader, application1 and application2. The boot-loader then needs to be more intelligent to know when application it should be updating and loading into on boot. Once again if you have managed to succeed with a single application then having the second just adds a few additional checks. Mainly
1) Which application to jump to?
2) Is this application checksum correct?
3) Which application space to erase and overwrite?
4) Should a failed update automatically revert to the other application area if checksum is valid?
One thing you need to make sure of is that you secure the flash space that the boot-loader is in. If power is removed during update the boot-loader should load and wait for instructions. I've seen poorly written boot-loaders that allow the boot-loader to be updated which in the event of power failure or other issues will brick the unit. The boot-loader needs to be extremely robust and secure or protected with an MPU (if one exists on chip).
I would recommend that instead of jumping straight to a two image system you first write a simple boot-loader, with minimal features and a single application. Get that working well and then add features to it like securing the device, adding the second application space, etc.