ARM Technical Support Knowledge Articles

CHANGING THE ORDER OF OBJ FILES MAKES PROGRAM CRASH

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

Help! I have a problem that causes a routine to not work, but only at a particular CODE location. If I move the routine to a different CODE area it will work, move it back and it stops. What's going on?

ANSWER

There are a few things that you should check.

  1. Make sure that the startup files are the last files in the link list. The startup code (STARTUP.A51) and the initialization code (INIT.A51) must be the last 2 files in the link list.
  2. Make sure that any RTX configuration files are at the end of the link list.
  3. Make sure that you don't have assembly modules (or C modules) that use ACALL and AJMP instructions that also cross over a 2K-page boundary. There are 2 types of JMP and CALL instructions in the 8051: LCALL/LJMP and ACALL/AJMP. If you have a program that exhibits weird behavior just by moving files around, it might be that you have a module that's compiled for ROM(SMALL) or ROM(COMPACT) that winds up straddling a 2K page. If that's the case, the AJMP or ACALL would wind up jumping to the wrong page (2K before the intended destination). This may be due to an assembly file or a library routine.

NOTE
There is a bug in the log and pow floating-point routines in the C51 Version 5.10 library that may cause this problem. The Version 5.11 library update corrects this problem and is available on the Keil web site at:

http://www.keil.com/update/

SEE ALSO

Article last edited on: 2005-07-15 16:18:24

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