Motorola dsp assembler Reference Manual



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

Software Project Management
Example 1: Multi-programmer Environment
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-13
4.6
  EXAMPLE 1: MULTI-PROGRAMMER ENVIRONMENT 
Typical multi-programmer projects are often split into tasks representing functional units.
For discussion purposes, suppose a project has been divided into three tasks - I/O,
FILTER, and MAIN. Each task will be written by a separate programmer as a separate
section. For example, when the I/O task has been written, there will be a file called
IO.ASM. This file will have the following form:
SECTION I_O
XREF I_PORT,O_PORT
ORG  XL:
.
.

.
.
ORG  P:
.
.

.
.
ENDSEC
In this example, because the X space storage locations were defined within the section
I_O, they will be private storage locations that are accessible only by the I_O handler, and
cannot be referenced by other sections.  If global memory resource management is de-
sired, then the I_O section would not have defined any storage locations, and these would
have been defined as XREF.  The X space data will be addressed through the Low
runtime counter.  The P memory code is also private to the I_O section and uses the de-
fault runtime location counter for address generation.
In the discussion below, assume that the programmers responsible for the FILTER and
MAIN sections have similar program structures located in files named FILTER.ASM and
MAIN.ASM respectively.  The program units can be combined either by invoking a final
assembly step to assign absolute addresses, or by assembling the modules separately
and then linking.


Software Project Management
Example 1: Multi-programmer Environment
4-14
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
4.6.1
  Absolute Mode Implementation
To assemble the entire project source code, a new file called PROJECT.ASM would be
created and would have the form:
ORG  XLE:$0000
.

.
ORG  YLE:$0000
.

.
ORG  YH:$FFC0
.

.
ORG  XH:$FFC0
.

.
; initialize internal low Program memory location counter
ORG  PL:$1000
; initialize external high Program memory location counter
ORG  PHE:$F000
INCLUDE 'MAIN.ASM'
INCLUDE 'IO.ASM'
INCLUDE 'FILTER.ASM'
END  ENTRY
This file provides the project manager with a mechanism to organize memory utilization
to suit the application. For example, the external high P memory initialization statement
might correspond to the memory location of an external EPROM.
After the location counters corresponding to the X, Y, and P(rogram) memory spaces are
initialized, the Assembler is directed to take input from the MAIN.ASM file with the IN-
CLUDE directive. Within the MAIN.ASM file, the source statements are assembled and
object code is generated. The X, Y, L, and P(rogram) location counters (High, Low) are
advanced corresponding to the number of words generated for each memory space and
location counter in use.
When the end of the MAIN.ASM file is encountered, the Assembler returns to the next se-
quential statement in the PROJECT.ASM file. This directs the Assembler to start taking
input from the IO.ASM file. Within this file, the ORG PL: statement directs the Assembler


Software Project Management
Example 1: Multi-programmer Environment
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
4-15
to set the current memory space to P(rogram) and restore the last used P(rogram) L(ow)
location counter. The shown previously will be assem-
bled at the next available Low Program memory space. When the end of the IO.ASM file
is encountered, the X, Y, and P(rogram) location counters (High and Low) will have been
advanced corresponding to the number of words generated for each memory space.
In a similar manner, the file FILTER.ASM will be assembled. The last statement of the
PROJECT.ASM file informs the Assembler that this is the last logical source statement,
and the starting address for the object module will be a label called ENTRY. In the exam-
ple above, ENTRY would have been a label defined in the section MAIN and declared as
global with the XDEF directive.
4.6.2
  Relative Mode Implementation
Using the Assembler default relative mode, each of the source files is assembled sepa-
rately. For each section defined in the input files a separate set of location counters is
maintained such that all memory spaces for each section begin at relative address zero.
The linker is invoked to combine the files and establish base addresses:
DSPLNK  -B  -M  -OXLI:0  -OYLI:0  -OYH:FFC0  -OXH:FFC0  \
-OPL:1000  -OPHE:A000  MAIN  IO  FILTER
The linker reads the command input and sets up base values for all counters specified on
the command line. In this example, the X and Y low memory counters are initialized to ze-
ro, whereas the X and Y high memory counters are set to FFC0 hexadecimal. The pro-
gram low and high memory counters are initialized similarly. When the linker creates the
executable file it reads the input files and sets the starting address for all sections relative
to the values obtained from the command line. As the MAIN object file is read the linker
increments the section counters for all appropriate memory spaces.
After the MAIN object file is processed, the IO object file is read. The section named I_O
contained an ORG directive indicating a switch to the low X data memory counter. Recall
that the Assembler generated relocatable code for the I_O section source such that the
low X data memory counter begins at zero. The linker adjusts the low X memory counter
associated with section I_O to reflect any previous data generation performed in low X
memory (e.g. in MAIN). The FILTER module is linked in a similar fashion.
Another way for specifying base addresses, instead of lengthy command line options, is
through a memory control file. The memory control file allows the programmer to indi-
cate memory space starting addresses analogously to the command line approach. In ad-
dition, the memory control file offers finer control over placement of sections in memory.
See the Motorola DSP Linker/Librarian Reference Manual for more information on the
memory control file.
The preceding examples described two methods for organizing a software project. Refer
to the descriptions of the ORG and SECTION directives in Chapter 6 for a more detailed
discussion. See also the Motorola DSP Linker/Librarian Reference Manual for more in-


Yüklə 4,8 Kb.

Dostları ilə paylaş:
1   ...   18   19   20   21   22   23   24   25   ...   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ə