firmware: eliminate non-io uses of std_artiq from runtime.

Just replace these with references to alloc.
This commit is contained in:
whitequark 2018-05-14 18:27:17 +00:00
parent a100c73dfe
commit cf33ba748d
6 changed files with 17 additions and 20 deletions

View File

@ -1,6 +1,4 @@
use std::vec::Vec;
use std::string::String;
use std::btree_map::BTreeMap;
use alloc::{Vec, String, BTreeMap};
#[derive(Debug)]
struct Entry {

View File

@ -1,6 +1,6 @@
use std::io::{self, Read};
use std::btree_map::BTreeMap;
use alloc::btree_map::BTreeMap;
use std::io::{self, Read};
use sched::Io;
use sched::{TcpListener, TcpStream};
use board_misoc::{clock, csr};

View File

@ -1,7 +1,6 @@
use std::mem;
use std::vec::Vec;
use std::string::String;
use std::btree_map::BTreeMap;
use core::mem;
use alloc::{Vec, String, BTreeMap};
use std::io::Write;
const ALIGNMENT: usize = 64;

View File

@ -3,14 +3,14 @@
use core::mem;
use core::result;
use core::cell::{Cell, RefCell};
use alloc::Vec;
use fringe::OwnedStack;
use fringe::generator::{Generator, Yielder, State as GeneratorState};
use smoltcp::wire::IpEndpoint;
use smoltcp::socket::{SocketHandle, SocketRef};
use std::vec::Vec;
use std::io::{Read, Write, Result, Error, ErrorKind};
use board_misoc::clock;
use std::io::{Read, Write, Result, Error, ErrorKind};
use urc::Urc;
type SocketSet = ::smoltcp::socket::SocketSet<'static, 'static, 'static>;

View File

@ -1,11 +1,9 @@
use std::prelude::v1::*;
use std::{mem, str};
use std::cell::{Cell, RefCell};
use std::io::{self, Read, Write};
use std::error::Error;
use core::{mem, str, cell::{Cell, RefCell}, fmt::Write as FmtWrite};
use alloc::{Vec, String};
use byteorder::{ByteOrder, NetworkEndian};
use board_misoc::{ident, cache, config};
use std::io::{self, Read, Write};
use {mailbox, rpc_queue, kernel};
use urc::Urc;
use sched::{ThreadHandle, Io};
@ -289,7 +287,9 @@ fn process_host_message(io: &Io,
match unsafe { kern_load(io, session, &kernel) } {
Ok(()) => host_write(stream, host::Reply::LoadCompleted),
Err(error) => {
host_write(stream, host::Reply::LoadFailed(error.description()))?;
let mut description = String::new();
write!(&mut description, "{}", error).unwrap();
host_write(stream, host::Reply::LoadFailed(&description))?;
kern_acknowledge()
}
},

View File

@ -1,6 +1,6 @@
use std::rc::Rc;
use std::ops::Deref;
use std::fmt;
use core::ops::Deref;
use core::fmt;
use alloc::rc::Rc;
pub struct Urc<T: ?Sized>(Rc<T>);