|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
Information in this article applies to:
We have a special chip that is based on the Mentor 8051EW core. The memory configuration of this device allows downloading to RAM in some special areas but blocks the execution of the MOVC instruction in the same memory area for security reasons.
It appears that the Keil C51 Compiler embeds tables into the program code and requires the MOVC instruction (which is blocked). Is there a way to locate constant tables to a different memory area?
The compiler embeds constant tables into program code to improve performance of code constructs like case statements. The constants are handled using the library functions ?C?xCASE and ?C?LSTKxxxx. So, if your MAP file lists these library routines, you likely have constant tables embedded in your program's code space.
Case statements are implemented using several different strategies. One is to store the case information in a jump table in code space. In such a situation, the ?C?xCASE library routine handles the switch-case statement.
You can avoid this type of constant table in one of several ways:
?C?LSTKxxxx Function Calls
To remove calls to the ?C?LSTKxxxx function, enable Project - Options for Target - 'far' memory type support (which sets the VARBANKING compiler directive).
To solve this issue, you must configure your project using a special code banking configuration. The LX51 Linker/Locater provides support for the Mentor 8051EW memory extensions. So you may configure your system with just one code bank using the L51IBANK.A51 file and the example provided in KEILC51EXAMPLESM8051EWL51IBANK. This code banking example allows you to define a Memory Bank for constants (so constant tables are not mixed in with program code).
Article last edited on: 2005-10-20 07:47:28
Did you find this article helpful? Yes No
How can we improve this article?