Need help in setting interrupt rountine in DG128B

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

Need help in setting interrupt rountine in DG128B

5,593 Views
Zaku
Contributor I
  I am now using MC9S12DG128B with Metrowerks CodeWarrior IDE ver. 5.5
 
  I tried methods mentioned in Help and Books, but I kept gettin Link Error in setting interrupt routines. I had got stuck at this trouble for almost a week. Really hope someone could enlighten me.

The Linker Map P&E_ICD.map is originally:
*********************************************************************************************
SECTION-ALLOCATION SECTION
Section Name                    Size  Type     From       To       Segment
---------------------------------------------------------------------------------------------
.init                             18     R     0xC000     0xC011   ROM_C000
.startData                        30     R     0xC012     0xC02F   ROM_C000
.(skipped...)
.abs_section_44                    2   N/I       0x44       0x45   .absSeg335
.bss                               6   R/W     0x2000     0x2005   RAM
.stack                             1   R/W     0x3F00     0x3F00   .stackSeg
  When I wrote in main.c
void interrupt 22 ATD_isr(void) {
}

  , I got Link Error.
Link Error: L1907: Fixup overflow in _Vector_22, to ATD_isr type 1, at offset 0x0
  And Linker map becomes:
.abs_section_44                    2   N/I       0x44       0x45   .absSeg335
.abs_section_ffd2                  2     R     0xFFD2     0xFFD3   .absSeg336
.stack                             1   R/W     0x3F00     0x3F00   .stackSeg
.vectSeg337_vect                   2     R     0xFFFE     0xFFFF   .vectSeg337
  When I wrote in main.c
#pragma TRAP_PROC
void _ATD_complete(void);

  , and in P&E_ICD_linker.prm bottom
VECTOR ADDRESS 0xFFD2 _ATD_complete (or VECTOR 22 _ATD_complete)
  , I also got Link Error.
Link Error: L1108: Initializing of Vector _ATD_complete failed because of over- or underflow of vector value
  And Linker map becomes:
.abs_section_44                    2   N/I       0x44       0x45   .absSeg335
.bss                               6   R/W     0x2000     0x2005   RAM
.stack                             1   R/W     0x3F00     0x3F00   .stackSeg
.vectSeg336_vect                   2     R     0xFFD2     0xFFD3   .vectSeg336
.vectSeg337_vect                   2     R     0xFFFE     0xFFFF   .vectSeg337
.(skipped...)
*********************************************************************************************
VECTOR-ALLOCATION SECTION
    Address     InitValue   InitFunction
---------------------------------------------------------------------------------------------
     0xFFD2      0x38800C   _ATD_complete
     0xFFFE        0xC000   _Startup
...

  Could anyone tell me how can I solve the problem? Many thanks.
Labels (1)
0 Kudos
5 Replies

762 Views
Zaku
Contributor I

Thank you for you all. Actually I missed the double underscore in __NEAR_SEG. The interrupt routine now works nice in a project without Processor Expert.

However, in a project with Processor Expert, a warning "L1912: object _VECTOR_22 overlaps with another" occurs. Is this related to the vector.c, which it seems that Processor Expert has defined something for interrupt vectors?

Attached is the project file.

Thanks again!

 

Message Edited by Zaku on 2006-06-07 08:26 AM

 

AA2.zip

Message Edited by t.dowe on 2009-10-21 12:20 AM
0 Kudos

762 Views
CrasyCat
Specialist III

Hello

Yes in fact the message "L1912: object _VECTOR_22 overlaps with another" is due to the fact that Processor Expert is defining the vector table in vector.c.

Note that if you are using Processor Expert and if you are using interrupt functions, which are not generated by Processor Expert we recommend you to proceed as follows:

  - Define your interrupt function without the vector number in your source file (i.e.
    interrupt void ADT_Interrupt(void) { ...
}
  - Add an "InterruptVector" Bean Set "Interrupt Vector" to the appropriate interrupt source and set "ISR name" to your interrupt function name.

This way the name of your interrupt function will be added to the Processor Expert generated vector table.

I hope this helps.

CrasyCat

0 Kudos

762 Views
Zaku
Contributor I
Thanks but Link Error again...
Warning: C3802: Segment pragma incorrect
Link Error: L1108: Initializing of Vector _ATD_complete failed because of over- or underflow of vector value
Sten: in P&E_ICD_linker.prm,
SEGMENTS
    RAM = READ_WRITE 0x2000 TO 0x3EFF;
    /* unbanked FLASH ROM */
    ROM_4000 = READ_ONLY  0x4000 TO 0x7FFF;
    ROM_C000 = READ_ONLY  0xC000 TO 0xFEFF;
    /* banked FLASH ROM */
    PAGE_38 = READ_ONLY  0x388000 TO 0x38BFFF;
    PAGE_39 = READ_ONLY  0x398000 TO 0x39BFFF;
    PAGE_3A = READ_ONLY  0x3A8000 TO 0x3ABFFF;
    PAGE_3B = READ_ONLY  0x3B8000 TO 0x3BBFFF;
    PAGE_3C = READ_ONLY  0x3C8000 TO 0x3CBFFF;
    PAGE_3D = READ_ONLY  0x3D8000 TO 0x3DBFFF;
/*    PAGE_3E = READ_ONLY  0x3E8000 TO 0x3EBFFF; not used: equivalent to ROM_4000 */
/*    PAGE_3F = READ_ONLY  0x3F8000 TO 0x3FBFFF; not used: equivalent to ROM_C000 */
END
PLACEMENT
    _PRESTART,                   /* Used in HIWARE format: jump to _Startup at the code start */
    STARTUP,                     /* startup data structures */
    ROM_VAR,                     /* constant variables */
    STRINGS,                     /* string literals */
    VIRTUAL_TABLE_SEGMENT,       /* C++ virtual table segment */
    NON_BANKED,                  /* runtime routines which must not be banked */
    COPY                         /* copy down information: how to initialize variables */
                                 /* in case you want to use ROM_4000 here as well, make sure
                                    that all files (incl. library files) are compiled with the
                                    option: -OnB=b */
                                 INTO  ROM_C000/*, ROM_4000*/;
    DEFAULT_ROM                  INTO  PAGE_38,PAGE_39,PAGE_3A,PAGE_3B,PAGE_3C,PAGE_3D;
    DEFAULT_RAM                  INTO  RAM;
END
STACKTOP 0x3F00
VECTOR 0 _Startup /* reset vector: this is the default entry point for a C/C++ application. */
VECTOR 22 _ATD_complete
//VECTOR 0 Entry  /* reset vector: this is the default entry point for a Assembly application. */
//INIT Entry      /* for assembly applications: that this is as well the initialisation entry point */
0 Kudos

762 Views
CrasyCat
Specialist III

Hello

I would need to look at the implementation of the function _ATD_complete (with all pragmas specified right before and right after the implementation.

CrasyCat

0 Kudos

762 Views
Sten
Contributor IV

I do not reqognise the error, but one possible cause could be that the ISR is in paged memory. Try putting it is the un-paged area:

#pragma CODE_SEG __NEAR_SEG NON_BANKED

interrupt void _ATD_Complete(void) {
.....
}

#pragma CODE_SEG DEFAULT


 

0 Kudos