]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gas/doc/c-pru.texi
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / gas / doc / c-pru.texi
1 @c Copyright (C) 2015-2022 Free Software Foundation, Inc.
2 @c This is part of the GAS manual.
3 @c For copying conditions, see the file as.texinfo.
4 @c man end
5 @ifset GENERIC
6 @page
7 @node PRU-Dependent
8 @chapter PRU Dependent Features
9 @end ifset
10
11 @cindex PRU support
12 @menu
13 * PRU Options:: Options
14 * PRU Syntax:: Syntax
15 * PRU Relocations:: Relocations
16 * PRU Directives:: PRU Machine Directives
17 * PRU Opcodes:: Opcodes
18 @end menu
19
20 @node PRU Options
21 @section Options
22 @cindex PRU options
23 @cindex options for PRU
24
25 @c man begin OPTIONS
26 @table @gcctabopt
27
28 @cindex @code{mlink-relax} command-line option, PRU
29 @item -mlink-relax
30 Assume that LD would optimize LDI32 instructions by checking the upper
31 16 bits of the @var{expression}. If they are all zeros, then LD would
32 shorten the LDI32 instruction to a single LDI. In such case @code{@value{AS}}
33 will output DIFF relocations for diff expressions.
34
35 @cindex @code{mno-link-relax} command-line option, PRU
36 @item -mno-link-relax
37 Assume that LD would not optimize LDI32 instructions. As a consequence,
38 DIFF relocations will not be emitted.
39
40 @cindex @code{mno-warn-regname-label} command-line option, PRU
41 @item -mno-warn-regname-label
42 Do not warn if a label name matches a register name. Usually assembler
43 programmers will want this warning to be emitted. C compilers may want
44 to turn this off.
45
46 @end table
47 @c man end
48
49 @node PRU Syntax
50 @section Syntax
51 @menu
52 * PRU Chars:: Special Characters
53 @end menu
54
55
56 @node PRU Chars
57 @subsection Special Characters
58
59 @cindex line comment character, PRU
60 @cindex PRU line comment character
61 @samp{#} and @samp{;} are the line comment characters.
62
63
64 @node PRU Relocations
65 @section PRU Machine Relocations
66
67 @cindex machine relocations, PRU
68 @cindex PRU machine relocations
69
70 @table @code
71
72 @cindex @code{pmem} directive, PRU
73 @item %pmem(@var{expression})
74 Convert @var{expression} from byte-address to a
75 word-address. In other words, shift right by two.
76
77 @item %label(@var{expression})
78 Mark the given operand as a label. This is useful if you need to jump to
79 a label that matches a register name.
80
81 @smallexample
82 @group
83 r1:
84 jmp r1 ; Will jump to register R1
85 jmp %label(r1) ; Will jump to label r1
86 @end group
87 @end smallexample
88
89 @end table
90
91
92 @node PRU Directives
93 @section PRU Machine Directives
94
95 @cindex machine directives, PRU
96 @cindex PRU machine directives
97
98 @table @code
99
100 @cindex @code{align} directive, PRU
101 @item .align @var{expression} [, @var{expression}]
102 This is the generic @code{.align} directive, however
103 this aligns to a power of two.
104
105 @cindex @code{word} directive, PRU
106 @item .word @var{expression}
107 Create an aligned constant 4 bytes in size.
108
109 @cindex @code{dword} directive, PRU
110 @item .dword @var{expression}
111 Create an aligned constant 8 bytes in size.
112
113 @cindex @code{2byte} directive, PRU
114 @item .2byte @var{expression}
115 Create an unaligned constant 2 bytes in size.
116
117 @cindex @code{4byte} directive, PRU
118 @item .4byte @var{expression}
119 Create an unaligned constant 4 bytes in size.
120
121 @cindex @code{8byte} directive, PRU
122 @item .8byte @var{expression}
123 Create an unaligned constant 8 bytes in size.
124
125 @cindex @code{16byte} directive, PRU
126 @item .16byte @var{expression}
127 Create an unaligned constant 16 bytes in size.
128
129 @cindex @code{set no_warn_regname_label} directive, PRU
130 @item .set no_warn_regname_label
131 Do not output warnings when a label name matches a register name. Equivalent
132 to passing the @code{-mno-warn-regname-label} command-line option.
133
134 @end table
135
136 @node PRU Opcodes
137 @section Opcodes
138
139 @cindex PRU opcodes
140 @cindex opcodes for PRU
141 @code{@value{AS}} implements all the standard PRU core V3 opcodes in the
142 original pasm assembler. Older cores are not supported by @code{@value{AS}}.
143
144 GAS also implements the LDI32 pseudo instruction for loading a 32-bit
145 immediate value into a register.
146
147 @smallexample
148 ldi32 sp, __stack_top
149 ldi32 r14, 0x12345678
150 @end smallexample