mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2024-12-23 12:41:31 +11:00
Make BSPs provide boot2 as a default feature (#153)
* Add boot2 feature. Add boot2 linkage into each BSP optional on feature * Enable boot2 feature in BSPs by default. Remove boot2 decl from all BSP examples * Add EXTERN in memory.x for BOOT2_FIRMWARE, rename bootloader static slice to BOOT2_FIRMWARE * Update new examples and itsy_bitsy BSP to use boot2 feature * Remove boot2 as a dev-dependency for the BSPs, no longer needed * Add no_mangle BOOT2_FIRMWARE to adafruit_macropad * Fix itsy-bitsy blinky - it wasn't using the BSP, so it didn't get BOOT2_FIRMWARE linked in
This commit is contained in:
parent
88bd408bc1
commit
0e7abdc705
|
@ -11,9 +11,12 @@ license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.7.2"
|
cortex-m = "0.7.2"
|
||||||
|
rp2040-boot2 = { version = "0.2.0", optional = true }
|
||||||
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0"}
|
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0"}
|
||||||
cortex-m-rt = { version = "0.7", optional = true }
|
cortex-m-rt = { version = "0.7", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rt"]
|
default = ["rt", "boot2"]
|
||||||
|
boot2 = ["rp2040-boot2"]
|
||||||
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,16 @@ extern crate cortex_m_rt;
|
||||||
#[cfg(feature = "rt")]
|
#[cfg(feature = "rt")]
|
||||||
pub use cortex_m_rt::entry;
|
pub use cortex_m_rt::entry;
|
||||||
|
|
||||||
|
// Adafruit macropad uses W25Q64JVxQ flash chip. Should work with BOOT_LOADER_W25Q080 (untested)
|
||||||
|
|
||||||
|
//// The linker will place this boot block at the start of our program image. We
|
||||||
|
//// need this to help the ROM bootloader get our code up and running.
|
||||||
|
#[cfg(feature = "boot2")]
|
||||||
|
#[link_section = ".boot2"]
|
||||||
|
#[no_mangle]
|
||||||
|
#[used]
|
||||||
|
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
||||||
|
|
||||||
pub use hal::pac;
|
pub use hal::pac;
|
||||||
|
|
||||||
hal::bsp_pins!(
|
hal::bsp_pins!(
|
||||||
|
|
|
@ -11,6 +11,7 @@ license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.7.2"
|
cortex-m = "0.7.2"
|
||||||
|
rp2040-boot2 = { version = "0.2.0", optional = true }
|
||||||
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0"}
|
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0"}
|
||||||
cortex-m-rt = { version = "0.7", optional = true }
|
cortex-m-rt = { version = "0.7", optional = true }
|
||||||
embedded-time = "0.12.0"
|
embedded-time = "0.12.0"
|
||||||
|
@ -18,12 +19,12 @@ embedded-time = "0.12.0"
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
panic-halt= "0.2.0"
|
panic-halt= "0.2.0"
|
||||||
embedded-hal ="0.2.5"
|
embedded-hal ="0.2.5"
|
||||||
rp2040-boot2 = "0.2"
|
|
||||||
nb = "1.0.0"
|
nb = "1.0.0"
|
||||||
smart-leds = "0.3.0"
|
smart-leds = "0.3.0"
|
||||||
pio = { git = "https://github.com/rp-rs/pio-rs.git", branch = "main" }
|
pio = { git = "https://github.com/rp-rs/pio-rs.git", branch = "main" }
|
||||||
ws2812-pio = { git = "https://github.com/ithinuel/ws2812-pio-rs", rev = "7a11616f994025f5c99f28b283d2b25d60d46a43" }
|
ws2812-pio = { git = "https://github.com/ithinuel/ws2812-pio-rs", rev = "7a11616f994025f5c99f28b283d2b25d60d46a43" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rt"]
|
default = ["boot2", "rt"]
|
||||||
|
boot2 = ["rp2040-boot2"]
|
||||||
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
||||||
|
|
|
@ -17,9 +17,6 @@ use feather_rp2040::{
|
||||||
Pins, XOSC_CRYSTAL_FREQ,
|
Pins, XOSC_CRYSTAL_FREQ,
|
||||||
};
|
};
|
||||||
use panic_halt as _;
|
use panic_halt as _;
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GD25Q64CS;
|
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
|
|
|
@ -24,9 +24,6 @@ use panic_halt as _;
|
||||||
use rp2040_hal::pio::PIOExt;
|
use rp2040_hal::pio::PIOExt;
|
||||||
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
||||||
use ws2812_pio::Ws2812;
|
use ws2812_pio::Ws2812;
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GD25Q64CS;
|
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
|
|
|
@ -7,6 +7,14 @@ extern crate cortex_m_rt;
|
||||||
#[cfg(feature = "rt")]
|
#[cfg(feature = "rt")]
|
||||||
pub use cortex_m_rt::entry;
|
pub use cortex_m_rt::entry;
|
||||||
|
|
||||||
|
//// The linker will place this boot block at the start of our program image. We
|
||||||
|
//// need this to help the ROM bootloader get our code up and running.
|
||||||
|
#[cfg(feature = "boot2")]
|
||||||
|
#[link_section = ".boot2"]
|
||||||
|
#[no_mangle]
|
||||||
|
#[used]
|
||||||
|
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_GD25Q64CS;
|
||||||
|
|
||||||
pub use hal::pac;
|
pub use hal::pac;
|
||||||
|
|
||||||
hal::bsp_pins!(
|
hal::bsp_pins!(
|
||||||
|
|
|
@ -11,6 +11,7 @@ license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.7.2"
|
cortex-m = "0.7.2"
|
||||||
|
rp2040-boot2 = { version = "0.2.0", optional = true }
|
||||||
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0"}
|
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0"}
|
||||||
cortex-m-rt = { version = "0.7", optional = true }
|
cortex-m-rt = { version = "0.7", optional = true }
|
||||||
embedded-time = "0.12.0"
|
embedded-time = "0.12.0"
|
||||||
|
@ -18,12 +19,12 @@ embedded-time = "0.12.0"
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
panic-halt= "0.2.0"
|
panic-halt= "0.2.0"
|
||||||
embedded-hal ="0.2.5"
|
embedded-hal ="0.2.5"
|
||||||
rp2040-boot2 = "0.2"
|
|
||||||
smart-leds = "0.3"
|
smart-leds = "0.3"
|
||||||
nb = "1.0.0"
|
nb = "1.0.0"
|
||||||
pio = { git = "https://github.com/rp-rs/pio-rs.git", branch = "main" }
|
pio = { git = "https://github.com/rp-rs/pio-rs.git", branch = "main" }
|
||||||
ws2812-pio = { git = "https://github.com/ithinuel/ws2812-pio-rs", rev = "7a11616f994025f5c99f28b283d2b25d60d46a43" }
|
ws2812-pio = { git = "https://github.com/ithinuel/ws2812-pio-rs", rev = "7a11616f994025f5c99f28b283d2b25d60d46a43" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rt"]
|
default = ["rt", "boot2"]
|
||||||
|
boot2 = ["rp2040-boot2"]
|
||||||
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! # GPIO 'Blinky' Example
|
//! # GPIO 'Blinky' Example
|
||||||
//!
|
//!
|
||||||
//! This application demonstrates how to control a GPIO pin on the RP2040.
|
//! Blinks the LED on a Adafruit itsy-bitsy RP2040 board
|
||||||
//!
|
//!
|
||||||
//! It may need to be adapted to your particular board layout and/or pin assignment.
|
//! It may need to be adapted to your particular board layout and/or pin assignment.
|
||||||
//!
|
//!
|
||||||
|
@ -16,27 +16,21 @@ use cortex_m_rt::entry;
|
||||||
// be linked)
|
// be linked)
|
||||||
use panic_halt as _;
|
use panic_halt as _;
|
||||||
|
|
||||||
// Alias for our HAL crate
|
|
||||||
use rp2040_hal as hal;
|
|
||||||
|
|
||||||
// A shorter alias for the Peripheral Access Crate, which provides low-level
|
|
||||||
// register access
|
|
||||||
use hal::pac;
|
|
||||||
|
|
||||||
// Some traits we need
|
// Some traits we need
|
||||||
use embedded_hal::digital::v2::OutputPin;
|
use embedded_hal::digital::v2::OutputPin;
|
||||||
use embedded_time::fixed_point::FixedPoint;
|
use embedded_time::fixed_point::FixedPoint;
|
||||||
use rp2040_hal::clocks::Clock;
|
|
||||||
|
|
||||||
/// The linker will place this boot block at the start of our program image. We
|
use itsy_bitsy_rp2040::{
|
||||||
// need this to help the ROM bootloader get our code up and running.
|
hal::{
|
||||||
#[link_section = ".boot2"]
|
clocks::{init_clocks_and_plls, Clock},
|
||||||
#[used]
|
pac,
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
sio::Sio,
|
||||||
|
watchdog::Watchdog,
|
||||||
|
},
|
||||||
|
Pins, XOSC_CRYSTAL_FREQ,
|
||||||
|
};
|
||||||
|
|
||||||
/// External high-speed crystal on the Raspberry Pi Pico board is 12 MHz. Adjust
|
use cortex_m::delay::Delay;
|
||||||
/// if your board has a different frequency
|
|
||||||
const XTAL_FREQ_HZ: u32 = 12_000_000u32;
|
|
||||||
|
|
||||||
/// Entry point to our bare-metal application.
|
/// Entry point to our bare-metal application.
|
||||||
///
|
///
|
||||||
|
@ -52,11 +46,11 @@ fn main() -> ! {
|
||||||
let core = pac::CorePeripherals::take().unwrap();
|
let core = pac::CorePeripherals::take().unwrap();
|
||||||
|
|
||||||
// Set up the watchdog driver - needed by the clock setup code
|
// Set up the watchdog driver - needed by the clock setup code
|
||||||
let mut watchdog = hal::watchdog::Watchdog::new(pac.WATCHDOG);
|
let mut watchdog = Watchdog::new(pac.WATCHDOG);
|
||||||
|
|
||||||
// Configure the clocks
|
// Configure the clocks
|
||||||
let clocks = hal::clocks::init_clocks_and_plls(
|
let clocks = init_clocks_and_plls(
|
||||||
XTAL_FREQ_HZ,
|
XOSC_CRYSTAL_FREQ,
|
||||||
pac.XOSC,
|
pac.XOSC,
|
||||||
pac.CLOCKS,
|
pac.CLOCKS,
|
||||||
pac.PLL_SYS,
|
pac.PLL_SYS,
|
||||||
|
@ -67,24 +61,21 @@ fn main() -> ! {
|
||||||
.ok()
|
.ok()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().integer());
|
let mut delay = Delay::new(core.SYST, clocks.system_clock.freq().integer());
|
||||||
|
|
||||||
// The single-cycle I/O block controls our GPIO pins
|
// The single-cycle I/O block controls our GPIO pins
|
||||||
let sio = hal::sio::Sio::new(pac.SIO);
|
let sio = Sio::new(pac.SIO);
|
||||||
|
|
||||||
// Set the pins to their default state
|
let pins = Pins::new(
|
||||||
let pins = hal::gpio::Pins::new(
|
|
||||||
pac.IO_BANK0,
|
pac.IO_BANK0,
|
||||||
pac.PADS_BANK0,
|
pac.PADS_BANK0,
|
||||||
sio.gpio_bank0,
|
sio.gpio_bank0,
|
||||||
&mut pac.RESETS,
|
&mut pac.RESETS,
|
||||||
);
|
);
|
||||||
|
let mut led_pin = pins.d13.into_push_pull_output();
|
||||||
|
|
||||||
// Configure GPIO25 as an output
|
|
||||||
let mut led_pin = pins.gpio11.into_push_pull_output();
|
|
||||||
loop {
|
loop {
|
||||||
led_pin.set_high().unwrap();
|
led_pin.set_high().unwrap();
|
||||||
// TODO: Replace with proper 1s delays once we have clocks working
|
|
||||||
delay.delay_ms(500);
|
delay.delay_ms(500);
|
||||||
led_pin.set_low().unwrap();
|
led_pin.set_low().unwrap();
|
||||||
delay.delay_ms(500);
|
delay.delay_ms(500);
|
||||||
|
|
|
@ -22,10 +22,6 @@ use itsy_bitsy_rp2040::{
|
||||||
Pins, XOSC_CRYSTAL_FREQ,
|
Pins, XOSC_CRYSTAL_FREQ,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let mut pac = pac::Peripherals::take().unwrap();
|
let mut pac = pac::Peripherals::take().unwrap();
|
||||||
|
|
|
@ -7,6 +7,14 @@ extern crate cortex_m_rt;
|
||||||
#[cfg(feature = "rt")]
|
#[cfg(feature = "rt")]
|
||||||
pub use cortex_m_rt::entry;
|
pub use cortex_m_rt::entry;
|
||||||
|
|
||||||
|
//// The linker will place this boot block at the start of our program image. We
|
||||||
|
//// need this to help the ROM bootloader get our code up and running.
|
||||||
|
#[cfg(feature = "boot2")]
|
||||||
|
#[link_section = ".boot2"]
|
||||||
|
#[no_mangle]
|
||||||
|
#[used]
|
||||||
|
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
||||||
|
|
||||||
pub use hal::pac;
|
pub use hal::pac;
|
||||||
|
|
||||||
hal::bsp_pins!(
|
hal::bsp_pins!(
|
||||||
|
|
|
@ -11,6 +11,7 @@ license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.7.2"
|
cortex-m = "0.7.2"
|
||||||
|
rp2040-boot2 = { version = "0.2.0", optional = true }
|
||||||
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0"}
|
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0"}
|
||||||
cortex-m-rt = { version = "0.7", optional = true }
|
cortex-m-rt = { version = "0.7", optional = true }
|
||||||
embedded-time = "0.12.0"
|
embedded-time = "0.12.0"
|
||||||
|
@ -36,12 +37,12 @@ optional = true
|
||||||
panic-halt= "0.2.0"
|
panic-halt= "0.2.0"
|
||||||
embedded-hal ="0.2.5"
|
embedded-hal ="0.2.5"
|
||||||
cortex-m-rtic = "0.6.0-alpha.5"
|
cortex-m-rtic = "0.6.0-alpha.5"
|
||||||
rp2040-boot2 = "0.2"
|
|
||||||
nb = "1.0"
|
nb = "1.0"
|
||||||
i2c-pio = { git = "https://github.com/ithinuel/i2c-pio-rs", rev = "fb6167d02b7fbc46a83f344f5242823bcd16e271" }
|
i2c-pio = { git = "https://github.com/ithinuel/i2c-pio-rs", rev = "fb6167d02b7fbc46a83f344f5242823bcd16e271" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rt"]
|
default = ["boot2", "rt"]
|
||||||
|
boot2 = ["rp2040-boot2"]
|
||||||
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
||||||
embassy-traits = ["futures", "embassy", "embassy_traits"]
|
embassy-traits = ["futures", "embassy", "embassy_traits"]
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,6 @@ use pico::hal::pac;
|
||||||
// higher-level drivers.
|
// higher-level drivers.
|
||||||
use pico::hal;
|
use pico::hal;
|
||||||
|
|
||||||
//// The linker will place this boot block at the start of our program image. We
|
|
||||||
//// need this to help the ROM bootloader get our code up and running.
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
/// Entry point to our bare-metal application.
|
/// Entry point to our bare-metal application.
|
||||||
///
|
///
|
||||||
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function
|
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function
|
||||||
|
|
|
@ -33,10 +33,6 @@ use pico::hal::pac;
|
||||||
// higher-level drivers.
|
// higher-level drivers.
|
||||||
use pico::hal;
|
use pico::hal;
|
||||||
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
// Grab our singleton objects
|
// Grab our singleton objects
|
||||||
|
|
|
@ -30,12 +30,6 @@ use pico::hal::pac;
|
||||||
// higher-level drivers.
|
// higher-level drivers.
|
||||||
use pico::hal;
|
use pico::hal;
|
||||||
|
|
||||||
//// The linker will place this boot block at the start of our program image. We
|
|
||||||
//// need this to help the ROM bootloader get our code up and running.
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
/// Entry point to our bare-metal application.
|
/// Entry point to our bare-metal application.
|
||||||
///
|
///
|
||||||
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function
|
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function
|
||||||
|
|
|
@ -41,10 +41,6 @@ use panic_halt as _;
|
||||||
mod controller;
|
mod controller;
|
||||||
mod peripheral;
|
mod peripheral;
|
||||||
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
const ADDRESS: u16 = 0x55;
|
const ADDRESS: u16 = 0x55;
|
||||||
|
|
||||||
#[embassy::task]
|
#[embassy::task]
|
||||||
|
|
|
@ -38,12 +38,6 @@ use pico::hal::pac;
|
||||||
// higher-level drivers.
|
// higher-level drivers.
|
||||||
use pico::hal;
|
use pico::hal;
|
||||||
|
|
||||||
//// The linker will place this boot block at the start of our program image. We
|
|
||||||
//// need this to help the ROM bootloader get our code up and running.
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
/// Prints the temperature received from the sensor
|
/// Prints the temperature received from the sensor
|
||||||
fn print_temperature(serial: &mut impl FmtWrite, temp: [u8; 2]) {
|
fn print_temperature(serial: &mut impl FmtWrite, temp: [u8; 2]) {
|
||||||
let temp_i16 = i16::from_be_bytes(temp) >> 5;
|
let temp_i16 = i16::from_be_bytes(temp) >> 5;
|
||||||
|
|
|
@ -34,12 +34,6 @@ use pico::hal::pac;
|
||||||
// higher-level drivers.
|
// higher-level drivers.
|
||||||
use pico::hal;
|
use pico::hal;
|
||||||
|
|
||||||
//// The linker will place this boot block at the start of our program image. We
|
|
||||||
//// need this to help the ROM bootloader get our code up and running.
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
// The minimum PWM value (i.e. LED brightness) we want
|
// The minimum PWM value (i.e. LED brightness) we want
|
||||||
const LOW: u16 = 0;
|
const LOW: u16 = 0;
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
use panic_halt as _;
|
use panic_halt as _;
|
||||||
use rp2040_hal as hal;
|
use rp2040_hal as hal;
|
||||||
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
#[rtic::app(device = crate::hal::pac, peripherals = true)]
|
#[rtic::app(device = crate::hal::pac, peripherals = true)]
|
||||||
mod app {
|
mod app {
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,6 @@ use usb_device::{class_prelude::*, prelude::*};
|
||||||
// USB Communications Class Device support
|
// USB Communications Class Device support
|
||||||
use usbd_serial::SerialPort;
|
use usbd_serial::SerialPort;
|
||||||
|
|
||||||
//// The linker will place this boot block at the start of our program image. We
|
|
||||||
//// need this to help the ROM bootloader get our code up and running.
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
/// Entry point to our bare-metal application.
|
/// Entry point to our bare-metal application.
|
||||||
///
|
///
|
||||||
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function
|
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function
|
||||||
|
|
|
@ -45,12 +45,6 @@ use usb_device::{class_prelude::*, prelude::*};
|
||||||
// USB Communications Class Device support
|
// USB Communications Class Device support
|
||||||
use usbd_serial::SerialPort;
|
use usbd_serial::SerialPort;
|
||||||
|
|
||||||
//// The linker will place this boot block at the start of our program image. We
|
|
||||||
//// need this to help the ROM bootloader get our code up and running.
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
/// The USB Device Driver (shared with the interrupt).
|
/// The USB Device Driver (shared with the interrupt).
|
||||||
static mut USB_DEVICE: Option<UsbDevice<hal::usb::UsbBus>> = None;
|
static mut USB_DEVICE: Option<UsbDevice<hal::usb::UsbBus>> = None;
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,6 @@ use usbd_hid::descriptor::generator_prelude::*;
|
||||||
use usbd_hid::descriptor::MouseReport;
|
use usbd_hid::descriptor::MouseReport;
|
||||||
use usbd_hid::hid_class::HIDClass;
|
use usbd_hid::hid_class::HIDClass;
|
||||||
|
|
||||||
//// The linker will place this boot block at the start of our program image. We
|
|
||||||
//// need this to help the ROM bootloader get our code up and running.
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
/// The USB Device Driver (shared with the interrupt).
|
/// The USB Device Driver (shared with the interrupt).
|
||||||
static mut USB_DEVICE: Option<UsbDevice<hal::usb::UsbBus>> = None;
|
static mut USB_DEVICE: Option<UsbDevice<hal::usb::UsbBus>> = None;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,14 @@ extern crate cortex_m_rt;
|
||||||
#[cfg(feature = "rt")]
|
#[cfg(feature = "rt")]
|
||||||
pub use cortex_m_rt::entry;
|
pub use cortex_m_rt::entry;
|
||||||
|
|
||||||
|
//// The linker will place this boot block at the start of our program image. We
|
||||||
|
//// need this to help the ROM bootloader get our code up and running.
|
||||||
|
#[cfg(feature = "boot2")]
|
||||||
|
#[link_section = ".boot2"]
|
||||||
|
#[no_mangle]
|
||||||
|
#[used]
|
||||||
|
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
||||||
|
|
||||||
pub use hal::pac;
|
pub use hal::pac;
|
||||||
|
|
||||||
hal::bsp_pins!(
|
hal::bsp_pins!(
|
||||||
|
|
|
@ -18,14 +18,15 @@ st7789 = "0.6.1"
|
||||||
display-interface-spi = "0.4.1"
|
display-interface-spi = "0.4.1"
|
||||||
embedded-time = "0.12.0"
|
embedded-time = "0.12.0"
|
||||||
embedded-graphics = "0.7.1"
|
embedded-graphics = "0.7.1"
|
||||||
|
rp2040-boot2 = { version = "0.2.0", optional = true }
|
||||||
[features]
|
|
||||||
default = ["rt"]
|
|
||||||
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
display-interface = "0.4.1"
|
display-interface = "0.4.1"
|
||||||
panic-halt = "0.2.0"
|
panic-halt = "0.2.0"
|
||||||
arrayvec = { version="0.7.1", default-features=false }
|
arrayvec = { version="0.7.1", default-features=false }
|
||||||
rp2040-boot2 = "0.2"
|
|
||||||
nb = "1.0.0"
|
nb = "1.0.0"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["boot2", "rt"]
|
||||||
|
boot2 = ["rp2040-boot2"]
|
||||||
|
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
||||||
|
|
|
@ -16,10 +16,6 @@ use hal::{adc::Adc, clocks::*, sio::Sio, watchdog::Watchdog};
|
||||||
use panic_halt as _;
|
use panic_halt as _;
|
||||||
use pico_explorer::{hal, pac, Button, PicoExplorer, XOSC_CRYSTAL_FREQ};
|
use pico_explorer::{hal, pac, Button, PicoExplorer, XOSC_CRYSTAL_FREQ};
|
||||||
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
// See 4.9.5 from RP2040 datasheet
|
// See 4.9.5 from RP2040 datasheet
|
||||||
fn calc_temp(adc_value: f32, refv: f64) -> f64 {
|
fn calc_temp(adc_value: f32, refv: f64) -> f64 {
|
||||||
let vbe: f64 = f64::from(adc_value) * refv;
|
let vbe: f64 = f64::from(adc_value) * refv;
|
||||||
|
|
|
@ -7,6 +7,15 @@ extern crate cortex_m_rt;
|
||||||
|
|
||||||
#[cfg(feature = "rt")]
|
#[cfg(feature = "rt")]
|
||||||
pub use cortex_m_rt::entry;
|
pub use cortex_m_rt::entry;
|
||||||
|
|
||||||
|
//// The linker will place this boot block at the start of our program image. We
|
||||||
|
//// need this to help the ROM bootloader get our code up and running.
|
||||||
|
#[cfg(feature = "boot2")]
|
||||||
|
#[link_section = ".boot2"]
|
||||||
|
#[no_mangle]
|
||||||
|
#[used]
|
||||||
|
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
||||||
|
|
||||||
use display_interface_spi::SPIInterface;
|
use display_interface_spi::SPIInterface;
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
draw_target::DrawTarget,
|
draw_target::DrawTarget,
|
||||||
|
|
|
@ -13,16 +13,16 @@ license = "MIT OR Apache-2.0"
|
||||||
cortex-m = "0.7.2"
|
cortex-m = "0.7.2"
|
||||||
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0"}
|
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0"}
|
||||||
cortex-m-rt = { version = "0.7", optional = true }
|
cortex-m-rt = { version = "0.7", optional = true }
|
||||||
|
rp2040-boot2 = { version = "0.2.0", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
embedded-time = "0.12.0"
|
embedded-time = "0.12.0"
|
||||||
panic-halt= "0.2.0"
|
panic-halt= "0.2.0"
|
||||||
embedded-hal ="0.2.5"
|
embedded-hal ="0.2.5"
|
||||||
cortex-m-rtic = "0.6.0-alpha.5"
|
cortex-m-rtic = "0.6.0-alpha.5"
|
||||||
rp2040-boot2 = "0.2"
|
|
||||||
nb = "1.0"
|
nb = "1.0"
|
||||||
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rt"]
|
default = ["boot2", "rt"]
|
||||||
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
boot2 = ["rp2040-boot2"]
|
||||||
|
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
||||||
|
|
|
@ -34,12 +34,6 @@ use pico_lipo_16_mb::hal::pac;
|
||||||
// higher-level drivers.
|
// higher-level drivers.
|
||||||
use pico_lipo_16_mb::hal;
|
use pico_lipo_16_mb::hal;
|
||||||
|
|
||||||
//// The linker will place this boot block at the start of our program image. We
|
|
||||||
//// need this to help the ROM bootloader get our code up and running.
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
/// Entry point to our bare-metal application.
|
/// Entry point to our bare-metal application.
|
||||||
///
|
///
|
||||||
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function
|
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this function
|
||||||
|
|
|
@ -7,6 +7,14 @@ extern crate cortex_m_rt;
|
||||||
#[cfg(feature = "rt")]
|
#[cfg(feature = "rt")]
|
||||||
pub use cortex_m_rt::entry;
|
pub use cortex_m_rt::entry;
|
||||||
|
|
||||||
|
//// The linker will place this boot block at the start of our program image. We
|
||||||
|
//// need this to help the ROM bootloader get our code up and running.
|
||||||
|
#[cfg(feature = "boot2")]
|
||||||
|
#[link_section = ".boot2"]
|
||||||
|
#[no_mangle]
|
||||||
|
#[used]
|
||||||
|
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
||||||
|
|
||||||
pub use hal::pac;
|
pub use hal::pac;
|
||||||
|
|
||||||
hal::bsp_pins!(
|
hal::bsp_pins!(
|
||||||
|
|
|
@ -14,16 +14,17 @@ cortex-m = "0.7.2"
|
||||||
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0" }
|
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0" }
|
||||||
cortex-m-rt = { version = "0.7.0", optional = true }
|
cortex-m-rt = { version = "0.7.0", optional = true }
|
||||||
embedded-hal = { version = "0.2.4", features = ["unproven"] }
|
embedded-hal = { version = "0.2.4", features = ["unproven"] }
|
||||||
|
rp2040-boot2 = { version = "0.2.0", optional = true }
|
||||||
[features]
|
|
||||||
default = ["rt"]
|
|
||||||
rt = ["cortex-m-rt", "rp2040-hal/rt"]
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
panic-halt = "0.2.0"
|
panic-halt = "0.2.0"
|
||||||
rp2040-boot2 = "0.2"
|
|
||||||
smart-leds = "0.3.0"
|
smart-leds = "0.3.0"
|
||||||
embedded-time = "0.12.0"
|
embedded-time = "0.12.0"
|
||||||
nb = "1.0.0"
|
nb = "1.0.0"
|
||||||
pio = { git = "https://github.com/rp-rs/pio-rs.git", branch = "main" }
|
pio = { git = "https://github.com/rp-rs/pio-rs.git", branch = "main" }
|
||||||
ws2812-pio = { git = "https://github.com/ithinuel/ws2812-pio-rs", rev = "7a11616f994025f5c99f28b283d2b25d60d46a43" }
|
ws2812-pio = { git = "https://github.com/ithinuel/ws2812-pio-rs", rev = "7a11616f994025f5c99f28b283d2b25d60d46a43" }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["boot2", "rt"]
|
||||||
|
boot2 = ["rp2040-boot2"]
|
||||||
|
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
||||||
|
|
|
@ -28,12 +28,6 @@ use rp2040_hal::pio::PIOExt;
|
||||||
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
use smart_leds::{brightness, SmartLedsWrite, RGB8};
|
||||||
use ws2812_pio::Ws2812;
|
use ws2812_pio::Ws2812;
|
||||||
|
|
||||||
//// The linker will place this boot block at the start of our program image.
|
|
||||||
/// We need this to help the ROM bootloader get our code up and running.
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
||||||
|
|
||||||
/// Entry point to our bare-metal application.
|
/// Entry point to our bare-metal application.
|
||||||
///
|
///
|
||||||
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this
|
/// The `#[entry]` macro ensures the Cortex-M start-up code calls this
|
||||||
|
|
|
@ -6,6 +6,14 @@ extern crate cortex_m_rt;
|
||||||
#[cfg(feature = "rt")]
|
#[cfg(feature = "rt")]
|
||||||
pub use cortex_m_rt::entry;
|
pub use cortex_m_rt::entry;
|
||||||
|
|
||||||
|
//// The linker will place this boot block at the start of our program image. We
|
||||||
|
//// need this to help the ROM bootloader get our code up and running.
|
||||||
|
#[cfg(feature = "boot2")]
|
||||||
|
#[link_section = ".boot2"]
|
||||||
|
#[no_mangle]
|
||||||
|
#[used]
|
||||||
|
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
||||||
|
|
||||||
pub use hal::pac;
|
pub use hal::pac;
|
||||||
|
|
||||||
hal::bsp_pins!(
|
hal::bsp_pins!(
|
||||||
|
|
|
@ -14,16 +14,17 @@ cortex-m = "0.7.2"
|
||||||
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0"}
|
rp2040-hal = { path = "../../rp2040-hal", version = "0.3.0"}
|
||||||
cortex-m-rt = { version = "0.7", optional = true }
|
cortex-m-rt = { version = "0.7", optional = true }
|
||||||
embedded-time = "0.12.0"
|
embedded-time = "0.12.0"
|
||||||
|
rp2040-boot2 = { version = "0.2.0", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
panic-halt= "0.2.0"
|
panic-halt= "0.2.0"
|
||||||
embedded-hal ="0.2.5"
|
embedded-hal ="0.2.5"
|
||||||
rp2040-boot2 = "0.2"
|
|
||||||
smart-leds = "0.3"
|
smart-leds = "0.3"
|
||||||
nb = "1.0.0"
|
nb = "1.0.0"
|
||||||
pio = { git = "https://github.com/rp-rs/pio-rs.git", branch = "main" }
|
pio = { git = "https://github.com/rp-rs/pio-rs.git", branch = "main" }
|
||||||
ws2812-pio = { git = "https://github.com/ithinuel/ws2812-pio-rs", rev = "7a11616f994025f5c99f28b283d2b25d60d46a43" }
|
ws2812-pio = { git = "https://github.com/ithinuel/ws2812-pio-rs", rev = "7a11616f994025f5c99f28b283d2b25d60d46a43" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rt"]
|
default = ["boot2", "rt"]
|
||||||
|
boot2 = ["rp2040-boot2"]
|
||||||
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
rt = ["cortex-m-rt","rp2040-hal/rt"]
|
||||||
|
|
|
@ -22,10 +22,6 @@ use qt_py_rp2040::{
|
||||||
Pins, XOSC_CRYSTAL_FREQ,
|
Pins, XOSC_CRYSTAL_FREQ,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[link_section = ".boot2"]
|
|
||||||
#[used]
|
|
||||||
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GD25Q64CS;
|
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let mut pac = pac::Peripherals::take().unwrap();
|
let mut pac = pac::Peripherals::take().unwrap();
|
||||||
|
|
|
@ -7,6 +7,14 @@ extern crate cortex_m_rt;
|
||||||
#[cfg(feature = "rt")]
|
#[cfg(feature = "rt")]
|
||||||
pub use cortex_m_rt::entry;
|
pub use cortex_m_rt::entry;
|
||||||
|
|
||||||
|
//// The linker will place this boot block at the start of our program image. We
|
||||||
|
//// need this to help the ROM bootloader get our code up and running.
|
||||||
|
#[cfg(feature = "boot2")]
|
||||||
|
#[link_section = ".boot2"]
|
||||||
|
#[no_mangle]
|
||||||
|
#[used]
|
||||||
|
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_GD25Q64CS;
|
||||||
|
|
||||||
pub use hal::pac;
|
pub use hal::pac;
|
||||||
|
|
||||||
hal::bsp_pins!(
|
hal::bsp_pins!(
|
||||||
|
|
2
memory.x
2
memory.x
|
@ -4,6 +4,8 @@ MEMORY {
|
||||||
RAM : ORIGIN = 0x20000000, LENGTH = 256K
|
RAM : ORIGIN = 0x20000000, LENGTH = 256K
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXTERN(BOOT2_FIRMWARE)
|
||||||
|
|
||||||
SECTIONS {
|
SECTIONS {
|
||||||
/* ### Boot loader */
|
/* ### Boot loader */
|
||||||
.boot2 ORIGIN(BOOT2) :
|
.boot2 ORIGIN(BOOT2) :
|
||||||
|
|
|
@ -39,7 +39,7 @@ optional = true
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
cortex-m-rt = "0.7"
|
cortex-m-rt = "0.7"
|
||||||
panic-halt = "0.2.0"
|
panic-halt = "0.2.0"
|
||||||
rp2040-boot2 = "0.2"
|
rp2040-boot2 = "0.2.0"
|
||||||
hd44780-driver = "0.4.0"
|
hd44780-driver = "0.4.0"
|
||||||
pio-proc = { git = "https://github.com/rp-rs/pio-rs.git", branch = "main" }
|
pio-proc = { git = "https://github.com/rp-rs/pio-rs.git", branch = "main" }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue