I am trying to write a firmware loader for an LPC2132. So far I have code that retrieves a HEX file via USB and saves it to the on chip flash. I want this code to remain in flash so that I can update the firmware any time.
The problem I am having though is figuring out how do I compile and link the main code (the code that can be changed via the loader) so that I can just jump to it and start its execution from the loader.
What I have tried so far is compiling the loader and the main code separately. The main code I confine it to 0x4000 and up, while I confine the loader to 0x0000 .. 0x3FFF. The I go into the HEX files and merge the loader file with the main code (using only 0x4000 and up). This doesnt work at all.
Any help will be greatly appreciated.