valentina lomi

vector table and the linker with M52235EVB

Discussion created by valentina lomi on Feb 15, 2007
Latest reply on Feb 15, 2007 by CrasyCat
Hallo,
I experienced a behaviour of the CodeWarrior linker on my M52235EVB I can't understand.
 
I wrote down an ISR for my UART1 and I wanted to insert its identifier in the vector table at the proper entry.
Find below my first attempt in file MCF52235_vectors.s:
 
/*
 * File: vectors.s
 * Purpose: MCF52235 vector table
 */
#ifdef __GNUC__ /* { */
#define sr %sr
#define _ethernet_handler ethernet_handler
#define _irq_handler      irq_handler
#define _timer_handler    timer_handler
#endif /* } __GNUC__ */
 .global VECTOR_TABLE
 .global _VECTOR_TABLE
 .global start
 .extern ___SP_INIT
 .extern _asm_startmeup
 .extern _asm_exception_handler
 .extern _irq_handler
 .extern _ethernet_handler
 .extern _timer_handler
 .extern _ephy_handler
 .extern _irq1_handler
 .extern _irq4_handler
 .extern _irq7_handler
 .extern _irq11_handler
 .extern rd_uart1_isr
 .text
 
... etc....etc
 
vector4C: .long _irq_handler
vector4D: .long _irq_handler
/*vector4E: .long _irq_handler*/
vector4E: .long rd_uart1_isr       /* UART1 ISR */
vector4F: .long _irq_handler
vector50: .long _irq_handler
 
...etc...etc
 
When I try to compile, I get this message back:
Link Error   : Undefined : "rd_uart1_isr"
Referenced from "start" in mcf52235_vectors.s
Link failed.
 
I next tried this different solution:
 
/*
 * File: vectors.s
 * Purpose: MCF52235 vector table
 */
#ifdef __GNUC__ /* { */
#define sr %sr
#define _ethernet_handler ethernet_handler
#define _irq_handler      irq_handler
#define _timer_handler    timer_handler
#define _rd_uart1_isr   rd_uart1_isr
#endif /* } __GNUC__ */
 
 .global VECTOR_TABLE
 .global _VECTOR_TABLE
 .global start
 .extern ___SP_INIT
 .extern _asm_startmeup
 .extern _asm_exception_handler
 .extern _irq_handler
 .extern _ethernet_handler
 .extern _timer_handler
 .extern _ephy_handler
 .extern _irq1_handler
 .extern _irq4_handler
 .extern _irq7_handler
 .extern _irq11_handler
 .extern _rd_uart1_isr
 .text
 
...etc...etc
 
vector48: .long _irq_handler
vector49: .long _irq_handler
vector4A: .long _irq_handler
vector4B: .long _irq_handler
vector4C: .long _irq_handler
vector4D: .long _irq_handler
/*vector4E: .long _irq_handler*/
vector4E: .long _rd_uart1_isr /* UART1 ISR */
vector4F: .long _irq_handler
vector50: .long _irq_handler
vector51: .long _irq_handler
and it worked.
I don't understand this behaviour....the preprocessor should do his work before linking....
what happens different this time with respect to the previous time?
Thank you for any help.
 
Vale

Outcomes