Skip to content

Commit 13cb431

Browse files
committed
Enable rp235x doc tests, fixup feature doc
The rp235x doc test requires an unfortunate workaround using a private feature, "_test", in order compile.
1 parent 752fbc6 commit 13cb431

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

.github/ci/test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ cargo test --manifest-path ./embassy-boot/Cargo.toml --features ed25519-salty
2121

2222
cargo test --manifest-path ./embassy-nrf/Cargo.toml --no-default-features --features nrf52840,time-driver-rtc1,gpiote
2323

24-
cargo test --manifest-path ./embassy-rp/Cargo.toml --no-default-features --features time-driver,rp2040
24+
cargo test --manifest-path ./embassy-rp/Cargo.toml --no-default-features --features time-driver,rp2040,_test
25+
cargo test --manifest-path ./embassy-rp/Cargo.toml --no-default-features --features time-driver,rp235xa,_test
2526

2627
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f429vg,exti,time-driver-any,exti
2728
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f732ze,exti,time-driver-any,exti

embassy-rp/Cargo.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,13 @@ rp235xa = ["_rp235x"]
9898
## Configure the hal for use with the rp235xB
9999
rp235xb = ["_rp235x"]
100100

101-
# Add a binary-info header block containing picotool-compatible metadata.
102-
#
103-
# Takes up a little flash space, but picotool can then report the name of your
104-
# program and other details.
101+
# hack around cortex-m peripherals being wrong when running tests.
102+
_test = []
103+
104+
## Add a binary-info header block containing picotool-compatible metadata.
105+
##
106+
## Takes up a little flash space, but picotool can then report the name of your
107+
## program and other details.
105108
binary-info = [ "rt" ]
106109

107110
[dependencies]

embassy-rp/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ pub fn install_core0_stack_guard() -> Result<(), ()> {
469469
unsafe { install_stack_guard(core::ptr::addr_of_mut!(_stack_end)) }
470470
}
471471

472-
#[cfg(feature = "rp2040")]
472+
#[cfg(all(feature = "rp2040", not(feature = "_test")))]
473473
#[inline(always)]
474474
fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
475475
let core = unsafe { cortex_m::Peripherals::steal() };
@@ -497,7 +497,7 @@ fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
497497
Ok(())
498498
}
499499

500-
#[cfg(all(feature = "_rp235x", not(test)))]
500+
#[cfg(all(feature = "_rp235x", not(feature = "_test")))]
501501
#[inline(always)]
502502
fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
503503
let core = unsafe { cortex_m::Peripherals::steal() };
@@ -517,7 +517,7 @@ fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
517517

518518
// This is to hack around cortex_m defaulting to ARMv7 when building tests,
519519
// so the compile fails when we try to use ARMv8 peripherals.
520-
#[cfg(test)]
520+
#[cfg(feature = "_test")]
521521
#[inline(always)]
522522
fn install_stack_guard(_stack_bottom: *mut usize) -> Result<(), ()> {
523523
Ok(())

0 commit comments

Comments
 (0)