rp2 asm_pio parameterization
Hi,
I would like to pass parameters into the RP2 assembler to configure the generated code, eg adjust a delay loop, change number of bits shifted etc.
I propose an additional parameter to the asm_pio function decorator 'vars' that takes a dictionary, that gets added to the global context that assembler runs in eg:
@asm_pio(vars={"DELAY":10})
def statemachine():
label("wait")
set(x,DELAY)
jmp(x_dec,"wait")
with an addition of gl.update(vars) in the asp_pio dec function
rp2: Add RP2350 PIO v1 assembler support.
Add support for new PIO v1 instruction features on RP2350:
- wait: add jmp_pin source (PINCTRL_JMP_PIN, src=3) with a
2-bit offset argument. - irq: add next_pio/prev_pio index modifiers for cross-PIO IRQ
targeting. - asm_pio: add in_count parameter encoding SHIFTCTRL.IN_COUNT
(bits [4:0]) to mask unneeded IN-mapped pins to zero. - asm_pio: fix fifo_join encoding to support RP2350 TXGET(4),
TXPUT(8) and PUTGET(12) modes via SHIFTCTRL bits [15:14].
All changes are backward-compatible with RP2040 PIO v0.
Also update RP2 docs to cover new changes.
Signed-off-by: NED KONZ NED@METAMAGIX.TECH
Summary
The RP2350 added a number of improvements to the PIO hardware in the RP2040.
This PR is the first of three that will bring MicroPython's RP2 PIO support up to date.
Testing
Tested on a RPI_PICO2 board using #18974: all encoding tests passed,
covering new instructions, RP2350 FIFO join modes, in_count,
and regression checks for all existing instruction encodings.
I also tested on a RPI_PICO board and there were no regressions.
Generative AI
I used generative AI tools when creating this PR, but a human has checked the
code and is responsible for the code and the description above.