Hello-
I am using CW to create a program in C for the 9S12XDP512. This program uses interrupts, but I have not been able to figure out how to build the vector table. I have searched this website but not found any documentation that explains the compliation process for this particular microcontroller. The closest I have come is document AN2216/D but that covers a different chip. I have been trying to use the information provided there since I expect them to be similar, but nothing has worked.
Building an interrupt routine should consist of two parts: getting the ISR located at a known memory address and then getting this address loaded into the vector table position for the interrupt it is handling. To do this I have this code:
// inside main.c
#pragma CODE_SEG __NEAR_SEG ROM_C000
#pragma TRAP_PROC
void ISR(void) { /* interesting code here */ }
#pragma CODE_SEG DEFAULT
// inside the PRM file
SEGMENTS
ROM_C000 = READ_ONLY 0xC000 TO 0xFEFF
/* other defined segments */
END
...
VECTOR 0 _Startup // provided by the project wizard tool
VECTOR 'n' ISR
There is a formula to calculate 'n' in order to get the correct entry in the vector table. However, ANY value I have tried so far produces the following error during the linking stage:
Link Error : L1108: Initializing of Vector ISR failed because of over- or underflow of vector value
Link Error : Link failed
I get this error whether I use the true value that I calculate from the formula or even something small like 2. What is the real way to get your vector table built? I cannot tell if this error is produced by trying to use a value that genuinely falls outside the range of entries in the vector table, or if I stored the function at a memory address that is too large to store as an entry in the table. Since the function is in non-paged memory I don't see how the latter would be true.