[LPC2148] Self programming bootloader

Hello :stuck_out_tongue:

I would like to make a bootloader to update the new user code into my LPC2148. This user firmware would be on SD card (Hex file).

My approach would be to write a program at the beginning of the flash memory which handle basic FAT functions. At each power-on, the bootloader is performed and check if a new firmware is needed to be loaded (with a system of ‘ID’ like firmware released information or something like that). If there is no new firmware, the system start the curent user code at a specific sector address (depending on bootloader size and few other stuff probably). The firmware is compiled to start at a defined sector address thus both programs are located in separate flash spaces.

My question is about vectors interrupt table. The vectoried IRQ and no-vectoried IRQ use the VIC so I think it’s not necessary to remappe the vectors in RAM. The bootloader and the firmware could init their VIC at the beginning of their execution to handle their ISR. However, the FIQ doesn’t use the VIC and point directly to the ISR. In this case, I understand we have to remap it in RAM otherwise the application code performs the FIQ ISR of the boot code…

If I don’t use FIQ, without remap the vectors, do you think my approach would work ? Do I misunderstand something ?

Thank you in advance,

Regards,

David

The FIQ can use the VIC so usually you don’t have to remap the vectors in RAM.

Interesting your idea of the bootloader, I could use it, I just implemented the MMC/SD driver for LPC2148.

Thanks gdisirio :wink:

The other idea is to map the vectors in flash for the bootloader code and map them in RAM into the firmware code (MEMMAP). Thus, each application have it’s own space location regarding vectors adresses :

  • ISP/IAP => remapped automatically (bootblock) : MEMMAP = 0x00

  • Bootloader => in Flash (0x00000000 - 0x00000040) : MEMMAP = 0x01

  • User firmware => in Ram (0x40000000 - 0x40000040) : MEMMAP = 0x02

Any other inputs, advices, tips about this project ? :stuck_out_tongue:

David

Hi David,

I made some bootloaders already and I used the same method. (I only copy a newly received program from an external Atmel flash or directly from the data stream of a GSM module.)

If you want to use the FIQ in the application you can let the vector point to the vector table of the bootloader in flash memory. You only have to add an ISR for the FIQ in the bootloader. The only thing it should do is to

vector to the FIQ entry point of the application. (If an application was launched earlier.)

Kind regards,

Ernst Losken