pio_encoding fixes + added PIO_VERSION to platform_defs.h #2958
No reviewers
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk!2958
Loading…
Reference in a new issue
No description provided.
Delete branch "pio-encode"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
pio_encode_mov(pio_pindirs)was wrong because themovdestination for pindirs is a different valuepio_instructions.his included beforePICO_PIO_VERSIONis set; didn't want to make a circular include, and previously pio_instructions.h is somewhat standalone include-able, so decided to addPIO_VERSIONtoplatform_defs.h... TBH it should have been there already as the init ofPICO_PIO_VERSIONwas a bit of a hack. I doubt anyone wants to override PICO_PIO_VERSION anywaypio_exec_movandpio_exec_out- kept these for backwards compatibility, but decided to just allowpio_execand havepio_encode_movtake care of it. as i imagine most of uses ofpio_encode_movtake a constant arg, this isn't much of an overhead (the alternative would have been to encode the two different values in the enum value, which is fine, but likely going to lead to more code if done at runtime vs just the ifs)fixes #2754
Maybe it's worth removing the
PICO_CONFIG: PICO_PIO_VERSIONline? 🤔@ -66,13 +66,20 @@ enum pio_src_dest {pio_x = 1u,For consistency, should this be using
PICO_PIO_VERSION?Or should some of the places in
pio_instructions.h,pio.handpio.cthat are currently doing#if PICO_PIO_VERSION > 0and#if PICO_PIO_VERSION == 0be updated to usePIO_VERSIONinstead?I'm not really awake-enough yet to figure out what this code is doing, but (for symmetry) should
pio_encode_outbe doingif (dest == pio_exec) dest = pio_exec_out;?@ -66,13 +66,20 @@ enum pio_src_dest {pio_x = 1u,I would say either the
PICO_PIO_VERSIONdefine should be moved intopio_instructions.hand used everywhere, or it should be removed entirely andPIO_VERSIONshould be used everywhere?Or is it the case that the version used in
pio_instructions.hmust match the chip being used (hence usingPIO_VERSIONdirectly), but the rest of the code can be compiled for version 0 on both RP2040 and RP2350?If we're keeping
PICO_PIO_VERSIONthen there should also be a check thatPICO_PIO_VERSION <= PIO_VERSION, otherwise you get lots of compile errors when trying to build RP2040 code withPICO_PIO_VERSION=1.@ -66,13 +66,20 @@ enum pio_src_dest {pio_x = 1u,I guess I'll just rename the one in platform_defs to PICO_PIO_VERSION (I had been avoiding that because other h/w stuff doesn't have a PICO_) we have PICO_PIO_VERSION in the build too, so I think it is probably confusing to introduce another
i could add an assert i guess!
@ -310,7 +317,7 @@ static inline uint pio_encode_wait_irq(bool polarity, bool relative, uint irq) {return _pio_encode_instr_and_args(pio_instr_bits_wait, 2u | (polarity ? 4u : 0u), _pio_encode_irq(relative, irq));@ -66,13 +66,20 @@ enum pio_src_dest {pio_x = 1u,Just because I was curious -
f4e041bis what this would look like withPICO_PIO_VERSIONreplaced byPIO_VERSIONProbably doesn't matter now, but I guess this could have been: