Ramey
Joined: 11 Sep 2007 Posts: 18
|
yet another bootloader question for pic 18 |
Posted: Fri Dec 05, 2008 2:39 am |
|
|
I'm tweaking my bootloader for a new project and I'm have some questions about the two interrupts.
In my boot loader I'm using #int_usb while in my application I'm polling a usb port - without out using interrupts. In the application I have the high priority interruput assigned to a more time critical task.
I use code in the boot loader below to redirect interrupts to the application unless a special button - the program load button - is pressed when things are powered up.
I'm unsure about the 0xA0. The interrupt tables are made by the CCS compiler. Is the "build" below sufficient or do I need two tables. If so, what syntax do I use to specify them?
Anyone who wants to chime in here - feel free.
Robert Ramey
Code: |
#build(reset=0, interrupt=0xA0)
/*
#org 0x0008,0x0037
void isr_global(){
if(!in_app)
jump_to_isr(0x00A0);
jump_to_isr(LOADER_END+5*(getenv("BITS_PER_INSTRUCTION")/8));
}
*/
#org 0x0008,0x0017
void isr_global_hp(){
#asm
movf in_app, w
bz 0xa0
goto 0x1808
#endasm
}
#org 0x0018,0x0027
void isr_global_lp(){
#asm
movf in_app, w
bz 0xa0
goto 0x1818
#endasm
}
#org default
...
#inline
void fork(){
if(input(NOTBOOTLOADER)){
in_app = TRUE;
goto_address(LOADER_END + 1);
}
else
in_app = FALSE;
}
|
|
|