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

pcd bootloader

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



Joined: 18 Nov 2008
Posts: 281
Location: Athens, Greece.

View user's profile Send private message

pcd bootloader
PostPosted: Thu Feb 20, 2020 5:57 am     Reply with quote

Hello all!

I tried the pcd bootloader example and it works just fine.
I can update various simple "Hello world" programs with Tera Term. (Siow shows Timeout error).

Now, I have a big and complex program with timer interrupts, spi interrupts etc which works normally. Will this work if I update through the bootloader? I am asking because I see interrupts in the bootloader code and I do not know what will happen.

Thanks.
_________________
George.
Ttelmah



Joined: 11 Mar 2010
Posts: 19492

View user's profile Send private message

PostPosted: Thu Feb 20, 2020 8:23 am     Reply with quote

In the program you load with the bootloader, this line in pcd_bootloader.h:

#build (reset=APPLICATION_START,interrupt=APPLICATION_ISR_START)

Relocates the interrupt table for this code. Note the 'interrupt=' part.

It's placed at the same location inside the new 'loaded' code, that it would
normally be at the bottom of memory outside the bootloader. PCD allows the
actual interrupt table to be moved, so none of the need to 're-vector' the
interrupts that applies with the PIC16/18.
georpo



Joined: 18 Nov 2008
Posts: 281
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Thu Feb 20, 2020 10:54 am     Reply with quote

Thanks Ttelmah.
So it will work. Right? Very Happy
_________________
George.
georpo



Joined: 18 Nov 2008
Posts: 281
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Fri Feb 21, 2020 1:43 am     Reply with quote

Hello!!!

I am modifying the example to read the firmware from external flash
but I get out of ROM error. How can I increase the bootloader size?

Thanks.
_________________
George.
Ttelmah



Joined: 11 Mar 2010
Posts: 19492

View user's profile Send private message

PostPosted: Fri Feb 21, 2020 1:58 am     Reply with quote

Just define LOADER_PAGES before you load pcd_bootloader.h (both
in the bootloader, and in the main application). The default is 19 pages
for chips that have a 128byte page size, and 2 pages for the ones that
have a 2K page size. Check the data sheet for your chip for the flash
erase size, and either take the number of pages up to 3, or possibly up
to something like 28 if yours is one of the chips with the smaller erase
size.

So for the bootloader, on a chip with the larger pages:
Code:

//processor stuff
//clock stuff
#define _bootloader
#define LOADER_PAGES 3
#include <pcd_bootloader.h>
//rest of code


Setting this automatically adjusts everything else (loader end, the load
address etc. etc..).
georpo



Joined: 18 Nov 2008
Posts: 281
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Fri Feb 21, 2020 2:03 am     Reply with quote

Thanks again!!

So can I set the loader pages to anything that will fit my code?
Or it must be multiple of something etc?
_________________
George.
Ttelmah



Joined: 11 Mar 2010
Posts: 19492

View user's profile Send private message

PostPosted: Fri Feb 21, 2020 3:28 am     Reply with quote

LOADER_PAGES can be 'anything you want'.
The loader has to occupy a multiple of the erase block size. This is handled
for you by the .h file which multiplies LOADER_PAGES by the chip's
erase block size to calculate the size to reserve for the loader.
However (obviously) on chips where the block size is 4KB, using a large
value gives an enormous amount of space reserved for the loader.
You don't want to set it any larger than is needed.
georpo



Joined: 18 Nov 2008
Posts: 281
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Fri Feb 21, 2020 4:05 am     Reply with quote

Ttelmah, thanks a million!!!
_________________
George.
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