View previous topic :: View next topic |
Author |
Message |
guy
Joined: 21 Oct 2005 Posts: 297
|
Microchip AN851 Bootloader, MPLAB 7.41 and CCS compiler |
Posted: Wed Aug 02, 2006 4:41 pm |
|
|
In MPLAB 7.41 there is a built-in option to program a chip using a bootloader. The bootloader code and documentation appear in application note 851 from Microchip. A utility called PIC16/18 Quick Programmer is also available from Microchip, for performing an easy firmware upgrade (good for the clients...)
My question is, what code do I put in my C source to make it support the bootloader? I am using a PIC18F6520 .
The application note explains the modifications required, but it's quite complex in the CCS compiler (unless you know how ).
Help will be appreciated!
Guy |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Aug 02, 2006 8:08 pm |
|
|
No one else has answered, so I'll try to help. I haven't use the AN851
bootloader, but here is a bootloader that's based on it:
http://www.ece.msstate.edu/~reese/ece3724/labs/bootloader/jolt.htm
He has instructions on how to configure your CCS program for the
bootloader. Scroll down about 2/3rds of the way down the page,
to the section on "How to Relocate User Code". Notice that the CCS
example has to be modified for PICs that have a 1KB boot block,
(such as the 18F6520) . You need to use addresses of 0x800 and
0x808 instead. |
|
|
guy
Joined: 21 Oct 2005 Posts: 297
|
|
Posted: Wed Aug 09, 2006 5:18 pm |
|
|
Thanks. I couldn't get the bootloader to work yet, so I haven't tested the code relocation. I sent a message in Microchip's forum.
I'll be back here once I manage to upload the file. |
|
|
Chill
Joined: 01 Jun 2010 Posts: 10
|
|
Posted: Mon Jun 07, 2010 11:22 am |
|
|
Hi all,
I have the similar application. The chip used is PIC18F65J10.
Following the link http://www.ece.msstate.edu/~reese/ece3724/labs/bootloader/jolt.htm
I get compiled OK, with the main directive as below,
Code: |
#build(reset=0x400)
#build(interrupt=0x408)
#org 0x0000,0x03ff //bootcode area. Actually 1024 bytes is too large for my boot code, BUT the erase block is 1024 bytes for 65j10.
|
In my understanding, the 0x008 is the physical interrupt vector. Every time if there is a interrupt, the program pointer will go to 0x008.
As the area 0x0000 to 0x3fff is reserved for the boot code, the ISR could be located there.
But what will happen if re-map the int vector to 0x408 with directive #build(interrupt=0x408) ??
my understanding: Interrupt occurs-->pointer=0x008---> instruction goto 0x408---> pointer=0x408 --> ISR.
But I didn't find any goto instruction at 0x008. Pls correct me if I'm wrong.
For the reset vector: reset event ---> pointer=0x000(always)---->enter boot mode. Then if it is OK to exit mode, and to enter user mode. "goto 0x400" is needed. Right?
Thanks,
Chill. |
|
|
|