From 426be0d5f163bcbd701eaa5b81d85275214db3ba Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 14 Sep 2019 19:09:38 +0200 Subject: [PATCH] main: remove allocator --- firmware/Cargo.lock | 32 -------------------------------- firmware/Cargo.toml | 3 --- firmware/src/main.rs | 13 ------------- 3 files changed, 48 deletions(-) diff --git a/firmware/Cargo.lock b/firmware/Cargo.lock index f0ed724..bf69463 100644 --- a/firmware/Cargo.lock +++ b/firmware/Cargo.lock @@ -13,15 +13,6 @@ dependencies = [ "as-slice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "alloc-cortex-m" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cortex-m 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "linked_list_allocator 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "as-slice" version = "0.1.0" @@ -72,14 +63,6 @@ name = "byteorder" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "cortex-m" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "volatile-register 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "cortex-m" version = "0.5.10" @@ -158,7 +141,6 @@ dependencies = [ name = "ionpak-firmware" version = "1.0.0" dependencies = [ - "alloc-cortex-m 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "bare-metal 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "bit_field 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "btoi 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -190,11 +172,6 @@ name = "libm" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "linked_list_allocator" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "managed" version = "0.5.1" @@ -360,11 +337,6 @@ name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "volatile-register" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "volatile-register" version = "0.2.0" @@ -396,7 +368,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum aligned 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d39da9b88ae1a81c03c9c082b8db83f1d0e93914126041962af61034ab44c4a5" "checksum aligned 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d3a316c7ea8e1e9ece54862c992def5a7ac14de9f5832b69d71760680efeeefa" -"checksum alloc-cortex-m 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d5f7d01bc93ce089de636f946f7f1fdc5e5d751732367e019c9755440e7aef4" "checksum as-slice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "293dac66b274fab06f95e7efb05ec439a6b70136081ea522d270bc351ae5bb27" "checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" "checksum bare-metal 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" @@ -405,7 +376,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum btoi 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e4ced8205e70d9e553d008d53ded735808fa6133597318d48f74fc2bf9861471" "checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" -"checksum cortex-m 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3df5de9a9829f2ccb7defa8945fa020c6614cd2f6ba9b5f33db9241dcc01985e" "checksum cortex-m 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0b159a1e8306949579de3698c841dba58058197b65c60807194e4fa1e7a554" "checksum cortex-m 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "145da2fc379bbd378ed425e75e1748214add9bbd800d4d5b77abb54ca423dbca" "checksum cortex-m-rt 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "17805910e3ecf029bdbfcc42b7384d9e3d9e5626153fa810002c1ef9839338ac" @@ -416,7 +386,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" -"checksum linked_list_allocator 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "47314ec1d29aa869ee7cb5a5be57be9b1055c56567d59c3fb6689926743e0bea" "checksum managed 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "43e2737ecabe4ae36a68061398bf27d2bfd0763f4c3c837a398478459494c4b7" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum nb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b1411551beb3c11dedfb0a90a0fa256b47d28b9ec2cdff34c25a2fa59e45dbdc" @@ -441,7 +410,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum vcell 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "876e32dcadfe563a4289e994f7cb391197f362b6315dc45e8ba4aa6f564a4b3c" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum volatile-register 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a470889aa8f2d3ad893bd43cd90c824e63e8ac0ee5fe64c5d81a932d184fd549" "checksum volatile-register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d67cb4616d99b940db1d6bd28844ff97108b498a6ca850e5b6191a532063286" "checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/firmware/Cargo.toml b/firmware/Cargo.toml index a42b17f..73e5507 100644 --- a/firmware/Cargo.toml +++ b/firmware/Cargo.toml @@ -19,9 +19,6 @@ cortex-m-semihosting = "0.3" byteorder = { version = "1.3", default-features = false } bit_field = "0.10" bare-metal = "0.2" -# TODO: remove -alloc-cortex-m = "0.3" -# TODO: needed with nom? btoi = { version = "~0.4", default-features = false } nom = { version = "~5", default-features = false } diff --git a/firmware/src/main.rs b/firmware/src/main.rs index 67654b3..827c3b0 100644 --- a/firmware/src/main.rs +++ b/firmware/src/main.rs @@ -1,9 +1,7 @@ #![feature(const_fn)] -#![feature(alloc_error_handler)] #![no_std] #![no_main] -extern crate alloc; use cortex_m_rt::{entry, heap_start}; use core::fmt::{self, Write}; use smoltcp::time::Instant; @@ -11,7 +9,6 @@ use smoltcp::wire::{IpCidr, IpAddress, EthernetAddress}; use smoltcp::iface::{NeighborCache, EthernetInterfaceBuilder}; use smoltcp::socket::{SocketSet, TcpSocket, TcpSocketBuffer}; use cortex_m_semihosting::hio; -use alloc_cortex_m::CortexMHeap; #[macro_export] macro_rules! print { @@ -36,15 +33,6 @@ pub fn panic_fmt(info: &core::panic::PanicInfo) -> ! { loop {} } -#[global_allocator] -static ALLOCATOR: CortexMHeap = CortexMHeap::empty(); -const HEAP_SIZE: usize = 8192; - -#[alloc_error_handler] -fn alloc_error_handler(layout: alloc::alloc::Layout) -> ! { - panic!("Allocation error for: {:?}", layout) -} - mod board; use self::board::{gpio::Gpio, systick::get_time}; mod ethmac; @@ -96,7 +84,6 @@ fn main() -> ! { writeln!(stdout, "ionpak boot").unwrap(); board::init(); writeln!(stdout, "board initialized").unwrap(); - unsafe { ALLOCATOR.init(heap_start() as usize, HEAP_SIZE) }; println!(r#" _ _