Min Ge wrote:
> I wanna build a boot loader code for my project. The boot code will load
> application code from external device (EEPROM or SD Card) and self
> So my code should have tow part, one is boot loader code, another one is
> application code.
> I want to put bootloader code in either beginning or the end of Flash,
> but I do not know how to compile the code into specific range in flash.
> Also, when I update applicatin code, I do not want to change my
> bootloader code.
> I used to use AVR micro, it has a fuse bit that can set reset vector to
> bootloader part.
Some ARM-controllers support something like the "reset-vector"-setting
of the AVRs. The start-address can be defined by connection pins to VCC
or GND. But devices without external memory-interface usualy start from
the first address in the internal flash-memory which is mapped to
0x0000000 (ARM Reset-Vector). So at least at this address should be a
"jump to bootloader". But it might be a better approach to place the
bootloader at the start of the internal flash. On system-startup the
bootloader is executed and can check a condition (Version-String on
SD-card or something like this) and a new version of the
user-application code can be read from the memory-card and programmed
into the internal flash. If the start-condition is not fullfilled the
loader can check for a valid application and start it (Jump to the
address of the application's startup-code). The application can be
linked so the start-adress is "behind" the bootloader (address depends
on the flash-memory-layout/banking and bootloader size), On startup the
application has to "remap" so the interrupt-vectors of the application
are used (not the ones from the bootloader). FLASH-programming itself is
very device-specific and should be documented in the manual of your
controller. IRC there is a bootloader for AT91SAM7S with USB available
(not SAM-BA, search the AT91.com forum) which should give an idea.