Skip to content

Commit 0610364

Browse files
authored
Merge pull request #35 from riscv-rust/cargo-workspace-hifive1
Add `hifive1` to Cargo workspace
2 parents 31244a5 + e00b007 commit 0610364

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+5232
-45
lines changed

.cargo/config.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[target.'cfg(all(target_arch = "riscv32", target_os = "none"))']
2+
rustflags = [
3+
"--cfg", "portable_atomic_target_feature=\"zaamo\"",
4+
]
5+
6+
[build]
7+
target = "riscv32imc-unknown-none-elf"

.github/workflows/changelog.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ jobs:
1919
filters: |
2020
e310x:
2121
- 'e310x/**'
22+
e310x-hal:
23+
- 'e310x-hal/**'
24+
hifive1:
25+
- 'hifive1/**'
2226
2327
- name: Check for CHANGELOG.md (e310x)
2428
if: steps.changes.outputs['e310x'] == 'true'
@@ -27,3 +31,20 @@ jobs:
2731
changeLogPath: ./e310x/CHANGELOG.md
2832
skipLabels: 'skip changelog'
2933
missingUpdateErrorMessage: 'Please add a changelog entry in the e310x/CHANGELOG.md file.'
34+
35+
- name: Check for CHANGELOG.md (e310x-hal)
36+
if: steps.changes.outputs['e310x-hal'] == 'true'
37+
uses: dangoslen/changelog-enforcer@v3
38+
with:
39+
changeLogPath: ./e310x-hal/CHANGELOG.md
40+
skipLabels: 'skip changelog'
41+
missingUpdateErrorMessage: 'Please add a changelog entry in the e310x-hal/CHANGELOG.md file.'
42+
43+
- name: Check for CHANGELOG.md (hifive1)
44+
if: steps.changes.outputs['hifive1'] == 'true'
45+
uses: dangoslen/changelog-enforcer@v3
46+
with:
47+
changeLogPath: ./hifive1/CHANGELOG.md
48+
skipLabels: 'skip changelog'
49+
missingUpdateErrorMessage: 'Please add a changelog entry in the hifive1/CHANGELOG.md file.'
50+

