Skip to content

Commit 7e583e2

Browse files
committed
Merge branch 'master' into interrupt
2 parents 879ae3c + 0423076 commit 7e583e2

Some content is hidden

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

53 files changed

+189
-104
lines changed

cortex-m-rt/.cargo/config

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

cortex-m-rt/.travis.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,28 @@ language: rust
33
matrix:
44
include:
55
- env: TARGET=x86_64-unknown-linux-gnu
6-
# TODO switch to 1.30-beta
7-
rust: nightly
6+
rust: beta
87
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
98

10-
# TODO enable when 1.30-beta is out
11-
# - env: TARGET=thumbv6m-none-eabi
12-
# rust: beta
13-
# if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
9+
- env: TARGET=thumbv6m-none-eabi
10+
rust: beta
11+
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
1412

15-
# TODO enable when 1.30-beta is out
16-
# - env: TARGET=thumbv7m-none-eabi
17-
# rust: beta
18-
# if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
13+
- env: TARGET=thumbv7m-none-eabi
14+
rust: beta
15+
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
1916

20-
# TODO enable when 1.30-beta is out
21-
# - env: TARGET=thumbv7em-none-eabi
22-
# rust: beta
23-
# if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
17+
- env: TARGET=thumbv7em-none-eabi
18+
rust: beta
19+
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
2420

25-
# TODO enable when 1.30-beta is out
26-
# - env: TARGET=thumbv7em-none-eabihf
27-
# rust: beta
28-
# if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
21+
- env: TARGET=thumbv7em-none-eabihf
22+
rust: beta
23+
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
24+
25+
- env: TARGET=x86_64-unknown-linux-gnu
26+
rust: nightly
27+
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
2928

3029
- env: TARGET=thumbv6m-none-eabi
3130
rust: nightly
@@ -47,7 +46,7 @@ before_install: set -e
4746

4847
install:
4948
- bash ci/install.sh
50-
- export PATH="$PATH:$PWD/gcc/bin"
49+
- export PATH="$PATH:$PWD/gcc/bin:$PWD/qemu"
5150

5251
script:
5352
- bash ci/script.sh

cortex-m-rt/CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
## [v0.6.4] - 2018-09-25
11+
12+
### Changed
13+
14+
- (macros) Improved the error message when any of the attribute is used on the
15+
wrong kind of item.
16+
17+
### Fixed
18+
19+
- (macros) The expansion of the `exception` attribute now uses the `extern "C"`
20+
ABI which is what the hardware expects.
21+
22+
- (macros) `entry` and `exception` now respect the declared unsafety. That is
23+
`#[entry] unsafe main() -> !` won't require `unsafe` blocks to use `unsafe`
24+
API.
25+
1026
## [v0.6.3] - 2018-09-09
1127

1228
### Fixed
@@ -372,7 +388,9 @@ section size addr
372388

373389
Initial release
374390

