Skip to content

Commit 5360efe

Browse files
committed
Update embed-alloc
1 parent 828aa7a commit 5360efe

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

D-heap-allocation/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ version = "0.1.0"
88
cortex-m = "0.7"
99
cortex-m-rt = "0.7"
1010
embedded-hal = { version = "1.0.0" }
11+
critical-section = "1.2.0"
1112

1213
# Debug probe printing
1314
defmt = "0.3"
@@ -18,7 +19,7 @@ panic-probe = { version = "0.3", features = ["print-defmt"] }
1819

1920
# Board support package (BSP)
2021
rp-pico = "0.9"
21-
embedded-alloc = "0.5.1"
22+
embedded-alloc = "0.6"
2223

2324
# cargo build/run
2425
[profile.dev]

D-heap-allocation/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use alloc::vec::Vec;
88
use bsp::entry;
99
use defmt::info;
1010
use defmt_rtt as _;
11-
use embedded_alloc::Heap;
11+
use embedded_alloc::LlffHeap as Heap;
1212
use embedded_hal::digital::OutputPin;
1313
use panic_probe as _;
1414

@@ -42,8 +42,8 @@ fn main() -> ! {
4242
{
4343
use core::mem::MaybeUninit;
4444
const HEAP_SIZE: usize = 1024;
45-
static HEAP_MEM: [MaybeUninit<u8>; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE];
46-
unsafe { HEAP.init(HEAP_MEM.as_ptr() as usize, HEAP_SIZE) }
45+
static mut HEAP_MEM: [MaybeUninit<u8>; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE];
46+
unsafe { HEAP.init(&raw mut HEAP_MEM as usize, HEAP_SIZE) }
4747
}
4848

4949
// Peripheral initialization

0 commit comments

Comments
 (0)