Motorola dsp assembler Reference Manual



Yüklə 4,8 Kb.
Pdf görüntüsü
səhifə24/91
tarix08.10.2017
ölçüsü4,8 Kb.
#3546
1   ...   20   21   22   23   24   25   26   27   ...   91

Software Project Management
Example 2: Overlays
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-19
Note that the ORG to P space does not specify an absolute address. In order to obtain
the same result from these files as in an absolute mode implementation the following link-
er command line would be used:
DSPLNK  -B  -M  -OXE:100  -OPI:200  OVLPROJ  OVER1  OVER2  OVER3
The linker scans the command line and sets the base addresses for X and P memory.
Here the X default counter is set to hex 100 and mapped to external memory; likewise the
P default counter is set to hex 200 and mapped to internal memory. Base addresses can
also be established with the linker memory control file.
The linker reads each input object file, placing the header file in internal P memory and
combining the overlay modules into a contiguous block loaded into external X memory at
location 100 hexadecimal. Any labels or jumps within the overlay blocks are resolved to
addresses relative to the relocatable symbol OVLBASE. Since OVLBASE is the first load
P memory address it is assigned the value 200 hexadecimal. The linker does not guaran-
tee that a given symbol or section will begin at a particular location unless that information
is explicitly specified in the linker memory control file. For more information on specific
linker operations see the Motorola DSP Linker/Librarian Reference Manual.


Software Project Management
Example 3: Bootstrap Overlay
4-20
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
4.8
  EXAMPLE 3: BOOTSTRAP OVERLAY
Many Motorola DSP processors, specifically those with RAM-based program memory,
support a bootstrap mode of operation. This involves mapping a built-in ROM-based boot-
strap program into P memory, executing the program to move user-supplied code from
another location (usually EPROM) into program RAM, then transferring control to the user
program. Because the user program is loaded in one location (e.g. EPROM) but moved
to another for execution, it is a natural application for assembly language overlay seman-
tics. Another wrinkle in bootstrap mode is that user instruction words are loaded in byte-
wise fashion, such that the load location counter must be incremented by bytes rather
than words. Consider the following section fragments contained in two files called
SECT1.ASM and SECT2.ASM respectively:
SECTION
SECT1
ORG
PI(1):,PE(2)
START1
.
.

.
.
END1
ENDSEC
. . .
SECTION
SECT2
ORG
PI(1):,PE(2)
START2
.
.

.
.
END2
ENDSEC


Software Project Management
Example 3: Bootstrap Overlay
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-21
4.8.1
  Absolute Mode Implementation
In order to avoid binding addresses within the individual modules, the programmer could
devise a preamble file called BOOTPROJ.ASM which sets the appropriate options and
establishes load and runtime base addresses:
OPT
LB
; increment load counter by
bytes
ORG
PI(1):$100,PE(2):$C000
; set runtime RAM address,
; bytewide load ROM ad-
dress
The OPT directive with the LB option indicates that the Assembler should increment the
load counter by the number of bytes in the target processor word. This guarantees that
the EPROM addresses will be correct for bytewide loading during bootstrap processing.
In the ORG directive, the runtime location counter, tagged as 1 and mapped to internal
memory, is set to hex 100. The load counter is tagged as 2, mapped to external memory,
and set to hex C000, where the built-in bootstrap program will begin loading bytes after
processor reset. The files are assembled using the command below:
ASM56100  -A  -B  -L  BOOTPROJ   SECT1  SECT2
The Assembler is invoked in absolute mode (-A option), and generates an executable and
listing file. All files on the command line are processed as a single assembly run and all
are used to produce the output. BOOTPROJ.ASM is read first and sets up the appropriate
absolute addresses for later sections. Since no explicit base address was given in the sec-
tion files, both load and runtime addresses will continue from one section to the other, e.g.
they will be contiguous. For example, if only two words of instruction were between each
of the START and END labels, the runtime value for END1 and START2 would be hex
102. However, the load address of the code associated with these labels, assuming a 16
bit target word size, would be C004 hexadecimal. Similarly, the runtime value for END2
would be 104 hex and the corresponding load address would be C008 hexadecimal.
4.8.2
  Relative Mode Implementation
In relative mode each of the source files is assembled separately to create individual ob-
ject files. The object files are combined to build a single executable file. A preamble file is
not necessary to handle bootstrap files in relative mode because the addresses are es-
tablished at link time. In order to generate bytewide load addresses the LB option can be
specified on the Assembler command line using the -O command line option:
ASM56100  -B  -L  -OLB  SECT1
This command assembles the file SECT1.ASM and creates a relocatable object file called
SECT1.CLN. The listing file shows that the starting address of the section is zero; howev-
er, because of the LB option on the command line the load counter will increment at twice
the rate of the runtime counter (assuming a 16 bit DSP56100 family target processor). A


Yüklə 4,8 Kb.

Dostları ilə paylaş:
1   ...   20   21   22   23   24   25   26   27   ...   91




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə