|
|||||||||||
Technical Support Support Resources
Product Information |
C51: Use Specific Address Range for MOVCInformation in this article applies to:
QUESTIONI need to use an 8051 device variant where the MOVC instruction is broken. MOVC A,@A+DPTR can only access constants in an certain address space (C:0xA000 - C:0xAFFF). Access to other memory regions fails. It is not possible to use the instruction MOVC A,@A+PC at all. I know that the C51 Compiler uses MOVC instructions a lot. Is there a way to configure the Keil C51 Compiler, that above restrictions can be achieved? ANSWERWhen you avoid certain constructs in the C source code, it is possible to minimize the MOVC instructions. In addition all constants need to be located to the specific address memory. Configure Compiler and Linker/Locater:The following explains the configuration settings for µVision, the C51 Compiler and the LX51 Linker/Locater that are required to avoid MOVC instructions.
With the settings described above all constant segments are already located to address space C:0xA000-c:0xAFFF. In addition you need to check your program code for the following issues: Check for ?C?CCASE, ?C?ICASE, or ?C?LCASE Library Calls:The C51 Compiler may embed DB and DW constants into the program code segment. Use the Compiler Code Listing file to check whether the code generated uses ?C?CCASE, ?C?ICASE, or ?C?LCASE library calls . If the Compiler uses one of these library calls, you need to break the switch/case statements apart into several switch/case constructs (each less than 7 case statements). Refer to C51: Switch/Case Statements for more information. Do Not Use bit Initializations at File Level:Example:
These sequences require execution of MOVC A,@A+PC instruction in INIT.A51. Instead, move the bit initialization to the beginning of main. Avoid the following function callsThe C51 Run-Time Library has several routines that have DB/DW statements embedded in the Library code. Therefore, you need to avoid the following function calls in your application program.
Generate Linker *.COD File and Check for DB/DW StatementsThe following settings enable a linker code listing file (extension *.COD) that might help you to analyze the compiler output for DB and DW statements that are embedded in the code.
Using the above methods, almost 100% ensures that the generated code is safe and does not contain any hidden DB/DW statements. In this way, you can work with the broken 8051 devices until you receive the final silicon version. SEE ALSOLast Reviewed: Thursday, February 25, 2021 | ||||||||||
|
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.