mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
Fix WL boot example
This commit is contained in:
parent
ab4d378dda
commit
90427ee231
@ -5,7 +5,8 @@ MEMORY
|
||||
BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K
|
||||
FLASH : ORIGIN = 0x08008000, LENGTH = 64K
|
||||
DFU : ORIGIN = 0x08018000, LENGTH = 68K
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K - 1K
|
||||
SHARED_RAM (rwx) : ORIGIN = 0x20007C00, LENGTH = 1K
|
||||
}
|
||||
|
||||
__bootloader_state_start = ORIGIN(BOOTLOADER_STATE) - ORIGIN(BOOTLOADER);
|
||||
@ -13,3 +14,11 @@ __bootloader_state_end = ORIGIN(BOOTLOADER_STATE) + LENGTH(BOOTLOADER_STATE) - O
|
||||
|
||||
__bootloader_dfu_start = ORIGIN(DFU) - ORIGIN(BOOTLOADER);
|
||||
__bootloader_dfu_end = ORIGIN(DFU) + LENGTH(DFU) - ORIGIN(BOOTLOADER);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.shared_data :
|
||||
{
|
||||
*(.shared_data)
|
||||
} > SHARED_RAM
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use core::mem::MaybeUninit;
|
||||
|
||||
#[cfg(feature = "defmt")]
|
||||
use defmt_rtt::*;
|
||||
use embassy_boot_stm32::{AlignedBuffer, FirmwareUpdater, FirmwareUpdaterConfig};
|
||||
@ -9,6 +11,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_stm32::exti::ExtiInput;
|
||||
use embassy_stm32::flash::{Flash, WRITE_SIZE};
|
||||
use embassy_stm32::gpio::{Level, Output, Pull, Speed};
|
||||
use embassy_stm32::SharedData;
|
||||
use embassy_sync::mutex::Mutex;
|
||||
use panic_reset as _;
|
||||
|
||||
@ -17,9 +20,12 @@ static APP_B: &[u8] = &[0, 1, 2, 3];
|
||||
#[cfg(not(feature = "skip-include"))]
|
||||
static APP_B: &[u8] = include_bytes!("../../b.bin");
|
||||
|
||||
#[link_section = ".shared_data"]
|
||||
static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
|
||||
|
||||
#[embassy_executor::main]
|
||||
async fn main(_spawner: Spawner) {
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
let p = embassy_stm32::init_primary(Default::default(), &SHARED_DATA);
|
||||
let flash = Flash::new_blocking(p.FLASH);
|
||||
let flash = Mutex::new(BlockingAsync::new(flash));
|
||||
|
||||
|
@ -1,16 +1,22 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use core::mem::MaybeUninit;
|
||||
|
||||
#[cfg(feature = "defmt")]
|
||||
use defmt_rtt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_stm32::SharedData;
|
||||
use embassy_time::Timer;
|
||||
use panic_reset as _;
|
||||
|
||||
#[link_section = ".shared_data"]
|
||||
static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
|
||||
|
||||
#[embassy_executor::main]
|
||||
async fn main(_spawner: Spawner) {
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
let p = embassy_stm32::init_primary(Default::default(), &SHARED_DATA);
|
||||
let mut led = Output::new(p.PB15, Level::High, Speed::Low);
|
||||
|
||||
loop {
|
||||
|
Loading…
Reference in New Issue
Block a user