Skip to content

Commit 11680a0

Browse files
committed
Port remaining on-target tests to rp235x
1 parent fa58345 commit 11680a0

File tree

12 files changed

+104
-8
lines changed

12 files changed

+104
-8
lines changed

on-target-tests/run_tests_rp235x.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Keep running tests even if one of them fails
44
# We need to specify probe-rs as our runner via environment variables here
55
# to control build since we aren't able to override them in config.toml
6-
CARGO_TARGET_THUMBV8M_MAIN_NONE_EABIHF_RUNNER="probe-rs run" cargo test --test dma_dyn --target thumbv8m.main-none-eabihf --no-fail-fast --features rp235x -- --chip rp235x
6+
CARGO_TARGET_THUMBV8M_MAIN_NONE_EABIHF_RUNNER="probe-rs run" cargo test --target thumbv8m.main-none-eabihf --no-fail-fast --features rp235x -- --chip rp235x

on-target-tests/tests/dma_m2m_u16.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ use defmt_test as _;
88
use panic_probe as _;
99
#[cfg(feature = "rp2040")]
1010
use rp2040_hal as hal; // memory layout // panic handler
11+
#[cfg(feature = "rp235x")]
12+
use rp235x_hal as hal;
1113

1214
/// The linker will place this boot block at the start of our program image. We
1315
/// need this to help the ROM bootloader get our code up and running.
@@ -18,6 +20,12 @@ use rp2040_hal as hal; // memory layout // panic handler
1820
#[used]
1921
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;
2022

