CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Microchip AN851 Bootloader, MPLAB 7.41 and CCS compiler

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
guy



Joined: 21 Oct 2005
Posts: 297

View user's profile Send private message Visit poster's website

Microchip AN851 Bootloader, MPLAB 7.41 and CCS compiler
PostPosted: Wed Aug 02, 2006 4:41 pm     Reply with quote

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 Wink ).

Help will be appreciated!

Guy
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 02, 2006 8:08 pm     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Wed Aug 09, 2006 5:18 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jun 07, 2010 11:22 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group