Re: Bootloader Placement
- From: Tim Wescott <tim@xxxxxxxxxxxxxxxx>
- Date: Wed, 19 Apr 2006 07:37:36 -0700
Tom Lucas wrote:
I have written a bootloader to reside in my first sector (128Kbyte) of flash which, firstly copies all code and data from flash to RAM and then checks data on an MMC card to see whether an update of the flash is necessary and, if so, copies new program data into the flash. At the moment I have two projects - the bootloader as a stand-alone loader and the full application, which has the bootloader code as part of it.The way I've seen to do this works best in a flash that can be protected sector-by-sector. Put the bootloader into the sector where your processor boots, and protect that sector. If necessary use multiple sectors, but it's a good idea to make bootloaders as small as possible. Set up the boot loader to _always_ branch to the beginning of the lowest unprotected sector once it detects application code, and _always_ load app code there.
What I'd like to do is seperate the bootloader code from the application code and have the boot loader pass control to the application once it has done its checks and, if necessary, reprogramming. However, I don't think I could have the application as stand-alone code as well because it would then be re-initialising the hardware and memory of what was initialised previously in the bootloader.
My thoughts were to define the first flash sector as a seperate linker section and locate all the bootloader functions and data in there but as part of the application software. Then, when a reprogram takes place I just don't write to the first sector. The problem with that is that the old bootloader then does not know where to jump to in the application and also the copy from flash to RAM on startup won't know how much there is to copy. I only want to write to the bootloader area when the loader itself is to be updated because, if it fails, JTAG is the only recovery and that won't be available in the field.
There must be a better way of doing this but I'm not sure which direction to proceed.
To run stand-alone app code just replace the bootloader with a jump, or your minimal hardware setup and a jump.
--
Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Posting from Google? See http://cfaj.freeshell.org/google/
.
- Follow-Ups:
- Re: Bootloader Placement
- From: Tom Lucas
- Re: Bootloader Placement
- References:
- Bootloader Placement
- From: Tom Lucas
- Bootloader Placement
- Prev by Date: Re: Real time scheduler C
- Next by Date: Re: Real time scheduler C
- Previous by thread: Re: Bootloader Placement
- Next by thread: Re: Bootloader Placement
- Index(es):
Relevant Pages
|