EmbeddedRelated.com
Forums

Writing your own Bootloader - tips needed

Started by Sutton Mehaffey July 31, 2009
--- In l..., Sutton Mehaffey wrote:
>
> The secondary bootloader is a good idea. Thanks for that.
>
> One caveat. My SD card is multipurpose, so the user might have the SD
> card inserted on power on. The way I envision the user loading new
> firmware is to email the binary file to him, have him put the file in
> the proper UPDATES directory on the card and go to the proper menu
> item. The SD card is also used to save configurations, save reports,
> and upload audio files. So, I don't want to automatically look at the
> SD card on power up for a new image. I'll need some type of flag that
> indicates 'bad image' and 'good image'. When the uploading starts, set
> flag to 'bad image'. That way, if the upload doesn't succeed, the 'bad
> image' flag will automatically look for a new image. I think someone
> mentioned that. This may work.
>

One way - name the file after the version number, eg 'V7-03.IMG'. On startup, check any SD card for '*.IMG' and only load in such a file if the version number in the filename is later than the version of software already loaded.

Rgds,
Martin

An Engineer's Guide to the LPC2100 Series

--- In l..., "mjames_doveridge" wrote:
> One way - name the file after the version number, eg 'V7-03.IMG'. On startup, check any SD card for '*.IMG' and only load in such a file if the version number in the filename is later than the version of software already loaded.

A problem that can be a killer is the user pulling out the SD card while it being used to read the new image.

I have used an extra serial flash chip to transfer the new image into the system, where the user can not fool with it.

You will want to verify the checksum of the SD card image before using it anyway.

So copying the new image to the serial flash can have its checksum verified before writing it to the internal flash.

If the power is lost or the user pulls out the SD card, the new image is always available.

Also, at powerup, you can check the flash image in the cpu and if the cpu flash gets corrupted, it can be reloaded without the SD card being available.

don
--- In l..., "donhamilton2002" wrote:
>
> --- In l..., "mjames_doveridge" wrote:
> >
> >
> > One way - name the file after the version number, eg 'V7-03.IMG'. On startup, check any SD card for '*.IMG' and only load in such a file if the version number in the filename is later than the version of software already loaded.
>
> A problem that can be a killer is the user pulling out the SD card while it being used to read the new image.
>

Yes :(

I have used an extra serial flash chip to transfer the new image into the system, where the user can not fool with it.

That should be OK. I don't need any serial flash with my system because I have enough room in flash for two banks of main app. If both banks contain valid images, my loader overwrites the older of the two stored versions.

Rgds,
Martin