I am working with KW24D512 on IAR and I am trying to add ota functionality to my application.
Based on "Connectivity Framework RM rev2" , MKW2xD_Connectivity_Software_1.0.2 and the OtaSupport functions, my own application can load, from a .srec file, a new application image into a AT45DB161E external Eeprom according to the format :
[Image_Size (@0x00 - 4bytes)] / [Bitmap (@0x04 - 32 byte)] / [Application_Image (@0x24 - x byte)].
(gEepromType_d == gEepromDevice_AT45DB161E_c)
First, in order to test the OTA bootloader I write the bootloader binary to the board.
The Bootloader checks the flags at the internal flash address @0x4400, gets back the image, the size and bitmap and finally copies the image from the external eeprom to the internal flash at the address @0x4000.
At the end Flags are updated to complete and bootloader tries to jump to the application (@0x4000) but something wrong must happen because bootloader is restarted again and again.
In order to see the program sequence, I added a TRACE function via a second UART to the bootloader and my own application both.
My application never starts
I suppose the problem is due to the icf file of my own application.
So my questions are
- How to modify a .icf file to write an application binary just after the bootloader sectors
- Using IAR, How to merge an user application and bootloader in a single file which can be downloaded into the microcontroller at once and reduce manufacturing time.