Skip to content

Commit fcfb704

Browse files
authored
Merge pull request #25 from GrepitAB/development
Upstream of internal work open sourced from https://github.com/GrepitAB. Thanks @tmplt.
2 parents ce2b8bb + ed3f444 commit fcfb704

File tree

70,163 files changed

+5343608
-15141738
lines changed

Some content is hidden

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

70,163 files changed

+5343608
-15141738
lines changed

.github/workflows/build.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: HAL
2+
on: [push, pull_request]
3+
4+
jobs:
5+
setup:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout sources
9+
uses: actions/checkout@v2
10+
- id: pacs
11+
run: echo "::set-output name=pac_matrix::$(ls ./pac --indicator-style=none | cut -c 3- | jq -ncR '[inputs]')"
12+
- id: boards
13+
run: echo "::set-output name=board_matrix::$(ls ./boards --indicator-style=none | jq -ncR '[inputs]')"
14+
outputs:
15+
pac_matrix: ${{ steps.pacs.outputs.pac_matrix }}
16+
board_matrix: ${{ steps.boards.outputs.board_matrix }}
17+
18+
build:
19+
needs: setup
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
pac: ${{ fromJson(needs.setup.outputs.pac_matrix) }}
24+
steps:
25+
- name: Checkout sources
26+
uses: actions/checkout@v2
27+
- name: Install Rust (thumbv7em)
28+
run: rustup show
29+
- name: Build HAL for ${{ matrix.pac }}
30+
run: |
31+
cargo check --package atsamx7x-hal --features ${{ matrix.pac }},unproven
32+
33+
board-examples:
34+
needs: setup
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
board: ${{ fromJson(needs.setup.outputs.board_matrix) }}
39+
steps:
40+
- name: Checkout sources
41+
uses: actions/checkout@v2
42+
- name: Install Rust (thumbv7em)
43+
run: rustup show
44+
- name: Build boards/${{ matrix.board }}/examples/*
45+
run: |
46+
cd boards/${{ matrix.board }}
47+
cargo check --examples
48+
49+
clippy-hal:
50+
needs: build
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout sources
54+
uses: actions/checkout@v2
55+
- name: Install Rust (thumbv7em)
56+
run: rustup show
57+
- name: Lint HAL
58+
run: cargo clippy --package atsamx7x-hal --no-deps --features samv71q21b,unproven -- --deny warnings
59+
60+
clippy-examples:
61+
needs: [setup, build, board-examples]
62+
runs-on: ubuntu-latest
63+
strategy:
64+
matrix:
65+
board: ${{ fromJson(needs.setup.outputs.board_matrix) }}
66+
steps:
67+
- name: Checkout sources
68+
uses: actions/checkout@v2
69+
- name: Install Rust (thumbv7em)
70+
run: rustup show
71+
- name: Lint boards/${{ matrix.board }}/examples/*
72+
run: |
73+
cd boards/${{ matrix.board }}
74+
cargo clippy --examples --no-deps -- --deny warnings
75+
76+
docs:
77+
needs: build
78+
runs-on: ubuntu-latest
79+
steps:
80+
- name: Checkout sources
81+
uses: actions/checkout@v2
82+
- name: Install Rust (thumbv7em)
83+
run: rustup show
84+
- name: Build HAL documentation
85+
run: cargo doc --package atsamx7x-hal --no-deps --features samv71q21b,unproven
86+
- name: Build HAL doc tests
87+
run: cargo test --package atsamx7x-hal --doc --features samv71q21b,unproven --target x86_64-unknown-linux-gnu
88+
89+

.github/workflows/changelog.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Check that the changelog is updated for all changes. This is only run
2+
# for PRs.
3+
#
4+
# Borrowed from <https://github.com/rtic-rs/cortex-m-rtic/pull/577>
5+
6+
on:
7+
pull_request:
8+
# opened, reopened, synchronize are the default types for pull_request.
9+
# labeled, unlabeled ensure this check is also run if a label is added or removed.
10+
types: [opened, reopened, labeled, unlabeled, synchronize]
11+
12+
name: Changelog
13+
14+
jobs:
15+
changelog:
16+
name: Changelog
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout sources
20+
uses: actions/checkout@v2
21+
22+
- name: Check that changelog updated
23+
uses: dangoslen/changelog-enforcer@v3
24+
with:
25+
changeLogPath: CHANGELOG.md
26+
skipLabels: 'skip-changelog'
27+
missingUpdateErrorMessage: 'Please add a changelog entry in the CHANGELOG.md file.'
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/rustfmt.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Formatting
2+
on: [push, pull_request]
3+
4+
env:
5+
CARGO_TERM_COLOR: always
6+
7+
jobs:
8+
format:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Install Rust (thumbv7em)
13+
run: rustup show
14+
- run: |
15+
set -xeu
16+
cargo fmt --package atsamx7x-hal -- --check
17+
for manifest in $(find ./boards -type f -iname Cargo.toml); do
18+
pushd $(dirname $manifest)
19+
cargo fmt -- --check
20+
popd
21+
done

.gitignore

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# IDE/Editors specific stuff and junk
2-
.vscode/
3-
4-
# Build artifacts
5-
target/
6-
**/*.rs.bk
1+
# IDE/Editors specific stuff and junk
2+
.vscode/
3+
4+
# Build artifacts
5+
target/
6+
**/*.rs.bk
7+
/boards/atsamv71-xult/logs/
8+
Cargo.lock

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "cmsis-svd"]
2-
path = cmsis-svd
3-
url = https://github.com/posborne/cmsis-svd.git

CHANGELOG.md

Lines changed: 97 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,97 @@
1-
# Changelog
2-
3-
## [Unreleased]
4-
5-
## [v0.1.0] 2022-03-16
6-
7-
* [cmsis-svd](./cmsis-svd/README.md) submodule as source of SVD files instead of collection in LFS (#2)
8-
* [svd2rust] v0.21.0 used for PAC generation (#2)
9-
* watchdog disabling facility (#4)
10-
11-
## [v0.0.2] 2020-06-03
12-
13-
* same70*: added foundations for ATSAME70 series support
14-
* Commitment to 0BSD license following practice from other PAC/HAL crates
15-
16-
## [v0.0.1] 2019-07-31
17-
18-
* pac: Generated for ATSAMS70 family
19-
* hal: Just very simple stuff added
20-
* automation script in Python
21-
22-
[Unreleased]: https://github.com/stm32-rs/stm32h7xx-hal/compare/v0.1.0...HEAD
23-
[v0.1.0]: https://github.com/stm32-rs/stm32h7xx-hal/compare/v0.2.0...v0.1.0
24-
[v0.0.2]: https://github.com/stm32-rs/stm32h7xx-hal/compare/v0.0.1...v0.0.2
25-
[v0.0.1]: https://github.com/michalfita/atsams70-rust/tree/v0.0.1
26-
[svd2rust]: https://github.com/rust-embedded/svd2rust
1+
# Changelog
2+
3+
## [Unreleased]
4+
5+
### Added
6+
7+
- GitHub CI.
8+
9+
### Changed
10+
11+
- [Sealed](https://rust-lang.github.io/api-guidelines/future-proofing.html#sealed-traits-protect-against-downstream-implementations-c-sealed) all HAL-internal traits to disallow potentially unsound downstream trait implementations.
12+
- Regenerated PACs with `svd2rust 0.25.1` using up-to-date (2022-05-18) SVDs. These SVDs are now vendored in this repository, instead of using a submodule.
13+
14+
### Removed
15+
16+
- Unused auxiliary script `hal/build.sh`.
17+
- Deprecated `.ci/` configuration files and Gitlab CI.
18+
19+
### Fixed
20+
21+
- HAL build when targeting `sams70n19b`.
22+
23+
## [v0.3.0] 2022-08-26
24+
25+
### Added
26+
- `tc` module: abstrations of Timer Counter channels:
27+
- `tc::Generate` channels: [`Monotonic`](https://docs.rs/rtic-monotonic/1.0.0/rtic_monotonic/trait.Monotonic.html), [`ehal::timer::{Countdown,Cancel}`](https://docs.rs/embedded-hal/0.2.7/embedded_hal/timer/index.html), and [`ehal::blocking::delay::Delay{Ms,Us}`](https://docs.rs/embedded-hal/0.2.7/embedded_hal/blocking/delay/index.html) implementations.
28+
- `tc::Capture` channels: measurement of frequencies, read from `TIOAx` `tc::ChannelInputPin<_, _ , A>`s, with subsampling support.
29+
- `boards/atsamv71_xult/examples`:
30+
- `blinky_tc`: blinks a LED by use of a `tc::Monotonic`; and
31+
- `blinky_tc_irq`: blinks a LED by use of a `tc::Timer`.
32+
- `serial::Uart::UartError::PrescalerUnderflow` error.
33+
- `serial::Uart::UartError::InvalidPck` error.
34+
- `pwm` module: allows frequencies and duty-rates to be independently set for each `pwm::Channel`, with help from `ehal::PwmPin`.
35+
- `hal/rust-toolchain.toml` that pins `rustc` (and relevant components/targets) to MSRV 1.63.0.
36+
- Crate feature: `reconfigurable-system-pins`; see below.
37+
- CI job that enforces `CHANGELOG.md` additions, unless the MR is labeled `skip-changelog`.
38+
39+
### Removed
40+
- `serial::Uart::UartError::BaudRateNotInRange` error.
41+
- `serial::Uart::reconfigure`, which did not exhaustively error check input parameters.
42+
43+
### Fixed
44+
- `Pck::configure` now records its output frequency correctly.
45+
- `Uart::{new,reconfigure}`: now rounds the calculated prescaler to the closest value instead of rounding down.
46+
- `Uart::new`: now returns `Err(UartError::InvalidPck)` if the baud-rate generating `Pck` is not at least three times slow than the peripheral clock (`HostClock`).
47+
- Clippy warnings in `boards/*/examples/*`.
48+
- The special-on-reset pins `PB4/5/6/7/12` are now switched from their alternate modes (ERASE, TCK/SWCLK, TMS/SWDIO, TDO/TRACESWO, TDI, respectively) to a regular PIO pin upon a `Pin::into_{mode,peripheral,input,output}`, if the `reconfigurable-system-pins` feature is enabled.
49+
50+
### Changed
51+
- `Pck::configure` now takes a `u16` prescaler instead of a `u8`, and returns `Err(PckError)` if the prescaler cannot be applied.
52+
- Renamed `serial::ExtU32` to `serial::ExtBpsU32`, in order to not clash with `fugit::ExtU32`.
53+
54+
## [v0.2.1] 2022-08-08
55+
56+
### Fixed
57+
- `boards/`: Incorrect HAL crate version.
58+
59+
## [v0.2.0] 2022-08-08
60+
61+
### Added
62+
- Nonexhaustive APIs for the following peripherals:
63+
- PMC;
64+
- EFC (to configure flash wait states only);
65+
- GPIO;
66+
- Serial peripherals: SPI, TWI (I²C), UART and USART (SPI/UART only);
67+
- AFEC (ADC);
68+
- RTT (for RTIC scheduling, `ehal::blocking::delay::Delay*` impl); and
69+
- USB support (via `usb-device`).
70+
- SAM V71/E70 Xplained Ultra/Pro board examples for most above peripherals.
71+
- GitLab CI configuration.
72+
73+
## [v0.1.0] 2022-03-16
74+
75+
* [cmsis-svd](./cmsis-svd/README.md) submodule as source of SVD files instead of collection in LFS (#2)
76+
* [svd2rust] v0.21.0 used for PAC generation (#2)
77+
* watchdog disabling facility (#4)
78+
79+
## [v0.0.2] 2020-06-03
80+
81+
* same70*: added foundations for ATSAME70 series support
82+
* Commitment to 0BSD license following practice from other PAC/HAL crates
83+
84+
## [v0.0.1] 2019-07-31
85+
86+
* pac: Generated for ATSAMS70 family
87+
* hal: Just very simple stuff added
88+
* automation script in Python
89+
90+
[Unreleased]: https://github.com/atsams-rs/atsamx7x-hal/compare/v0.3.0...HEAD
91+
[v0.3.0]: https://github.com/atsams-rs/atsamx7x-hal/compare/v0.2.1...v0.3.0
92+
[v0.2.1]: https://github.com/atsams-rs/atsamx7x-hal/compare/v0.2.0...v0.2.1
93+
[v0.2.0]: https://github.com/atsams-rs/atsamx7x-hal/compare/v0.1.0...v0.2.0
94+
[v0.1.0]: https://github.com/atsams-rs/atsamx7x-hal/compare/compare/v0.2.0...v0.1.0
95+
[v0.0.2]: https://github.com/atsams-rs/atsamx7x-hal/compare/v0.0.1...v0.0.2
96+
[v0.0.1]: https://github.com/atsams-rs/atsamx7x-hal/compare/tree/v0.0.1
97+
[svd2rust]: https://github.com/rust-embedded/svd2rust

0 commit comments

Comments
 (0)