using code warrior for MC9S12XDP512 how to write my own linker file for it. i am not using XGATE

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

using code warrior for MC9S12XDP512 how to write my own linker file for it. i am not using XGATE

5,243 Views
sunil99
Contributor I
hi ALL,
 
  SUB:     i am using code warrior for MC9S12XDP512 please tell me how to write my own linker file for it. i am not using XGATE
       
          Can any one please reply me how to write my own linker file for code warrior for MC9S12XDP512 and i am not using XGATE. codewarrior is  generating linker file but its not able to handle interrupts of CAN so i need to write linker file for it for handling CAN interrupts and i need to place my own vector.c which contains interrupt handling routine so please help me and please forward me the link where can i get linker manual and compiler settings manual of codewarrior for MC9S12XDP512.and suggest me the ways how can i handle CAN interupts by making changes in existing linker file or should i write new linker file if so how to handle it please provide me sufficient information.
 
 
thanks in advance.please solve my problem i am facing it form one week.
 
thanking you
bye
sunil
Labels (1)
0 Kudos
8 Replies

1,333 Views
Alban
Senior Contributor II
Hello

Code:
VECTOR 0 _Startup /* reset vector: this is the default entry point for a C/C++ application. */
VECTOR 1 (...)
VECTOR x ISRfunction

 Is the way to do this directly in the PRM file.
