-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
245 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# Rust target | ||
target | ||
|
||
# Example targets | ||
examples/**/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[workspace] | ||
members = ["crates/*"] | ||
exclude = ["examples/minimal"] | ||
resolver = "2" | ||
|
||
[workspace.package] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM --platform=linux/amd64 ubuntu:22.04 | ||
|
||
ENV SHELL=/bin/bash | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# todo: pin `nightly` version | ||
ENV RUST_VERSION nightly | ||
|
||
RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ | ||
ca-certificates \ | ||
build-essential \ | ||
curl \ | ||
g++-riscv64-linux-gnu \ | ||
libc6-dev-riscv64-cross \ | ||
binutils-riscv64-linux-gnu \ | ||
llvm \ | ||
clang \ | ||
make \ | ||
cmake \ | ||
git | ||
|
||
# Install Rustup and Rust | ||
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain ${RUST_VERSION} --component rust-src | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
|
||
# Set up the env vars to instruct rustc to use the correct compiler and linker | ||
# and to build correctly to support the Cannon processor | ||
ENV CC_riscv64_unknown_none_elf=riscv64-linux-gnu-gcc \ | ||
CXX_riscv64_unknown_none_elf=riscv64-linux-gnu-g++ \ | ||
CARGO_TARGET_RISCV64_UNKNOWN_NONE_ELF_LINKER=riscv64-linux-gnu-gcc \ | ||
RUSTFLAGS="-Clink-arg=-e_start -Ctarget-feature=-c" \ | ||
CARGO_BUILD_TARGET="riscv64gc-unknown-none-elf" \ | ||
RUSTUP_TOOLCHAIN=${RUST_VERSION} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
all: cannon asterisc | ||
|
||
# Build the `cannon` program builder image | ||
cannon: | ||
docker build -t cannon-pipeline:latest -f cannon/cannon.dockerfile ./cannon | ||
|
||
# Build the `asterisc` program builder image | ||
asterisc: | ||
docker build -t asterisc-pipeline:latest -f asterisc/asterisc.dockerfile ./asterisc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//! TODO | ||
pub mod io; | ||
pub(crate) mod io; | ||
mod syscall; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "minimal" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
kona-common = { path = "../../crates/common" } | ||
|
||
[profile.dev] | ||
panic = "abort" | ||
|
||
[profile.release] | ||
panic = "abort" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `minimal` | ||
|
||
Minimal example program using the SDK. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Build for the `cannon` target | ||
build-cannon *args='': | ||
docker run \ | ||
--rm \ | ||
--platform linux/amd64 \ | ||
-v `pwd`/../../:/workdir \ | ||
-w="/workdir/examples/minimal" \ | ||
cannon-pipeline:latest cargo build -Zbuild-std $@ | ||
|
||
# Build for the `asterisc` target | ||
build-asterisc *args='': | ||
docker run \ | ||
--rm \ | ||
--platform linux/amd64 \ | ||
-v `pwd`/../../:/workdir \ | ||
-w="/workdir/examples/minimal" \ | ||
asterisc-pipeline:latest cargo build -Zbuild-std $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#![no_std] | ||
#![no_main] | ||
|
||
use kona_common::{ | ||
io::{ClientIO, FileDescriptor}, | ||
traits::BasicKernelInterface, | ||
}; | ||
|
||
extern crate alloc; | ||
|
||
const HEAP_SIZE: usize = 0xFFFF; | ||
|
||
#[no_mangle] | ||
pub extern "C" fn _start() { | ||
kona_common::alloc_heap!(HEAP_SIZE); | ||
|
||
let _ = ClientIO::write(FileDescriptor::StdOut, b"Hello, world!\n"); | ||
|
||
ClientIO::exit(0) | ||
} | ||
|
||
#[panic_handler] | ||
fn panic(info: &core::panic::PanicInfo) -> ! { | ||
let msg = alloc::format!("Panic: {}", info); | ||
let _ = ClientIO::write(FileDescriptor::StdErr, msg.as_bytes()); | ||
ClientIO::exit(2) | ||
} |
Oops, something went wrong.