linker problem when compilin the code

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

linker problem when compilin the code

Jump to solution
1,576 Views
yaprak
Contributor I

Hi,

 

I'm trying to write a code of interrupt routines. I found an example project of "dashboard"of freescale. (the location of the file is

 

C:\Program Files\Freescale\CodeWarrior for HCS12 V4.7\(CodeWarrior_Examples)\HCS12X\S12X_Automotive_Cluster_Demo\dashboard.mcp

 

I'm trying to modify this project. However, after I make some modifications I started to encounter some problems. It gives a linker error:

 

the definition of this error is given below:

 

[error]

 

L1823: External object SwLEDData in C:\Users\ayyazilim\Documents\work\p23_03\p23_03_Data\Full_Chip_Simulation\ObjectCode\CPU12ISRs.c.o
created by default

Project: p23_03.mcp, Target: Full Chip Simulation

L1823: External object tickCounter in C:\Users\ayyazilim\Documents\work\p23_03\p23_03_Data\Full_Chip_Simulation\ObjectCode\CPU12ISRs.c.o
created by default

Project: p23_03.mcp, Target: Full Chip Simulation

Link Error   : L1119: Vector allocated at absolute address 0xFFFE overlaps with sections placed in segment .absSeg647

Project: p23_03.mcp, Target: Full Chip Simulation

Link Error   : Link failed
Project: p23_03.mcp, Target: Full Chip Simulation

 [/error]

 

I attached the project also. Can any one tell me the reason for this, please?

 

p23_03.zip

Message Edited by t.dowe on 2009-10-22 09:15 AM
Labels (1)
Tags (1)
0 Kudos
1 Solution
465 Views
CrasyCat
Specialist III

Hello

 

The warning messages L1823 are generated because you have only external declarations for variable SwLEDData and tickCounter.

 

In one of your ANSI C source files you need to explicitly define the variables as follows:

 

SwLEDDataType SwLEDData;

int tickCounter;

 

To remove the error message L1119 remove the line

VECTOR 0 _Startup

from your .prm file

 

CrasyCat

View solution in original post

0 Kudos
2 Replies
465 Views
Lundin
Senior Contributor IV
You must make sure that the vector table is linked to the program. This isn't done, since CW can't see it used from anywhere in the code - it is just called from the hardware itself, but the compiler doesn't know that.

First, you need to make the vector table global for the project, by putting a prototype in some h file:

extern void (* near const vectors[])(void);

Second, you need to enforce the linker to include the vector table through the prm file:

ENTRIES
vectors
END

Third, you need to put the reset vector from the prm file into your own vector table. Remove the line
VECTOR 0 _Startup
from the prm file and set _Startup as the reset vector in your vector table. This is causing the overlap error.

All interrupt service routines used in the vector table must have their prototypes visible to vectors.c or you will get linker errors from that too. That is, vectors.c needs to include all h files containing prototypes to interrupts.
Message Edited by Lundin on 2009-03-23 09:39 AM
0 Kudos
466 Views
CrasyCat
Specialist III

Hello

 

The warning messages L1823 are generated because you have only external declarations for variable SwLEDData and tickCounter.

 

In one of your ANSI C source files you need to explicitly define the variables as follows:

 

SwLEDDataType SwLEDData;

int tickCounter;

 

To remove the error message L1119 remove the line

VECTOR 0 _Startup

from your .prm file

 

CrasyCat

0 Kudos