Otherwise, you can do it from the C file:
Code:
/*****************************************************************************
ResetVectorTable
Interrupt vector table for S12XDP512
This is the default CPU interrupt vector table at reset: IVBR = $FF
Other vector tables can be created and used by changing IVBR
*****************************************************************************/
const tIsrFunc ResetVectorTable[] @0xFF10 =
{                                     
    SpuriousISR,                      /* 0xFF10 Spurious Interrupt */
    ReservedISR,                      /* 0xFF12 Reserved */
    ReservedISR,                      /* 0xFF14 Reserved */
    ReservedISR,                      /* 0xFF16 Reserved */
    ReservedISR,                      /* 0xFF18 Reserved */
    ReservedISR,                      /* 0xFF1A Reserved */
    ReservedISR,                      /* 0xFF1C Reserved */
    ReservedISR,                      /* 0xFF1E Reserved */
    ReservedISR,                      /* 0xFF20 Reserved */
    ReservedISR,                      /* 0xFF22 Reserved */
    ReservedISR,                      /* 0xFF24 Reserved */
    ReservedISR,                      /* 0xFF26 Reserved */
    ReservedISR,                      /* 0xFF28 Reserved */
    ReservedISR,                      /* 0xFF2A Reserved */
    ReservedISR,                      /* 0xFF2C Reserved */
    ReservedISR,                      /* 0xFF2E Reserved */
    ReservedISR,                      /* 0xFF30 Reserved */
    ReservedISR,                      /* 0xFF32 Reserved */
    ReservedISR,                      /* 0xFF34 Reserved */
    ReservedISR,                      /* 0xFF36 Reserved */
    ReservedISR,                      /* 0xFF38 Reserved */
    ReservedISR,                      /* 0xFF3A Reserved */
    ReservedISR,                      /* 0xFF3C Reserved */
    ReservedISR,                      /* 0xFF3E Reserved */
    ReservedISR,                      /* 0xFF40 Reserved */
    ReservedISR,                      /* 0xFF42 Reserved */
    ReservedISR,                      /* 0xFF44 Reserved */
    ReservedISR,                      /* 0xFF46 Reserved */
    ReservedISR,                      /* 0xFF48 Reserved */
    ReservedISR,                      /* 0xFF4A Reserved */
    ReservedISR,                      /* 0xFF4C Reserved */
    ReservedISR,                      /* 0xFF4E Reserved */
    ReservedISR,                      /* 0xFF50 Reserved */
    ReservedISR,                      /* 0xFF52 Reserved */
    ReservedISR,                      /* 0xFF54 Reserved */
    ReservedISR,                      /* 0xFF56 Reserved */
    ReservedISR,                      /* 0xFF58 Reserved */
    ReservedISR,                      /* 0xFF5A Reserved */
    ReservedISR,                      /* 0xFF5C Reserved */
    ReservedISR,                      /* 0xFF5E Reserved */
    UnimplementedISR,                 /* 0xFF60 XSRAM20K Access Violation */
    UnimplementedISR,                 /* 0xFF62 XGATE Software Error */
    UnimplementedISR,                 /* 0xFF64 XGATE Software Trigger 7 */
    UnimplementedISR,                 /* 0xFF66 XGATE Software Trigger 6 */
    UnimplementedISR,                 /* 0xFF68 XGATE Software Trigger 5 */
    UnimplementedISR,                 /* 0xFF6A XGATE Software Trigger 4 */
    UnimplementedISR,                 /* 0xFF6C XGATE Software Trigger 3 */
    UnimplementedISR,                 /* 0xFF6E XGATE Software Trigger 2 */
    UnimplementedISR,                 /* 0xFF70 XGATE Software Trigger 1 */
    UnimplementedISR,                 /* 0xFF72 XGATE Software Trigger 0 */
    UnimplementedISR,                 /* 0xFF74 Periodic Interrupt Timer */
    UnimplementedISR,                 /* 0xFF76 Periodic Interrupt Timer */
    UnimplementedISR,                 /* 0xFF78 Periodic Interrupt Timer */
    UnimplementedISR,                 /* 0xFF7A Periodic Interrupt Timer */
    UnimplementedISR,                 /* 0xFF7C Reserved */
    UnimplementedISR,                 /* 0xFF7E API Autonomous Periodical Interrupt */
    UnimplementedISR,                 /* 0xFF80 LVI Low Voltage Interrupt */
    UnimplementedISR,                 /* 0xFF82 IIC1 */
    UnimplementedISR,                 /* 0xFF84 SCI5 */
    UnimplementedISR,                 /* 0xFF86 SCI4 */
    UnimplementedISR,                 /* 0xFF88 SCI3 */
    UnimplementedISR,                 /* 0xFF8A SCI2 */
    UnimplementedISR,                 /* 0xFF8C PWM Emergency Shutdown */
    UnimplementedISR,                 /* 0xFF8E Port P Interrupt */
    UnimplementedISR,                 /* 0xFF90 MSCAN 4 transmit */
    UnimplementedISR,                 /* 0xFF92 MSCAN 4 receive */
    UnimplementedISR,                 /* 0xFF94 MSCAN 4 errors */
    UnimplementedISR,                 /* 0xFF96 MSCAN 4 wake-up */
    UnimplementedISR,                 /* 0xFF98 MSCAN 3 transmit */
    UnimplementedISR,                 /* 0xFF9A MSCAN 3 receive */
    UnimplementedISR,                 /* 0xFF9C MSCAN 3 errors */
    UnimplementedISR,                 /* 0xFF9E MSCAN 3 wake-up */
    UnimplementedISR,                 /* 0xFFA0 MSCAN 2 transmit */
    UnimplementedISR,                 /* 0xFFA2 MSCAN 2 receive */
    UnimplementedISR,                 /* 0xFFA4 MSCAN 2 errors */
    UnimplementedISR,                 /* 0xFFA6 MSCAN 2 wake-up */
    UnimplementedISR,                 /* 0xFFA8 MSCAN 1 transmit */
    UnimplementedISR,                 /* 0xFFAA MSCAN 1 receive */
    UnimplementedISR,                 /* 0xFFAC MSCAN 1 errors */
    UnimplementedISR,                 /* 0xFFAE MSCAN 1 wake-up */
    UnimplementedISR,                 /* 0xFFB0 MSCAN 0 transmit */
    UnimplementedISR,                 /* 0xFFB2 MSCAN 0 receive */
    UnimplementedISR,                 /* 0xFFB4 MSCAN 0 errors */
    UnimplementedISR,                 /* 0xFFB6 MSCAN 0 wake-up */
    UnimplementedISR,                 /* 0xFFB8 Flash */
    UnimplementedISR,                 /* 0xFFBA EEPROM */
    UnimplementedISR,                 /* 0xFFBC SPI2 */
    UnimplementedISR,                 /* 0xFFBE SPI1 */
    UnimplementedISR,                 /* 0xFFC0 IIC0 */
    UnimplementedISR,                 /* 0xFFC2 Reserved */
    UnimplementedISR,                 /* 0xFFC4 CRG Self Clock Mode */
    UnimplementedISR,                 /* 0xFFC6 CRG PLL lock */
    UnimplementedISR,                 /* 0xFFC8 Pulse accumulator B overflow */
    UnimplementedISR,                 /* 0xFFCA Modulus Down Counter Underflow */
    UnimplementedISR,                 /* 0xFFCC Port H */
    UnimplementedISR,                 /* 0xFFCE Port J */
    UnimplementedISR,                 /* 0xFFD0 ATD1 */
    UnimplementedISR,                 /* 0xFFD2 ATD0 */
    UnimplementedISR,                 /* 0xFFD4 SCI1 */
    UnimplementedISR,                 /* 0xFFD6 SCI0 */
    UnimplementedISR,                 /* 0xFFD8 SPI0 */
    UnimplementedISR,                 /* 0xFFDA Pulse accumulator input edge */
    UnimplementedISR,                 /* 0xFFDC Pulse accumulator A overflow */
    UnimplementedISR,                 /* 0xFFDE Enhanced Capture Timer overflow  */
    UnimplementedISR,                 /* 0xFFE0 Enhanced Capture Timer channel 7 */
    UnimplementedISR,                 /* 0xFFE2 Enhanced Capture Timer channel 6 */
    UnimplementedISR,                 /* 0xFFE4 Enhanced Capture Timer channel 5 */
    UnimplementedISR,                 /* 0xFFE6 Enhanced Capture Timer channel 4 */
    UnimplementedISR,                 /* 0xFFE8 Enhanced Capture Timer channel 3 */
    UnimplementedISR,                 /* 0xFFEA Enhanced Capture Timer channel 2 */
    UnimplementedISR,                 /* 0xFFEC Enhanced Capture Timer channel 1 */
    UnimplementedISR,                 /* 0xFFEE Enhanced Capture Timer channel 0 */
    UnimplementedISR,                 /* 0xFFF0 Real Time Interrupt */
    UnimplementedISR,                 /* 0xFFF2 IRQ */
    UnimplementedISR,                 /* 0xFFF4 XIRQ */
    UnimplementedISR,                 /* 0xFFF6 SWI */
    UnimplementedISR,                 /* 0xFFF8 Unimplemented instruction trap */
    UnimplementedISR,                 /* 0xFFFA COP failure reset */
    UnimplementedISR,                 /* 0xFFFC Clock monitor fail reset */
    _Startup                          /* 0xFFFE Reset vector */
};