23+
/// Tell the Boot ROM about our application
24+
#[cfg(feature = "rp235x")]
25+
#[link_section = ".start_block"]
26+
#[used]
27+
pub static IMAGE_DEF: hal::block::ImageDef = hal::block::ImageDef::secure_exe();
28+
2129
/// External high-speed crystal on the Raspberry Pi Pico board is 12 MHz. Adjust
2230
/// if your board has a different frequency
2331
const XTAL_FREQ_HZ: u32 = 12_000_000u32;
@@ -51,6 +59,8 @@ mod tests {
5159
use panic_probe as _;
5260
#[cfg(feature = "rp2040")]
5361
use rp2040_hal as hal;
62+
#[cfg(feature = "rp235x")]
63+
use rp235x_hal as hal;
5464

5565
use hal::{clocks::init_clocks_and_plls, pac, watchdog::Watchdog};
5666

@@ -62,6 +72,7 @@ mod tests {
6272
hal::sio::spinlock_reset();
6373
}
6474
let mut pac = pac::Peripherals::take().unwrap();
75+
#[cfg(feature = "rp2040")]
6576
let _core = pac::CorePeripherals::take().unwrap();
6677
let mut watchdog = Watchdog::new(pac.WATCHDOG);
6778

on-target-tests/tests/dma_m2m_u32.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ use defmt_test as _;
88
use panic_probe as _;
99
#[cfg(feature = "rp2040")]
1010
use rp2040_hal as hal; // memory layout // panic handler
11+
#[cfg(feature = "rp235x")]
12+
use rp235x_hal as hal;
1113

1214
/// The linker will place this boot block at the start of our program image. We
1315
/// need this to help the ROM bootloader get our code up and running.
@@ -18,6 +20,12 @@ use rp2040_hal as hal; // memory layout // panic handler
1820
#[used]
1921
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;
2022

23+
/// Tell the Boot ROM about our application
24+
#[cfg(feature = "rp235x")]
25+
#[link_section = ".start_block"]
26+
#[used]
27+
pub static IMAGE_DEF: hal::block::ImageDef = hal::block::ImageDef::secure_exe();
28+
2129
/// External high-speed crystal on the Raspberry Pi Pico board is 12 MHz. Adjust
2230
/// if your board has a different frequency
2331
const XTAL_FREQ_HZ: u32 = 12_000_000u32;
@@ -51,6 +59,8 @@ mod tests {
5159
use panic_probe as _;
5260
#[cfg(feature = "rp2040")]
5361
use rp2040_hal as hal;
62+
#[cfg(feature = "rp235x")]
63+
use rp235x_hal as hal;
5464

5565
use hal::{clocks::init_clocks_and_plls, pac, watchdog::Watchdog};
5666

@@ -62,6 +72,7 @@ mod tests {
6272
hal::sio::spinlock_reset();
6373
}
6474
let mut pac = pac::Peripherals::take().unwrap();
75+
#[cfg(feature = "rp2040")]
6576
let _core = pac::CorePeripherals::take().unwrap();
6677
let mut watchdog = Watchdog::new(pac.WATCHDOG);
6778

on-target-tests/tests/dma_m2m_u8.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ use defmt_test as _;
88
use panic_probe as _;
99
#[cfg(feature = "rp2040")]
1010
use rp2040_hal as hal; // memory layout // panic handler
11+
#[cfg(feature = "rp235x")]
12+
use rp235x_hal as hal;
1113

1214
/// The linker will place this boot block at the start of our program image. We
1315
/// need this to help the ROM bootloader get our code up and running.
@@ -18,6 +20,12 @@ use rp2040_hal as hal; // memory layout // panic handler
1820
#[used]
1921
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;
2022

23+
/// Tell the Boot ROM about our application
24+
#[cfg(feature = "rp235x")]
25+
#[link_section = ".start_block"]
26+
#[used]
27+
pub static IMAGE_DEF: hal::block::ImageDef = hal::block::ImageDef::secure_exe();
28+
2129
/// External high-speed crystal on the Raspberry Pi Pico board is 12 MHz. Adjust
2230
/// if your board has a different frequency
2331
const XTAL_FREQ_HZ: u32 = 12_000_000u32;
@@ -51,6 +59,8 @@ mod tests {
5159
use panic_probe as _;
5260
#[cfg(feature = "rp2040")]
5361
use rp2040_hal as hal;
62+
#[cfg(feature = "rp235x")]
63+
use rp235x_hal as hal;
5464

5565
use hal::{clocks::init_clocks_and_plls, pac, watchdog::Watchdog};
5666

@@ -62,6 +72,7 @@ mod tests {
6272
hal::sio::spinlock_reset();
6373
}
6474
let mut pac = pac::Peripherals::take().unwrap();
75+
#[cfg(feature = "rp2040")]
6576
let _core = pac::CorePeripherals::take().unwrap();
6677
let mut watchdog = Watchdog::new(pac.WATCHDOG);
6778

on-target-tests/tests/dma_spi_loopback_u16.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,26 @@ use hal::gpio::{self, Pin};
1111
use panic_probe as _;
1212
#[cfg(feature = "rp2040")]
1313
use rp2040_hal as hal; // memory layout // panic handler
14+
#[cfg(feature = "rp235x")]
15+
use rp235x_hal as hal;
1416
use hal::pac::SPI0;
1517
use hal::spi;
1618

1719
/// The linker will place this boot block at the start of our program image. We
1820
/// need this to help the ROM bootloader get our code up and running.
1921
/// Note: This boot block is not necessary when using a rp-hal based BSP
2022
/// as the BSPs already perform this step.
23+
#[cfg(feature = "rp2040")]
2124
#[link_section = ".boot2"]
2225
#[used]
2326
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;
2427

28+
/// Tell the Boot ROM about our application
29+
#[cfg(feature = "rp235x")]
30+
#[link_section = ".start_block"]
31+
#[used]
32+
pub static IMAGE_DEF: hal::block::ImageDef = hal::block::ImageDef::secure_exe();
33+
2534
/// External high-speed crystal on the Raspberry Pi Pico board is 12 MHz. Adjust
2635
/// if your board has a different frequency
2736
const XTAL_FREQ_HZ: u32 = 12_000_000u32;
@@ -61,6 +70,8 @@ mod tests {
6170
use panic_probe as _;
6271
#[cfg(feature = "rp2040")]
6372
use rp2040_hal as hal;
73+
#[cfg(feature = "rp235x")]
74+
use rp235x_hal as hal;
6475
use hal::dma::{bidirectional, DMAExt};
6576
use hal::Clock;
6677

@@ -70,6 +81,7 @@ mod tests {
7081
hal::sio::spinlock_reset();
7182
}
7283
let mut pac = pac::Peripherals::take().unwrap();
84+
#[cfg(feature = "rp2040")]
7385
let _core = pac::CorePeripherals::take().unwrap();
7486
let mut watchdog = Watchdog::new(pac.WATCHDOG);
7587

on-target-tests/tests/dma_spi_loopback_u8.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use defmt_test as _;
1010
use panic_probe as _;
1111
#[cfg(feature = "rp2040")]
1212
use rp2040_hal as hal; // memory layout // panic handler
13+
#[cfg(feature = "rp235x")]
14+
use rp235x_hal as hal;
1315
use hal::gpio::{self, Pin};
1416
use hal::pac::SPI0;
1517
use hal::spi;
@@ -23,6 +25,12 @@ use hal::spi;
2325
#[used]
2426
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;
2527

28+
/// Tell the Boot ROM about our application
29+
#[cfg(feature = "rp235x")]
30+
#[link_section = ".start_block"]
31+
#[used]
32+
pub static IMAGE_DEF: hal::block::ImageDef = hal::block::ImageDef::secure_exe();
33+
2634
/// External high-speed crystal on the Raspberry Pi Pico board is 12 MHz. Adjust
2735
/// if your board has a different frequency
2836
const XTAL_FREQ_HZ: u32 = 12_000_000u32;
@@ -62,6 +70,8 @@ mod tests {
6270
use panic_probe as _;
6371
#[cfg(feature = "rp2040")]
6472
use rp2040_hal as hal;
73+
#[cfg(feature = "rp235x")]
74+
use rp235x_hal as hal;
6575
use hal::dma::bidirectional;
6676
use hal::dma::DMAExt;
6777
use hal::Clock;
@@ -72,6 +82,7 @@ mod tests {
7282
hal::sio::spinlock_reset();
7383
}
7484
let mut pac = pac::Peripherals::take().unwrap();
85+
#[cfg(feature = "rp2040")]
7586
let _core = pac::CorePeripherals::take().unwrap();
7687
let mut watchdog = Watchdog::new(pac.WATCHDOG);
7788

on-target-tests/tests/gpio.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use defmt_test as _;
77
use panic_probe as _;
88
#[cfg(feature = "rp2040")]
99
use rp2040_hal as hal; // memory layout // panic handler
10+
#[cfg(feature = "rp235x")]
11+
use rp235x_hal as hal;
1012

1113
/// The linker will place this boot block at the start of our program image. We
1214
/// need this to help the ROM bootloader get our code up and running.
@@ -17,6 +19,12 @@ use rp2040_hal as hal; // memory layout // panic handler
1719
#[used]
1820
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;
1921

22+
/// Tell the Boot ROM about our application
23+
#[cfg(feature = "rp235x")]
24+
#[link_section = ".start_block"]
25+
#[used]
26+
pub static IMAGE_DEF: hal::block::ImageDef = hal::block::ImageDef::secure_exe();
27+
2028
/// External high-speed crystal on the Raspberry Pi Pico board is 12 MHz. Adjust
2129
/// if your board has a different frequency
2230
const XTAL_FREQ_HZ: u32 = 12_000_000u32;
@@ -36,6 +44,7 @@ mod tests {
3644
hal::sio::spinlock_reset();
3745
}
3846
let mut pac = pac::Peripherals::take().unwrap();
47+
#[cfg(feature = "rp2040")]
3948
let _core = pac::CorePeripherals::take().unwrap();
4049
let mut watchdog = Watchdog::new(pac.WATCHDOG);
4150

on-target-tests/tests/i2c_loopback.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ use defmt_test as _;
1414
use panic_probe as _;
1515
#[cfg(feature = "rp2040")]
1616
use rp2040_hal as hal; // memory layout // panic handler
17+
#[cfg(feature = "rp235x")]
18+
use rp235x_hal as hal;
1719

1820
use hal::pac::interrupt;
1921

@@ -26,6 +28,12 @@ use hal::pac::interrupt;
2628
#[used]
2729
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;
2830

31+
/// Tell the Boot ROM about our application
32+
#[cfg(feature = "rp235x")]
33+
#[link_section = ".start_block"]
34+
#[used]
35+
pub static IMAGE_DEF: hal::block::ImageDef = hal::block::ImageDef::secure_exe();
36+
2937
/// External high-speed crystal on the Raspberry Pi Pico board is 12 MHz. Adjust
3038
/// if your board has a different frequency
3139
const XTAL_FREQ_HZ: u32 = 12_000_000u32;

on-target-tests/tests/i2c_loopback_async.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ use defmt_test as _;
1414
use panic_probe as _;
1515
#[cfg(feature = "rp2040")]
1616
use rp2040_hal as hal; // memory layout // panic handler
17+
#[cfg(feature = "rp235x")]
18+
use rp235x_hal as hal;
1719

1820
use hal::{async_utils::AsyncPeripheral, pac::interrupt};
1921

@@ -26,6 +28,12 @@ use hal::{async_utils::AsyncPeripheral, pac::interrupt};
2628
#[used]
2729
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;
2830

31+
/// Tell the Boot ROM about our application
32+
#[cfg(feature = "rp235x")]
33+
#[link_section = ".start_block"]
34+
#[used]
35+
pub static IMAGE_DEF: hal::block::ImageDef = hal::block::ImageDef::secure_exe();
36+
2937
/// External high-speed crystal on the Raspberry Pi Pico board is 12 MHz. Adjust
3038
/// if your board has a different frequency
3139
const XTAL_FREQ_HZ: u32 = 12_000_000u32;

on-target-tests/tests/i2c_tests/blocking.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use critical_section::Mutex;
44
use fugit::{HertzU32, RateExtU32};
55
#[cfg(feature = "rp2040")]
66
use rp2040_hal as hal;
7+
#[cfg(feature = "rp235x")]
8+
use rp235x_hal as hal;
79
use hal::{
810
clocks::init_clocks_and_plls,
911
gpio::{FunctionI2C, Pin, PullUp},
@@ -17,15 +19,21 @@ use super::{Controller, FIFOBuffer, Generator, MutexCell, Target, TargetState};
1719

1820
pub struct State {
1921
controller: Option<Controller>,
20-
timer: hal::Timer,
22+
#[cfg(feature = "rp2040")]
23+
timer: Timer,
24+
#[cfg(feature = "rp235x")]
25+
timer: Timer<hal::timer::CopyableTimer0>,
2126
resets: hal::pac::RESETS,
2227
ref_clock_freq: HertzU32,
2328
}
2429

2530
static TARGET: MutexCell<Option<Target>> = Mutex::new(RefCell::new(None));
2631

2732
static PAYLOAD: MutexCell<TargetState> = MutexCell::new(RefCell::new(TargetState::new()));
33+
#[cfg(feature = "rp2040")]
2834
static TIMER: MutexCell<Option<Timer>> = MutexCell::new(RefCell::new(None));
35+
#[cfg(feature = "rp235x")]
36+
static TIMER: MutexCell<Option<Timer<hal::timer::CopyableTimer0>>> = MutexCell::new(RefCell::new(None));
2937

3038
macro_rules! assert_vec_eq {
3139
($e:expr) => {
@@ -67,7 +75,10 @@ pub fn setup<T: ValidAddress>(xtal_freq_hz: u32, addr: T) -> State {
6775
.ok()
6876
.unwrap();
6977

78+
#[cfg(feature = "rp2040")]
7079
let timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS, &clocks);
80+
#[cfg(feature = "rp235x")]
81+
let timer = hal::Timer::new_timer0(pac.TIMER0, &mut pac.RESETS, &clocks);
7182

7283
// The single-cycle I/O block controls our GPIO pins
7384
let mut sio = hal::Sio::new(pac.SIO);
@@ -111,8 +122,8 @@ pub fn setup<T: ValidAddress>(xtal_freq_hz: u32, addr: T) -> State {
111122
.get_mut(1)
112123
.expect("core 1 is not available")
113124
.spawn(STACK.take().unwrap(), || {
114-
pac::NVIC::unpend(hal::pac::Interrupt::I2C1_IRQ);
115-
pac::NVIC::unmask(hal::pac::Interrupt::I2C1_IRQ);
125+
cortex_m::peripheral::NVIC::unpend(hal::pac::Interrupt::I2C1_IRQ);
126+
cortex_m::peripheral::NVIC::unmask(hal::pac::Interrupt::I2C1_IRQ);
116127

117128
loop {
118129
cortex_m::asm::wfi()

0 commit comments

Comments
 (0)