|
|
View previous topic :: View next topic |
Author |
Message |
joe2008
Joined: 19 Aug 2008 Posts: 6
|
Procedure of bootload |
Posted: Thu Aug 28, 2008 8:26 pm |
|
|
Hello,
I has something about the procedure of bootload, but don't sure.
1)Firstly, i need to build my bootloader, using ex_bootloader.c, bootloader.c, bootloader.h in CCS folder. Update the real_load_program in bootloader.c to fit for bootload through I2C communication. Now make a bootload.exe, bootload area mostly in 0x0000-0x0400.
2)inport bootload.exe and program my PIC18F4520 with ICD2.
3)Make another project file, build my application hex file as below (above 0x500):
Code: | #define _bootload
#ifdef _bootload
#define LOADER_END 0x7FF
#define LOADER_SIZE 0x6FF
#build(reset=LOADER_END+1, interrupt=LOADER_END+9)
#org 0, LOADER_END {}
#endif
void main(void)
{
...
} |
4) Power up MCU and provide power for SCL&SDA line, run my VB program sending my application hex file through I2C, MCU self-program.
It that procedure OK? Need your advice. Thanks. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Aug 28, 2008 11:41 pm |
|
|
Hello,
it is working exactly as you described (also according to the ex_bootload.c and ex_bootloader.c and bootload.h examples). The restriction is to use no interrupts in the bootloader, cause the global interrupt is directly forwarded to application. This should be O.K. in most cases.
To protect the bootloader, it should no allow to overwrite it's own program space, whatever is requested in the received image file.
As a another comment, I prefer not to simply import the *.hex or *.cof in MPLAB, but to setup a respective workspace and project to support debugging of the application by ICD2. |
|
|
RobertoP
Joined: 30 Mar 2007 Posts: 3
|
|
Posted: Tue Sep 02, 2008 3:52 am |
|
|
Hello,
I'm trying to compile the bootloader and the application in a single step,
including the bootloader code inside of my application, but I want that remains two separate programs.
I tried several changes to bootldr.c, bootldr.h, ldr.c, but always I get errors about #org and #build directives.
Someone has already solved this problem ?
I need a sample or indications to make the compilation/link in a single step.
Thanks, |
|
|
|
|
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
|