Skip to content

Commit f8c3923

Browse files
Merge pull request #151 from rust-embedded/add-riscv-rt
Add riscv-rt to workspace
2 parents 8071b55 + 5407f38 commit f8c3923

23 files changed

+1810
-50
lines changed

.github/workflows/changelog.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
filters: |
2020
riscv:
2121
- 'riscv/**'
22+
riscv-rt:
23+
- 'riscv-rt/**'
2224
2325
- name: Check for CHANGELOG.md (riscv)
2426
if: steps.changes.outputs.riscv == 'true'
@@ -27,3 +29,11 @@ jobs:
2729
changeLogPath: ./riscv/CHANGELOG.md
2830
skipLabels: 'skip changelog'
2931
missingUpdateErrorMessage: 'Please add a changelog entry in the riscv/CHANGELOG.md file.'
32+
33+
- name: Check for CHANGELOG.md (riscv-rt)
34+
if: steps.changes.outputs.riscv-rt == 'true'
35+
uses: dangoslen/changelog-enforcer@v3
36+
with:
37+
changeLogPath: ./riscv-rt/CHANGELOG.md
38+
skipLabels: 'skip changelog'
39+
missingUpdateErrorMessage: 'Please add a changelog entry in the riscv-rt/CHANGELOG.md file.'

.github/workflows/clippy.yaml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on:
22
push:
3-
branches: [ staging, trying, master ]
3+
branches: [ master ]
44
pull_request:
55
merge_group:
66

@@ -14,28 +14,46 @@ jobs:
1414
strategy:
1515
matrix:
1616
toolchain: [ stable, nightly ]
17-
cargo_flags:
18-
- "--no-default-features"
19-
- "--all-features"
2017
include:
2118
# Nightly is only for reference and allowed to fail
2219
- toolchain: nightly
2320
experimental: true
2421
runs-on: ubuntu-latest
2522
continue-on-error: ${{ matrix.experimental || false }}
2623
steps:
27-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2825
- uses: dtolnay/rust-toolchain@master
2926
with:
3027
toolchain: ${{ matrix.toolchain }}
3128
components: clippy
32-
- name: Run clippy
33-
run: cargo clippy --all ${{ matrix.cargo_flags }} -- -D warnings
29+
- name: Run clippy (no features)
30+
run: cargo clippy --all --no-default-features -- -D warnings
31+
- name: Run clippy (all features)
32+
run: cargo clippy --all --all-features -- -D warnings
33+
34+
# Additonal clippy checks for riscv-rt
35+
clippy-riscv-rt:
36+
strategy:
37+
matrix:
38+
toolchain: [ stable, nightly ]
39+
runs-on: ubuntu-latest
40+
continue-on-error: ${{ matrix.experimental || false }}
41+
steps:
42+
- uses: actions/checkout@v4
43+
- uses: dtolnay/rust-toolchain@master
44+
with:
45+
toolchain: ${{ matrix.toolchain }}
46+
components: clippy
47+
- name: Run clippy (s-mode)
48+
run: cargo clippy --package riscv-rt --all --features=s-mode -- -D warnings
49+
- name: Run clippy (single-hart)
50+
run: cargo clippy --package riscv-rt --all --features=single-hart -- -D warnings
3451

3552
# Job to check that all the lint checks succeeded
3653
clippy-check:
3754
needs:
3855
- clippy
56+
- clippy-riscv-rt
3957
runs-on: ubuntu-latest
4058
if: always()
4159
steps:

.github/workflows/label.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Check Labels
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
6+
7+
jobs:
8+
label-check:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: mheap/github-action-required-labels@v5
12+
with:
13+
mode: exactly
14+
count: 0
15+
labels: "work in progress, do not merge"
16+
add_comment: true
17+
message: "This PR is being prevented from merging because it presents one of the blocking labels: {{ provided }}."

.github/workflows/riscv-rt.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
on:
2+
push:
3+
branches: [ master ]
4+
pull_request:
5+
merge_group:
6+
7+
name: Build check (riscv-rt)
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
# All generated code should be running on stable now, MRSV is 1.59.0
14+
toolchain: [ stable, nightly, 1.59.0 ]
15+
target:
16+
- riscv32i-unknown-none-elf
17+
- riscv32imc-unknown-none-elf
18+
- riscv32imac-unknown-none-elf
19+
- riscv64imac-unknown-none-elf
20+
- riscv64gc-unknown-none-elf
21+
example:
22+
- empty
23+
- multi_core
24+
include:
25+
# Nightly is only for reference and allowed to fail
26+
- toolchain: nightly
27+
experimental: true
28+
runs-on: ubuntu-latest
29+
continue-on-error: ${{ matrix.experimental || false }}
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: dtolnay/rust-toolchain@master
33+
with:
34+
toolchain: ${{ matrix.toolchain }}
35+
targets: ${{ matrix.target }}
36+
- name: Build (no features)
37+
run: RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --package riscv-rt --target ${{ matrix.target }} --example ${{ matrix.example }}
38+
- name : Build example (s-mode)
39+
run: RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --package riscv-rt --target ${{ matrix.target }} --example ${{ matrix.example }} --features=s-mode
40+
- name : Build example (single-hart)
41+
run: RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --package riscv-rt --target ${{ matrix.target }} --example ${{ matrix.example }} --features=single-hart
42+
- name: Build example (all features)
43+
run: RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --package riscv-rt --target ${{ matrix.target }} --example ${{ matrix.example }} --all-features
44+
45+
# Job to check that all the builds succeeded
46+
build-check:
47+
needs:
48+
- build
49+
runs-on: ubuntu-latest
50+
if: always()
51+
steps:
52+
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'