Cheers,
Alban.

0 Kudos

1,333 Views
sunil99
Contributor I
hai alban sir,
                       I am thankful to you thousand times if u are near i can hug you and say thanks thousand times.i was facing this problem from almost more than a week.Now u have sent me solution which is tremendous  but just please  elaborate on this and answer my question.you have sent me one C function which is absolutely required by me.now i can keep that c routine in a file suppose interrupt.c but how should i keep it in linker file just tell me.i am sending my linker file  just see that and tell me how should i keep it in that linker file .in that function which u have sent i can keep my interrupt handling routines in that respected location but how should i keeep my interrupt.c containing ur routine   in the linker file just elaborate and say me it could be of great help to me and please say how can we write our own linker file and how can we keep our files in our desired locations please tell me .please go through the linker file and say me where can i keep that c file in the linker file  please tell me  if u want tell me i can give u more infromation which u want so that u can solve my problem.please reply me as soon as possible i am eagerly expexcvting reply form you bcoz i am in trouble and i need to close this issue so please help me.
 
what is IVBR=FF what is meant by this "Other vector tables can be created and used by changing IVBR"
how to do that if u have nay sample code and linker files please mail me
 
 
in this what is  @0XFF10   "const tIsrFunc ResetVectorTable[] @0xFF10'"  please explain me
 
 
if u answer and help me i can help others please help me immedaitely my mail id is sunil.puli18@gmail.com
thanks in advance
 
