SDK 2.3.0 - pio_encoding still broken #3068
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#3068
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Following this PR #2958 pio_encoding fixes + added PIO_VERSION to platform_defs.h
it fixes #2946 hardware_pio: fix pio_encode_mov(pio_pindirs, ...) on RP2350
but it breaks other opcode encodings.
A simple test:
RP2350 SDK 2.3.0 results:
For comparison SDK 2.2.0
There are reports on forum that RP2040 is affected too: https://forums.raspberrypi.com/viewtopic.php?t=399120#p2380376
pio_encode_mov(pio_osr, pio_x) is actually generating mov exec,x
I think the problem arises from overlapping enum fields across different instructions, maybe separate enums (per instruction type) would be easier to manage.
I did a bit of investigation, and surprisingly it works fine in Debug mode (i.e. when
#ifndef NDEBUG).I did a bit more investigation, and tracked down that in Debug mode
pio_osrandpio_exechave different integer values, because of the invalid parameter-checking stuff; and so everything works fine. But in Release mode (i.e. whenNDEBUGis defined)pio_osrandpio_execboth have the integer value0x7, and this means that theif (dest == pio_exec) dest = pio_exec_mov;line inpio_encode_mov()is incorrectly translating apio_osrinto apio_exec_mov.EDIT: Similarly (when
NDEBUGis defined),pio_pindirsandpio_exec_movboth have the integer value0x4which means that theif (dest == pio_pindirs) dest = pio_pindirs_mov;line inpio_encode_mov()is incorrectly translating apio_exec_movinto apio_pindirs_mov.And the combination of
means that a
pio_execgets translated intto apio_exec_mov, and this then gets incorrectly translated into into apio_pindirs_mov.(Which in turn also means that
pio_osris getting translated topio_pindirs_mov, which explains why you're getting three identical "WRONG" encodings in your report above.)ack - i guess a testcase is in order!
Fix merged into
developGreat, many thanks!