aboutsummaryrefslogtreecommitdiff
path: root/tests/rp/src/bin/bootsel.rs
blob: aa123ab03d96ed23a993e74147889cdc206fce01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#![no_std]
#![no_main]
teleprobe_meta::target!(b"rpi-pico");

use defmt::{assert_eq, *};
use embassy_executor::Spawner;
use embassy_rp::bootsel::is_bootsel_pressed;
use embassy_time::Timer;
use {defmt_rtt as _, panic_probe as _};

#[embassy_executor::main]
async fn main(_spawner: Spawner) {
    let p = embassy_rp::init(Default::default());
    info!("Hello World!");

    // add some delay to give an attached debug probe time to parse the
    // defmt RTT header. Reading that header might touch flash memory, which
    // interferes with flash write operations.
    // https://github.com/knurling-rs/defmt/pull/683
    Timer::after_millis(10).await;

    assert_eq!(is_bootsel_pressed(p.BOOTSEL), false);

    info!("Test OK");
    cortex_m::asm::bkpt();
}