bye
sunil.
0 Kudos

1,333 Views
Alban
Senior Contributor II
Hello again sunil, and thanks for your recongnition :smileywink:

There are two possibilities, do not mix them.
Either you work on the PRM file, either you use the C declaration I gave, not both.


For the PRM file, you can see at the very end the line "VECTOR 0 "...
You just have to continue the table and enter the line of the CAN interrupt you want to use.

For the C I included, it is different. You do NOT need to change the linker file.
You need to declare your interrupts in your C code like the following example:

Code:
#pragma CODE_SEG __NEAR_SEG NON_BANKED #pragma TRAP_PROCvoid msCANISR(void) {   //Here insert your interrupt code
}
#pragma DATA_SEG DEFAULT

 
and put the name of the function in the table I gave.

IVBR tells where the table is located. By defautl it is 0xFF wich means the Vector table ends at 0xFFFF. ou don't need to change anything !

@0XFF10 is to force the table at the address $FF10.

Cheers,
Alban.
0 Kudos

1,333 Views
sunil99
Contributor I
hai sir,
 
          I have kept the vector table routine as it is as u have sent me and its getting error vector allocated at absloute address 0XFFFE overlaps with sections placed in segment .absseg0 please rectify the error please suggest me some thing how to handle it i am sending both my vector.c file and linker file please suggest me changes so as to over come this error.
 
thanks in advance -please dont stop replying me ur suggestions are valuable to me
bye
sunil.
 
please reply me and save me
0 Kudos

1,333 Views
Alban
Senior Contributor II
Hello,

need to look in the map file what is abs0.
I guess its because you left
VECTOR 0 _Startup in the PRM file.

You need to remove the line and put _Startup for the RESET vector in the C file.

Alban.
0 Kudos

1,333 Views
sunil99
Contributor I
hai sir ,
               i waited eagerly two days for your reply and finally you replied me u are genius u solved my error by saying remove the startup vector in prm file i did it solved my error thanks for it.this is my last doubt but now i am facing small problem i not able to handle interrupts properly i think i am  able to keep
break point in CANMODULE0receive ISR but break point is not coming in to it that means its not executing . so please go throguh it and solve my problem its my sincere request. u are the only person capable of it and can solve it and save me i am sending the prm file and main.c routine and can mocule0 receive isr routine so please help me in solving it.please please identify the eror and tell me why the break point is not coming in to it and what are the compiler settings to handle interupts and i ran same code in cosmic its working but its not in code warrior i made changes accordingly please tell compiler settings and rest to solve for thsi i willl be thank ful if u can solve it. i am sending files please see them in that i forgot to add vector ADDRESS 0XFFB2  CANMODULE0RECEIVEISR in prm file
and keeping #pragma TRAP_PROC for CAN module0 RECEIVE ISR in can.c file .
 
waiting eagerly for ur reply and hope u will solve my problem and save me
 
bye
thanking you sir
 
sunil
0 Kudos

1,333 Views
Alban
Senior Contributor II
Hello,

A new question means a new thread.
The new thread MUST include, in the Message Subject, the device you use and a summary of the problem.

Regards,
Alban.
0 Kudos

1,333 Views
sunil99
Contributor I
hai sir,
             today i am lucky i got reply from you and I tried what u have said by keeping the vector table which u sent  in a file named vector.c and in that mscan0 interrupt location i kept respective function routine which i have written in some  .c file but when i kept that table inside a vector.c file its throwing error
expecting ;= at this  line const tIsrFunc ResetVectorTable[ ] @0xFF10 =
can i change the function name and keep then no poroblem na it will handle my routine right.so all interrupts will get handled by this way right
can u guess why its happening like this and it showed error not declared reserved isr then i kept it as 0x00 but its also showing not declared or mentioned type at
_startup why its giving that error because its mentioned at vector_0 startup in the linker file na again it was giving error not declared so what should i do please reply am i going in a correct way and will i get answer if these errors are corrected please reply and say the corrections required
 
thanks in advance- suggestions sent by you are invaluable and their worth is my life saving
bye
sunil
0 Kudos