Commit c967c1d
committed
fix peripheral register read/write for larger ULP addresses
When register addresses less than or equal to 0x3ff are given to the
reg_rd and reg_wr opcodes, these addresses should be used unmodified
as the address in the machine instruction.
In our implementation we split the 10 bit address field of the machine
instruction into two fields, namely "addr" for the lower 8 bits and
"periph_sel" for the upper 2 bits.
We already had a mechanism for determining the periph_sel part for
"full" addresses (e.g. 0x3ff48000), but for direct (ULP) addresses, we
always set periph_sel to 0 instead of using the upper 2 bits from the
given address. This commit fixes that.
Note 1: In binutils-esp32ulp, they don't split the address into these 2
fields but simply put the direct ULP address into a single combined
field of 10 bits, which has the same effect. See: https://github.com/espressif/binutils-esp32ulp/blob/249ec34/gas/config/tc-esp32ulp_esp32.c#L145
Note 2: In the "macro approach" in esp-idf for creating ULP code, they
also use the split field approach (I assume our implementation is
modelled after that) and they also don't handle direct (ULP) addresses
correctly (or seemingly at all). See: https://github.com/espressif/esp-idf/blob/9d34a1c/components/ulp/include/esp32/ulp.h#L349
This commit contributes to being able to eventually assemble the
esp32ulp_ranges.s test from binutils-esp32ulp. It addresses this line:
https://github.com/espressif/binutils-esp32ulp/blob/249ec34/gas/testsuite/gas/esp32ulp/esp32/esp32ulp_ranges.s#L1361 parent 479f809 commit c967c1d
2 files changed
+73
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
| 382 | + | |
382 | 383 | | |
383 | 384 | | |
384 | | - | |
| 385 | + | |
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
| |||
393 | 394 | | |
394 | 395 | | |
395 | 396 | | |
| 397 | + | |
396 | 398 | | |
397 | 399 | | |
398 | | - | |
| 400 | + | |
399 | 401 | | |
400 | 402 | | |
401 | 403 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
111 | 177 | | |
112 | 178 | | |
113 | 179 | | |
114 | 180 | | |
115 | 181 | | |
116 | 182 | | |
117 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
0 commit comments