Obtain the firmware blobs from the user instead of hardcoding magic flash addrs.

This commit is contained in:
Dario Nieuwenhuis
2022-07-17 00:33:30 +02:00
parent 4205eef3ec
commit 13c88a9ca3
7 changed files with 77 additions and 20 deletions

View File

@ -43,6 +43,17 @@ async fn net_task(stack: &'static Stack<cyw43::NetDevice<'static>>) -> ! {
async fn main(spawner: Spawner, p: Peripherals) {
info!("Hello World!");
// Include the WiFi firmware and CLM.
let fw = include_bytes!("../../../firmware/43439A0.bin");
let clm = include_bytes!("../../../firmware/43439A0_clm.bin");
// To make flashing faster for development, you may want to flash the firmwares independently
// at hardcoded addresses, instead of baking them into the program with `include_bytes!`:
// probe-rs-cli download 43439A0.bin --format bin --chip RP2040 --base-address 0x10100000
// probe-rs-cli download 43439A0.clm_blob --format bin --chip RP2040 --base-address 0x10140000
//let fw = unsafe { core::slice::from_raw_parts(0x10100000 as *const u8, 224190) };
//let clm = unsafe { core::slice::from_raw_parts(0x10140000 as *const u8, 4752) };
let pwr = Output::new(p.PIN_23, Level::Low);
let cs = Output::new(p.PIN_25, Level::High);
let clk = Output::new(p.PIN_29, Level::Low);
@ -54,11 +65,11 @@ async fn main(spawner: Spawner, p: Peripherals) {
let spi = ExclusiveDevice::new(bus, cs);
let state = forever!(cyw43::State::new());
let (mut control, runner) = cyw43::new(state, pwr, spi).await;
let (mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
spawner.spawn(wifi_task(runner)).unwrap();
let net_device = control.init().await;
let net_device = control.init(clm).await;
//control.join_open("MikroTik-951589").await;
control.join_wpa2("DirbaioWifi", "HelloWorld").await;