From ef2d3033c76a80e137173321b3bbd5fb09b4a3be Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Sat, 5 Nov 2022 22:30:56 +0100 Subject: add README and LICENSE --- Cargo.lock | 2 +- Cargo.toml | 4 ++-- LICENSE | 21 +++++++++++++++++++++ README.md | 15 +++++++++++++++ src/main.rs | 2 +- 5 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 LICENSE create mode 100644 README.md diff --git a/Cargo.lock b/Cargo.lock index 51c8e32..b196d44 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,5 +3,5 @@ version = 3 [[package]] -name = "user-sw" +name = "rv64i-linux-user-no-std" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index f7e203e..d4b0017 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] -name = "user-sw" +name = "rv64i-linux-user-no-std" version = "0.1.0" authors = ["Johannes Stoelp"] edition = "2021" -license = "" +license = "MIT" [dependencies] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7c153e5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Johannes Stoelp + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a63e125 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# riscv64i `#[no_std]` Linux user space example + +This repository serves as reference to my later self as starting point for +`#[no_std]` rust code and to document some cargo configurations. + +It builds a riscv64i Linux user space binary which invokes some syscalls +according to the Linux [syscall(2) +ABI](https://man7.org/linux/man-pages/man2/syscall.2.html) for riscv. + +When running `cargo run` the binary will be executed using the QEMU riscv user +space emulator as configured in [.cargo/config](.cargo/config). + +## Requirements +To run this example the QEMU riscv64 user space emulator (`qemu-riscv64`) is +required. diff --git a/src/main.rs b/src/main.rs index 9b48fd7..7ece64b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ #![no_std] #![no_main] -use user_sw::{eprintln, println, sys}; +use rv64i_linux_user_no_std::{eprintln, println, sys}; fn main() { println!("Hello {} from rust main().", 1337); -- cgit v1.2.3