|ARM Technical Support Knowledge Articles|
Applies to: uVision IDE
Information in this article applies to:
I have a question regarding the project management in the uVision IDE.
The link order of the files is derived from the order in the uVision project. Does the link order affect the program behavior? Is there a specific order that needs to be followed for the file list in the linker invocation line?
The link order does not normally affect program behavior. It only affects the order in which variables and functions in your application are stored in memory. C programs should be structured in such a way that the order of functions or variables does not influence the program behavior.
If you include the startup code (lfor example, STARTUP.A51) and initialization code (for example, INIT.A51) files in your project, they must be the last two files linked. The startup code must preceed the initialization code file in the linkage.
Other than the startup code, there is only one case where the link order might be critical. That is when several modules have partial segments. Partial segments are segments with the same name that are used in multiple modules. Such segments may contain data or code blocks. While processing object modules, the linker combines all partial segments in the same order in which their respective files are processed.
For example, the C compiler uses partial segments for the variable initalization tables. When you write:
int i = 0x5566;
the C compiler generates a table entry into an initilization segment that is interpreted in the STARTUP code. The end of this table is signaled with a ZERO entry that comes from the C run-time library module. Therefore, it is important the the C run-time libraries are the last module in your linker input list and therefore the last file in a uVision2 project.
Article last edited on: 2006-12-14 14:32:57
Did you find this article helpful? Yes No
How can we improve this article?