I am trying to write a simple, stand-alone TCP bootloader for an AVR micro-controller.
Right now, I have got a collection of APN that weigh almost 14KB memory. The application code will establish a TCP connection with the server,using the network's APN that was stored in the program space and checks with the server for any updated application code. If server responds positively, the code will restart controller itself to enter into the bootloader program. The bootloader will fetch the application code and store it in the program space.
My question is, How can i make the stand-alone TCP bootloader without depending on the application code for establishing TCP connection. As bootloader is only limited to 8KB of flash memory, How can i store the 14KB of APN+4KB of bootloader code into this 8KB boot section?
initiate TCP connection using APN in pgmspace; check server for any updates; if(yes) restart; else normal function;
request server to send the updated application code; receive code and flash the application code; goto application code address;
EDIT: My main concern here is, if suppose, something went wrong while flashing the new application code, then bootloader cannot connect to the server and i fear there is no other go but program it with a programmer