| |
Datasheet Home \ Datasheet Details
Download
PDF Abstract Text:
2 ASSEMBLER
Figure 2-0. Table 2-0. Listing 2-0. Listing 2-0.
2 ASSEMBLER
Figure 2-0. Table 2-0. Listing 2-0. Listing 2-0.
Overview
The assembler section (or .SECTION) declaration referred to here corresponds to a linker input section.
Assembler Manual for ADSP-219x Family DSPs
Overview
The chapter contains the following information about the assembler: · "Assembler Guide" on page 2-3 · "Command-Line Reference" on page 2-21 · "Assembler Syntax Reference" on page 2-30 · "Assembler Glossary" on page 2-64
Assembler Manual for ADSP-219x Family DSPs
Assembler
Assembler Guide
Writing Assembly Programs
Assembler Manual for ADSP-219x Family DSPs
Assembler Guide
embed binary information in Debugging Information Format (DWARF-2) for source level debugging. Listing files are text files that you can read for information on the results of the assembly process.
The Release 7.0 assembler can process your source programs developed under Release 6.1. The assembly of these programs requires an additional processing step described in "Assembler Enhancements and Legacy Support" on page 3-1.
Assembler Manual for ADSP-219x Family DSPs
Assembler
Data initialization file (.DAT)
Assembly source file (.ASM)
Header file (.H)
Preprocessor
Intermediate preprocessed file (.IS)
Assembler
Object file (.DOJ)
Listing file (.LST)
Figure 2-1. Assembler Input & Output Files
Assembler Manual for ADSP-219x Family DSPs
Assembler Guide
· Assembler directives Directives begin with a period (.) and end with a semicolon ( ). The period must be the first character on the line containing your directive. The assembler does not differentiate between directives in lowercase or uppercase characters. Note that this manual prints directives in uppercase to distinguish them from other assembly statements.
Assembler Manual for ADSP-219x Family DSPs
Assembler
Example:
#include "string.h" #define MAX 100
Figure 2-2 on page 2-9 contains an example assembly source file. Program Structure An assembly source file must describe how code and data are mapped into the memory on your target DSP. There are two types of memory: data memory, which typically contains data and memory-mapped ports, and program memory, which typically contains code (and can also store data). The way you structure your code and data into memory should follow from the memory architecture of the target DSP. The mapping of code and data is accomplished using the .SECTION directive (formerly .DMSEG and .PMSEG). The .SECTION directive defines groupings of instructions and data that are set as contiguous memory addresses in the DSP. Each .SECTION name corresponds to an input sec-
Assembler Manual for ADSP-219x Family DSPs
Assembler Guide
tion name in the Linker Description File (.LDF). Some suggested section names that you could use in your assembly source appear in Table 2-1. Using these predefined names in your sources makes it easier to take advantage of the default Linker Description File included in your DSP system. For more information on the LDF, see the Linker & Utilities Manual for ADSP-21xx Family DSPs. Table 2-1. Suggested Input Section Names
.SECTION Name data1 data2 program Description A section in Data Memory that holds data. A section in Program Memory that holds data. A section in Program Memory that holds code.
You may create sections in a program by grouping elements to meet hardware constraints. To group code that reside in off-chip memory, declare a section for that code and place that section in the selected memory with the linker. Figure 2-2 on page 2-9 shows how a program divides into sections that match the program and data memory segmentation of a DSP system.
Assembler Manual for ADSP-219x Family DSPs
Assembler
Data Section Data Section
Data Section Code Section Assembler Directive Code Section Assembler Label and Instructions
Code Section Assembler Label Preprocessor Commands for Conditional Assembly
Assembly Instructions
Figure 2-2. Example Assembly Source File Assembler Manual for ADSP-219x Family DSPs 2-9
Assembler Guide
Assembler Manual for ADSP-219x Family DSPs
Assembler
RAM) RAM) ROM) RAM)
Assembler Manual for ADSP-219x Family DSPs
Assembler Guide
Assembler Manual for ADSP-219x Family DSPs
Assembler
for ADSP-219x Family DSPs, which also includes a series of examples to demonstrate how to mix C and assembly code.
Preprocessing a Program
Reading a Listing File
Assembler Manual for ADSP-219x Family DSPs
Assembler Guide
· Line - The third column contains the line number in the assembly source file. · Assembly Source - The fourth column contains the an assembly source line from the file. Note that no comments appear in the listing file. Building your source file with the preprocessor automatically removes all comments. To output comments in the listing output, you must skip preprocessing entirely using the -sp switch.
Setting Assembler Options
Assembler Manual for ADSP-219x Family DSPs
Assembler
Assembler Command-Line Reference
Assembler Manual for ADSP-219x Family DSPs
Assembler Command-Line Reference
Assembler Command-Line Interface
easm219x -switch1 -switch2 .. sourceFile
Where: · - Name of the assembler program for the ADSP-219x family DSPs.
easm219x
Assembler Manual for ADSP-219x Family DSPs
Assembler
-switch1, -switch2
- Switches to process.
The assembler offers many optional switches that select operations and modes for the assembler and preprocessor. Some assembler switches take a file name as a required parameter. ·
sourceFile
- Name of the source file to assemble.
Assembler Manual for ADSP-219x Family DSPs
Assembler Command-Line Reference
Table 2-2 summarizes file extension conventions that the assembler follows. Table 2-2. File Name Extension Conventions
Extension .asm File Description
Assembly source file. Note that the assembler treats all files with unrecognized
extensions as assembly source files with an .asm extension. .app .dsp .is .h .lst .doj .dat Release 6.1 preprocessed assembly source file. Release 6.1 assembly source file. Preprocessed assembly source file. Header file. Listing file. Assembled object file in ELF / DWARF-2 format. Data initialization file.
The assembler command line switches are case-sensitive. The following command line, for example:
runs the assembler with:
-219x
- Assembles instructions unique to the ADSP-219x DSPs. Directs the assembler to output the listing file.
- Defines the macro max as equal to 100.
Assembler Manual for ADSP-219x Family DSPs
Assembler
- Displays verbose information on each phase of the assembly. - Specifies the name and directory for the assembled
object output.
p1.asm
- Identifies the assembly source file to assemble.
The following command line, for example:
easm219x -legacy -c -o test.doj program2.dsp
runs the assembler with:
-legacy -c
- Processes source code developed under Release 6.1.
- Preserves case-sensitivity of assembly symbols. - Renames the assembled object file. - Specifies the source file of the 6.1 Release.
-o test.doj program2.dsp
Command-Line Options This section describes the easm219x command-line option set. A summary of the assembler switches appears in Table 2-3, and a brief description of each switch appears in "Command-Line Reference" on page 2-21. Table 2-3. easm219x Command-Line Switches
-Ao filename
Assembler Manual for ADSP-219x Family DSPs
Assembler Command-Line Reference
-Mt filename -o filename -pp -r -sp -verbose -version
Assembler Manual for ADSP-219x Family DSPs
Assembler
Command-Line Reference
Assembler Manual for ADSP-219x Family DSPs
Assembler Command-Line Reference
For example,
For more information about the RESOLVE() command, see the Linker and Utilities Manual for ADSP-21xx Family DSPs. -c The -c (preserve case) switch directs the assembler to preserve the casesensitive mode. Previous versions of the assembler software upper-cased program symbols by default. The new easm219x assembler preserves the case, i.e. is case-sensitive. Use the -c switch in combination with -legacy to preserve the original case of program symbols when re-assembling or linking legacy (coded in the previous version of the assembler language) and easm219x-written routines. For example, Release 6.1 assembler processes the CALL coded in your p1.dsp program:
asm21 p1.dsp asm21 p1.dsp -c Start
instruction
/ / produces a relocation against START / / produces a relocation against Start
Release 7.0 assembler re-assembles p1.dsp:
easm219x p1.dsp -legacy -219x easm219x p1.dsp -legacy -c -219x / produces a relocation against START / / produces a relocation against Start /
By default, Release 7.0 assembler differentiates between lowercase and uppercase characters Release 6.1 assembler does not.
Assembler Manual for ADSP-219x Family DSPs
Assembler
Assembler Manual for ADSP-219x Family DSPs
Assembler Command-Line Reference
subdirectory of the VisualDSP installation directory
· specified directory (a list of directories). The order of the list defines the order of multiple searches.
Current directory is your .dpj project directory, not the directory of the assembler program. Usage of full pathnames for the -I switch on the command line (omitting the disk partition) is recommended. For example,
-JumpCallShort2Long The -JumpCallShort2Long or -jcs2l (expand short instruction to long) directs the assembler to: · Disable diagnostic messages if the address offsets of the JUMP or CALL instruction exceeds their range. · Directs the linker to expand the out-of-range short JUMP / CALL instruction to long LJUMP / LCALL. If the -verbose switch is used, the linker issues a report on the provided changes. The assembler and linker encode the jump / call instruction based on its destination offset. For more information on the linker switch, see the Linker and Utilities Manual for ADSP-219x Family DSPs. -l filename The -l (listing) switch directs the assembler to generate the named listing file. Each listing file shows the relationship between your source code and instruction opcodes that the assembler produces. If you omit the filename, the assembler outputs an error message. For more information about listing files, see "Reading a Listing File" on page 2-13.
Assembler Manual for ADSP-219x Family DSPs
Assembler
-legacy The -legacy (accept legacy code) switch directs the assembler to process source programs developed using Release 6.1 assembler software. This compatibility switch calls an additional preprocessing step for legacy directives and syntax conventions summarized in Table 2-9 on page 2-44. The preprocessor generates an intermediate assembly file (.APP) using the name of the input source program. This temporary file is deleted upon successful completion of the assembly (unless the -sp switch is used). Note that legacy assembly automatically uppercases symbols. To preserve the original case of program symbols, use the -legacy -c combination. For more information about -c, see "-c" on page 2-22.
You may need to revise source code programs when re-assembling with easm219x. Please review any diagnostic or error messages issued during the assembly of Release 6.1 source program.
For information on how to revise Release 6.1programs so they comply with Release 7.0 assembler syntax, refer to "Assembler Enhancements and Legacy Support" on page 3-1. -M The -M (generate make rule only) assembler switch directs the preprocessor to output a rule, which is suitable for the make utility, describing the dependencies of the source file. After preprocessing, the assembler stops without assembling the source into an object file. The output, an assembly make dependencies list, is written to stdout in the standard command-line format:
Assembler Manual for ADSP-219x Family DSPs
Assembler Command-Line Reference
When the -o filename option is used with -M, the assembler outputs the make dependencies list to the named file. -MM The -MM (generate make rule and assemble) assembler switch directs the preprocessor to output a rule, which is suitable for the make utility, describing the dependencies of the source file. After preprocessing, the assembly of the source into an object file proceeds normally. The output, an assembly make dependencies list, is written to stdout in the standard command-line format:
easm21k -MM vectAdd.asm
the assembler appends the .DOJ extension to the source file name for the list of dependencies:
vectAdd.doj: MakeDepend.h vectAdd.doj: inits.dat
When the -o filename option is used with -MM, the assembler outputs the make dependencies list to stdout. -Mo filename The -Mo (output make rule) assembler switch specifies the name of the make dependencies file, which the assembler generates when you use the
Assembler Manual for ADSP-219x Family DSPs
Assembler
or -MM switch. If the named file is not in the current directory, you must provide the pathname in the double quotation marks ("").
The -Mo filename option takes precedence over the -o name option.
file-
-Mt filename The -Mt (output make rule for the named source) assembler switch specifies the name of the source file for which the assembler generates the make rule when you use the -M or -MM switch. If the named file is not in the current directory, you must provide the pathname in the double quotation marks (""). -o filename The -o (output) switch directs the assembler to use the specified filename argument for the object file. If you omit the switch or its argument, the assembler uses the input file name for the output and appends a .DOJ extension. You also can use this switch to specify filename for the preprocessed assembly file (.IS) - the only file that the preprocessor outputs when the -pp switch is selected. Some examples of this switch are as follows:
Assembler Manual for ADSP-219x Family DSPs
Assembler Command-Line Reference
-pp The -pp (proceed with preprocessing only) switch directs the assembler to run the preprocessor, but stop without assembling the source into an object file. By default, the preprocessor generates an intermediate preprocessed assembly file using the name of the source program and attaching an .IS extension to it. When assembling with the -pp switch, the .IS file is the final result of the assembly. -r The -r (remove preprocessor output) switch directs the assembler to remove lines that contain the preprocessor output information from the listing file. -sp The -sp (skip preprocessing) switch directs the assembler to assemble the source file into an object file without running the preprocessor. When the assembly skips preprocessing entirely (the -sp switch), no preprocessed assembly file (.IS) is created. -verbose The -v or -verbose (verbose) switch directs the assembler to display both version and command-line information for each phase of assembly. -version The -version (display version) switch directs the assembler to display version information for the assembler and preprocessor programs.
Assembler Manual for ADSP-219x Family DSPs
Assembler
-w The -w (disable all warnings) switch directs the assembler not to display warning messages generated during the assembly.
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
Assembler Keywords & Symbols
The assembler supports a set of predefined keywords that includes register and bitfield names, assembly instructions, and assembler directives. Listing 2-1 on page 2-32 lists the assembler keywords.
Assembler Manual for ADSP-219x Family DSPs
Assembler
AC AND ASTAT AX1 BM
ADDRESS AR AUX AYO BOOT
CALL CLRBIT
CE CLRINT
CIRC CNTR
DIS DMSEG EMUIDLE ENTRY EXPORT FL1
DIVQ DO ENA ERROR EXTERNEXTERNAL FL2
I2 I7 IFC INDENT IO
I3 ICNTR IFDEF INIT ISTAT
I4 ICTRL IFNDEF INIT24
L3 LE LOCAL
L4 LEFTMARGIN LOOP
M2 M7 MODIFY MR2 MYO NEG NOT NOT MV
M3 MACRO MODULE MSTAT MY1 NEWPAGE NOT AC
NONE NOT AV
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
OFFSETOF
PAGELENGTH PMSEG PRAGMA
PAGEWIDTH PMOVLAY PRECISION
PASS POP PREVIOUS
WARNING
WRITE
Listing 2-1. ADSP-219x Assembler Keywords
Assembler Manual for ADSP-219x Family DSPs
Assembler
You extend this set of keywords with symbols that declare sections, variables, constants, and address labels. When defining symbols in assembly source code, follow these conventions: · Define symbols that are unique within the file in which they are declared. If you use a symbol in more than one file, use the .GLOBAL directive to export the symbol from the file in which it is defined. Then use the .EXTERN directive to import the symbol into the other files. · Begin symbols with alphabetic characters.
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
Address label symbols may appear at the beginning of an instruction line or stand alone on the preceding line. The following disassociated lines of code demonstrate some symbol usage:
Assembler Manual for ADSP-219x Family DSPs
Assembler
Assembler Expressions
The assembler can evaluate simple expressions in source code. The assembler supports two types of expressions: · Constant expressions A constant expression is acceptable wherever a numeric value is expected in an assembly instruction or in a preprocessor command syntax. Constant expressions contain an arithmetic or logical operation on two or more numeric constants:
2.9e-5 + 1.29 (128 - 48) / 3 0x55 & 0x0f 7.6r - .8r
For information about fraction type support, refer to "Numeric Formats" on page 2-39. · Address expressions Address expressions contain a symbol + or - an integer constant:
Symbols in this type of expression are data variables, data buffers, and program labels. Adding or subtracting an integer from a symbol specifies an offset from the address the symbol represents.
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
Assembler Operators
Assembler Manual for ADSP-219x Family DSPs
Assembler
The assembler also supports special "address of", "length of", and "page of" operators. Table 2-5 lists and describes these operators used in constant and address expressions. Table 2-5. Special Assembler Operators
Operator ADDRESS(symbol) symbol LENGTH(symbol) PAGE(symbol) Usage Description Least significant 16 address bits of symbol. Address pointer to symbol. Length of symbol in words. Most significant 8 address bits associated with symbol.
The "address of", "length of", and "page of" operators can be used with external symbols - apply these special operators to symbols that are defined in other sections as .GLOBAL symbols.
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
The following example demonstrate how the assembler operators are used to load L (length) and I (index) registers when setting up circular buffers:
Assembler Manual for ADSP-219x Family DSPs
Assembler
Numeric Formats
The assembler supports binary, decimal, hexadecimal, and fractional numeric formats (bases) within expressions and assembly instructions. Table 2-6 describes the conventions of notation the assembler uses to distinguish between numeric formats. Table 2-6. Numeric Formats
Convention 0xnumber B#number b#number number numberr Description An "0x" prefix indicates a hexadecimal number. A "B#" or "b#" prefix indicates a binary number.
No prefix indicates a decimal number. An "r" suffix indicates a fractional number.
Fractional Type Support Fractional (fract) constants are specially marked floating-point constants to be represented in fixed-point. A fract constant uses the floating-point representation with a trailing "r", where "r" stands for "fract". The legal range is -1..1). Fracts are represented as signed values, which means the values must be greater than or equal -1 and less than 1. Example:
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
1.15 Fracts Fracts are 1.15 in the ADSP-21xx DSP family, meaning a sign bit and "15 bits of fraction". This is -1 to +1-215. For example, 1.15 maps the constant 0.5r to 214. The conversion formula used for ADSP-21xx DSP to convert from the floating-point to fixed-point uses a scale factor of 15:
Example:
1.0r Special Case is out of the fract range. Specify 0x7FFF for the closest approximation of 1.0r within the 1.15 representation.
Fractional Arithmetic The assembler supports arithmetic operations on fractional constants. As implemented, constant fract expressions are consistent with what is provided for other numeric types in the assembler. Doing fract constant arithmetic is sometimes necessary when one receives constants and wants to derive others from them.
Assembler Manual for ADSP-219x Family DSPs
Assembler
The internal (intermediate) representation for expression evaluation is a double floating-point value. Fract range checking is deferred until the expression is evaluated.
Mixed Type Arithmetic The assembler implementation currently supports arithmetic between fracts, but not fracts and integers.
Comment Conventions
The assembler supports C- and C++-style formats for inserting comments in assembly source code. Table 2-7 lists and describes these formats. Table 2-7. Comment Conventions
Convention / comment / / / comment Description A " / / " string encloses a multiple-line comment. A pair of slashes " / / " denote a single-line comment.
easm219x
assembler does not allow nested comments.
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
Assembler Directives
Directives in an assembly source file control the assembly process. Unlike instructions, directives do not produce opcodes during assembly. Use the following general syntax for the assembler directives:
Assembler Manual for ADSP-219x Family DSPs
Assembler
Table 2-8. Assembler Directives
.GLOBAL (see page 2-47) .LEFTMARGIN (see page 2-49) .NEWPAGE (see page 2-50) .PAGELENGTH (see page 2-51) .PAGEWIDTH (see page 2-52) .PREVIOUS (see page 2-53) .REPEAT() (see page 2-54) .SECTION (see page 2-56) .SIZE (see page 2-58) .TYPE (see page 2-59)
.VAR (see page 2-60) .VAR / INIT24 (see page 2-63)
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
Table 2-9. Release 6.1 Legacy Directives
Release 6.1 Directive .CONST (see page 3-8) .DMSEG (see page 3-9) .ENTRY (see page 3-11) .EXTERNAL (see page 3-12) .INCLUDE (see page 3-13) .INDENT (see page 3-15) Replaced With in Release 7.0 #define (see page 4-19) .SECTION / DATA or / DM (see page 2-56) .GLOBAL (see page 2-46) .EXTERN (see page 2-46) #include (see page 4-28) .LEFTMARGIN (see page 2-49), .PAGELENGTH (see page 2-51), and .PAGEWIDTH (see page 2-52) .VAR (see page 2-60) .VAR / INIT24 (see page 2-63) ## (concatenation) (see page 4-32) #define (see page 4-19) .SECTION / CODE or .SECTION / PM (see page 2-56) .SECTION / CODE or .SECTION / PM (see page 2-56) .VAR (see page 2-60) & .GLOBAL (see page 2-46) RESOLVE() (see page 2-21) Base registers B0-B7
.INIT (see page 3-16) .INIT24 (see page 3-16) .LOCAL (see page 3-19) .MACRO / .ENDMACRO (see page 3-21) .MODULE / .ENDMOD (see page 3-23)
.PMSEG (see page 3-9)
.PORT (see page 3-27) .VAR / ABS (see page 3-27) .VAR / CIRC (see page 3-27)
Assembler Manual for ADSP-219x Family DSPs
Assembler
.ALIGN, Specify an Address Alignment The .ALIGN directive forces the address alignment of an instruction or data item within the .SECTION it is used. The .ALIGN directive uses the following syntax:
.ALIGN expression
Where: · evaluates to an integer. The expression specifies the byte alignment requirement its value must be a power of 2. When aligning a data item or instruction, the assembler adjusts the address of the current location counter to the next address so it can be evenly divided by the value of expression, or aligned. The expression set to 0 or 1 signifies no address alignment requirement.
expression .ALIGN
Example:
directive, the default address align-
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
.EXTERN, Refer to a Globally Available Symbol The .EXTERN directive imports symbols that have been declared as .GLOBAL in other files. For more information on the .GLOBAL directive, see page 2-47. The .EXTERN directive uses the following syntax:
.EXTERN symbolName1, symbolName2, ..
Where: ·
symbolName
is the name of a global symbol to import. A single
.EXTERN directive can reference any number of separated by commas
symbols on one line. Example:
.EXTERN coeffs / / / / / / / / This code declares an external symbol to reference the global symbol declared in the example code in the .GLOBAL directive description (page 2-47).
Assembler Manual for ADSP-219x Family DSPs
Assembler
.FILE, Override the Name of an Object File The .FILE directive overrides the name of an object file specified with the command-line switch. This directive may appear in the C compiler-generated assembly source file (.S). The .FILE directive is used to ensure that the debugger has the correct file name for a symbol table. This directive is added in connection with overlay linking to enable overriding of the filename given on the command line.
-o filename
This directive uses the following syntax:
.FILE "filename.ext"
Where: ·
filename
is the name the assembler applies to the object file. The argument is enclosed in double quotes.
Example:
.FILE "vect.c" / / the argument may be a .c file .SECTION / DM data1 .. ..
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
.GLOBAL, Make a Symbol Globally Available The .GLOBAL directive changes the scope of a symbol from local to global, making the symbol available for reference in object files that are linked with the current one. By default, a symbol is valid only in the file in which it is declared. Local symbols in different files can have the same name, and the assembler considers them to be independent entities. Global symbols are recognizable in other files and refer to the same address and value. You change the scope of a symbol with the .GLOBAL directive. Once the symbol is declared global, other files may refer to it with .EXTERN. For more information on the .EXTERN directive, see page 2-46. The .GLOBAL directive uses the following syntax:
.GLOBAL symbolName1, symbolName2, ..
Where: · is the name of a global symbol. A single .GLOBAL directive may define the global scope of any number of symbols, separated by commas, on one line.
symbolName
Example:
Assembler Manual for ADSP-219x Family DSPs
Assembler
.LEFTMARGIN, Set the Margin Width of a Listing File The .LEFTMARGIN directive sets the margin width of the listing page. It specifies the number of empty spaces at the left margin of the listing file (.LST), which the assembler produces when you use the -l switch. In the absence of the .LEFTMARGIN directive, the printer advances 5 empty spaces for the left margin. The .LEFTMARGIN directive uses the following syntax:
.LEFTMARGIN expression
Where: · evaluates to an integer from 1 to 72. The expression value cannot exceed 72, the maximum number of columns per printed page. To change the default setting for the entire listing, place the .LEFTMARGIN directive at the beginning of your assembly source file.
expression
Example:
.LEFTMARGIN 9 / the listing line begins at column 10. /
directive, it ignores all of them except the last.
.LEFTMARGIN
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
.NEWPAGE, Insert a Page Break in a Listing File The .NEWPAGE directive inserts a page break in the printed listing file (.LST ), which the assembler produces when you use the -l switch. The assembler inserts a page break at the location of the .NEWPAGE directive. The .NEWPAGE directive uses the following syntax:
.NEWPAGE
This directive may appear anywhere in your source file. In the absence of the .NEWPAGE directive, a page is ejected after listing 66 lines.
Assembler Manual for ADSP-219x Family DSPs
Assembler
.PAGELENGTH, Set the Page Length of a Listing File The .PAGELENGTH directive controls the page length of the listing file (.LST), which the assembler produces when you use the -l switch. The .PAGELENGTH directive uses the following syntax:
.PAGELENGTH expression
Where: · evaluates to an integer from 1 to 66. It specifies the number of text lines per printed page. In the absence of the .PAGELENGTH directive, the listing file prints 66 lines per page. To format the entire listing, place the .PAGELENGTH directive at the beginning of your assembly source file.
expression
Example:
.PAGELENGTH 50 / / starts a new page / / after printing 50 lines
directive, it ignores all of them except the last.
.PAGELENGTH
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
.PAGEWIDTH, Set the Page Width of a Listing File The .PAGEWIDTH directive sets the page width of the listing file (.LST), which the assembler produces when you use the -l switch. The .PAGEWIDTH directive uses the following syntax:
.PAGEWIDTH expression
Where: · evaluates to an integer from 1 to 72. It specifies the maximum number of characters per row in the printed output. In the absence of the .PAGEWIDTH directive, a new line begins after 72 characters are printed on the preceding line. To change the default number of characters per line in the entire listing, place the .PAGEWIDTH directive at the beginning of the assembly source file.
expression
Example:
.PAGEWIDTH 36 / / starts a new line after 36 / / characters are printed on one line
.PAGEWIDTH
Assembler Manual for ADSP-219x Family DSPs
Assembler
.PREVIOUS, Revert to the Previously Defined Section The .PREVIOUS directive instructs the assembler to set the current section in program memory or data memory to the section that has been described directly before the current one. This directive uses the following syntax:
.PREVIOUS
Example:
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
Where: · The expression evaluates to a constant at assembly time. The expression is the total number of times the instruction sequence repeats. The lowest meaningful number is 1, .REPEAT(1) . Example:
Assembler Manual for ADSP-219x Family DSPs
Assembler
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
.SECTION, Declare a Memory Section The .SECTION directive marks the beginning of a program memory section or data memory section, which is an array of contiguous locations in your target DSP program memory or data memory. Statements between .SECTION and the following .SECTION directive or the end-of-file comprise the contents of the section. This directive uses the following syntax:
.SECTION / type sectionName sectionType
Memory / Section Type PM or CODE DM or DATA RAM ROM Description Memory that contains instructions and possibly data. Memory that contains data. Random access memory. Read only memory.
· The section name symbol, sectionName, is not limited in length and is case-sensitive. Section names must match the corresponding input section names used by the Linker Description File to place the
Assembler Manual for ADSP-219x Family DSPs
Assembler
If you select an invalid qualifier or disregard it entirely, the assembler exits with an error message.
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
.SIZE, Calculate the Size of a Function The .SIZE directive directs the assembler to mark the boundaries of a function, thus allowing for size calculation. The .SIZE directive may appear in the compiler-generated assembly source code as the statement following the last instruction of a function. This directive uses the following syntax:
.SIZE(functionSymbol, .-functionLabel)
Where: · ·
functionSymbol .-functionLabel
is the name of a function.
The assembler creates two relocations for each .SIZE directive - for the beginning and closing labels. The linker resolves the .SIZE directive at link time this provides correct size calculations of assembly functions that may change their size at link time. Example:
start: NOP NOP NOP .SIZE(start, .-start)
Assembler Manual for ADSP-219x Family DSPs
Assembler
.TYPE, Change Default Symbol Type The .TYPE directive enables the compiler to change the default symbol type of an object. This directive may appear in the compiler-generated assembly source file (.S). This directive uses the following syntax:
.TYPE symbolName, symbolType
Where: · · is the name of the object, which symbol type the compiler has changed.
symbolName
symbolType
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
.VAR, Declare a Data Variable or Buffer The .VAR directive declares and optionally initializes variables and data buffers. A variable uses a single memory location, and a data buffer uses an array of memory locations. When declaring or initializing variables, be aware of the following: · A .VAR directive is valid only if it appears within a section. The assembler associates the variable with the memory type of the section in which the .VAR appears. · A single .VAR directive can declare any number of variables or buffers, separated by commas, on one line. Unless the absolute placement for a variable is specified with the LDF RESOLVE() command, Release 7.0 linker places variables in consecutive memory locations. For example, .VAR x, y, z50 sequentially places symbols x, y and 50 elements of the buffer z in DSP memory, so as:
.VAR x .VAR y .VAR z50
The linker of the previous release places multiple variables in consecutive memory locations only if they were declared on the same line. · Referring to variables and buffers in code before declaring them, leads to syntax errors. · A single .VAR directive can declare any number of variables or buffers, separated by commas, on one line. · Initialized variables in program memory and data memory are 16-bit variables by default.
Assembler Manual for ADSP-219x Family DSPs
Assembler
· The number of initial values may not exceed the number of variables or buffer locations that you declare. · The .VAR directive may declare an implicit-size buffer. The number of initialization elements defines the length of the implicit-size buffer. The.VAR directive takes one of the following forms:
Where: · The user-defined varName and bufferName symbols identify variables and buffers. · The fileName parameter indicates that the elements of a buffer get their initial values from the fileName data file (.DAT). If the initialization file is in the current directory of your operating system, only the filename need be given inside brackets. Otherwise, you specify the directory and the name of the initialization file with the -I switch. · The ellipsis (..) represents a comma-delimited list of parameters.
The brackets ( ) that enclose the optional length are required. For more information, see the following .VAR examples.
Assembler Manual for ADSP-219x Family DSPs
Assembler Syntax Reference
· The optional length parameter defines the length of the associated buffer in words. The number of initialization elements defines length of an implicit-size buffer. · The initExpressions parameters set initial values for variables and buffer elements. The following lines of code demonstrate some .VAR directives:
Initializing from files is useful for loading buffers with data, such as filter coefficients or FFT phase rotation factors that are generated by other programs. The assembler determines how the values are stored in memory when it reads the data files. .VAR & ASCII String Initialization Support The easm218x assembler supports ASCII string initialization. This allows the full use of the ASCII character set, including digits, and special characters.
Assembler Manual for ADSP-219x Family DSPs
Assembler
String initialization takes one of the following forms:
Note that the number of initialization characters defines length of a string (implicit-size initialization). Example:
The assembler also accepts ASCII characters within comments. .VAR / INIT24 A special case of the .VAR directive, .VAR / INIT24, allows declaration and and initialization of 24-bits wide data structures in program memory sections. The.VAR / INIT24 directive takes the following form: The.VAR / INIT21 directive takes the following form:
Example:
Assembler Manual for ADSP-219x Family DSPs
Assembler Glossary
Assembler Manual for ADSP-219x Family DSPs
|