-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit cf199f8
Showing
11 changed files
with
154 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
scripts/* -linguist-detectable | ||
Makefile -linguist-detectable |
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,48 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
clippy: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
rust-toolchain: [nightly] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@nightly | ||
with: | ||
toolchain: ${{ matrix.rust-toolchain }} | ||
components: rust-src, clippy, rustfmt | ||
- name: Setup ArceOS | ||
run: ./scripts/get_deps.sh | ||
- name: Check rust version | ||
run: rustc --version --verbose | ||
- name: Check code format | ||
run: cargo fmt -- --check | ||
- name: Clippy | ||
run: cargo clippy | ||
- name: Build for rust-std | ||
run: cargo build | ||
|
||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
arch: [x86_64, riscv64, aarch64] | ||
rust-toolchain: [nightly] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: ${{ matrix.rust-toolchain }} | ||
components: rust-src, llvm-tools | ||
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat | ||
- uses: Swatinem/rust-cache@v2 | ||
- run: cargo install cargo-binutils | ||
- run: ./scripts/get_deps.sh | ||
- name: Build for ${{ matrix.arch }} | ||
run: make ARCH=${{ matrix.arch }} |
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,8 @@ | ||
/target | ||
/.vscode | ||
/.arceos | ||
/.cargo | ||
.DS_Store | ||
Cargo.lock | ||
*.elf | ||
*.bin |
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,10 @@ | ||
[package] | ||
name = "arceos-helloworld" | ||
version = "0.1.0" | ||
edition = "2021" | ||
authors = ["Yuekai Jia <[email protected]>"] | ||
homepage = "https://github.com/arceos-org/arceos" | ||
repository = "https://github.com/arceos-org/app-helloworld" | ||
|
||
[dependencies] | ||
axstd = { git = "https://github.com/arceos-org/arceos.git", optional = true } |
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,11 @@ | ||
AX_ROOT ?= $(PWD)/.arceos | ||
|
||
all: build | ||
|
||
ax_root: | ||
@./scripts/set_ax_root.sh $(AX_ROOT) | ||
|
||
build run justrun debug fmt disasm clean: ax_root | ||
@make -C $(AX_ROOT) A=$(PWD) $@ | ||
|
||
.PHONY: all ax_root build run justrun debug fmt disasm clean |
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,44 @@ | ||
# app-helloworld | ||
|
||
[![CI](https://github.com/arceos-org/app-helloworld/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/arceos-org/app-helloworld/actions/workflows/ci.yml) | ||
|
||
A "Hello, world!" application on [ArceOS](https://github.com/arceos-org/arceos). | ||
|
||
## Quick Start | ||
|
||
### 1. Install Build Dependencies | ||
|
||
Install [cargo-binutils](https://github.com/rust-embedded/cargo-binutils) to use `rust-objcopy` and `rust-objdump` tools: | ||
|
||
```bash | ||
cargo install cargo-binutils | ||
``` | ||
|
||
Download ArceOS source code: | ||
|
||
```bash | ||
./scripts/get_deps.sh | ||
``` | ||
|
||
The ArceOS repository will be cloned into `.arceos`. | ||
You can also skip this step by specifying the `AX_ROOT` parameter when running the `make` command. | ||
|
||
### 2. Build & Run | ||
|
||
```bash | ||
make ARCH=<arch> LOG=<log> run | ||
``` | ||
|
||
Where `<arch>` should be one of `riscv64`, `aarch64`, `x86_64`. | ||
|
||
`<log>` should be one of `off`, `error`, `warn`, `info`, `debug`, `trace`. | ||
|
||
Other arguments are the same as ArceOS's [Makefile](https://github.com/arceos-org/arceos/blob/main/Makefile). | ||
|
||
For example, to run on `qemu-system-aarch64` with 4 cores and log level `info`: | ||
|
||
```bash | ||
make ARCH=aarch64 LOG=info SMP=4 run | ||
``` | ||
|
||
[![Run app-helloworld on ArceOS](img/demo.gif)](https://asciinema.org/a/669147?autoplay=1) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,2 @@ | ||
[patch.'https://github.com/arceos-org/arceos.git'] | ||
axstd = { path = "%AX_ROOT%/ulib/axstd" } |
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,6 @@ | ||
#!/bin/bash | ||
|
||
AX_ROOT=.arceos | ||
|
||
test ! -d "$AX_ROOT" && echo "Cloning repositories ..." || true | ||
test ! -d "$AX_ROOT" && git clone https://github.com/arceos-org/arceos $AX_ROOT || true |
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 @@ | ||
#/bin/bash | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <AX_ROOT>" | ||
exit 1 | ||
fi | ||
|
||
AX_ROOT=$1 | ||
|
||
mkdir -p .cargo | ||
sed -e "s|%AX_ROOT%|$AX_ROOT|g" scripts/config.toml.temp > .cargo/config.toml | ||
|
||
echo "Set AX_ROOT (ArceOS directory) to $AX_ROOT" |
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,10 @@ | ||
#![cfg_attr(feature = "axstd", no_std)] | ||
#![cfg_attr(feature = "axstd", no_main)] | ||
|
||
#[cfg(feature = "axstd")] | ||
use axstd::println; | ||
|
||
#[cfg_attr(feature = "axstd", no_mangle)] | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |