If I use the C51 compiler directive... #pragma iv(0x1000) ...in all the C source files of a multi source file project it is clear that this moves the compiler/linkers idea of where the interrupt vector table is located up to 0x1000 and beyond. My question is...does this directive also cause all of the code, including the C-startup code, to be offsetted up to and past 0x1000 ?? Note: I ask this question because I am not yet at the implementation stage of a project where it will be necessary to port an existing external EPROM based program to a new implementation that is in FLASH. I want to try to preserve the first part of FLASH for an in-application firmware loader that can permit the application to be re-programmed without having to risk erasing the first page of FLASH. My goal would be to try to make the loader smart enough to validate the program image starting at 0x1000 with a CRC of some sort so that I know legitimate application code has been loaded. Of course the loader code under 0x1000 would have to provide for transfer of the normal physical interrupt vectors at 0x0000 range to those at 0x1000. And if the loader used any interrupts it would have to provide the soft-switch passthrough for those vectors to the tatget application. Michael Karas
does this directive also cause all of the code, including the C-startup code, to be offsetted... Nope. There are 3 things you must do to do that.
Thanks Jon, Your reply was very helpful. Michael Karas