- •Chapter 1. Introduction
- •How to Develop A Program
- •What is an Assembler?
- •Modular Programming
- •Modular Program Development Process
- •Segments, Modules, and Programs
- •Translate and Link Process
- •Filename Extensions
- •Program Template File
- •Chapter 2. Architecture Overview
- •Memory Classes and Memory Layout
- •Classic 8051
- •Extended 8051 Variants
- •Philips 80C51MX
- •Intel/Atmel WM 251
- •CPU Registers
- •CPU Registers of the 8051 Variants
- •CPU Registers of the Intel/Atmel WM 251
- •Program Status Word (PSW)
- •Instruction Sets
- •Opcode Map
- •8051 Instructions
- •Additional 251 Instructions
- •Additional 80C51MX Instructions via Prefix A5
- •Chapter 3. Writing Assembly Programs
- •Assembly Statements
- •Directives
- •Controls
- •Instructions
- •Comments
- •Symbols
- •Symbol Names
- •Labels
- •Operands
- •Special Assembler Symbols
- •Immediate Data
- •Memory Access
- •Program Addresses
- •Expressions and Operators
- •Numbers
- •Characters
- •Character Strings
- •Location Counter
- •Operators
- •Expressions
- •Chapter 4. Assembler Directives
- •Introduction
- •Segment Directives
- •Location Counter
- •Generic Segments
- •Stack Segment
- •Absolute Segments
- •Default Segment
- •SEGMENT
- •RSEG
- •BSEG, CSEG, DSEG, ISEG, XSEG
- •Symbol Definition
- •CODE, DATA, IDATA, XDATA
- •esfr, sfr, sfr16, sbit
- •LIT (AX51 & A251 only)
- •Memory Initialization
- •DD (AX51 & A251 only)
- •Reserving Memory
- •DBIT
- •DSW (AX51 & A251 only)
- •DSD (AX51 & A251 only)
- •Procedure Declaration (AX51 & A251 only)
- •PROC / ENDP (AX51 & A251 only)
- •LABEL (AX51 and A251 only)
- •Program Linkage
- •PUBLIC
- •EXTRN / EXTERN
- •NAME
- •Address Control
- •EVEN (AX51 and A251 only)
- •USING
- •Other Directives
- •_ _ERROR_ _
- •Chapter 5. Assembler Macros
- •Standard Macro Directives
- •Defining a Macro
- •Parameters
- •Labels
- •Repeating Blocks
- •REPT
- •IRPC
- •Nested Definitions
- •Nested Repeating Blocks
- •Recursive Macros
- •Operators
- •NUL Operator
- •& Operator
- •< and > Operators
- •% Operator
- •;; Operator
- •! Operator
- •Invoking a Macro
- •C Macros
- •C Macro Preprocessor Directives
- •Stringize Operator
- •Predefined C Macro Constants
- •Examples with C Macros
- •C Preprocessor Side Effects
- •Chapter 6. Macro Processing Language
- •Overview
- •Creating and Calling MPL Macros
- •Creating Parameterless Macros
- •MPL Macros with Parameters
- •Local Symbols List
- •Macro Processor Language Functions
- •Comment Function
- •Escape Function
- •Bracket Function
- •METACHAR Function
- •Numbers and Expressions
- •Numbers
- •Character Strings
- •SET Function
- •EVAL Function
- •Logical Expressions and String Comparison
- •Conditional MPL Processing
- •IF Function
- •WHILE Function
- •REPEAT Function
- •EXIT Function
- •String Manipulation Functions
- •LEN Function
- •SUBSTR Function
- •MATCH Function
- •Console I/O Functions
- •Advanced Macro Processing
- •Literal Delimiters
- •Blank Delimiters
- •Identifier Delimiters
- •Literal and Normal Mode
- •MACRO Errors
- •Chapter 7. Invocation and Controls
- •Environment Settings
- •Running Ax51
- •ERRORLEVEL
- •Output Files
- •Assembler Controls
- •Controls for Conditional Assembly
- •Conditional Assembly Controls
- •Chapter 8. Error Messages
- •Fatal Errors
- •Non–Fatal Errors
- •Chapter 9. Linker/Locator
- •Overview
- •Combining Program Modules
- •Segment Naming Conventions
- •Combining Segments
- •Locating Segments
- •Overlaying Data Memory
- •Resolving External References
- •Absolute Address Calculation
- •Generating an Absolute Object File
- •Generating a Listing File
- •Bank Switching
- •Using RTX51, RTX251, and RTX51 Tiny
- •Linking Programs
- •Command Line Examples
- •Control Linker Input with µVision2
- •ERRORLEVEL
- •Output File
- •Linker/Locater Controls
- •Locating Programs to Physical Memory
- •Classic 8051
- •Extended 8051 Variants
- •Philips 80C51MX
- •Intel/Atmel WM 251
- •Data Overlaying
- •Program and Data Segments of Functions
- •Using the Overlay Control
- •Tips and Tricks for Program Locating
- •Locate Segments with Wildcards
- •Special ROM Handling (LX51 & L251 only)
- •Bank Switching
- •Common Code Area
- •Code Bank Areas
- •Bank Switching Configuration
- •Configuration Examples
- •Control Summary
- •Listing File Controls
- •Output File Controls
- •Segment and Memory Location Controls
- •High-Level Language Controls
- •Error Messages
- •Warnings
- •Non-Fatal Errors
- •Fatal Errors
- •Exceptions
- •Chapter 10. Library Manager
- •Using LIBx51
- •Interactive Mode
- •Create Library within µVision2
- •Command Summary
- •Creating a Library
- •Adding or Replacing Object Modules
- •Removing Object Modules
- •Extracting Object Modules
- •Listing Library Contents
- •Error Messages
- •Fatal Errors
- •Errors
- •Chapter 11. Object-Hex Converter
- •Using OHx51
- •OHx51 Command Line Examples
- •Creating HEX Files for Banked Applications
- •OHx51 Error Messages
- •Using OC51
- •OC51 Error Messages
- •Intel HEX File Format
- •Record Format
- •Data Record
- •Extended 8086 Segment Record
- •Extended Linear Address Record
- •Example Intel HEX File
- •Appendix A. Application Examples
- •ASM – Assembler Example
- •Using A51 and BL51
- •Using AX51 and LX51
- •Using A251 and L251
- •CSAMPLE – C Compiler Example
- •Using C51 and BL51
- •Using C51 and LX51
- •Using C251 and L251
- •BANK_EX1 – Code Banking with C51
- •Using C51 and BL51
- •Using C51 and LX51
- •BANK_EX2 – Banking with Constants
- •Using C51 and BL51
- •Using C51 and LX51
- •Using BL51
- •Using C51 and LX51
- •Philips 80C51MX – Assembler Example
- •Philips 80C51MX – C Compiler Example
- •Appendix B. Reserved Symbols
- •Appendix C. Listing File Format
- •Assembler Listing File Format
- •Listing File Heading
- •Source Listing
- •Macro / Include File / Save Stack Format
- •Symbol Table
- •Listing File Trailer
- •Appendix D. Assembler Differences
- •Differences Between A51 and A251/AX51
- •Differences between A51 and ASM51
- •Differences between A251/AX51 & ASM51
- •Glossary
- •Index
Keil Software — A51/AX51/A251 Macro Assembler and Utilities |
321 |
|
|
Output File Controls
The linker/locator either generates absolute object files or banked object files. |
9 |
||||
Absolute object files contain no relocatable information or external references. |
|||||
Absolute object files can be loaded into debugging tools or may be converted |
|
|
|||
into Intel HEX files for PROM programming by OHx51 Object-Hex Converter. |
|
|
|||
Banked object files generated by the BL51 linker/locater must be converted by |
|
|
|||
the OC51 Banked Object File Converter into absolute object files (one for each |
|
|
|||
bank) to convert them into Intel HEX files by the OH51 Object-Hex Converter. |
|
|
|||
The generated object module may contain debugging information if the |
|
|
|||
linker/locator is so directed. This information facilitates symbolic debugging |
|
|
|||
and testing. You may use the linker controls to suppress debugging information |
|
|
|||
in the object file. The following table provides an overview of the controls that |
|
|
|||
control information in the output file. For a detailed description of each control |
|
|
|||
refer to the page specified in the table. |
|
|
|
|
|
|
|
|
|
|
|
BL51 |
LX51, L251 |
Page |
Description |
|
|
– |
ASSIGN |
322 |
Defines public symbols on the command |
|
|
|
|
|
line. |
|
|
IBANKING |
– |
323 |
Generate bank switch code for Infineon |
|
|
|
|
|
TV TEXT devices SDA555x and |
|
|
|
|
|
SDA30C16x. |
|
|
NAME |
NAME |
323 |
Specifies a module name for the object |
|
|
|
|
|
file. |
|
|
NOAJMP |
NOAJMP |
325 |
Generate bank switch code without |
|
|
|
|
|
AJMP instructions. |
|
|
NOINDIRECTCALL |
NOINDIRECTCALL |
327 |
Do not generate by default bank switch |
|
|
|
|
|
code for indirectly called functions. |
|
|
NOJMPTAB |
– |
328 |
Do not generate bank switch code. |
|
|
– |
NOTYPE |
327 |
Specifies a module name for the object |
|
|
|
|
|
file. |
|
|
NODEBUGLINES |
OBJECTCONTROLS |
325 |
Excludes debug information from the |
|
|
NODEBUGPUBLICS |
|
330 |
object file. |
|
|
NODEBUGSYMBOLS |
|
|
|
|
|
|
322 |
Chapter 9. Linker/Locator |
|
|
|
|
ASSIGN |
|
9 |
Restriction: |
This control is available in LX51 and L251 only. |
|
Abbreviation: |
AS |
|
Arguments: |
ASSIGN (symname (value) , ... ) |
|
Default: |
None |
|
µVision2 Control: Options – Lx51 Misc – Assign. |
|
|
Description: |
ASSIGN defines a PUBLIC symbol whit a numeric value at |
|
|
Lx51 linker/locater level. The PUBLIC symbol is handled |
as a number without a specific memory class and matches with an unresolved external symbol with the same name.
Example: |
L251 MYFILE.OBJ ASSIGN (FUNC (0x2000), BITVAR (20H.2)) |
|
|
|
In this example the public symbols FUNC and BITVAR are |
|
defined. The value 0x2000 is given as value for FUNC. |
|
The value 20H.2 is used as bit-address for BITVAR. |
Keil Software — A51/AX51/A251 Macro Assembler and Utilities |
323 |
|
|
IBANKING
Restriction: |
This control is available in BL51 only. |
9 |
||
Abbreviation: |
IB |
|
|
|
|
|
|
||
Arguments: |
IBANKING (bank_sfr_address) |
|
||
Default: |
The default bank_sfr_address is 0x94. This is also the SFR |
|
||
|
address for the support Infineon devices. |
|
||
µVision2 Control: Options – Lx51 Misc – Misc Controls – enter the control. |
|
|||
Description: |
With the BL51 linker/locater control IBANKING the linker |
|
||
|
uses the on-chip code banking hardware of the Infineon |
|
||
|
SDA30C16x/26x and SDA555x TV TEXT devices. The |
|
||
|
BL51 linker/locater places automatically all code segments |
|
||
|
in the bank area, which do not have the ?CO? prefix or ?CO |
|
||
|
postfix. Segments with a ?CO prefix or postfix are placed |
|
||
|
into the common area. |
|
||
|
The module L51_BANK.A51 is not used when the control |
|
||
|
IBANKING is used. The BL51 linker/locater generates in |
|
||
|
this operation mode a jump table with the following format: |
|
||
|
|
|
|
|
|
MOV |
bank_sfr,#BANK_NUMBER |
|
|
|
LJMP |
target |
|
|
See Also:
Example:
NOTE
When you are using this directive, you need also special C51 run-time libraries. Please contact Keil Software to obtain these C51 run-time libraries.
NOAJMP, NOINDIRECTCALL, NOJMPTAB, BANKAREA
BL51 BANK0 {MODULA.OBJ}, BANK1 {MODULB.OBJ} IBANKING
BL51 BANK0 {MODULA.OBJ}, BANK1 {MODULB.OBJ} IB (80H)
|
324 |
Chapter 9. Linker/Locator |
|
|
|
|
NAME |
|
9 |
Abbreviation: |
NA |
|
Arguments: |
NAME (modulename) |
|
Default: |
Module name of the first object file in the input list is used. |
|
µVision2 Control: |
Options – Lx51 Misc – Misc Controls – enter the control. |
|
Description: |
Use the NAME control to specify a module name for the |
|
|
absolute object module that the BL51 linker/locator |
generates. The NAME control may be accompanied by the module name (in parentheses) that you want to assign. If no module name is specified with the NAME control, the name of the first input module is used for the module name.
NOTE
The module name specified with the NAME control is not the filename of the absolute object file. The module name is stored in the object module file and may be accessed only by a program that reads the contents of that file.
Example: |
BL51 MYPROG.OBJ TO MYPROG.ABS NAME(BIGPROG) |
|
|
|
In this example BIGPROG is the module name stored in the |
|
object file. |
Keil Software — A51/AX51/A251 Macro Assembler and Utilities |
325 |
|
|
NOAJMP
Abbreviation: |
NOAJ |
9 |
|
Default: |
The Lx51 linker/locater generates for code banking |
||
|
|||
|
applications an inter-bank jump table. This bank switch |
|
|
|
table is used for jumps into a code bank from a different |
|
|
|
code bank or the common area. Depending on the table size, |
|
|
|
the linker uses AJMP or LJMP instructions within this bank |
|
|
|
switch table. |
|
|
µVision2 Control: Options – Lx51 Misc – Misc Controls – enter the control. |
|
||
Description: |
With the NOAJMP control you can disable the AJMP |
|
|
|
instruction in the inter-bank jump table. This option is |
|
|
|
required for 8051 derivatives that are not supporting the |
|
|
|
AJMP instruction. |
|
|
See Also: |
IBANKING, NOINDIRECTCALL, NOJMPTAB, |
|
|
|
BANKAREA |
|
|
Example: |
BL51 MYPROG.OBJ NOAJMP |
|
|
326 |
Chapter 9. Linker/Locator |
|
|
|
|
|
|
NODEBUGLINES, NODEBUGPUBLICS, |
||
9 |
NODEBUGSYMBOLS |
||
Restriction: |
This control is available in BL51 only. For LX51 and L251 |
||
|
|
use the OBJECTCONTROLS control. |
|
|
|
||
|
Abbreviation: |
NODL, NODP, NODS |
|
|
Default: |
Include complete debug information in the output file. |
|
|
µVision2 Control: Options – Lx51 Misc – Misc Controls – enter the control. |
||
|
Description: |
The NODEBUGLINES control directs the BL51 |
|
|
|
linker/locator to exclude line number information from the |
|
|
|
output object file. |
|
|
|
The NODEBUGPUBLICS control excludes public symbol |
|
|
|
information from the output object file. |
|
|
|
The NODEBUGSYMBOLS control excludes local symbol |
|
|
|
information from the output object file. |
|
|
|
|
|
|
|
NOTE |
|
|
|
Line number and symbol information in the absolute object |
|
|
|
file is used for symbolic debugging in the µVision2 debugger |
|
|
|
or in-circuit emulator. If you exclude debug information, |
|
|
|
source level debugging of your program is no longer |
|
|
|
possible. |
|
|
See Also: |
NOLINES, NOPUBLICS, NOSYMBOLS, |
|
|
|
OBJECTCONTROLS, PRINTCONTROLS |
|
Example: |
BL51 MYPROG.OBJ NODEBUGLINES NODEBUGSYMBOLS |
|
Keil Software — A51/AX51/A251 Macro Assembler and Utilities |
327 |
|
|
NOINDIRECTCALL
Abbreviation: |
NOIC |
9 |
|
||
Default: |
In code banking applications, the Lx51 linker/locater inserts |
|
|
an interbank CALL for each function that is indirectly called |
|
|
via a function pointer. This is done (by the linker) to ensure |
|
|
that functions which are invoked through a function pointer |
|
|
are available to all code banks. |
|
µVision2 Control: Options – Lx51 Misc – Misc Controls – enter the control.
Description: The NOINDIRECTCALL control allows you to disable the generation of interbank CALLs (for indirect function calls). This directive is useful if your application uses tables that contain pointers to functions and if you ensure that these indirect function calls never cross a code bank.
See Also: |
IBANKING, NOAJMP, NOJMPTAB, BANKAREA |
|
Example: |
|
|
BL51 MYPROG.OBJ NOINDIRECTCALL |
||
|
|
328 |
|
Chapter 9. Linker/Locator |
|
|
|
|
|
NOJMPTAB |
|
|
9 |
Restriction: |
This control is available in BL51 only. |
|
|
Abbreviation: |
NOJT |
|
|
Default: |
The Lx51 linker/locater generates for code banking |
|
|
|
automatically an inter-bank jump table or bank switch table. |
|
|
|
For each function that is located in a code bank and is called |
|
|
|
from a different code bank or the common area the linker |
|
|
|
inserts a bank switch code into the inter-bank jump table |
|
|
|
redirects the function call to this table. |
|
|
µVision2 Control: Options – Lx51 Misc – Misc Controls – enter the control. |
||
|
Description: |
When the NOJMPTAB control is stated, BL51 no longer |
|
|
|
inserts inter-bank calls for program calls. This feature is |
|
|
|
implemented to use the user-defined bank switch mechanism |
|
|
|
for code banking. The NOJMPTAB directive modifies the |
|
|
|
following features of BL51: |
|
|
|
|
The linker no longer needs the bank switch configuration |
|
|
|
file: L51_BANK.OBJ. |
|
|
|
The linker does not modify any jump call instructions. |
|
|
The linker does not generate any warnings if a jump/call is |
|
|
|
made to another bank. The user must ensure that the proper |
|
|
|
bank is selected before a call is made since the BL51 |
|
|
|
linker/locator no longer selects the bank automatically. |
|
|
See Also: |
IBANKING, NOAJMP, NOINDIRECTCALL, |
|
|
|
BANKAREA |
|
Example: |
BL51 MYPROG.OBJ NOJMPTAB |
|
Keil Software — A51/AX51/A251 Macro Assembler and Utilities |
329 |
|
|
NOTYPE
Restriction: |
|
This control is available in LX51 and L251 only. |
9 |
||
Syntax: |
|
NOTYPE |
|||
|
|
||||
Abbreviation: |
|
NOTY |
|
||
Default: |
|
Include complete type information in the output file. |
|
||
µVision2 Control: |
|
Options – Lx51 Misc – Misc Controls – enter the control. |
|
||
Description: |
|
The NOTYPE control removes symbol type information for |
|
||
|
|
debug symbols from the output file. The symbol type |
|
||
|
|
information is only required for program debugging and has |
|
||
|
|
no influence on the executable code. |
|
||
|
|
|
|
|
|
|
|
NOTE |
|
||
|
|
Symbol type information in the absolute object file is used |
|
||
|
|
for symbolic debugging in the µVision2 debugger or in- |
|
||
|
|
circuit emulator. The Cx51 compiler generates complete |
|
||
|
|
symbol information up to structure members and parameter |
|
||
|
|
passing values. If you exclude symbol type information, you |
|
||
|
|
might no be able to display variables during debugging. |
|
|
|
See also: |
|
OBJECTCONTROL, PURGE |
|
||
Example: |
|
|
|
|
|
|
LX51 file1.obj NOTYPE |
|
|
|
|
|
|
|
|
||
330 Chapter 9. Linker/Locator
OBJECTCONTROLS
9 |
Restriction: |
This control is available in LX51 and L251 only. |
|
|
Abbreviation: |
OC |
|
|
Arguments: |
OBJECTCONTROLS (subcontrol , … ) |
|
|
Default: |
Include complete debug information in the output file. |
|
|
µVision2 Control: Options – Lx51 Misc – Misc Controls – enter the control. |
||
|
Description: |
The OBJECTCONTROLS control allows you to remove |
|
|
|
specific debug information from the object output file. The |
|
|
|
subcontrol option can be one or more of the following |
|
|
|
parameters: |
|
|
|
|
|
|
|
subcontrol |
Removes from the object output file ... |
|
|
NOCOMMENTS |
... comment records. |
|
|
NOLINES |
... line number information. |
|
|
NOPUBLICS |
... public symbol information. |
|
|
NOSYMBOLS |
... local symbol information. |
|
|
PURGE |
... complete debug information. |
|
See Also: |
NOCOMMENTS, NOLINES, NOPUBLICS, |
|
|
|
NOSYMBOLS, OBJECTCONTROLS, PURGE |
|
Example: |
LX51 MYPROG.OBJ OBJECTCONTROLS (NOCOMMENTS) |
|
