Skip to content

Commit 2a9542f

Browse files
committed
Merge remote-tracking branch 'hifive1/master' into cargo-workspace-hifive1
2 parents a783004 + 4d4e23f commit 2a9542f

20 files changed

+932
-0
lines changed

hifive1/.github/CODEOWNERS

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

hifive1/.github/bors.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
block_labels = ["needs-decision"]
2+
delete_merged_branches = true
3+
required_approvals = 1
4+
status = [
5+
"ci-linux (stable)",
6+
"ci-linux (1.59.0)",
7+
"build-other (macOS-latest)",
8+
"build-other (windows-latest)",
9+
"Rustfmt"
10+
]

hifive1/.github/workflows/ci.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
on:
2+
push:
3+
branches: [ staging, trying, master ]
4+
pull_request:
5+
6+
name: Continuous integration
7+
8+
jobs:
9+
ci-linux:
10+
runs-on: ubuntu-20.04
11+
continue-on-error: ${{ matrix.experimental || false }}
12+
strategy:
13+
matrix:
14+
# All generated code should be running on stable now, MRSV is 1.59.0
15+
rust: [nightly, stable, 1.59.0]
16+
17+
include:
18+
# Nightly is only for reference and allowed to fail
19+
- rust: nightly
20+
experimental: true
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: actions-rs/toolchain@v1
25+
with:
26+
profile: minimal
27+
toolchain: ${{ matrix.rust }}
28+
override: true
29+
- name: Install all Rust targets for ${{ matrix.rust }}
30+
run: rustup target install --toolchain=${{ matrix.rust }} x86_64-unknown-linux-gnu riscv32imac-unknown-none-elf riscv64imac-unknown-none-elf riscv64gc-unknown-none-elf
31+
- name: Run CI script for riscv32imac-unknown-none-elf under ${{ matrix.rust }}
32+
run: |
33+
cargo check --target riscv32imac-unknown-none-elf --features board-hifive1
34+
cargo check --target riscv32imac-unknown-none-elf --features board-hifive1-revb
35+
cargo check --target riscv32imac-unknown-none-elf --features board-redv
36+
cargo check --target riscv32imac-unknown-none-elf --features board-lofive
37+
cargo check --target riscv32imac-unknown-none-elf --features board-lofive-r1
38+
39+
# On macOS and Windows, we at least make sure that the crate builds and links.
40+
build-other:
41+
strategy:
42+
matrix:
43+
os:
44+
- macOS-latest
45+
- windows-latest
46+
runs-on: ${{ matrix.os }}
47+
48+
steps:
49+
- uses: actions/checkout@v2
50+
- uses: actions-rs/toolchain@v1
51+
with:
52+
profile: minimal
53+
toolchain: stable
54+
override: true
55+
- name: Build crate for host OS
56+
run: |
57+
cargo build --features board-hifive1
58+
cargo build --features board-hifive1-revb
59+
cargo build --features board-redv
60+
cargo build --features board-lofive
61+
cargo build --features board-lofive-r1
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
on:
3+
push:
4+
branches: [ staging, trying, master ]
5+
pull_request:
6+
7+
name: Code formatting check
8+
9+
jobs:
10+
fmt:
11+
name: Rustfmt
12+
runs-on: ubuntu-20.04
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions-rs/toolchain@v1
16+
with:
17+
profile: minimal
18+
toolchain: stable
19+
override: true
20+
components: rustfmt
21+
- uses: actions-rs/cargo@v1
22+
with:
23+
command: fmt
24+
args: --all -- --check

hifive1/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Cargo.lock
2+
target/
3+
core
4+
.gdb_history

