Skip to content

Commit d4769c7

Browse files
committed
Port dma_dyn test to rp235x
1 parent 3b7c64b commit d4769c7

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

on-target-tests/.cargo/config.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,26 @@ runner = "elf2uf2-rs -d"
3535
# This runner will find a supported SWD debug probe and flash your RP2040 over
3636
# SWD:
3737
# runner = "probe-rs run --chip RP2040"
38+
39+
# This is the hard-float ABI for Arm mode.
40+
#
41+
# The FPU is enabled by default, and float function arguments use FPU
42+
# registers.
43+
[target.thumbv8m.main-none-eabihf]
44+
# Pass some extra options to rustc, some of which get passed on to the linker.
45+
#
46+
# * linker argument --nmagic turns off page alignment of sections (which saves
47+
# flash space)
48+
# * linker argument -Tlink.x tells the linker to use link.x as a linker script.
49+
# This is usually provided by the cortex-m-rt crate, and by default the
50+
# version in that crate will include a file called `memory.x` which describes
51+
# the particular memory layout for your specific chip.
52+
# * linker argument -Tdefmt.x also tells the linker to use `defmt.x` as a
53+
# secondary linker script. This is required to make defmt_rtt work.
54+
rustflags = [
55+
"-C", "link-arg=--nmagic",
56+
"-C", "link-arg=-Tlink.x",
57+
"-C", "link-arg=-Tdefmt.x",
58+
"-C", "target-cpu=cortex-m33",
59+
]
60+

on-target-tests/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@ once_cell = { version = "1.19.0", default-features = false, features = ["critica
6464
panic-probe = {version = "0.3", features = ["print-defmt"]}
6565
rp2040-boot2 = { version = "0.3.0", optional = true }
6666
rp2040-hal = {path = "../rp2040-hal", features = ["critical-section-impl", "defmt", "rt", "i2c-write-iter"], optional = true}
67+
rp235x-hal = {path = "../rp235x-hal", features = ["critical-section-impl", "defmt", "rt", "i2c-write-iter"], optional = true}
6768

6869
[features]
6970

7071
rp2040 = ["dep:rp2040-boot2", "dep:rp2040-hal"]
72+
rp235x = ["dep:rp235x-hal"]
7173

7274
[profile.dev]
7375
codegen-units = 1

on-target-tests/tests/dma_dyn.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;
@@ -55,6 +63,8 @@ mod tests {
5563
use panic_probe as _;
5664
#[cfg(feature = "rp2040")]
5765
use rp2040_hal as hal;
66+
#[cfg(feature = "rp235x")]
67+
use rp235x_hal as hal;
5868

5969
use hal::{clocks::init_clocks_and_plls, pac, watchdog::Watchdog};
6070

@@ -66,6 +76,7 @@ mod tests {
6676
hal::sio::spinlock_reset();
6777
}
6878
let mut pac = pac::Peripherals::take().unwrap();
79+
#[cfg(feature = "rp2040")]
6980
let _core = pac::CorePeripherals::take().unwrap();
7081
let mut watchdog = Watchdog::new(pac.WATCHDOG);
7182

0 commit comments

Comments
 (0)