From 23ae289bf406ca8a45e418b5d85d0287f564c6c4 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 26 Feb 2018 22:27:52 +0100 Subject: [PATCH] fix the allocator example --- Cargo.toml | 1 - examples/allocator.rs | 2 +- memory.x | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e4e05ae..ebcc9c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,6 @@ cortex-m-semihosting = "0.2.0" # Uncomment for the allocator example. #alloc-cortex-m = "0.3.2" - [dependencies.cortex-m-rt] version = "0.3.12" # Comment for the panic example. diff --git a/examples/allocator.rs b/examples/allocator.rs index 7ebf962..209dc37 100644 --- a/examples/allocator.rs +++ b/examples/allocator.rs @@ -55,7 +55,7 @@ extern "C" { fn main() { // Initialize the allocator let start = unsafe { &mut _sheap as *mut u32 as usize }; - let end = unsafe { &mut _sheap as *mut u32 as usize }; + let end = unsafe { &mut _eheap as *mut u32 as usize }; unsafe { ALLOCATOR.init(start, end - start) } // Growable array allocated on the heap diff --git a/memory.x b/memory.x index 0a4ba2b..f407292 100644 --- a/memory.x +++ b/memory.x @@ -18,3 +18,6 @@ MEMORY /* This is required only on microcontrollers that store some configuration right after the vector table */ /* _stext = ORIGIN(FLASH) + 0x400; */ + +/* Size of the heap (in bytes) */ +/* _heap_size = 1024; */