Skip to content

Commit 0bae216

Browse files
committed
Merge remote-tracking branch 'riscv-rt/master' into add-riscv-rt
2 parents 8071b55 + 721f107 commit 0bae216

File tree

20 files changed

+1828
-0
lines changed

20 files changed

+1828
-0
lines changed

riscv-rt/.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @rust-embedded/riscv

riscv-rt/.github/workflows/build.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
push:
3+
branches: [ master ]
4+
pull_request:
5+
merge_group:
6+
7+
name: Build check
8+
9+
jobs:
10+
build-riscv:
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+
cargo_flags: [ "--no-default-features", "--all-features" ]
25+
include:
26+
# Nightly is only for reference and allowed to fail
27+
- toolchain: nightly
28+
experimental: true
29+
runs-on: ubuntu-latest
30+
continue-on-error: ${{ matrix.experimental || false }}
31+
steps:
32+
- uses: actions/checkout@v3
33+
- uses: dtolnay/rust-toolchain@master
34+
with:
35+
toolchain: ${{ matrix.toolchain }}
36+
targets: ${{ matrix.target }}
37+
- name: Build library
38+
run: cargo build --target ${{ matrix.target }} ${{ matrix.cargo_flags }}
39+
- name: Build example
40+
run: RUSTFLAGS="-C link-arg=-Texamples/device.x" cargo build --target ${{ matrix.target }} --example ${{ matrix.example }} ${{ matrix.cargo_flags }}
41+
42+
# Job to check that all the builds succeeded
43+
build-check:
44+
needs:
45+
- build-riscv
46+
runs-on: ubuntu-latest
47+
if: always()
48+
steps:
49+
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Check CHANGELOG.md
2+
3+
on:
4+
merge_group:
5+
pull_request:
6+
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
7+
8+
jobs:
9+
changelog-check:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Check for CHANGELOG.md
16+
uses: dangoslen/changelog-enforcer@v3
17+
with:
18+
skipLabels: 'skip changelog'
19+
missingUpdateErrorMessage: 'Please add a changelog entry in the CHANGELOG.md file.'
20+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
on:
2+
push:
3+
branches: [ master ]
4+
pull_request:
5+
merge_group:
6+
7+
name: Lints compliance check
8+
9+
env:
10+
CLIPPY_PARAMS: -W clippy::all -W clippy::pedantic -W clippy::nursery -W clippy::cargo
11+
12+
jobs:
13+
clippy:
14+
strategy:
15+
matrix:
16+
toolchain: [ stable, nightly ]
17+
cargo_flags:
18+
- "--no-default-features"
19+
- "--all-features"
20+
include:
21+
# Nightly is only for reference and allowed to fail
22+
- toolchain: nightly
23+
experimental: true
24+
runs-on: ubuntu-latest
25+
continue-on-error: ${{ matrix.experimental || false }}
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: dtolnay/rust-toolchain@master
29+
with:
30+
toolchain: ${{ matrix.toolchain }}
31+
components: clippy
32+
- name: Run clippy
33+
run: cargo clippy --all ${{ matrix.cargo_flags }} -- -D warnings
34+
35+
# Job to check that all the lint checks succeeded
36+
clippy-check:
37+
needs:
38+
- clippy
39+
runs-on: ubuntu-latest
40+
if: always()
41+
steps:
42+
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'

riscv-rt/.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 }}."
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
on:
3+
push:
4+
branches: [ master ]
5+
pull_request:
6+
merge_group:
7+
8+
name: Code formatting check
9+
10+
jobs:
11+
rustfmt:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: dtolnay/rust-toolchain@stable
16+
with:
17+
components: rustfmt
18+
- name: Run Rustfmt
19+
run: cargo fmt --all -- --check --verbose

