Coldfire Interrupt Syntax

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Coldfire Interrupt Syntax

999 Views
RatHead2
Contributor II

I'm sure it's staring me in the face, but I can't find the answer anywhere...



CW V10.1, S08QE128 / F51QE128



To declare in interrupt handler with the S08, I do this:


interrupt VectorNumber_Vadc  void isrADC(void)


With Coldfire, using the above syntax, or the preferred


__declspec(interrupt) VectorNumber_Vadc void isrADC(void)


results in the compiler complaining


illegal use of '__declspec(interrupt)'


and yes, it flags the syntax as well, but I understand that's an Eclipse problem.


However, this works:


__declspec(interrupt)  void isrADC(void)


But then how does the linker know how to fill out the exception vector table? Do I have to manually edit exceptions.c?

Labels (1)
0 Kudos
2 Replies

368 Views
CrasyCat
Specialist III

Hello

 

  According to my understanding you are developing a project for Coldfire V1 chip.

  Am I right?

 

  If this is the case, I would recommend you to create a project using the wizard.

  In the generated project you will see at the end of the file exception.c how you can initialize the vector table.

 

  For instance

 

__declspec(weak) vectorTableEntryType vector_112 @Vadc = asm_exception_handler;

 

 

If you are using a V2, V3 or V4 core, once again check the wizard generated file.

In this case you need to adjust the definition of the table _vect in exception.c.

Just replace  asm_exception_handler with the name of your interrupt function for the desired vector.

I hope this helps

CrasyCat

0 Kudos

368 Views
RatHead2
Contributor II

CrasyCat,

 

CF V1

CW 10.1

S08QE128 / F51QE128

 

Thank you for the quick response.

 

Just to confirm I understand - I must manually edit the exceptions.c file and for each interrupt handler I change the entry.

 

From:

__declspec(weak) vectorTableEntryType vector_112 @Vadc = asm_exception_handler;

 

To:

__declspec(weak) vectorTableEntryType vector_112 @Vadc = MyVadcISR;

 

Of course this raises other problems, such as now I have to #include a file with a prototype of my ISR. And for different builds if I have different ISRs then I have to keep manually editing the exceptions.c file. Yuck.

 

 

What I did that seems to work is to comment out the vectors in exceptions.c that I wish to replace. Then in my source file where I have the interrupt handler I put:

 


typedef void (* vectorTableEntryType)(void);
__declspec(weak) vectorTableEntryType vector_112  @(GetIntVectAddr(Vadc)) = MyVadcISR;
static void
MyVadcISR(void) { ... }

 

 

Is this documented anywhere? I sure couldn't find it.

0 Kudos