Home

Awesome

arceos-apps

CI CI

Example apps for ArceOS.

Quick Start

1. Install Build Dependencies

Install cargo-binutils to use rust-objcopy and rust-objdump tools:

cargo install cargo-binutils

Download ArceOS source code:

./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.

Dependencies for C apps

Install libclang-dev:

sudo apt install libclang-dev

Download & install musl toolchains:

# download
wget https://musl.cc/aarch64-linux-musl-cross.tgz
wget https://musl.cc/riscv64-linux-musl-cross.tgz
wget https://musl.cc/x86_64-linux-musl-cross.tgz
# install
tar zxf aarch64-linux-musl-cross.tgz
tar zxf riscv64-linux-musl-cross.tgz
tar zxf x86_64-linux-musl-cross.tgz
# exec below command in bash OR add below info in ~/.bashrc
export PATH=`pwd`/x86_64-linux-musl-cross/bin:`pwd`/aarch64-linux-musl-cross/bin:`pwd`/riscv64-linux-musl-cross/bin:$PATH

2. Build & Run

make A=path/to/app ARCH=<arch> LOG=<log>

Where path/to/app is the relative path to the application.

<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.

For example, to run the httpserver on qemu-system-aarch64 with 4 cores and log level info:

make A=rust/net/httpserver ARCH=aarch64 LOG=info SMP=4 run NET=y

Note that the NET=y argument is required to enable the network device in QEMU. These arguments (BLK, GRAPHIC, etc.) only take effect at runtime not build time.

List of Rust Apps

Appaxstd featuresExtra modulesDescription
helloworldA minimal app that just prints a string
exceptionException handling test
memtestallocaxallocDynamic memory allocation test
displaydisplayaxdriver, axdisplayGraphic/GUI test
yieldmultitaskaxalloc, axtaskMulti-threaded yielding test
sleepmultitask, irqaxalloc, axtaskThread sleeping test
parallelalloc, multitaskaxalloc, axtaskParallel computing test (to test synchronization & mutex)
priorityalloc, multitaskaxalloc, axtaskTask priority test
tlsalloc, multitask, tlsaxalloc, axtaskThread local storage test
shellalloc, fsaxalloc, axdriver, axfsA simple shell that responds to filesystem operations
httpclientnetaxalloc, axdriver, axnetA simple client that sends an HTTP request and then prints the response
udpservernetaxalloc, axdriver, axnetA single-threaded echo server using UDP protocol
echoserveralloc, multitask, netaxalloc, axdriver, axnet, axtaskA multi-threaded TCP server that reverses messages sent by the client
httpserveralloc, multitask, netaxalloc, axdriver, axnet, axtaskA multi-threaded HTTP server that serves a static web page
bwbenchnetaxalloc, axdriver, axnetNetwork bandwidth benchmark

List of C Apps

Appaxlibc featuresExtra modulesDescription
helloworldA minimal C app that just prints a string
memtestallocaxallocDynamic memory allocation test in C
pthread_basicalloc, multitaskaxalloc, axtaskBasic pthread test (create, join, exit, and mutex)
pthread_parallelalloc, multitaskaxalloc, axtaskParallel computing test in C
pthread_sleepalloc, multitask, irqaxalloc, axtaskThread sleeping test in C
pthread_pipealloc, multitask, pipeaxalloc, axtaskMulti-thread communication using pipe
httpclientalloc, netaxalloc, axdriver, axnetA simple client that sends an HTTP request and then prints the response
udpserveralloc, netaxalloc, axdriver, axnetA single-threaded echo server using UDP protocol
httpserveralloc, netaxalloc, axdriver, axnetA single-threaded HTTP server that serves a static web page
sqlite3fp_simd, alloc, fsaxalloc, axdriver, axfsPorting of SQLite3
iperffp_simd, alloc, fs, net, selectaxalloc, axdriver, axfs, axnetPorting of iPerf3
redisfp_simd, alloc, irq, multitask, fs, net, pipe, epollaxalloc, axdriver, axtask, axfs, axnetPorting of Redis