Forum: ARM programming with GCC/GNU tools guidance with firmware update

Author: Jeroen Penya (jpenya)
Posted on:

Rate this post
0 useful
not useful

Let me start by presenting my problem, and then hopefully someone can 
give some guidance on how to approach it :)

I am working with a Keil MCB2300 board with SD interface (which I 
configured by using the code from Martin Thomas and ChaN's FAT-Module). 
I also have a GSM modem connected to the UART port, from which I receive 
an update on the firmware.

This update (hex file) is stored into the SD card, and at this point I 
am supposed to do an upgrade of the firmware (my application is 
bare-metal, at this point I am not using any embedded OS).

Could you give me some hints on which steps would you follow in order to 
perform the upgrading? Any input that you can provide would be more than 

Many thanks in advance!

Kind regards,

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 useful
not useful
I have played a little bit with update from SD-card with other 
controllers and this ist the basic concept I have used:

- Try to add some extra checksum/crc/similar and version information in 
a second file or use a extra record in the hex-file. In my experiments I 
have used a "metadatafile" with CRC16-Checksum, Version, Numb. of bytes 
and filename of a binary file on the card which contains the 
application's code. I have used raw-binary to avoid parsing of hex-files 
in the firmware.

Some kind of Bootloader with functions to read and browse the SD-card 
should be installed at the start-address of the internal flash. The real 
application is located "behind" this.

- retrieve the version of the current version, could be a number located 
at a "fixed" address
- browse the files on sd-card to find the latest firmware code-version
- if latest firmware on card ist same or older than the on ein flash, 
continue normal operation
- no newer version available verify that the checksum/crc of the file on 
the card is correct
- if correct start the update procedure, if not jump to main application
- update procedure: parse the content of the hex-file and convert it in 
binary-data, upload the binary data to the internal flash using the IAP 
functions documented in the LPC23xx manual. Keep the memory layout in 
mind (sectors, pages). Write the version to the "fixed" address.

The main application should copy it's exceptions vectors in RAM and 
Remap since the start of the flash is already occupied by the exceptions 
vectors of the Bootloader. The main application should be linked to an 
adress behind the bootloader. The bootloader can be started from the 
main application by watchdog-reset or maybe by a simple "branch to 0x0"

Hope this give at least a rough idea.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.