PIC18F67J10 RS232 Bootloader

Support for Bloader and Screamer

Moderator: phalanx

PIC18F67J10 RS232 Bootloader

Postby kapricanon » Mon Nov 29, 2010 4:28 am

Hi All

I have implemented a bootloader for PIC18F67J10 device in 'C' along with PC interface.

My bootloader sits at the bottom of the program memory. The bootloader will start updating the flash from address 0 of the program memory and work its way down till it reaches address 0x1E000 where the bootloader starts. I have placed my bootloader at the end so that in future I can add new vectors which can be updated using the bootloader.

I have proved the bootloader works fine by changing the version number constant defined in my main.h file and upload the code I can see the new version number when I run the software.

However, when I change a single line of my program (for example add a new line of code or delete a line of code) compile it and try to load the new HEX file it bricks my hardware. However if I program the same HEX file using ICD3 the code runs fine.

I think when programming the new HEX file using the bootloader, it does not update the function call jump addresses and hence any call to a function still jumps to the old address which results in the unit to lock up.

But I am not sure if this is the case and if it is then what am I doing wrong in my bootloader?

Any ideas....

Thanks
kapricanon
 
Posts: 3
Joined: Mon Nov 29, 2010 4:09 am

Re: PIC18F67J10 RS232 Bootloader

Postby itikhonov » Mon Nov 29, 2010 2:59 pm

May be just do the reset after programming?
User avatar
itikhonov
 
Posts: 332
Joined: Mon Nov 08, 2010 12:05 pm
Location: Yekaterinburg, Russia

Re: PIC18F67J10 RS232 Bootloader

Postby kapricanon » Tue Nov 30, 2010 3:01 am

no a reset does not help either...
kapricanon
 
Posts: 3
Joined: Mon Nov 29, 2010 4:09 am

Re: PIC18F67J10 RS232 Bootloader

Postby itikhonov » Tue Nov 30, 2010 4:39 am

kapricanon wrote:no a reset does not help either...


It's not really clear from your post but do you call flashed code from bootloader?

If yes, you can go with real vector table. Place at known address (for example 0x100) code with jumps to real routines like:

0x100: goto func1
0x104: goto func2
0x108: goto func3


Then you can safely call address 0x104 from bootloader and end up in func2.

In MPLAB it can be done with #pragma code and some inline asm probably.
User avatar
itikhonov
 
Posts: 332
Joined: Mon Nov 08, 2010 12:05 pm
Location: Yekaterinburg, Russia

Re: PIC18F67J10 RS232 Bootloader

Postby kapricanon » Tue Nov 30, 2010 6:20 am

Found the problem in my bootloader...

I was calling a function located in the user code from my bootloader.

Secondly I had to make the bootloader section PROTECTED in the linker file as the compiler used to puts a few function from user code in the bootloader section for some reason.

This seems to have fixed the problem.

Thanks for the help
kapricanon
 
Posts: 3
Joined: Mon Nov 29, 2010 4:09 am


Return to Boot Loading

Who is online

Users browsing this forum: No registered users and 1 guest