 RE: Creating a boot loader and application in ROM at different locations Juan Velasquez Your approach is the one I am currently working on. There are some explanations as to how to implement this. Some links: http://www.keil.com/support/docs/143.htm Refer to http://www.keil.com/support/docs/132.htm http://www.keil.com/support/docs/2707.htm Basically you need to relocate your code not your boot loader) somewhere else and vector your interrupts which are hard coded to the beggining of the flash. But do it for all of them except the reset 0000H (you use this to jump to your boot loader to determine if the firmware is valid). Once you determine if your firmware is valid you jump to it using function pointers. Ininclude some code: #pragma iv(0x400) // Force the compiler to relocate the code #pragma src // Creates the src file #pragma asm // ASM code to redirect the interrupts. OFFSET EQU 400H CSEG AT 0003H ; External Interrupt 0 LJMP OFFSET + 0003H CSEG AT 000BH ; Timer 0 overflow LJMP OFFSET + 000BH CSEG AT 0013H ; External Interrupt 1 LJMP OFFSET + 0013H CSEG AT 001BH ; Timer 1 overflow LJMP OFFSET + 001BH CSEG AT 0023H ; UART LJMP OFFSET + 0023H CSEG AT 002BH ; Timer 2 overflow LJMP OFFSET + 002BH CSEG AT 0033H ; SPIO LJMP OFFSET + 0033H CSEG AT 003BH ; SMB0 LJMP OFFSET + 003BH CSEG AT 0053H ; ADC0 LJMP OFFSET + 0053H CSEG AT 005BH ; Programmable counter array LJMP OFFSET + 005BH CSEG AT 0063H ; Comparator0 LJMP OFFSET + 0063H CSEG AT 0073H ; Timer 3 overflow LJMP OFFSET + 0073H #pragma endasm Let me know about your progress. JV |