Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Software IRQs are missing from device.x leading to undefined symbols when linking #11

Open
solimike opened this issue Jan 28, 2025 · 2 comments

Comments

@solimike
Copy link

I believe that #8 missed adding the corresponding aliases for the SW0_IRQ - SW5_IRQ interrupt handlers into device.x so causing undefined symbols unless the user of the HAL+PAC provides real/dummy interrupt handlers for the six software interrupts.

I am experimenting with an RTIC application on an RP2350 board using the RP235x HAL & PAC. RTIC uses interrupt vectors for its "dispatchers" for software tasks (i.e. async fns that are spawned and not associated with real hardware interrupt handlers). Having got it working using hardware interrupts that I didn't need for their intended harware peripherals, it seemed sensible to use some of the software IRQs so I didn't constrain what hardware interrupts I can use in the future in my application.

As soon as I started using the version of the rp235x-pac from GitHub that actually has the software IRQs defined, rather than V0.1.0 on crates.io, I immediately got undefined symbols for the SWx_IRQ symbols. From reading up on the cortex_m_rt docs this sounds like it's to be expected (unless I provide real or dummy interrupt handlers in my application).

I've patched a local copy of device.x to alias the relevant symbols and everything then works as expected.

Hope that's useful - if it would help I'm happy to create a PR...

@solimike
Copy link
Author

I've read up a bit more about how svd2rust is used to automate parts of creating the PAC. The root-cause of the missing interrupt aliases seems to be that update.sh fails to do anything with the device.x file that's generated. I'll look at fixing that too in a PR...

@9names
Copy link
Member

9names commented Jan 30, 2025

Yep, should be as simple as doing mv device.x ${SCRIPT_DIR} sometime before leaving tmp_dir in update.sh.

eg

tmp_dir=$(mktemp -d -t svd2rust-XXXX)
pushd ${tmp_dir}
svd2rust -i ${SCRIPT_DIR}/svd/RP2350.svd.patched -c ${SCRIPT_DIR}/svd2rust.toml --target cortex-m
form -i mod.rs -o inner
rustfmt inner/lib.rs
mv inner/lib.rs inner/mod_cortex_m.rs
# This is what needs to be added to preserve svd2rust-generated device.x
mv device.x ${SCRIPT_DIR}
rm -rf ${SCRIPT_DIR}/src/inner
mv inner ${SCRIPT_DIR}/src
popd
rm -rf ${tmp_dir}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants