Running code from RAM with a program compiled for FLASH

I would like to have the ability to update the code in FLASH when the product is in the field. I’m thinking about using external flash to be able to store the new image to first, so that it can be crc’ed etc to check for validity, and then from there, update the internal flash. I would need a small stub piece of code that can be stored into RAM, which would basically move the image from external FLASH to internal FLASH. I guess I’m not sure how to go about this, or at least these are ideas I’ve come up with. All with require copying to RAM and then jumping to the code.

#1 - hand write it all in assembler, and just fill up a ‘C’ array with the bytes.

#2 - Write it in C, compile to a small program with a RAM linker script. Then try and merge this into the FLASH image with the FLASH linker script.

#3 - Write it in C, compile to a small program with a RAM linker script. Use a pre-processor tool to copy this image into a C array. Compile as usual for a FLASH image.

Anyone done something similar, or know of any code for something similar.

thanks,

Andy

The NXP ARM chips have an RS-232 bootloader.

Leon

Hi

You don’t say which processor this is for - if it an LC23XX ,Sam7X , STR91XF or Luminary LM3S with Ethernet the uTasker project supports this (using external SPI FLASH or free internal FLASH) over Ethernet / Internet.

Regards

Mark

http://www.uTasker.com

It’s for a lpc2378, and maybe a 2103. I know about utasker, and I use the rs232 bootloader everyday. A couple of the protocols I’m supporting ( industry specific ) support downloading new firmware, and I would like to support this. Downloading through the protocol to an external FLASH is easy. Then on reboot, it’s simple to check version in external flash against internal version. It’s just the small stub that is currently taking some working out.

Andy