diff options
| author | taitep <taitep@taitep.se> | 2025-12-21 17:49:02 +0100 |
|---|---|---|
| committer | taitep <taitep@taitep.se> | 2025-12-21 17:49:02 +0100 |
| commit | c10e1ec09bca38d634b632d4afc75d80b893c41f (patch) | |
| tree | ea3e40062273d43634ae9a476fdfb72e2edc08fd /src/main.rs | |
| parent | 25dd685345b4bba7418eca4252e1b65ce20356cd (diff) | |
Allow other image file names through cli args, increase ram size, update readme
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 12 |
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)); |
