Skip to content

Commit c9ff24d

Browse files
committed
fix ADC instruction when used with undocumented parameter
binutil-esp32ulp accepts an undocumented 4th parameter for the ADC instruction, even though this parameter is unused as per binutils' current code. This commit contributes to being able to eventually assemble the esp32ulp_all.s test from binutils-esp32ulp. It addresses this line: https://github.com/espressif/binutils-esp32ulp/blob/249ec34cc2c9574a86f3f86bbb175a863f988bcf/gas/testsuite/gas/esp32ulp/esp32/esp32ulp_all.s#L174
1 parent 5e8ab92 commit c9ff24d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

esp32_ulp/opcodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def i_tsens(reg_dest, delay):
449449
return _tsens.all
450450

451451

452-
def i_adc(reg_dest, adc_idx, mux):
452+
def i_adc(reg_dest, adc_idx, mux, _not_used=None):
453453
_adc.dreg = get_reg(reg_dest)
454454
_adc.mux = get_imm(mux)
455455
_adc.sar_sel = get_imm(adc_idx)

tests/compat/fixes.S

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,9 @@ entry:
2828
# interpret ; as statement separator - this results in 2 NOP machine instructions
2929
nop; nop;
3030

31+
# adc supports an undocumented 4th argument, which should be entirely ignored
32+
# binutils-esp32ulp also ignores this argument, if present, see:
33+
# https://github.com/espressif/binutils-esp32ulp/blob/249ec34cc2c9574a86f3f86bbb175a863f988bcf/gas/config/esp32ulp-parse.y#L810
34+
adc r1, 0, 1, 100
35+
3136
halt

0 commit comments

Comments
 (0)