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

bootloader interrupt dispatch

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



Joined: 11 Sep 2007
Posts: 18

View user's profile Send private message

bootloader interrupt dispatch
PostPosted: Thu Dec 13, 2007 6:03 pm     Reply with quote

I want to do something that would seem very simple to me but I can't get the compiler to do it!!!


If the app is running I want interrupts forward to the interrupt vector of the app. If the boot loader is running, I want the bootloader to interrupt handler to handle it. Seems simple enough doesn't it?

Here is the code i want to use to do the job. The compiler doesn't like this as I've used #int_usb in the bootloader code. But for the life I me I can't figure out how to work around this.

Any help would be appreciated.

Robert Ramey


#build{reset=0, interrupts=0x28}

static BOOLEAN in_app = FALSE;

#int_global
void isr_global(){
if(in_app)
jump_to_isr(LOADER_END+5*(getenv("BITS_PER_INSTRUCTION")/8));
else
jump_to_isr(0x28);
}
Ken Johnson



Joined: 23 Mar 2006
Posts: 197
Location: Lewisburg, WV

View user's profile Send private message

PostPosted: Fri Dec 14, 2007 8:06 am     Reply with quote

My requirement was different, but this worked for me:

Code:

#define HIBEGIN     0x0020              //  Hi-Priority Interrupt code starts here;
#define HIFINAL     (HIBEGIN + 0x007F)
#define LOBEGIN     (HIFINAL + 1)       //  Lo-Priority Interrupt code starts here;
#define LOFINAL     (LOBEGIN + 0x00FF)
#define HIVECTOR    (LOFINAL + 1)
#define LOVECTOR    (HIVECTOR + 0x0010)

#pragma build (interrupt=HIVECTOR)

#pragma org 0x0008,0x000F       //  Vector to Hi-Priority Interrupt:
static  void HiInt (void)
{
    goto_address (HIBEGIN);
}

#pragma org 0x0018,0x001F       //  Vector to Lo-Priority Interrupt:
static  void LoInt (void)
{
    //  do whatever you want :)
    goto_address (LOBEGIN);
}

#pragma org HIBEGIN,HIFINAL     //  This is the Hi-Priority ISR:
void HiPriorityISR (void)
{
    #asm
    RETFIE 1
    #endasm
}

#pragma org LOBEGIN,LOFINAL     //  This is the Lo-Priority ISR:
static  void LoPriorityISR (void)
{
    //  do whatever you want :)
    #asm
    RETFIE 1
    #endasm
}


Might work for you also. In the HiInt and LoInt, you'll need a test to know where to vector to.

Ken
Ramey



Joined: 11 Sep 2007
Posts: 18

View user's profile Send private message

close but no cigar?
PostPosted: Fri Dec 14, 2007 12:58 pm     Reply with quote

This would seem to be almost what I want. Here I forward to the default global_int located at 0xa0. The 0x009f was determined by inspection of the global_int automatically generated. Any other won't work. This small test should not alter the program in anyway. However, it causes the program to fail. I'm sure that if I can't get this to work I'll be home free.

Any help appreciated.

Robert Ramey

Code:

#build(reset=0, interrupt=0xA0)

#org 0x0008,0x009f
void isr_global(){
    jump_to_isr(0x00A0);
}

#org default

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