Keil Logo

Translate and Link Process

Typically you will use the A251 assembler and the tools within the µVision IDE. For more information on using the µVision IDE refer to the User's Guide µVision: Getting Started.

However, you may invoke the A251 assembler also from the command line. Simply type the name of the assembler version that you want to use, for example A251 at the Windows command prompt. On this command line, you must include the name of the assembler source file to be translated, as well as any other necessary control directives required to translate your source file. Example:

A251 DEMO.A51

The assembler output for this command line is:

A251 MACRO ASSEMBLER V6.00
ASSEMBLY COMPLETE.  0 WARNING(S), 0 ERROR(S)

After assembly of all your program modules, the object modules are linked and all variables and addresses are resolved and located into an executable program by the L251 linker. The following example shows a simple command line for the linker:

L251 DEMO.OBJ, PRINT.OBJ

The linker generates an absolute object file as well as a map file that contains detailed statistic information and screen messages. The output of the linker is:

L251 LINKER/LOCATER V4.00
LINK/LOCATE RUN COMPLETE.  0 WARNING(S),  0 ERROR(S)

Then you might convert the executable program into an Intel HEX file for PROM programming. This is done with the OH251 hex conversion utility with the following invocation:

OH251 DEMO

The output of the hex conversion utility is:

OBJECT TO HEX FILE CONVERTER OH51 V2.40
GENERATING INTEL HEX FILE: DEMO.HEX
OBJECT TO HEX CONVERSION COMPLETED.

An example listing file generated by the assembler is:

A251 MACRO ASSEMBLER  ASSEMBLER DEMO PROGRAM      27/04/07 11:11:09 PAGE 1

MACRO ASSEMBLER A251 V3.52
OBJECT MODULE PLACED IN Demo.OBJ
ASSEMBLER INVOKED BY: C:\Keil_v5\C251\BIN\A251.EXE Demo.a51 MODSRC INTR2
                      SET(TINY) DEBUG EP

LOC    OBJ             LINE     SOURCE
                          1     $title   (ASSEMBLER DEMO PROGRAM)
                          2     ; A simple Assembler Module Demo
                          3
                          4     ; Symbol Definition
 000D                     5     CR      EQU  13         ; Carriage?Return
 000A                     6     LF      EQU  10         ; Line?Feed
                          7
                          8     ; Segment Definition
------                    9     ?PR?DEMO  SEGMENT  CODE ; Program Part
------                   10     ?CO?DEMO  SEGMENT  CODE ; Constant Part
                         11
                         12     ; External Definition
                         13     EXTRN CODE (PRINTS)
                         14
                         15     ; The Program Start
000000                   16             CSEG  AT  0     ; Reset Vector
000000 020000     F      17             JMP   START
                         18
------                   19             RSEG  ?PR?DEMO  ; Program Part
000000 900000     F      20     START:  MOV   DPTR,#TXT ; Demo Text
000003 120000     E      21             CALL  PRINTS    ; Print String
                         22     ;
000006 8000       F      23             JMP   START     ; Repeat forever
                         24
                         25     ; The Text Constants
------                   26             RSEG  ?CO?DEMO  ; Constant Part
000000 48656C6C          27     TXT:    DB    'Hello World',CR,LF,0
000004 6F20576F
000008 726C640D
00000C 0A00
                         28
                         29             END             ; End of Module

A251 MACRO ASSEMBLER  ASSEMBLER DEMO PROGRAM      27/04/07 11:11:09 PAGE 1

SYMBOL TABLE LISTING
------ ----- -------

N A M E             T Y P E  V A L U E     ATTRIBUTES

?CO?DEMO . . . . .  C  SEG   00000EH       REL=UNIT, ALN=BYTE
?PR?DEMO . . . . .  C  SEG   000008H       REL=UNIT, ALN=BYTE
CR . . . . . . . .  N  NUMB  000DH     A
LF . . . . . . . .  N  NUMB  000AH     A
PRINTS . . . . . .  C  ADDR  -------       EXT
START. . . . . . .  C  ADDR  0000H     R   SEG=?PR?DEMO
TXT. . . . . . . .  C  ADDR  0000H     R   SEG=?CO?DEMO

REGISTER BANK(S) USED: 0

ASSEMBLY COMPLETE.  0 WARNING(S), 0 ERROR(S).
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

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.