hifive1/CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
- Use inline assembly instead of binary blobs for flash
10+
11+
## [v0.12.0] - 2023-03-28
12+
- Update e310x-hal to v0.11 with new svd2rust generated code
13+
14+
## [v0.11.0] - 2023-03-03
15+
16+
### Changed
17+
- Updated riscv dependency to v0.10 with interrupt/critical section changes
18+
19+
## [v0.10.0] - 2021-07-15
20+
21+
### Added
22+
23+
- Added [SparkFun Red-V RedBoard](https://www.sparkfun.com/products/15594)` support

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

hifive1/Cargo.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[package]
2+
name = "hifive1"
3+
version = "0.12.0"
4+
repository = "https://github.com/riscv-rust/hifive1"
5+
authors = ["David Craven <david@craven.ch>"]
6+
categories = ["embedded", "hardware-support", "no-std"]
7+
description = "Board support crate for HiFive1 and LoFive boards"
8+
keywords = ["riscv", "register", "peripheral"]
9+
license = "ISC"
10+
edition = "2018"
11+
rust-version = "1.59"
12+
13+
[dependencies]
14+
e310x-hal = "0.11.0"
15+
embedded-hal = "0.2.7"
16+
riscv = "0.10.1"
17+
nb = "1.0.0"
18+
19+
[features]
20+
board-hifive1 = []
21+
board-hifive1-revb = ["e310x-hal/g002"]
22+
board-redv = ["e310x-hal/g002"]
23+
board-lofive = []
24+
board-lofive-r1 = ["e310x-hal/g002"]
25+
26+
[package.metadata.docs.rs]
27+
features = ['board-hifive1-revb']

hifive1/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[![crates.io](https://img.shields.io/crates/d/hifive1.svg)](https://crates.io/crates/hifive1)
2+
[![crates.io](https://img.shields.io/crates/v/hifive1.svg)](https://crates.io/crates/hifive1)
3+
[![Build Status](https://travis-ci.org/riscv-rust/hifive1.svg?branch=master)](https://travis-ci.org/riscv-rust/hifive1)
4+
5+
# `hifive1`
6+
7+
> Board support crate for HiFive1 and LoFive boards
8+
9+
## Supported Boards
10+
11+
* [SiFive Hifive1](https://www.sifive.com/boards/hifive1) - use feature `board-hifive1`
12+
* [SiFive Hifive1 RevB](https://www.sifive.com/boards/hifive1-rev-b) - use feature `board-hifive1-revb`
13+
* [SparkFun Red-V RedBoard](https://www.sparkfun.com/products/15594) - use feature `board-redv`
14+
* [lofive1](https://github.com/mwelling/lofive) - use feature `board-lofive`
15+
* [lofive1-r1](https://github.com/mwelling/lofive) - use feature `board-lofive-r1`
16+
17+
## [Documentation](https://docs.rs/crate/hifive1)
18+
19+
## Minimum Supported Rust Version (MSRV)
20+
21+
This crate is guaranteed to compile on stable Rust 1.59.0 and up. It *might*
22+
compile with older versions but that may change in any new patch release.
23+
24+
## License
25+
26+
Copyright 2018-2023 [RISC-V team][team]
27+
28+
Permission to use, copy, modify, and/or distribute this software for any purpose
29+
with or without fee is hereby granted, provided that the above copyright notice
30+
and this permission notice appear in all copies.
31+
32+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
33+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
34+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
35+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
36+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
37+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
38+
THIS SOFTWARE.
39+
40+
## Code of Conduct
41+
42+
Contribution to this crate is organized under the terms of the [Rust Code of
43+
Conduct][CoC], the maintainer of this crate, the [RISC-V team][team], promises
44+
to intervene to uphold that code of conduct.
45+
46+
[CoC]: CODE_OF_CONDUCT.md
47+
[team]: https://github.com/rust-embedded/wg#the-risc-v-team

hifive1/build.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
use std::path::PathBuf;
2+
use std::{env, fs};
3+
4+
fn main() {
5+
// Put the memory definitions somewhere the linker can find it
6+
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
7+
println!("cargo:rustc-link-search={}", out_dir.display());
8+
9+
let boards: Vec<_> = env::vars()
10+
.filter_map(|(key, _value)| {
11+
if key.starts_with("CARGO_FEATURE_BOARD") {
12+
Some(key[20..].to_ascii_lowercase()) // Strip 'CARGO_FEATURE_BOARD_'
13+
} else {
14+
None
15+
}
16+
})
17+
.collect();
18+
19+
if boards.is_empty() {
20+
panic!("No board features selected");
21+
}
22+
if boards.len() > 1 {
23+
panic!("More than one board feature selected: {:?}", boards);
24+
}
25+
26+
let board = boards.first().unwrap();
27+
28+
match board.as_str() {
29+
"hifive1" => {
30+
fs::copy("memory-hifive1.x", out_dir.join("hifive1-memory.x")).unwrap();
31+
println!("cargo:rerun-if-changed=memory-hifive1.x");
32+
}
33+
"hifive1_revb" | "redv" => {
34+
fs::copy("memory-hifive1-revb.x", out_dir.join("hifive1-memory.x")).unwrap();
35+
println!("cargo:rerun-if-changed=memory-hifive1-revb.x");
36+
}
37+
"lofive" | "lofive_r1" => {
38+
fs::copy("memory-lofive-r1.x", out_dir.join("hifive1-memory.x")).unwrap();
39+
println!("cargo:rerun-if-changed=memory-lofive-r1.x");
40+
}
41+
42+
other => panic!("Unknown board: {}", other),
43+
}
44+
45+
fs::copy("hifive1-link.x", out_dir.join("hifive1-link.x")).unwrap();
46+
println!("cargo:rerun-if-changed=hifive1-link.x");
47+
}

0 commit comments

Comments
 (0)