Software IRQs missing from RP2350 SVD #1898
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#1898
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?
According to the RP235x datasheet, there are 6 spare IRQs which can be used for software interrupts:
SPAREIRQ_IRQ_0SPAREIRQ_IRQ_1SPAREIRQ_IRQ_2SPAREIRQ_IRQ_3SPAREIRQ_IRQ_4SPAREIRQ_IRQ_5However, these are not defined in the SVD, meaning things like the
rp235x-pacrust crate don't expose them. (see also: https://github.com/rp-rs/rp235x-pac/issues/4)ping @matiasilva
(IIRC there's also some "spare" IRQs on RP2040 which can be used for software interrupts? Ah yes, RP2040 datasheet says "The core can still be forced to enter the relevant interrupt handler by writing bits 26 to 31 in the NVIC ISPR register")
Yes, as far as I can tell those are also not on the RP2040 SVD, but they are also not named on the datasheet there.
Hi all, thanks for raising this. These spare IRQs were not present in the previous SVD either. The main issue here is that the SVD spec requires interrupts to be attached to a peripheral (https://arm-software.github.io/CMSIS_5/SVD/html/elem_peripherals.html#elem_interrupt). As these are spare, they don't have a peripheral source. I suppose we could lump them with the NVIC?
It's actually weirder than that: there is a dummy peripheral called SPAREIRQ in the RTL to ensure those IRQ numbers are not accidentally reused (which is where the
intctrl.hname comes from) but we can't add that to the SVD either because it doesn't have an addresshttps://github.com/rp-rs/rp235x-pac/pull/5/files so the SVD patch uses a dummy peripheral with a NULL address and no registers. @matiasilva can you think of any issues with that? It seems a bit less dirty than assigning interrupt outputs to the NVIC.
Let me know if you need the same peripheral to exist in RP2040 RTL.
Aha! Yes, I'll get that in then. It would be nice to get the same on RP2040, yes.
A peripheral with a null address could be a problem for svd2rust generated peripheral access crates. Because converting null pointers to references is UB even if the type is zero-sized and never dereferenced, AFAIK. However I guess this is a limitation of svd2rust and could be fixed there.
Not sure if that's necessarily a problem, this is the approach
rp2040-pactakes, and which I copied when I created the PR forrp235x-pac(see here:github.com/rp-rs/rp2040-pac@89e78ff078/svd/rp2040.yaml (L766-L788))Indeed, for svd2rust generated pacs this isn't an issue: Since
github.com/rust-embedded/svd2rust@82ebef29e8(from 2017), empty register blocks won't be added to thePeripheralsstruct. This doesn't completely invalidate my argument, because there is some special handling needed to avoid potential unsoundness. But it also shows that there's precedence for taking that route. (https://github.com/rust-embedded-community/tm4c-rs/blob/master/svd/tm4c129x.xml#L25 is another example). It seems to be a common approach and shouldn't be too surprising, so code-generators likely handle it gracefully.Thanks for pointing that out, @pta2002!
moved to 2.1.2 pending feedback on #2271
@kilograham On a similar note, I've just noticed that Table 94 in https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf (on page 83) lists IRQ numbers 40 and 41 as
PROC0_IRQ_CTIandPROC1_IRQ_CTI, but these also appear to be missing from theRP2350.svd?please open a separate issue and assign to @matiasilva
... as this one is actually already merged into develop
this was not fixed in 2.2.0
Hmmm, I think that #2380 (adding PROC0_IRQ_CTI and PROC1_IRQ_CTI) wasn't fixed in 2.2.0, but this issue is (still) fixed in 2.2.0, because https://raw.githubusercontent.com/raspberrypi/pico-sdk/refs/heads/master/src/rp2350/hardware_regs/RP2350.svd contains:
? 🤔
Closing, as this is already fixed on
master: