Skip to content

Commit 35cd719

Browse files
bors[bot]raz-aDisasmthejpsteradamgreig
authored
Merge #391
391: Merge cortex-m-rt into this repository r=therealprof a=adamgreig This PR merges the cortex-m-rt repository (with history) into this repo, inside the `cortex-m-rt` folder which is added to the workspace. The main advantage is easier combined testing of cortex-m with cortex-m-rt (including on-hardware tests e.g. #355), and in the future easier changes across the two projects. The MSRV of cortex-m-rt is bumped 1.39 -> 1.40 to align it with cortex-m itself. I've updated the CI to run the same tests and checks as before, and updated references to the old URL. If/after this is merged, I propose adding a note to the old repo's README and then archiving it. An alternative to this technique would be adding all the files in one new commit (not preserving history), if anyone thinks that would be neater. NB: This PR also adds an inline to ITM to fix a clippy hard error. For future reference, the git work was: ``` cd cortex-m-rt git filter-repo --to-subdirectory-filter cortex-m-rt cd ../cortex-m git remote add rt ../cortex-m-rt git fetch rt git merge --allow-unrelated-histories rt/master ``` Co-authored-by: bors[bot] <bors[bot]@users.noreply.github.com> Co-authored-by: Raz Aloni <[email protected]> Co-authored-by: Vadim Kaushan <[email protected]> Co-authored-by: Jonathan 'theJPster' Pallant <[email protected]> Co-authored-by: Adam Greig <[email protected]> Co-authored-by: Jonas Schievink <[email protected]> Co-authored-by: Jorge Aparicio <[email protected]> Co-authored-by: Emil Fresk <[email protected]> Co-authored-by: Daniel Egger <[email protected]> Co-authored-by: Niklas Claesson <[email protected]> Co-authored-by: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
2 parents 92552c7 + 657af97 commit 35cd719

File tree

94 files changed

+4917
-3
lines changed

Some content is hidden

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

94 files changed

+4917
-3
lines changed

.github/bors.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ required_approvals = 1
44
status = [
55
"ci-linux (stable)",
66
"ci-linux (1.40.0)",
7+
"rt-ci-linux (stable)",
8+
"rt-ci-linux (1.40.0)",
9+
"rt-ci-other-os (macOS-latest)",
10+
"rt-ci-other-os (windows-latest)",
711
"rustfmt",
812
"clippy",
913
]

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
branches: [ staging, trying, master ]
44
pull_request:
55

6-
name: CI
6+
name: cortex-m CI
77

88
jobs:
99
ci-linux:
@@ -29,6 +29,6 @@ jobs:
2929
toolchain: ${{ matrix.rust }}
3030
override: true
3131
- name: Run tests
32-
run: cargo test --all
32+
run: cargo test --all --exclude cortex-m-rt
3333

3434
# FIXME: test on macOS and Windows

.github/workflows/clippy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ jobs:
2323
- uses: actions-rs/clippy-check@v1
2424
with:
2525
token: ${{ secrets.GITHUB_TOKEN }}
26+
args: --all

.github/workflows/rt-ci.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
on:
2+
push:
3+
branches: [ staging, trying, master ]
4+
pull_request:
5+
6+
name: cortex-m-rt CI
7+
8+
jobs:
9+
rt-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
15+
rust: [nightly, stable, 1.40.0]
16+
17+
include:
18+
# Nightly is only for reference and allowed to fail
19+
- rust: nightly
20+
experimental: true
21+
defaults:
22+
run:
23+
working-directory: cortex-m-rt
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: actions-rs/toolchain@v1
27+
with:
28+
profile: minimal
29+
toolchain: ${{ matrix.rust }}
30+
override: true
31+
- name: Install all Rust targets for ${{ matrix.rust }}
32+
run: rustup target install --toolchain=${{ matrix.rust }} thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabi thumbv7em-none-eabihf thumbv8m.base-none-eabi thumbv8m.main-none-eabi thumbv8m.main-none-eabihf
33+
- name: Install qemu and gcc
34+
run: sudo apt-get update && sudo apt-get install qemu-system-arm gcc-arm-none-eabi
35+
- name: Run CI script for x86_64-unknown-linux-gnu under ${{ matrix.rust }}
36+
run: TARGET=x86_64-unknown-linux-gnu TRAVIS_RUST_VERSION=${{ matrix.rust }} bash ci/script.sh
37+
- name: Run CI script for thumbv6m-none-eabi under ${{ matrix.rust }}
38+
run: TARGET=thumbv6m-none-eabi TRAVIS_RUST_VERSION=${{ matrix.rust }} bash ci/script.sh
39+
- name: Run CI script for thumbv7m-none-eabi under ${{ matrix.rust }}
40+
run: TARGET=thumbv7m-none-eabi TRAVIS_RUST_VERSION=${{ matrix.rust }} bash ci/script.sh
41+
- name: Run CI script for thumbv7em-none-eabi under ${{ matrix.rust }}
42+
run: TARGET=thumbv7em-none-eabi TRAVIS_RUST_VERSION=${{ matrix.rust }} bash ci/script.sh
43+
- name: Run CI script for thumbv7em-none-eabihf under ${{ matrix.rust }}
44+
run: TARGET=thumbv7em-none-eabihf TRAVIS_RUST_VERSION=${{ matrix.rust }} bash ci/script.sh
45+
- name: Run CI script for thumbv8m.base-none-eabi under ${{ matrix.rust }}
46+
run: TARGET=thumbv8m.base-none-eabi TRAVIS_RUST_VERSION=${{ matrix.rust }} bash ci/script.sh
47+
- name: Run CI script for thumbv8m.main-none-eabi under ${{ matrix.rust }}
48+
run: TARGET=thumbv8m.main-none-eabi TRAVIS_RUST_VERSION=${{ matrix.rust }} bash ci/script.sh
49+
- name: Run CI script for thumbv8m.main-none-eabihf under ${{ matrix.rust }}
50+
run: TARGET=thumbv8m.main-none-eabihf TRAVIS_RUST_VERSION=${{ matrix.rust }} bash ci/script.sh
51+
52+
# On macOS and Windows, we at least make sure that all examples build and link.
53+
rt-ci-other-os:
54+
strategy:
55+
matrix:
56+
os:
57+
- macOS-latest
58+
- windows-latest
59+
runs-on: ${{ matrix.os }}
60+
defaults:
61+
run:
62+
working-directory: cortex-m-rt
63+
steps:
64+
- uses: actions/checkout@v2
65+
- uses: actions-rs/toolchain@v1
66+
with:
67+
profile: minimal
68+
toolchain: stable
69+
override: true
70+
- name: Install all Rust targets
71+
run: rustup target install thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabi thumbv7em-none-eabihf thumbv8m.base-none-eabi thumbv8m.main-none-eabi thumbv8m.main-none-eabihf
72+
- name: Build examples for thumbv6m-none-eabi
73+
run: cargo build --target=thumbv6m-none-eabi --examples
74+
- name: Build examples for thumbv7m-none-eabi
75+
run: cargo build --target=thumbv7m-none-eabi --examples
76+
- name: Build examples for thumbv7em-none-eabi
77+
run: cargo build --target=thumbv7em-none-eabi --examples
78+
- name: Build examples for thumbv7em-none-eabihf
79+
run: cargo build --target=thumbv7em-none-eabihf --examples
80+
- name: Build examples for thumbv8m.base-none-eabi
81+
run: cargo build --target=thumbv8m.base-none-eabi --examples
82+
- name: Build examples for thumbv8m.main-none-eabi
83+
run: cargo build --target=thumbv8m.main-none-eabi --examples
84+
- name: Build examples for thumbv8m.main-none-eabihf
85+
run: cargo build --target=thumbv8m.main-none-eabihf --examples
86+
- name: Build crate for host OS
87+
run: cargo build

Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ linker-plugin-lto = []
3434
std = []
3535

3636
[workspace]
37-
members = ["xtask", "cortex-m-semihosting", "panic-semihosting", "panic-itm"]
37+
members = [
38+
"xtask",
39+
"cortex-m-rt",
40+
"cortex-m-semihosting",
41+
"panic-semihosting",
42+
"panic-itm"
43+
]
3844

3945
[package.metadata.docs.rs]
4046
targets = [

cortex-m-rt/.cargo/config

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[target.thumbv6m-none-eabi]
2+
runner = "qemu-system-arm -cpu cortex-m0 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
3+
4+
[target.thumbv7m-none-eabi]
5+
runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
6+
7+
[target.thumbv7em-none-eabi]
8+
runner = "qemu-system-arm -cpu cortex-m4 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
9+
10+
[target.thumbv7em-none-eabihf]
11+
runner = "qemu-system-arm -cpu cortex-m4 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
12+
13+
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
14+
# uncomment ONE of these three option to make `cargo run` start a GDB session
15+
# which option to pick depends on your system
16+
# runner = "arm-none-eabi-gdb -q -x openocd.gdb"
17+
# runner = "gdb-multiarch -q -x openocd.gdb"
18+
# runner = "gdb -q -x openocd.gdb"
19+
20+
rustflags = [
21+
# LLD (shipped with the Rust toolchain) is used as the default linker
22+
"-C", "link-arg=-Tlink.x",
23+
24+
# if you run into problems with LLD switch to the GNU linker by commenting out
25+
# this line
26+
# "-C", "linker=arm-none-eabi-ld",
27+
28+
# if you need to link to pre-compiled C libraries provided by a C toolchain
29+
# use GCC as the linker by commenting out both lines above and then
30+
# uncommenting the three lines below
31+
# "-C", "linker=arm-none-eabi-gcc",
32+
# "-C", "link-arg=-Wl,-Tlink.x",
33+
# "-C", "link-arg=-nostartfiles",
34+
]

cortex-m-rt/.gitignore

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

0 commit comments

Comments
 (0)