Enable rp235x doc tests, fixup feature doc

The rp235x doc test requires an unfortunate workaround using a private
feature, "_test", in order compile.
This commit is contained in:
Caleb Jamison 2024-08-12 05:47:16 -04:00
parent 752fbc662a
commit 13cb431472
3 changed files with 12 additions and 8 deletions

3
.github/ci/test.sh vendored
View File

@ -21,7 +21,8 @@ cargo test --manifest-path ./embassy-boot/Cargo.toml --features ed25519-salty
cargo test --manifest-path ./embassy-nrf/Cargo.toml --no-default-features --features nrf52840,time-driver-rtc1,gpiote cargo test --manifest-path ./embassy-nrf/Cargo.toml --no-default-features --features nrf52840,time-driver-rtc1,gpiote
cargo test --manifest-path ./embassy-rp/Cargo.toml --no-default-features --features time-driver,rp2040 cargo test --manifest-path ./embassy-rp/Cargo.toml --no-default-features --features time-driver,rp2040,_test
cargo test --manifest-path ./embassy-rp/Cargo.toml --no-default-features --features time-driver,rp235xa,_test
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f429vg,exti,time-driver-any,exti cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f429vg,exti,time-driver-any,exti
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f732ze,exti,time-driver-any,exti cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f732ze,exti,time-driver-any,exti

View File

@ -98,10 +98,13 @@ rp235xa = ["_rp235x"]
## Configure the hal for use with the rp235xB ## Configure the hal for use with the rp235xB
rp235xb = ["_rp235x"] rp235xb = ["_rp235x"]
# Add a binary-info header block containing picotool-compatible metadata. # hack around cortex-m peripherals being wrong when running tests.
# _test = []
# Takes up a little flash space, but picotool can then report the name of your
# program and other details. ## Add a binary-info header block containing picotool-compatible metadata.
##
## Takes up a little flash space, but picotool can then report the name of your
## program and other details.
binary-info = [ "rt" ] binary-info = [ "rt" ]
[dependencies] [dependencies]

View File

@ -469,7 +469,7 @@ pub fn install_core0_stack_guard() -> Result<(), ()> {
unsafe { install_stack_guard(core::ptr::addr_of_mut!(_stack_end)) } unsafe { install_stack_guard(core::ptr::addr_of_mut!(_stack_end)) }
} }
#[cfg(feature = "rp2040")] #[cfg(all(feature = "rp2040", not(feature = "_test")))]
#[inline(always)] #[inline(always)]
fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> { fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
let core = unsafe { cortex_m::Peripherals::steal() }; let core = unsafe { cortex_m::Peripherals::steal() };
@ -497,7 +497,7 @@ fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
Ok(()) Ok(())
} }
#[cfg(all(feature = "_rp235x", not(test)))] #[cfg(all(feature = "_rp235x", not(feature = "_test")))]
#[inline(always)] #[inline(always)]
fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> { fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
let core = unsafe { cortex_m::Peripherals::steal() }; let core = unsafe { cortex_m::Peripherals::steal() };
@ -517,7 +517,7 @@ fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
// This is to hack around cortex_m defaulting to ARMv7 when building tests, // This is to hack around cortex_m defaulting to ARMv7 when building tests,
// so the compile fails when we try to use ARMv8 peripherals. // so the compile fails when we try to use ARMv8 peripherals.
#[cfg(test)] #[cfg(feature = "_test")]
#[inline(always)] #[inline(always)]
fn install_stack_guard(_stack_bottom: *mut usize) -> Result<(), ()> { fn install_stack_guard(_stack_bottom: *mut usize) -> Result<(), ()> {
Ok(()) Ok(())