Skip to content

Commit 42b279c

Browse files
committed
Crate can now be built without manual adjustments.
I let svd2rust build both the Cortex-M and RISC-V versions of the PAC, and then join them together in a custom lib.rs file. Note that, GHA and Debian disagree about sorting so I re-sorted the files in an Ubuntu 20.04 container.
1 parent 28c2699 commit 42b279c

File tree

1,686 files changed

+7344
-4897
lines changed

Some content is hidden

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

1,686 files changed

+7344
-4897
lines changed

.cargo/config.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build]
2+
# Set a default target so the docs build
3+
target = "riscv32imac-unknown-none-elf"

.github/workflows/build_and_test.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ jobs:
55
name: cargo-check
66
runs-on: ubuntu-20.04
77
steps:
8-
- uses: actions/checkout@v3
8+
- uses: actions/checkout@v4
99
- uses: dtolnay/rust-toolchain@stable
1010
with:
11-
target: thumbv8m.main-none-eabi
12-
- run: cargo build --target=thumbv8m.main-none-eabi
11+
target: thumbv8m.main-none-eabihf
12+
- run: cargo build --target=thumbv8m.main-none-eabihf
1313
check-riscv:
1414
name: cargo-check
1515
runs-on: ubuntu-20.04
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
- uses: dtolnay/rust-toolchain@stable
1919
with:
2020
target: riscv32imac-unknown-none-elf

.github/workflows/clippy.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ jobs:
66
env:
77
RUSTFLAGS: "-D warnings"
88
steps:
9-
- uses: actions/checkout@v3
10-
- uses: dtolnay/rust-toolchain@1.64.0
9+
- uses: actions/checkout@v4
10+
- uses: dtolnay/rust-toolchain@stable
1111
with:
1212
target: thumbv8m.main-none-eabihf
1313
components: clippy
14-
- run: cargo clippy --target=thumbv8m.main-none-eabihf -- -D warnings
14+
- run: cargo clippy --target=thumbv8m.main-none-eabihf
1515
clippy-check-riscv:
1616
runs-on: ubuntu-20.04
1717
env:
1818
RUSTFLAGS: "-D warnings"
1919
steps:
20-
- uses: actions/checkout@v3
21-
- uses: dtolnay/rust-toolchain@1.64.0
20+
- uses: actions/checkout@v4
21+
- uses: dtolnay/rust-toolchain@stable
2222
with:
2323
target: riscv32imac-unknown-none-elf
2424
components: clippy
25-
- run: cargo clippy --target=riscv32imac-unknown-none-elf -- -D warnings
25+
- run: cargo clippy --target=riscv32imac-unknown-none-elf

.github/workflows/rustfmt.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
env:
88
RUSTFLAGS: "-D warnings"
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111
- uses: dtolnay/rust-toolchain@stable
1212
with:
1313
components: rustfmt

.github/workflows/update.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
on: [push, pull_request]
2+
name: Run update.sh and check for changed files
3+
jobs:
4+
update-and-diff:
5+
runs-on: ubuntu-20.04
6+
steps:
7+
- uses: actions/checkout@v4
8+
- run: ./update.sh
9+
- run: git diff --exit-code

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "rp235x-pac"
3-
version = "0.6.0"
3+
version = "0.1.0"
44
authors = ["The RP-RS team"]
5-
edition = "2018"
5+
edition = "2021"
66
homepage = "https://github.com/rp-rs/rp235x-pac"
77
description = "A Peripheral Access Crate for the Raspberry Pi RP235x microcontrollers"
88
license = "BSD-3-Clause"

sortFieldsAlphaNum.sh

+10-9
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,39 @@ set -e
1717

1818
# This array should be populated with enough characters to locate a struct that needs to have its fields alphabetized.
1919
alphaTargets=('struct Peripherals')
20+
FILE=$1
2021

2122
for ((i = 0; i < ${#alphaTargets[@]}; i++)); do
2223

2324
# File line count
24-
maxLen=$(cat src/lib.rs | wc -l)
25+
maxLen=$(cat ${FILE} | wc -l)
2526

2627
# This will find the line number before the starting line of the block to replace
27-
blockStart=$(cat src/lib.rs | grep "${alphaTargets[$i]}" -m 1 -n | cut -d ":" -f1)
28+
blockStart=$(cat ${FILE} | grep "${alphaTargets[$i]}" -m 1 -n | cut -d ":" -f1)
2829

2930
# This will find the line number after the ending line of the block to replace
30-
blockEnd=$(cat src/lib.rs | grep "${alphaTargets[$i]}" -A $maxLen | grep -m 1 -n "}" | cut -d ":" -f1)
31+
blockEnd=$(cat ${FILE} | grep "${alphaTargets[$i]}" -A $maxLen | grep -m 1 -n "}" | cut -d ":" -f1)
3132
blockEndLine=$(($blockEnd - 2)) # used for grep display count after match
3233
blockEnd=$((blockEndLine + blockStart)) # used for tail
3334

3435
# Calculate the tail number needed to crop to blockEnd
3536
blockTail=$((maxLen-blockEnd))
3637

3738
# This will replace the parts that need to be sorted.
38-
toReplace=$(cat src/lib.rs | grep "${alphaTargets[$i]}" -A $blockEndLine | tail -n $blockEndLine)
39+
toReplace=$(cat ${FILE} | grep "${alphaTargets[$i]}" -A $blockEndLine | tail -n $blockEndLine)
3940
if [ "$(uname)" == "Darwin" ]; then
4041
alphabetized=$(echo "$toReplace" | sed '$!N;s/\n/ /' | sort | sed 's/ /\n /')
4142
else
4243
alphabetized=$(echo "$toReplace" | sed '$!N;s/\n/ /' | sort | sed -E 's/\s{5}/\n /')
4344
fi
4445

4546
# Grab the parts that we aren't sorting
46-
libSrcHead=$(cat src/lib.rs | head -n $blockStart)
47-
libSrcTail=$(cat src/lib.rs | tail -n $blockTail)
47+
libSrcHead=$(cat ${FILE} | head -n $blockStart)
48+
libSrcTail=$(cat ${FILE} | tail -n $blockTail)
4849

4950
# Write out the sorted file
50-
echo "$libSrcHead" > src/lib.rs
51-
echo "$alphabetized" >> src/lib.rs
52-
echo "$libSrcTail" >> src/lib.rs
51+
echo "$libSrcHead" > ${FILE}
52+
echo "$alphabetized" >> ${FILE}
53+
echo "$libSrcTail" >> ${FILE}
5354

5455
done
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/adc.rs src/inner/adc.rs

File renamed without changes.

src/adc/cs.rs src/inner/adc/cs.rs

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/clocks.rs src/inner/clocks.rs

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/dma.rs src/inner/dma.rs

File renamed without changes.

src/dma/ch.rs src/inner/dma/ch.rs

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/eppb.rs src/inner/eppb.rs

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)