ARM Technical Support Knowledge Articles


Applies to: C51 C Compiler


Information in this article applies to:


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?


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.

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:


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

Rate this article

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