Commit 7eda90c
committed
fix relative jumps for immediate offsets
The JUMPR and JUMPS instructions in assembly are defined to take
an offset in bytes, but the real CPU instruction expects this to
be expressed in 32-bit words. Thus, the assembler needs to
translate offsets into words (32-bits). i.e. 4 bytes is 1 word.
Only immediate values, which are multiples of 4 are allowed. Other
values will result in a ValueError. (binutils-esp32ulp actually
allows other values and rounds the result, but to get the exact same
behaviour as binutils with its peculiarities would require a bigger
change for a case, which might more likely represent a mistake than
a useful offset)
Note, since py-esp32-ulp already tracks label offsets in 32-bit words
internally, this conversion is only necessary for immediate offsets.1 parent 82e2765 commit 7eda90c
2 files changed
+27
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
343 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
344 | 346 | | |
345 | 347 | | |
346 | 348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
18 | 31 | | |
19 | 32 | | |
20 | 33 | | |
| |||
26 | 39 | | |
27 | 40 | | |
28 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
29 | 53 | | |
30 | 54 | | |
31 | 55 | | |
| |||
0 commit comments