Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
e552f3c
Add sys_yield tests and compile them to different location.
wyfcyx Nov 28, 2020
91043b0
Switch ok with debug mode apps, implement sys_exit correctly later.
wyfcyx Nov 28, 2020
4590f23
sys_yield tests worked on qemu.
wyfcyx Nov 28, 2020
63aaa9d
Chapter3: power2/3/5 & sleep test worked on k210/qemu based on timer.
wyfcyx Nov 29, 2020
ca4c6d3
Release mode app worked on ch3.
wyfcyx Nov 30, 2020
62513f6
Update rustsbi-qemu.bin.
wyfcyx Dec 29, 2020
e4fee99
Update sys_time unit to ms && Update clock freq of K210.
wyfcyx Dec 29, 2020
3ebfddf
Add env
wyfcyx Jan 2, 2021
b3a3ac5
Update format of link_user.S
wyfcyx Jan 2, 2021
4b215e9
Remove meaningless sstatus::set_sie() when initializing.
wyfcyx Jan 3, 2021
0b33404
Move some variable name to task_cx to task_cx_ptr2
wyfcyx Jan 4, 2021
0c9cb6f
Wrap syscalls in user_lib && change xstate to exit_code
wyfcyx Jan 5, 2021
6ca5413
rust-toochain --> nightly
chyyuu Jan 16, 2021
84c5811
Fix os/Makefile: Support macOS
wyfcyx Jan 20, 2021
1ca5592
Declare _unused explicitly when running first task.
wyfcyx Jan 29, 2021
1dd08f7
Update os/Makefile && Update rust to 2021-01-30
wyfcyx Feb 2, 2021
b7600bf
Bump rustsbi to 0.1.1 && make config of qemu/k210 different
wyfcyx Feb 7, 2021
414bbf3
Move kflash.py out of proj.
wyfcyx Feb 8, 2021
0c4baeb
Fix alignment in os/build.rs
wyfcyx Feb 13, 2021
038be03
Add Ubuntu18.04 docker
wyfcyx Feb 27, 2021
f64cff4
Do not fetch tools when running on qemu.
wyfcyx Mar 5, 2021
ce39504
Link small sections in linker
wyfcyx Mar 7, 2021
a43f0cf
Bump rustsbi to 0.2.0-alpha.1[81d53d8]
wyfcyx Mar 9, 2021
30b2e88
Downgrade cargo-binutils to 0.2.0
wyfcyx Apr 5, 2021
6ffe9c0
RefCell->UPSafeCell
wyfcyx Jul 9, 2021
fb9855b
Move TaskContext into TCB instead of kstack.
wyfcyx Jul 10, 2021
265bbae
Remove a warning.
wyfcyx Jul 12, 2021
82a0487
Bump rustsbi to qemu[d4968dd2] k210[b689314e].
wyfcyx Jul 16, 2021
5f6646f
rustc 1.55.0-nightly (2f391da2e 2021-07-14)
wyfcyx Jul 17, 2021
a70fbfd
Replace llvm_asm! with asm
wyfcyx Jul 18, 2021
2bd7dcf
Exclusive UPSafeCell: A RefCell wrapper
wyfcyx Jul 19, 2021
5276068
update to rustc 1.56.0-nightly (08095fc1f 2021-07-26)
chyyuu Jul 29, 2021
254bd6f
Update rustc && rustsbi; llvm_asm -> asm in user
wyfcyx Aug 26, 2021
d29398d
Update README
wyfcyx Aug 26, 2021
ac3e330
rust->nightly-2021-10-15,cargo-binutils->0.3.3
wyfcyx Oct 20, 2021
1517e12
update .gitignore, README.md, dev-env-info.md
chyyuu Nov 20, 2021
f4622d4
Update os/Makefile, rm ... -f -> rm -f ...
wyfcyx Nov 27, 2021
95b0581
Bump to Rust nightly 2021-12-15
wyfcyx Dec 22, 2021
0d5b0f9
Bump to rust nightly-2022-01-01, feature global_asm,asm->stable
wyfcyx Jan 1, 2022
5c9bcf0
Kernel cannot dump now.
wyfcyx Jan 4, 2022
19758b8
Update .gitignore
wyfcyx Jan 19, 2022
ddaf5fa
Bump Rust to nightly-2022-01-19
wyfcyx Jan 21, 2022
fff4669
cargo clippy & fmt
wyfcyx Jan 21, 2022
f796209
Add boards/ && cargo clippy&fmt
wyfcyx Jan 24, 2022
6dbd0ba
Update docs
Mar 14, 2022
776fc23
Merge pull request #1 from dramforever/ch3_doc
chyyuu Mar 20, 2022
c8dfeff
add CI for build-doc
chyyuu Mar 20, 2022
8730000
update README
chyyuu Mar 20, 2022
716c236
add #![deny(missing_docs)] AND #![deny(warnings)] in main.rs, and add…
chyyuu Mar 25, 2022
657050c
fix typo comments
chyyuu Mar 25, 2022
164ec78
update comments
chyyuu Mar 25, 2022
87fcfa0
Bump to Rust nightly-2022-04-11 rustsbi-qemu=5992db7 rustsbi-k210=193…
wyfcyx Apr 15, 2022
adb3a27
Rollback rustsbi && debugging in release mode
wyfcyx Apr 16, 2022
1117f80
add cargo fmt in Makefile, and exec make fmt
chyyuu May 20, 2022
285d0a1
Merge branch 'ch3' of github.com:rcore-os/rCore-Tutorial-v3 into ch3
chyyuu May 20, 2022
69c92d5
sbi spec uses a6, a7 as sbicall id, so we need to set a6 to 0
chyyuu Jun 21, 2022
7e4d35c
update rustsbi commit-id 74c103bc0f0c1931074c6edcd65a83fdff3cec33 in …
chyyuu Jun 21, 2022
7577e15
add CI autotest, update README
chyyuu Jun 23, 2022
105b5c1
support rust-analyzer for board_qemu features
chyyuu Jul 14, 2022
09b27e6
update Dockerfile: ubuntu 18.04-->20.04, QEMU-5.0-->7.0
chyyuu Jul 18, 2022
b68297f
udpate rust-toolchain: nightly-2022-07-20, cargo-utils 0.36
chyyuu Jul 25, 2022
3ab0f3a
Update Docker
wyfcyx Oct 1, 2022
994aed6
Bump rustsbi-qemu to 701e891
wyfcyx Oct 8, 2022
10eb7c8
build: update toolchain
YdrMaster Oct 20, 2022
e36a5a0
in entry.asm: boot_stack->boot_stack_lower_bound
wyfcyx Nov 29, 2022
d1f0389
Remove K210 support.
wyfcyx Dec 13, 2022
0da9ade
Remove K210 support.
wyfcyx Dec 13, 2022
e6ea392
Workflow: Remove k210 support.
wyfcyx Dec 13, 2022
b46036b
user add fp support
wyfcyx Dec 21, 2022
c712b27
fix for rust-analyzer warning
chyyuu Dec 31, 2022
fadf677
Remove unnecessary output.
wyfcyx Feb 1, 2023
03ae31d
ch3: print task switching information
brelance Mar 17, 2023
05035b6
ch3: add counter to count context switch cost
brelance Mar 17, 2023
dd28cc9
ch3: extend kernel to count kernel time and user time
brelance Mar 17, 2023
6bf40ef
ch3: debug and fix
brelance Mar 17, 2023
efd1b59
ch3-lab: add syscall sys_task_info
brelance Mar 17, 2023
48d2728
ch3-lab: test and debug
brelance Mar 18, 2023
fca11cb
update rust toolchain
brelance Mar 24, 2023
bfcc6f2
Update doc-and-test.yml
brelance Mar 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/*
68 changes: 68 additions & 0 deletions .github/workflows/doc-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build Rust Doc And Run tests

on: [push]

env:
CARGO_TERM_COLOR: always
rust_toolchain: nightly-2023-03-19

jobs:
build-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.rust_toolchain }}
components: rust-src, llvm-tools-preview
target: riscv64gc-unknown-none-elf
- name: Build doc
run: cd os && cargo doc --no-deps --verbose
- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./os/target/riscv64gc-unknown-none-elf/doc
destination_dir: ${{ github.ref_name }}

run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.rust_toolchain }}
components: rust-src, llvm-tools-preview
target: riscv64gc-unknown-none-elf
- uses: actions-rs/install@v0.1
with:
crate: cargo-binutils
version: latest
use-tool-cache: true
- name: Cache QEMU
uses: actions/cache@v3
with:
path: qemu-7.0.0
key: qemu-7.0.0-x86_64-riscv64
- name: Install QEMU
run: |
sudo apt-get update
sudo apt-get install ninja-build -y
if [ ! -d qemu-7.0.0 ]; then
wget https://download.qemu.org/qemu-7.0.0.tar.xz
tar -xf qemu-7.0.0.tar.xz
cd qemu-7.0.0
./configure --target-list=riscv64-softmmu
make -j
else
cd qemu-7.0.0
fi
sudo make install
qemu-system-riscv64 --version

- name: Run usertests
run: cd os && make run TEST=1
timeout-minutes: 10

24 changes: 20 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
.idea/*
os/target/*
os/.idea/*
.*/*
!.github/*
!.vscode/settings.json
.idea
Cargo.lock
target
os/src/link_app.S
os/src/linker.ld
os/last-*
os/Cargo.lock
os/.gdb_history
user/build
user/target/*
user/.idea/*
user/.idea/*
user/Cargo.lock
easy-fs/Cargo.lock
easy-fs/target/*
easy-fs-fuse/Cargo.lock
easy-fs-fuse/target/*
tools/
pushall.sh
*.bak
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// Prevent "can't find crate for `test`" error on no_std
// Ref: https://github.com/rust-lang/vscode-rust/issues/729
// For vscode-rust plugin users:
"rust.target": "riscv64gc-unknown-none-elf",
"rust.all_targets": false,
// For Rust Analyzer plugin users:
"rust-analyzer.cargo.target": "riscv64gc-unknown-none-elf",
"rust-analyzer.checkOnSave.allTargets": false,
// "rust-analyzer.cargo.features": [
// "board_qemu"
// ]
}
85 changes: 85 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# syntax=docker/dockerfile:1
# This Dockerfile is adapted from https://github.com/LearningOS/rCore-Tutorial-v3/blob/main/Dockerfile
# with the following major updates:
# - ubuntu 18.04 -> 20.04
# - qemu 5.0.0 -> 7.0.0
# - Extensive comments linking to relevant documentation
FROM ubuntu:20.04

ARG QEMU_VERSION=7.0.0
ARG HOME=/root

# 0. Install general tools
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y \
curl \
git \
python3 \
wget

# 1. Set up QEMU RISC-V
# - https://learningos.github.io/rust-based-os-comp2022/0setup-devel-env.html#qemu
# - https://www.qemu.org/download/
# - https://wiki.qemu.org/Documentation/Platforms/RISCV
# - https://risc-v-getting-started-guide.readthedocs.io/en/latest/linux-qemu.html

# 1.1. Download source
WORKDIR ${HOME}
RUN wget https://download.qemu.org/qemu-${QEMU_VERSION}.tar.xz && \
tar xvJf qemu-${QEMU_VERSION}.tar.xz

# 1.2. Install dependencies
# - https://risc-v-getting-started-guide.readthedocs.io/en/latest/linux-qemu.html#prerequisites
RUN apt-get install -y \
autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \
gawk build-essential bison flex texinfo gperf libtool patchutils bc \
zlib1g-dev libexpat-dev git \
ninja-build pkg-config libglib2.0-dev libpixman-1-dev libsdl2-dev

# 1.3. Build and install from source
WORKDIR ${HOME}/qemu-${QEMU_VERSION}
RUN ./configure --target-list=riscv64-softmmu,riscv64-linux-user && \
make -j$(nproc) && \
make install

# 1.4. Clean up
WORKDIR ${HOME}
RUN rm -rf qemu-${QEMU_VERSION} qemu-${QEMU_VERSION}.tar.xz

# 1.5. Sanity checking
RUN qemu-system-riscv64 --version && \
qemu-riscv64 --version

# 2. Set up Rust
# - https://learningos.github.io/rust-based-os-comp2022/0setup-devel-env.html#qemu
# - https://www.rust-lang.org/tools/install
# - https://github.com/rust-lang/docker-rust/blob/master/Dockerfile-debian.template

# 2.1. Install
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=nightly
RUN set -eux; \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup-init; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME;

# 2.2. Sanity checking
RUN rustup --version && \
cargo --version && \
rustc --version

# 3. Build env for labs
# See os1/Makefile `env:` for example.
# This avoids having to wait for these steps each time using a new container.
RUN rustup target add riscv64gc-unknown-none-elf && \
cargo install cargo-binutils --vers ~0.2 && \
rustup component add rust-src && \
rustup component add llvm-tools-preview

# Ready to go
WORKDIR ${HOME}
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
DOCKER_NAME ?= rcore-tutorial-v3
.PHONY: docker build_docker

docker:
docker run --rm -it -v ${PWD}:/mnt -w /mnt ${DOCKER_NAME} bash

build_docker:
docker build -t ${DOCKER_NAME} .

fmt:
cd os ; cargo fmt; cd ..

Loading