Skip to content

Commit d89630c

Browse files
committed
improve runner, try to fix CI
1 parent d51f81b commit d89630c

File tree

4 files changed

+44
-9
lines changed

4 files changed

+44
-9
lines changed

.cargo/config.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@
55

66
[target.thumbv7em-none-eabihf]
77
# used to run the qemu_test.rs example with QEMU
8-
runner = "./qemu-runner.sh"
8+
runner = "./qemu-runner.sh --target thumbv7em-none-eabihf"
9+
rustflags = [
10+
"-Clink-arg=-Tlink.x",
11+
"-Clink-arg=-Tdefmt.x",
12+
]
913

14+
[target.thumbv6m-none-eabi]
15+
# used to run the qemu_test.rs example with QEMU
16+
runner = "./qemu-runner.sh --target thumbv6m-none-eabi"
1017
rustflags = [
1118
"-Clink-arg=-Tlink.x",
1219
"-Clink-arg=-Tdefmt.x",

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ jobs:
5656
sudo apt update
5757
sudo apt install qemu-system-arm
5858
- run: qemu-system-arm --version
59-
- run: cargo run --target thumbv7m-none-eabi --example llff_integration_test --all-features
60-
- run: cargo run --target thumbv7m-none-eabi --example tlsf_integration_test --all-features
59+
- run: cargo +nightly run --target thumbv7m-none-eabi --example llff_integration_test --all-features
60+
- run: cargo +nightly run --target thumbv7m-none-eabi --example tlsf_integration_test --all-features
6161

6262
clippy:
6363
name: Clippy

Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,19 @@ const-default = { version = "1.0.0", default-features = false, optional = true }
4141
[dev-dependencies]
4242
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
4343
cortex-m-rt = "0.7"
44-
# cortex-m-semihosting = "0.5"
4544
defmt = "1.0"
4645
defmt-semihosting = "0.3.0"
4746
semihosting = { version = "0.1.20", features = ["stdio"] }
4847
static_cell = "2"
4948

49+
# thumbv6m-none-eabi only
50+
[target.thumbv6m-none-eabi.dev-dependencies]
51+
portable-atomic = { version = "1", features = ["unsafe-assume-single-core"] }
52+
53+
# every other target gets the crate without the feature
54+
[target.'cfg(not(target = "thumbv6m-none-eabi"))'.dev-dependencies]
55+
portable-atomic = { version = "1" }
56+
5057
[[example]]
5158
name = "allocator_api"
5259
required-features = ["allocator_api", "llff"]

qemu-runner.sh

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,33 @@
33
# This requires you to previously run `cargo install defmt-print`
44

55
# See https://ferroussystems.hackmd.io/@jonathanpallant/ryA1S6QDJx for a description of all the relevant QEMU machines
6-
ELF_BINARY="$1"
6+
TARGET=""
7+
ELF_BINARY=""
8+
9+
# very small argument parser
10+
while [[ $# -gt 0 ]]; do
11+
case "$1" in
12+
--target) TARGET="$2"; shift 2 ;;
13+
*) ELF_BINARY="$1"; shift ;;
14+
esac
15+
done
16+
17+
# default to the target cargo is currently building for
18+
TARGET="${TARGET:-thumbv7em-none-eabihf}"
19+
20+
case "$TARGET" in
21+
thumbv6m-none-eabi)
22+
MACHINE="-cpu cortex-m3 -machine mps2-an385" ;;
23+
thumbv7em-none-eabihf)
24+
# All suitable for thumbv7em-none-eabihf
25+
MACHINE="-cpu cortex-m4 -machine mps2-an386" ;;
26+
# MACHINE="-cpu cortex-m7 -machine mps2-387" ;;
27+
# MACHINE="-cpu cortex-m7 -machine mps2-500"
28+
*)
29+
echo "Unsupported target: $TARGET" >&2
30+
exit 1 ;;
31+
esac
732

8-
# All suitable for thumbv7em-none-eabihf
9-
MACHINE="-cpu cortex-m4 -machine mps2-an386"
10-
# MACHINE="-cpu cortex-m7 -machine mps2-387"
11-
# MACHINE="-cpu cortex-m7 -machine mps2-500"
1233
LOG_FORMAT='{[{L}]%bold} {s} {({ff}:{l:1})%dimmed}'
1334

1435
echo "Running on '$MACHINE'..."

0 commit comments

Comments
 (0)