Skip to content

Commit 14922a8

Browse files
committed
Get firmware from cyw43 driver
1 parent a81cc29 commit 14922a8

File tree

6 files changed

+11
-73
lines changed

6 files changed

+11
-73
lines changed

boards/rp-pico-w/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ default = ["boot2", "rt", "critical-section-impl"]
3939
critical-section-impl = ["rp2040-hal/critical-section-impl"]
4040
boot2 = ["rp2040-boot2"]
4141
rt = ["cortex-m-rt","rp2040-hal/rt"]
42-
fix_fw = []
42+
fix_fw = ["cyw43/fix_fw"]
-219 KB
Binary file not shown.
-4.64 KB
Binary file not shown.

boards/rp-pico-w/examples/firmware/LICENSE-permissive-binary-license-1.0.txt

Lines changed: 0 additions & 49 deletions
This file was deleted.

boards/rp-pico-w/examples/firmware/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

boards/rp-pico-w/examples/pico_w_blinky.rs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ use embassy_executor::Spawner;
3131
use embassy_net::Stack;
3232
use embassy_time::{Duration, Timer};
3333

34-
/// The function configures the RP2040 peripherals, then blinks the LED in an
35-
/// infinite loop.
34+
/// The function configures the RP2040 peripherals, initializes
35+
/// networking, then blinks the LED in an infinite loop.
36+
/// TODO: add some simple network service
3637
#[entry]
3738
fn main() -> ! {
3839
info!("start");
@@ -89,15 +90,17 @@ fn main() -> ! {
8990
});
9091
}
9192

93+
// TODO documentation
9294
unsafe fn forever_mut<T>(r: &'_ mut T) -> &'static mut T {
9395
core::mem::transmute(r)
9496
}
9597

98+
// TODO documentation
9699
unsafe fn forever<T>(r: &'_ T) -> &'static T {
97100
core::mem::transmute(r)
98101
}
99102

100-
async fn run(spawner: Spawner, pins: rp_pico_w::Pins, state: &'static cyw43::State) {
103+
async fn run(spawner: Spawner, pins: rp_pico_w::Pins, state: &'static cyw43::State) -> ! {
101104
// These are implicitly used by the spi driver if they are in the correct mode
102105
let mut spi_cs: hal::gpio::dynpin::DynPin = pins.wl_cs.into();
103106
// TODO should be high from the beginning :-(
@@ -120,19 +123,8 @@ async fn run(spawner: Spawner, pins: rp_pico_w::Pins, state: &'static cyw43::Sta
120123

121124
let pwr = pins.wl_on.into_push_pull_output();
122125

123-
#[cfg(not(feature = "fix_fw"))]
124-
let fw = include_bytes!("firmware/43439A0.bin");
125-
#[cfg(not(feature = "fix_fw"))]
126-
let clm = include_bytes!("firmware/43439A0_clm.bin");
127-
128-
// To make flashing faster for development, you may want to flash the firmwares independently
129-
// at hardcoded addresses, instead of baking them into the program with `include_bytes!`:
130-
// probe-rs-cli download 43439A0.bin --format bin --chip RP2040 --base-address 0x10100000
131-
// probe-rs-cli download 43439A0.clm_blob --format bin --chip RP2040 --base-address 0x10140000
132-
#[cfg(feature = "fix_fw")]
133-
let fw = unsafe { core::slice::from_raw_parts(0x10100000 as *const u8, 224190) };
134-
#[cfg(feature = "fix_fw")]
135-
let clm = unsafe { core::slice::from_raw_parts(0x10140000 as *const u8, 4752) };
126+
let fw = cyw43::firmware::firmware();
127+
let clm = cyw43::firmware::clm();
136128

137129
use embassy_futures::yield_now;
138130
yield_now().await;
@@ -191,10 +183,10 @@ async fn run(spawner: Spawner, pins: rp_pico_w::Pins, state: &'static cyw43::Sta
191183
loop {
192184
info!("on");
193185
control.gpio_set(0, true).await;
194-
Timer::after(Duration::from_millis(200)).await;
186+
Timer::after(Duration::from_millis(500)).await;
195187

196188
info!("off");
197189
control.gpio_set(0, false).await;
198-
Timer::after(Duration::from_millis(200)).await;
190+
Timer::after(Duration::from_millis(500)).await;
199191
}
200192
}

0 commit comments

Comments
 (0)