Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esp32s2ulp: fix JUMPS offset interpretation (make same as JUMPR)
As per ESP32-S2 ULP coprocessor instruction set documentation, all JUMP family instructions expect the address argument in 32-bit words. For immediate values, JUMP and JUMPR do this as per documentation. In other words an offset given in the assembly source in bytes is correctly converted to 32-bit words (by doing >>2) when creating the binary instruction. With JUMPS however any value given in the assembly source file is kept as-is when creating the binary instruction. Thus for example 4 bytes specified in the source will stay 4 (32-bit words) in the binary instruction, instead of 1 (32-bit word). This commit fixes that behaviour. This also aligns the behaviour with that of the ESP32 (not S2) assembler, where this already worked correctly. This change was tested on an actual ESP32-S2 with the following code: ``` .data val: .long 0 .text entry: move r3, val jumps 4, 42, lt right: move r0, 66 # correct jump jump end nop wrong: move r0, 73 # incorrect jump nop end: st r0, r3, 0 halt ``` Before the fix, the JUMPS instruction jumped 4 instructions forward, and "val" was set to 73. After the fix JUMPS correctly jumped 1 instruction forward (4 bytes = 1 word), and "val" was set to 66. Closes #3
- Loading branch information