375-
[Unreleased]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.2...HEAD
391+
[Unreleased]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.4...HEAD
392+
[v0.6.4]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.3...v0.6.4
393+
[v0.6.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.2...v0.6.3
376394
[v0.6.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.1...v0.6.2
377395
[v0.6.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.0...v0.6.1
378396
[v0.6.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.5.3...v0.6.0

cortex-m-rt/Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
authors = ["Jorge Aparicio <[email protected]>"]
2+
authors = ["Jorge Aparicio <[email protected]>", "Hideki Sekine <[email protected]>"]
33
categories = ["embedded", "no-std"]
44
description = "Minimal runtime / startup for Cortex-M microcontrollers"
55
documentation = "https://rust-embedded.github.io/cortex-m-rt/"
@@ -8,17 +8,16 @@ license = "MIT OR Apache-2.0"
88
name = "cortex-m-rt"
99
readme = "README.md"
1010
repository = "https://github.com/rust-embedded/cortex-m-rt"
11-
version = "0.6.3"
11+
version = "0.6.4"
1212

1313
[dependencies]
1414
r0 = "0.2.1"
15-
cortex-m-rt-macros = { path = "macros", version = "0.1.1" }
15+
cortex-m-rt-macros = { path = "macros", version = "0.1.2" }
1616

1717
[dev-dependencies]
1818
cortex-m = "0.5.4"
19-
panic-abort = "0.3.0"
20-
panic-semihosting = "0.4.0"
2119
panic-halt = "0.2.0"
20+
cortex-m-semihosting = "0.3.1"
2221

2322
[dev-dependencies.rand]
2423
default-features = false

cortex-m-rt/ci/install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ main() {
88
mkdir gcc
99

1010
curl -L https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2?revision=bc2c96c0-14b5-4bb4-9f18-bceb4050fee7?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Linux,7-2018-q2-update | tar --strip-components=1 -C gcc -xj
11+
12+
mkdir qemu
13+
curl -L https://github.com/japaric/qemu-bin/raw/master/14.04/qemu-system-arm-2.12.0 > qemu/qemu-system-arm
14+
chmod +x qemu/qemu-system-arm
1115
}
1216

1317
main

cortex-m-rt/ci/script.sh

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ main() {
55

66
cargo check --target $TARGET --features device
77

8-
if [ $TARGET = x86_64-unknown-linux-gnu ]; then
8+
if [ $TARGET = x86_64-unknown-linux-gnu ] && [ $TRAVIS_RUST_VERSION = nightly ]; then
99
( cd macros && cargo check && cargo test )
1010

1111
cargo test --features device --test compiletest
@@ -20,6 +20,7 @@ main() {
2020
minimal
2121
override-exception
2222
pre_init
23+
qemu
2324
rand
2425
state
2526
unsafe-default-handler
@@ -34,54 +35,51 @@ main() {
3435
# linking with GNU LD
3536
for ex in "${examples[@]}"; do
3637
cargo rustc --target $TARGET --example $ex -- \
37-
-C linker=arm-none-eabi-ld \
38-
-C link-arg=-Tlink.x
38+
-C linker=arm-none-eabi-ld
3939

4040
cargo rustc --target $TARGET --example $ex --release -- \
41-
-C linker=arm-none-eabi-ld \
42-
-C link-arg=-Tlink.x
41+
-C linker=arm-none-eabi-ld
4342
done
4443
for ex in "${fail_examples[@]}"; do
4544
! cargo rustc --target $TARGET --example $ex -- \
46-
-C linker=arm-none-eabi-ld \
47-
-C link-arg=-Tlink.x
45+
-C linker=arm-none-eabi-ld
4846

4947
! cargo rustc --target $TARGET --example $ex --release -- \
50-
-C linker=arm-none-eabi-ld \
51-
-C link-arg=-Tlink.x
48+
-C linker=arm-none-eabi-ld
5249
done
5350

5451
cargo rustc --target $TARGET --example device --features device -- \
55-
-C linker=arm-none-eabi-ld \
56-
-C link-arg=-Tlink.x
52+
-C linker=arm-none-eabi-ld
5753

5854
cargo rustc --target $TARGET --example device --features device --release -- \
59-
-C linker=arm-none-eabi-ld \
60-
-C link-arg=-Tlink.x
55+
-C linker=arm-none-eabi-ld
6156

6257
# linking with rustc's LLD
6358
for ex in "${examples[@]}"; do
64-
cargo rustc --target $TARGET --example $ex -- \
65-
-C link-arg=-Tlink.x
66-
67-
cargo rustc --target $TARGET --example $ex --release -- \
68-
-C link-arg=-Tlink.x
59+
cargo rustc --target $TARGET --example $ex
60+
cargo rustc --target $TARGET --example $ex --release
6961
done
7062
for ex in "${fail_examples[@]}"; do
71-
! cargo rustc --target $TARGET --example $ex -- \
72-
-C link-arg=-Tlink.x
73-
74-
! cargo rustc --target $TARGET --example $ex --release -- \
75-
-C link-arg=-Tlink.x
63+
! cargo rustc --target $TARGET --example $ex
64+
! cargo rustc --target $TARGET --example $ex --release
7665
done
7766

78-
cargo rustc --target $TARGET --example device --features device -- \
79-
-C link-arg=-Tlink.x
80-
81-
cargo rustc --target $TARGET --example device --features device --release -- \
82-
-C link-arg=-Tlink.x
67+
cargo rustc --target $TARGET --example device --features device
68+
cargo rustc --target $TARGET --example device --features device --release
8369
fi
8470

71+
case $TARGET in
72+
thumbv6m-none-eabi|thumbv7m-none-eabi)
73+
# linking with GNU LD
74+
env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" cargo run --target $TARGET --example qemu | grep "x = 42"
75+
env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" cargo run --target $TARGET --example qemu --release | grep "x = 42"
76+
77+
# linking with rustc's LLD
78+
cargo run --target $TARGET --example qemu | grep "x = 42"
79+
cargo run --target $TARGET --example qemu --release | grep "x = 42"
80+
;;
81+
esac
82+
8583
if [ $TARGET = x86_64-unknown-linux-gnu ]; then
8684
./check-blobs.sh
8785
fi

cortex-m-rt/examples/alignment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![no_std]
66

77
extern crate cortex_m_rt as rt;
8-
extern crate panic_abort;
8+
extern crate panic_halt;
99

1010
use core::ptr;
1111

cortex-m-rt/examples/data_overflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#![no_std]
77

88
extern crate cortex_m_rt as rt;
9-
extern crate panic_abort;
9+
extern crate panic_halt;
1010

1111
use core::ptr;
1212

cortex-m-rt/examples/device.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#![no_std]
77

88
extern crate cortex_m_rt as rt;
9-
extern crate panic_semihosting;
9+
extern crate panic_halt;
1010

1111
use rt::entry;
1212

cortex-m-rt/examples/divergent-default-handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![no_std]
55

66
extern crate cortex_m_rt;
7-
extern crate panic_semihosting;
7+
extern crate panic_halt;
88

99
use cortex_m_rt::{entry, exception};
1010

cortex-m-rt/examples/divergent-exception.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![no_std]
44

55
extern crate cortex_m_rt;
6-
extern crate panic_semihosting;
6+
extern crate panic_halt;
77

88
use cortex_m_rt::{entry, exception};
99

cortex-m-rt/examples/entry-static.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#![no_std]
77

88
extern crate cortex_m_rt as rt;
9-
extern crate panic_semihosting;
9+
extern crate panic_halt;
1010

1111
use rt::entry;
1212

cortex-m-rt/examples/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![no_std]
66

77
extern crate cortex_m_rt as rt;
8-
extern crate panic_semihosting;
8+
extern crate panic_halt;
99

1010
#[no_mangle]
1111
pub unsafe extern "C" fn main() -> ! {

cortex-m-rt/examples/minimal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#![no_std]
77

88
extern crate cortex_m_rt as rt;
9-
extern crate panic_semihosting;
9+
extern crate panic_halt;
1010

1111
use rt::entry;
1212

cortex-m-rt/examples/override-exception.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
extern crate cortex_m;
99
extern crate cortex_m_rt as rt;
10-
extern crate panic_semihosting;
10+
extern crate panic_halt;
1111

1212
use cortex_m::asm;
1313
use rt::{entry, exception, ExceptionFrame};

cortex-m-rt/examples/pre_init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![no_std]
66

77
extern crate cortex_m_rt as rt;
8-
extern crate panic_semihosting;
8+
extern crate panic_halt;
99

1010
use rt::{entry, pre_init};
1111

cortex-m-rt/examples/qemu.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// #![feature(stdsimd)]
2+
#![no_main]
3+
#![no_std]
4+
5+
extern crate cortex_m;
6+
7+
extern crate cortex_m_rt as rt;
8+
extern crate cortex_m_semihosting as semihosting;
9+
extern crate panic_halt;
10+
11+
use core::fmt::Write;
12+
use cortex_m::asm;
13+
use rt::entry;
14+
15+
#[entry]
16+
fn main() -> ! {
17+
let x = 42;
18+
19+
loop {
20+
asm::nop();
21+
22+
// write something through semihosting interface
23+
let mut hstdout = semihosting::hio::hstdout().unwrap();
24+
write!(hstdout, "x = {}\n", x);
25+
26+
// exit from qemu
27+
semihosting::debug::exit(semihosting::debug::EXIT_SUCCESS);
28+
}
29+
}

cortex-m-rt/examples/rand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
extern crate cortex_m_rt as rt;
88
use rt::entry;
99

10-
extern crate panic_semihosting;
10+
extern crate panic_halt;
1111

1212
extern crate rand;
1313
use rand::Rng;

cortex-m-rt/examples/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#![no_std]
77

88
extern crate cortex_m_rt as rt;
9-
extern crate panic_semihosting;
9+
extern crate panic_halt;
1010

1111
use rt::{entry, exception};
1212

0 commit comments

Comments
 (0)