Example apps for ArceOS.
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.
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
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.
App | axstd features |
Extra modules | Description |
---|---|---|---|
helloworld | A minimal app that just prints a string | ||
exception | Exception handling test | ||
memtest | alloc | axalloc | Dynamic memory allocation test |
display | display | axdriver, axdisplay | Graphic/GUI test |
yield | multitask | axalloc, axtask | Multi-threaded yielding test |
sleep | multitask, irq | axalloc, axtask | Thread sleeping test |
parallel | alloc, multitask | axalloc, axtask | Parallel computing test (to test synchronization & mutex) |
priority | alloc, multitask | axalloc, axtask | Task priority test |
tls | alloc, multitask, tls | axalloc, axtask | Thread local storage test |
shell | alloc, fs | axalloc, axdriver, axfs | A simple shell that responds to filesystem operations |
httpclient | net | axalloc, axdriver, axnet | A simple client that sends an HTTP request and then prints the response |
udpserver | net | axalloc, axdriver, axnet | A single-threaded echo server using UDP protocol |
echoserver | alloc, multitask, net | axalloc, axdriver, axnet, axtask | A multi-threaded TCP server that reverses messages sent by the client |
httpserver | alloc, multitask, net | axalloc, axdriver, axnet, axtask | A multi-threaded HTTP server that serves a static web page |
bwbench | net | axalloc, axdriver, axnet | Network bandwidth benchmark |
App | axlibc features |
Extra modules | Description |
---|---|---|---|
helloworld | A minimal C app that just prints a string | ||
memtest | alloc | axalloc | Dynamic memory allocation test in C |
pthread_basic | alloc, multitask | axalloc, axtask | Basic pthread test (create, join, exit, and mutex) |
pthread_parallel | alloc, multitask | axalloc, axtask | Parallel computing test in C |
pthread_sleep | alloc, multitask, irq | axalloc, axtask | Thread sleeping test in C |
pthread_pipe | alloc, multitask, pipe | axalloc, axtask | Multi-thread communication using pipe |
httpclient | alloc, net | axalloc, axdriver, axnet | A simple client that sends an HTTP request and then prints the response |
udpserver | alloc, net | axalloc, axdriver, axnet | A single-threaded echo server using UDP protocol |
httpserver | alloc, net | axalloc, axdriver, axnet | A single-threaded HTTP server that serves a static web page |
sqlite3 | fp_simd, alloc, fs | axalloc, axdriver, axfs | Porting of SQLite3 |
iperf | fp_simd, alloc, fs, net, select | axalloc, axdriver, axfs, axnet | Porting of iPerf3 |
redis | fp_simd, alloc, irq, multitask, fs, net, pipe, epoll | axalloc, axdriver, axtask, axfs, axnet | Porting of Redis |