ARM Technical Support Knowledge Articles

INCLUDING OBJECT FILES IN LINK

Applies to: uVision (Version 1) IDE

Answer


Information in this article applies to:


QUESTION

My project consists of two source files, SOURCE1.C and SOURCE2.C. When these are compiled, I link them with some object files that were built in another project, EXTERN1.OBJ through EXTERN3.OBJ.

The way I currently build my project is to run a batch file, which compiles the source files, and call the linker using the following linker command file:

EXTERN1.OBJ, &
EXTERN2.OBJ, &
EXTERN3.OBJ, &
SOURCE1.OBJ, &
SOURCE2.OBJ, &
TO OUTPUT
RAMSIZE(0FFh)
PDATA(0400h)
XDATA(0400h)

I tried to create a uVision project which included the two source files and called the linker command file, however, I get an error when it tries to link. How do I convert my batch file based project to a uVision project?

ANSWER

When using uVision, the linker command file may only contain directives, not lists of object files or an output file, so the first thing to do is change your linker command file to:

RAMSIZE(0FFh)
PDATA(0400h)
XDATA(0400h)

Next, you need to add the object files to your project in such a way that they are only linked, not compiled or assembled (translated).

Complete the following steps for each object file:

You will now be able to build your project successfully. Note that you should not add object files in this way if they are generated from a source file that is already included in the project. The result is that the object file will be linked twice, generating errors.

MORE INFORMATION

See also: UVISION1: LINKER COMMAND AND RESPONSE FILES

Article last edited on: 2004-06-15 09:58:46

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential