satman: use new alloc_list (#880)

This commit is contained in:
Sebastien Bourdeauducq 2017-12-23 22:15:39 +08:00
parent f8c8f3fe26
commit 00ed51f6f4

View File

@ -1,8 +1,8 @@
#![feature(compiler_builtins_lib, lang_items)] #![feature(compiler_builtins_lib, lang_items, global_allocator)]
#![no_std] #![no_std]
extern crate compiler_builtins; extern crate compiler_builtins;
extern crate alloc_artiq; extern crate alloc_list;
extern crate std_artiq as std; extern crate std_artiq as std;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
@ -218,6 +218,9 @@ fn startup() {
} }
} }
#[global_allocator]
static mut ALLOC: alloc_list::ListAlloc = alloc_list::EMPTY;
#[no_mangle] #[no_mangle]
pub extern fn main() -> i32 { pub extern fn main() -> i32 {
unsafe { unsafe {
@ -225,8 +228,7 @@ pub extern fn main() -> i32 {
static mut _fheap: u8; static mut _fheap: u8;
static mut _eheap: u8; static mut _eheap: u8;
} }
alloc_artiq::seed(&mut _fheap as *mut u8, ALLOC.add_range(&mut _fheap, &mut _eheap);
&_eheap as *const u8 as usize - &_fheap as *const u8 as usize);
static mut LOG_BUFFER: [u8; 65536] = [0; 65536]; static mut LOG_BUFFER: [u8; 65536] = [0; 65536];
logger_artiq::BufferLogger::new(&mut LOG_BUFFER[..]).register(startup); logger_artiq::BufferLogger::new(&mut LOG_BUFFER[..]).register(startup);