Uploading a new program through SoftwareSerial.

I'm working on a project that involves a GPRS module and arduino pro mini (mega328 3,3v).
I've managed to succesfully establish a connection with a remote http server and I'm sending GPS coordinates to it every few minutes.

The question is:

lest say that the http server holds a new program update for the device I've built.

is there a way to send this program to be uploaded onto my device through the GPRS connection?

For example, is it possible to wright the whole program at the empty memory area and change the bootloader so that after the reset it will be loaded?

if so, whats the basic flow-chart for such process / some reading links?

tnx in advance. sorry for my spelling. :slight_smile:

I am not sure but you should definitely connect gprs to hardware serial if you have any hope to load a new sketch to arduino. Westfw is the expert of bootloaders so him and a few others should be able to tell you whether it is possible. A while back Itead showed they can upload via a bluetooth shield but that's different from gprs. Still possible though.

is there a way to send this program to be uploaded onto my device through the GPRS connection?

Yes, there is a way although a rather complex one. You have to get all necessary code into your bootloader. The standard Arduino bootloader code is only able to get the new program using a serial protocol. There are bootloaders which get the updates by TFTP, other types are possible but probably increase the size of the bootloader, so the available storage size for your sketches decreases.

For example, is it possible to wright the whole program at the empty memory area and change the bootloader so that after the reset it will be loaded?

No, because usually you don't have enough memory. The only memory available from a sketch is RAM and EEPROM. An UNO has 2kB RAM and 1kB EEPROM, so the sketch size would be rather limited. A relativly simple solution is using an external EEPROM (by SPI or I2C), getting the update from the server, storing it in the external EEPROM and resetting the Arduino. Then the special bootloader can read the new sketch from the EEPROM and write it to the program memory (flash), deleting the EEPROM after that. But in any case you need to burn a new bootloader.