.github/workflows/e310x-hal.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
on:
2+
push:
3+
branches: [ master ]
4+
pull_request:
5+
merge_group:
6+
7+
name: Build check (e310x-hal)
8+
9+
jobs:
10+
# We check that the crate builds and links for all the toolchains and targets.
11+
build-riscv:
12+
strategy:
13+
matrix:
14+
# All generated code should be running on stable now, MRSV is 1.72.0
15+
toolchain: [ stable, nightly, 1.72.0 ]
16+
include:
17+
# Nightly is only for reference and allowed to fail
18+
- toolchain: nightly
19+
experimental: true
20+
runs-on: ubuntu-latest
21+
continue-on-error: ${{ matrix.experimental || false }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Update Rust toolchain
25+
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
26+
- name: Install Rust target
27+
run: rustup target install riscv32imc-unknown-none-elf
28+
- name: Build (no features)
29+
run: cargo build --package e310x-hal
30+
- name: Build (all features)
31+
run: cargo build --package e310x-hal --all-features
32+
33+
# On MacOS and Ubuntu, we at least make sure that the crate builds and links.
34+
# On Windows, linking fails when the rt feature is enabled.
35+
build-others:
36+
strategy:
37+
matrix:
38+
os: [ macos-latest, ubuntu-latest ]
39+
runs-on: ${{ matrix.os }}
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: Update Rust toolchain
43+
run: rustup update stable && rustup default stable
44+
- name: Rename .cargo/config to .cargo/config.bak to ignore it
45+
run: mv .cargo/config.toml .cargo/config.bak
46+
- name: Build (no features)
47+
run: cargo test --package e310x-hal
48+
- name: Build (all features)
49+
run: cargo test --package e310x-hal --all-features
50+

.github/workflows/e310x.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ jobs:
1111
build-riscv:
1212
strategy:
1313
matrix:
14-
# All generated code should be running on stable now, MRSV is 1.65.0
15-
toolchain: [ stable, nightly, 1.65.0 ]
16-
target:
17-
- riscv32imc-unknown-none-elf
18-
- riscv32imac-unknown-none-elf # TODO e310x is not a purely IMAC core
14+
# All generated code should be running on stable now, MRSV is 1.72.0
15+
toolchain: [ stable, nightly, 1.72.0 ]
1916
include:
2017
# Nightly is only for reference and allowed to fail
2118
- toolchain: nightly
@@ -27,11 +24,11 @@ jobs:
2724
- name: Update Rust toolchain
2825
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
2926
- name: Install Rust target
30-
run: rustup target install ${{ matrix.target }}
27+
run: rustup target install riscv32imc-unknown-none-elf
3128
- name: Build (no features)
32-
run: cargo build --package e310x --target ${{ matrix.target }}
29+
run: cargo build --package e310x
3330
- name: Build (all features)
34-
run: cargo build --package e310x --target ${{ matrix.target }} --all-features
31+
run: cargo build --package e310x --all-features
3532

3633
# On MacOS and Ubuntu, we at least make sure that the crate builds and links.
3734
# On Windows, linking fails when the rt feature is enabled.
@@ -44,6 +41,8 @@ jobs:
4441
- uses: actions/checkout@v4
4542
- name: Update Rust toolchain
4643
run: rustup update stable && rustup default stable
44+
- name: Rename .cargo/config to .cargo/config.bak to ignore it
45+
run: mv .cargo/config.toml .cargo/config.bak
4746
- name: Build (no features)
4847
run: cargo test --package e310x
4948
- name: Build (all features)

.github/workflows/hifive1.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 (hifive1)
8+
9+
jobs:
10+
# We check that the crate builds and links for all the toolchains and targets.
11+
build-riscv:
12+
strategy:
13+
matrix:
14+
# All generated code should be running on stable now, MRSV is 1.72.0
15+
toolchain: [nightly, stable, 1.72.0]
16+
board: [hifive1, hifive1-revb, redv, lofive, lofive-r1]
17+
include:
18+
# Nightly is only for reference and allowed to fail
19+
- toolchain: nightly
20+
experimental: true
21+
runs-on: ubuntu-latest
22+
continue-on-error: ${{ matrix.experimental || false }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Update Rust toolchain
26+
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
27+
- name: Install Rust target
28+
run: rustup target install riscv32imc-unknown-none-elf
29+
- name: Build (direct)
30+
run: cargo build --package hifive1 --features board-${{ matrix.board }}
31+
- name: Build (vectored)
32+
run: cargo build --package hifive1 --features board-${{ matrix.board }},virq
33+
34+
# On MacOS and Ubuntu, we at least make sure that the crate builds and links.
35+
# On Windows, linking fails when the rt feature is enabled.
36+
build-others:
37+
strategy:
38+
matrix:
39+
os: [ macos-latest, ubuntu-latest ]
40+
board: [hifive1, hifive1-revb, redv, lofive, lofive-r1]
41+
runs-on: ${{ matrix.os }}
42+
steps:
43+
- uses: actions/checkout@v4
44+
- name: Update Rust toolchain
45+
run: rustup update stable && rustup default stable
46+
- name: Rename .cargo/config to .cargo/config.bak to ignore it
47+
run: mv .cargo/config.toml .cargo/config.bak
48+
- name: Build (direct)
49+
run: cargo test --package hifive1 --features board-${{ matrix.board }}
50+
- name: Build (vectored)
51+
run: cargo test --package hifive1 --features board-${{ matrix.board }},virq
52+

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Cargo.lock
2-
target/
2+
target/
3+
.vscode/

.travis.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
resolver = "2"
33
members = [
44
"e310x",
5+
"e310x-hal",
6+
"hifive1",
57
]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This repository contains various crates useful for writing Rust programs on E310x microcontrollers:
44

55
* [`e310x`]: Peripheral Access Crate (PAC) for E310x chips.
6+
* [`e310x-hal`]: HAL for the E310x family of microcontrollers.
67

78
This project is developed and maintained by the [RISC-V team][team].
89

e310x-hal/CHANGELOG.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
### Changed
11+
- Use `portable-atomic` with `zaamo` feature to use native `amo*` operations.
12+
- Official target is now `riscv32imc-unknown-none-elf`, as it does not fully support the A extension.
13+
- Update `e310x` dependency and adapt code
14+
- Bump MSRV to 1.72.0 to ensure a correct behavior of portable-atomic
15+
16+
## [v0.10.0] - 2023-03-28
17+
18+
### Added
19+
- Added Pulse Width Modulation interface implementing `embedded_hal::Pwm`
20+
- Added `interrupt` module for vectored interrupt handlers. This module is only active if feature `virq` is selected.
21+
22+
### Changed
23+
- Refactored `e310x-hal::spi` module, splitting the abstraction into `SpiBus` and `SpiExclusiveDevice/SpiSharedDevice` to allow multiple devices on a single SPI bus to co-exist
24+
- Update `e310x` dependency to version 0.11
25+
- Update `riscv` dependency to version 0.10
26+
27+
### Removed
28+
- removed interrupt linking definitions, they are now provided by `e310x` via `svd2rust`
29+
30+
## [v0.9.4] - 2022-07-10
31+
32+
### Changed
33+
34+
- Fixed code still using old `riscv::interrupt::Nr`
35+
36+
## [v0.9.3] - 2021-08-15
37+
38+
### Changed
39+
40+
- Fixed `e310x-hal::delay::Delay` call typo to `delay_ms`
41+
42+
## [v0.9.2] - 2021-07-17
43+
44+
### Changed
45+
46+
- Fixed `e310x-hal::delay::Delay` timing typo with extra 0
47+
48+
## [v0.9.1] - 2021-07-15
49+
50+
### Added
51+
52+
- Added implementation of `embedded_hal::blocking::delay::DelayUs` for `e310x-hal::delay::Delay` using `MTIME`

0 commit comments

Comments
 (0)