Skip to content

Commit 446bf59

Browse files
f-brooli-obk
authored andcommitted
Switch to CortexMHeap
1 parent bc92db7 commit 446bf59

File tree

4 files changed

+26
-17
lines changed

4 files changed

+26
-17
lines changed

Cargo.lock

Lines changed: 21 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spin = "0.4.5"
1717
volatile = "0.2.1"
1818
net = {git = "https://github.com/embed-rs/net.git"}
1919
rusttype = {git = "https://github.com/phil-opp/rusttype.git", branch = "no_std"}
20-
linked_list_allocator = "0.4.1"
20+
alloc-cortex-m = {git = "https://github.com/f-bro/alloc-cortex-m.git", branch = "alloc_api"}
2121

2222
[dependencies.arrayvec]
2323
default-features = false

src/heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ pub unsafe fn init() {
1010
let start = &__HEAP_START as *const _ as usize;
1111
let end = &__HEAP_END as *const _ as usize;
1212
let size = end - start;
13-
ALLOCATOR.lock().init(start, size);
13+
ALLOCATOR.init(start, size);
1414
}

src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#![feature(alloc)]
66
#![feature(try_from)]
77
#![feature(drop_types_in_const)]
8-
#![feature(option_entry)]
98
#![feature(global_allocator)]
109

1110
#![no_std]
@@ -26,7 +25,7 @@ extern crate spin;
2625
extern crate byteorder;
2726
extern crate net;
2827
extern crate rusttype;
29-
extern crate linked_list_allocator;
28+
extern crate alloc_cortex_m;
3029

3130
#[macro_use]
3231
pub mod semi_hosting;
@@ -64,7 +63,7 @@ pub extern "C" fn panic_fmt(fmt: core::fmt::Arguments, file: &'static str, line:
6463
}
6564

6665

67-
use linked_list_allocator::LockedHeap;
66+
use alloc_cortex_m::CortexMHeap;
6867

6968
#[global_allocator]
70-
static ALLOCATOR: LockedHeap = LockedHeap::empty();
69+
static ALLOCATOR: CortexMHeap = CortexMHeap::empty();

0 commit comments

Comments
 (0)