riscv-rt/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Cargo.lock
2+
target/
3+
bin/*.after
4+
bin/*.before
5+
bin/*.o
6+
7+
.vscode/

riscv-rt/CHANGELOG.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- New GitHub workflow for checking invalid labels in PRs
13+
- New GitHub workflow for checking modifications on CHANGELOG.md
14+
- New GitHub workflow for checking clippy lints in PRs
15+
- Optional cargo feature `single-hart` for single CPU targets
16+
17+
### Changed
18+
19+
- Use inline assembly instead of pre-compiled blobs
20+
- Removed bors in favor of GitHub Merge Queue
21+
- `start_trap_rust` is now marked as `unsafe`
22+
- Implement `r0` as inline assembly
23+
- Use `${ARCH_WIDTH}` in `link.x.in` to adapt to different archs
24+
- mhartid CSR is no longer read in single-hart mode, assumed zero
25+
- Ensure stack pointer is 16-byte aligned before jumping to Rust entry point
26+
27+
## [v0.11.0] - 2023-01-18
28+
29+
### Changed
30+
31+
- Update `riscv` to version 0.10.1 fixing a critical section bug
32+
33+
## [v0.10.0] - 2022-11-04
34+
35+
### Added
36+
37+
- Optional cargo feature `s-mode` for supervisor mode, including conditional compilation for supervisor/machine mode instructions.
38+
39+
### Changed
40+
41+
- Remove superfluous parentheses from link.x, which caused linker errors with nightly.
42+
- Changed `mp_hook` signature, hartid as passed as usize parameter by the caller (required for `s-mode` feature).
43+
- Update `riscv` to version 0.9
44+
45+
## [v0.9.0] - 2022-07-01
46+
47+
### Added
48+
49+
- Pass `a0..a2` register values to the `#[entry]` function.
50+
51+
### Changed
52+
53+
- Update `riscv` to version 0.8
54+
- Update `riscv-rt-macros` to 0.2.0
55+
- Update Minimum Supported Rust Version to 1.59
56+
- The main symbol is no longer randomly generated in the `#[entry]` macro, instead it uses `__risc_v_rt__main`.
57+
58+
### Removed
59+
60+
- Remove `inline-asm` feature which is now always enabled
61+
62+
## [v0.8.1] - 2022-01-25
63+
64+
### Added
65+
66+
- Enable float support for targets with extension sets F and D
67+
- Add ability to override trap handling mechanism
68+
69+
### Changed
70+
71+
- Update `riscv` to version 0.7
72+
- Update `quote` to version 1.0
73+
- Update `proc-macro2` to version 1.0
74+
- Update `rand` to version to version 0.7.3
75+
76+
## [v0.8.0] - 2020-07-18
77+
78+
### Changed
79+
80+
- Update `riscv` to version 0.6
81+
- Update Minimum Supported Rust Version to 1.42.0
82+
83+
## [v0.7.2] - 2020-07-16
84+
85+
### Changed
86+
87+
- Preserve `.eh_frame` and `.eh_frame_hdr` sections
88+
- Place `.srodata` and `.srodata.*` sections in `.rodata`
89+
90+
## [v0.7.1] - 2020-06-02
91+
92+
### Added
93+
94+
- Add support to initialize custom interrupt controllers.
95+
96+
### Changed
97+
98+
- Exception handler may return now
99+
100+
## [v0.7.0] - 2020-03-10
101+
102+
### Added
103+
104+
- Assure address of PC at startup
105+
- Implement interrupt and exception handling
106+
- Add support for the `riscv32i-unknown-none-elf` target
107+
- Added Changelog
108+
109+
### Fixed
110+
111+
- Fix linker script compatibility with GNU linker
112+
113+
### Changed
114+
115+
- Move `abort` out of the `.init` section
116+
- Update `r0` to v1.0.0
117+
- Set MSRV to 1.38
118+
119+
120+
[Unreleased]: https://github.com/rust-embedded/riscv-rt/compare/v0.11.0..HEAD
121+
[v0.10.1]: https://github.com/rust-embedded/riscv-rt/compare/v0.10.0...v0.11.0
122+
[v0.10.0]: https://github.com/rust-embedded/riscv-rt/compare/v0.9.1...v0.10.0
123+
[v0.9.0]: https://github.com/rust-embedded/riscv-rt/compare/v0.8.1...v0.9.0
124+
[v0.8.1]: https://github.com/rust-embedded/riscv-rt/compare/v0.8.0...v0.8.1
125+
[v0.8.0]: https://github.com/rust-embedded/riscv-rt/compare/v0.7.2...v0.8.0
126+
[v0.7.2]: https://github.com/rust-embedded/riscv-rt/compare/v0.7.1...v0.7.2
127+
[v0.7.1]: https://github.com/rust-embedded/riscv-rt/compare/v0.7.0...v0.7.1
128+
[v0.7.0]: https://github.com/rust-embedded/riscv-rt/compare/v0.6.1...v0.7.0

riscv-rt/CODE_OF_CONDUCT.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# The Rust Code of Conduct
2+
3+
## Conduct
4+
5+
**Contact**: [RISC-V team](https://github.com/rust-embedded/wg#the-riscv-team)
6+
7+
* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
8+
* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
9+
* Please be kind and courteous. There's no need to be mean or rude.
10+
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
11+
* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works.
12+
* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term "harassment" as including the definition in the [Citizen Code of Conduct](http://citizencodeofconduct.org/); if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.
13+
* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact one of the channel ops or any of the [RISC-V team][team] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a safe place for you and we've got your back.
14+
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome.
15+
16+
## Moderation
17+
18+
These are the policies for upholding our community's standards of conduct.
19+
20+
1. Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.)
21+
2. Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed.
22+
3. Moderators will first respond to such remarks with a warning.
23+
4. If the warning is unheeded, the user will be "kicked," i.e., kicked out of the communication channel to cool off.
24+
5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded.
25+
6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended party a genuine apology.
26+
7. If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a different moderator, **in private**. Complaints about bans in-channel are not allowed.
27+
8. Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate situation, they should expect less leeway than others.
28+
29+
In the Rust community we strive to go the extra step to look out for each other. Don't just aim to be technically unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly if they're off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can drive people away from the community entirely.
30+
31+
And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could've communicated better — remember that it's your responsibility to make your fellow Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust.
32+
33+
The enforcement policies listed above apply to all official embedded WG venues; including official IRC channels (#rust-embedded); GitHub repositories under rust-embedded; and all forums under rust-embedded.org (forum.rust-embedded.org).
34+
35+
*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).*
36+
37+
[team]: https://github.com/rust-embedded/wg#the-riscv-team

riscv-rt/Cargo.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[package]
2+
name = "riscv-rt"
3+
version = "0.11.0"
4+
rust-version = "1.59"
5+
repository = "https://github.com/rust-embedded/riscv-rt"
6+
authors = ["The RISC-V Team <[email protected]>"]
7+
categories = ["embedded", "no-std"]
8+
description = "Minimal runtime / startup for RISC-V CPU's"
9+
keywords = ["riscv", "runtime", "startup"]
10+
license = "ISC"
11+
edition = "2018"
12+
13+
[features]
14+
s-mode = []
15+
single-hart = []
16+
17+
[dependencies]
18+
riscv = "0.10"
19+
riscv-rt-macros = { path = "macros", version = "0.2.0" }
20+
21+
[dev-dependencies]
22+
panic-halt = "0.2.0"
23+
24+
[build-dependencies]
25+
riscv-target = "0.1.2"

0 commit comments

Comments
 (0)