GNU Compatibility. NXP CodeWarrior Development Studio
Reklama
Reklama
Chapter 12 Assembler
assembly_statement
parms ::=
parameter [ ,
parameter ]...
NOTE
If you specify parameters for a macro, you must enclose them in parentheses.
name parameter assembly_statement
Table 12-14. Syntax Elements: #define Directive
Element Description
Label that invokes the macro.
Operand the assembler passes to the macro.
An assembly language statement. To extend the statement beyond the length of one physical line, type a backslash (\) at the end of a line, then continue the statement on the next line.
To specify multiple statements on the same line, separate then with semicolon and backslash characters (;\).
12.4 GNU Compatibility
The CodeWarrior Assembler supports several GNU-format assembly language extensions.
•
•
•
12.4.1 GNU Compatible Syntax option
Only in cases where GNU's assembler format conflicts with that of the CodeWarrior assembler does the GNU Compatible Syntax option have any effect. Specifically:
• Defining Equates
Whether defined using .equ or .set, all equates can be re-defined.
• Ignored directives
The .type directive ignored.
CodeWarrior Development Studio for Power Architecture Processors Build Tools Reference Manual, Rev.
10.6, 02/2014
Freescale Semiconductor, Inc.
209
GNU Compatibility
• Undefined Symbols
Undefined symbols are automatically treated as imported
• Arithmetic Operators
< and > mean left-shift and right-shift instead of less than and greater than.
! means bitwise-or-not instead of logical not.
• Precedence Rules
Precedence rules for operators are changed to be compatible with GNU rather than with C.
• Local Labels
Local labels with multi-number characters are supported (example: "1000:"). There is no limit on the number of digits in the label name. Multiple instances of the label are allowed. When referenced, you get the nearest one - forwards or backwards depending on whether you append 'f' or 'b' to the number.
• Numeric Constants
Numeric constants beginning with 0 are treated as octal.
• Semicolon Use
Semicolons can be used as a statement separator.
• Unbalanced Quotes
A single unbalanced quote can be used for character constants. For example: .byte 'a
12.4.2 Supported Extensions
Some GNU extensions are always available, regardless whether you enable GNU
compatible syntax . Specifically:
• Lines beginning with # * or ; are always treated as comment, even if the comment symbol for that assembler is someting different.
• Escape characters in strings extended to include
\xNN
for hex digits and
\NNN
for octal.
• Binary constants may begin with
0b
.
• Supports the GNU macro language, with macros defined by:
CodeWarrior Development Studio for Power Architecture Processors Build Tools Reference Manual, Rev.
10.6, 02/2014
210 Freescale Semiconductor, Inc.
Chapter 12 Assembler
.macro name,arg1[=default1],arg2...s1
...
.endm
Arguments may have default values as shown, and when called may be specified by value or position. See the GNU documentation for details.
• New or enhanced directives (see GNU documentation for details)
Table 12-15. Supported GNU Assembler
Directives
Directive
.abort
.align N,[pad]
Description
End assembly
Align
.app-file name
.balign[wl] N,[pad]
.comm name,length
.def
.desc
.dim
.eject
.endr
.endef
.fill N,[size],[val]
.hword val..
.ident
.ifnotdef name
.include name
.int val..
.irp name,values
.irpc name,chars
.lcomm name,length
.lflags
.ln lineno
.list
.local name
.macro name, args..
Source name
Align
Common data
Debugging
Debugging
Debugging
Eject page
End repeat
Debugging
Repeat data
Half-word
Tags
Conditional
Include file
Word
Repeat
Repeat
Local common
Ignored
Line number
Listing on
Local macro var
Macros
Comment
Supported
Now accepts optional padding byte
Synonym for .file
Align to N (with optional padding value)
Reserve space in BSS for global symbol
Accepted but ignored
Accepted but ignored
Accepted but ignored
Accepted but ignored
See .irp, .irpc
Accepted but ignored
Emit N copies of width 'size', value 'val'
Synonym for .short
Accepted but ignored
Synonym for .ifndef
Now accepts single, double or no quotes
Synonm for .long
Repeat up to .endr substituting values for name
Repeat up to .endr substituting chars for name
Reserve length bytes in bss
Accepted but ignored
Synonym for .line
Switch on listing
Declare name as local to macro
Supports Gnu syntax, default values, etc
Table continues on the next page...
CodeWarrior Development Studio for Power Architecture Processors Build Tools Reference Manual, Rev.
10.6, 02/2014
Freescale Semiconductor, Inc.
211
GNU Compatibility
Directive
.nolist
.org pos,fill
.p2align[wl] N[,pad]
.psize
.rept N
.sbttl
.scl
.size name,N
.skip N[,pad]
.space N[,pad]
.stabd
.stabn
.stabs
.str "string"
.string "string"
.tag
.title
.type
.val
.word
Table 12-15. Supported GNU Assembler Directives
(continued)
Description
Listing off
Origin
Align
Page size
Repeat
Subtitle
Debugging
Set size
Space
Space
Debugging
Debugging
Debugging
Constant string
Constant string
Debugging
Title
Debugging
Debugging
Word
Comment
Disable listing
Now allows fill value ot be specified
Align to 2**N, using pad value
'pad'
Accepted but ignored
Repeat block up to .endr N times
Accepted but ignored
Accepted but ignored
Set size of name to N
Skip N bytes, pad with 'pad'
Skip N bytes, pad with 'pad'
Accepted but ignored
Accepted but ignored
Accepted but ignored
Synonym for .asciz
Synonym for .asciz
Accepted but ignored
Accepted but ignored
Ignored in Gnu mode
Accepted but ignored
Synonym for .long
12.4.3 Unsupported Extensions
Among the GNU extensions that the CodeWarrior Assembler does not support are:
• Sub-sections (such as "
.text 2
"). The sub-section number will be ignored.
As a workaround, you can create your own sections with the
.section <name>
directive.
You may have an arbitrary number of text subsections with the names
.text1
,
.text2
, etc.
• Assignment to location counter (such as "
. = .+4
")
As a workaround, you can advance the location counter with
.space <expr>
• Empty expressions defaulting to 0. Example: ". byte ,
" equivalent to "
.byte 0,0
")
CodeWarrior Development Studio for Power Architecture Processors Build Tools Reference Manual, Rev.
10.6, 02/2014
212 Freescale Semiconductor, Inc.
Chapter 12 Assembler
There is no workaround for this. You must always supply the arguments.
•
.linkonce
directive
The linker automatically detects logically-identical sections, and uses the following factors to determine whether to keep only one or both in the final image:
• the binding of the symbols associated with each section
• the location of these two sections. For example, are the sections in the same
•
.octa
overlay or overlay group? Is one in main, and the other in an overlay group?
We do not support 16-byte numbers directly. As a workaround, you may use consecutive
.long
directives to build a large number in memory.
•
.quad
We do not support eight-byte numbers directly. As a workaround, you may use consecutive
.long
directives to build a large number in memory.
CodeWarrior Development Studio for Power Architecture Processors Build Tools Reference Manual, Rev.
10.6, 02/2014
Freescale Semiconductor, Inc.
213
GNU Compatibility
CodeWarrior Development Studio for Power Architecture Processors Build Tools Reference Manual, Rev.
10.6, 02/2014
214 Freescale Semiconductor, Inc.
Preuzimanje
Reklama