X:\Program Files\Mikroelektronika\mikroC PRO for PIC\Examples\Other\Bootloader\P18\032K
and the boot loader works just perfect, after I programed the code with the programmer I was able to bootload my program successfully.
But I need to add several lines to the boot loader code and ufortunately I was not able to compile the code I get this error message: “109 361 Bad function absolute address 'Susart_Write_Loop[32156]' boot18_32K.c”
In the code below you can see my several lines added, they control a switch which routes PIC's USART to MAX232 chip in my device so I could reprogram it at any time I need. I have no idea how to calculate new addresses for the functions, I there a way to fix this problem ?
Thank you.
I use PIC18F452 (not 4520), EasyPIC3, Mikro C Pro 3.8
Code: Select all
//-------------- Boootloader main for 32K PIC18's
void main() org 32112 {
// My code begin
TRISB = 0;
TRISD = 0;
PORTB.F3 = 1; //
PORTD.F0 = 0; // 2OE - A5
PORTD.F1 = 0; // 1OE - E2
PORTD.F2 = 1; // S1 - E1
PORTD.F3 = 0; // S0 - E0
// my code end
// 16Mhz --> 103 look for asynchronous high speed table
// 8Mhz --> 51
// 4Mhz --> 25
// |
// |
// |
// \ /
// |
Susart_Init(51); // Init USART at 9600
if (Susart_Write_Loop('g','r')) { // Send 'g' for ~5 sec, if 'r'
Start_Bootload(); // received start bootload
}
else {
Start_Program(); // else start program
}
}