.github/workflows/build.yaml renamed to .github/workflows/riscv.yaml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
on:
22
push:
3-
branches: [ staging, trying, master ]
3+
branches: [ master ]
44
pull_request:
55
merge_group:
66

7-
name: Build check
7+
name: Build check (riscv)
88

99
jobs:
1010
# We check that the crate builds and links for all the toolchains and targets.
@@ -19,37 +19,36 @@ jobs:
1919
- riscv32imac-unknown-none-elf
2020
- riscv64imac-unknown-none-elf
2121
- riscv64gc-unknown-none-elf
22-
cargo_flags: [ "--no-default-features", "--all-features" ]
2322
include:
2423
# Nightly is only for reference and allowed to fail
2524
- toolchain: nightly
2625
experimental: true
2726
runs-on: ubuntu-latest
2827
continue-on-error: ${{ matrix.experimental || false }}
2928
steps:
30-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
3130
- uses: dtolnay/rust-toolchain@master
3231
with:
3332
toolchain: ${{ matrix.toolchain }}
3433
targets: ${{ matrix.target }}
35-
- name: Build library
36-
run: cargo build --target ${{ matrix.target }} ${{ matrix.cargo_flags }}
34+
- name: Build (no features)
35+
run: cargo build --package riscv --target ${{ matrix.target }}
36+
- name: Build (all features)
37+
run: cargo build --package riscv --target ${{ matrix.target }} --all-features
3738

3839
# On MacOS, Ubuntu, and Windows, we at least make sure that the crate builds and links.
3940
build-others:
4041
strategy:
4142
matrix:
42-
os:
43-
- macos-latest
44-
- ubuntu-latest
45-
- windows-latest
46-
cargo_flags: [ "--no-default-features", "--all-features" ]
43+
os: [ macos-latest, ubuntu-latest, windows-latest ]
4744
runs-on: ${{ matrix.os }}
4845
steps:
4946
- uses: actions/checkout@v3
5047
- uses: dtolnay/rust-toolchain@stable
51-
- name: Build crate for host OS
52-
run: cargo build ${{ matrix.cargo_flags }}
48+
- name: Build (no features)
49+
run: cargo build --package riscv
50+
- name: Build (all features)
51+
run: cargo build --package riscv --all-features
5352

5453
# Job to check that all the builds succeeded
5554
build-check:

.github/workflows/rustfmt.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on:
22
push:
3-
branches: [ staging, trying, master ]
3+
branches: [ master ]
44
pull_request:
55
merge_group:
66

@@ -10,7 +10,7 @@ jobs:
1010
rustfmt:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- uses: dtolnay/rust-toolchain@stable
1515
with:
1616
components: rustfmt

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
resolver = "2"
33
members = [
44
"riscv",
5+
"riscv-rt",
56
]

README.md

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,26 @@
1-
[![crates.io](https://img.shields.io/crates/d/riscv.svg)](https://crates.io/crates/riscv)
2-
[![crates.io](https://img.shields.io/crates/v/riscv.svg)](https://crates.io/crates/riscv)
3-
[![Build Status](https://travis-ci.org/rust-embedded/riscv.svg?branch=master)](https://travis-ci.org/rust-embedded/riscv)
1+
# RISC-V crates
42

5-
# `riscv`
3+
This repository contains various crates useful for writing Rust programs on RISC-V microcontrollers:
64

7-
> Low level access to RISC-V processors
5+
* [`riscv`]: CPU peripheral access and intrinsics
6+
* [`riscv-rt`]: Startup code and interrupt handling
87

9-
This project is developed and maintained by the [RISC-V team][team].
10-
11-
## [Documentation](https://docs.rs/crate/riscv)
12-
13-
## Minimum Supported Rust Version (MSRV)
14-
15-
This crate is guaranteed to compile on stable Rust 1.60 and up. It *might*
16-
compile with older versions but that may change in any new patch release.
178

18-
## License
19-
20-
Copyright 2019-2022 [RISC-V team][team]
9+
This project is developed and maintained by the [RISC-V team][team].
2110

22-
Permission to use, copy, modify, and/or distribute this software for any purpose
23-
with or without fee is hereby granted, provided that the above copyright notice
24-
and this permission notice appear in all copies.
11+
### Contribution
2512

26-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
27-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
28-
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
29-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
30-
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
31-
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
32-
THIS SOFTWARE.
13+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the
14+
work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
15+
additional terms or conditions.
3316

3417
## Code of Conduct
3518

3619
Contribution to this crate is organized under the terms of the [Rust Code of
3720
Conduct][CoC], the maintainer of this crate, the [RISC-V team][team], promises
3821
to intervene to uphold that code of conduct.
3922

40-
[CoC]: CODE_OF_CONDUCT.md
23+
[`riscv`]: https://crates.io/crates/riscv
24+
[`riscv-rt`]: https://crates.io/crates/riscv-rt
4125
[team]: https://github.com/rust-embedded/wg#the-risc-v-team
26+
[CoC]: CODE_OF_CONDUCT.md

0 commit comments

Comments
 (0)