summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index cdaa6eb..67186bb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,6 +5,7 @@
// See LICENSE file in the project root for full license text.
use std::{
+ env,
error::Error,
fs::File,
io::{self, Read},
@@ -41,9 +42,16 @@ fn read_file_to_buffer(path: &str, buffer: &mut [u8]) -> io::Result<usize> {
}
fn main() -> Result<(), Box<dyn Error>> {
- let mut ram = Ram::try_new(1024 * 1024 / 4096)?;
+ let mut ram = Ram::try_new(16 * 1024 * 1024 / 4096)?;
let buf = ram.buf_mut();
- read_file_to_buffer("./img", buf)?;
+
+ let args: Vec<String> = env::args().collect();
+
+ if args.len() != 2 {
+ eprintln!("USAGE: trve <ram_image>")
+ }
+
+ read_file_to_buffer(&args[1], buf)?;
let uart = BasicUart::new();
let uart = uart.spawn_poller(Duration::from_millis(10));