aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Greig <adam@adamgreig.com> 2018-10-09 21:20:57 +0100
committerGravatar Adam Greig <adam@adamgreig.com> 2018-10-09 21:20:57 +0100
commit7e583e2abf261910ed1a7778b07b72c1a7d97e3b (patch)
tree1c21d49626d101f90fe9a89b48a2a0220b05d5e2
parent879ae3c6296d19888bc00a18e50668f981deb7bb (diff)
parent0423076f192a07d1aeba2721d549c4359ff283ae (diff)
downloadcortex-m-7e583e2abf261910ed1a7778b07b72c1a7d97e3b.tar.gz
cortex-m-7e583e2abf261910ed1a7778b07b72c1a7d97e3b.tar.zst
cortex-m-7e583e2abf261910ed1a7778b07b72c1a7d97e3b.zip
Merge branch 'master' into interrupt
-rw-r--r--cortex-m-rt/.cargo/config31
-rw-r--r--cortex-m-rt/.travis.yml37
-rw-r--r--cortex-m-rt/CHANGELOG.md20
-rw-r--r--cortex-m-rt/Cargo.toml9
-rw-r--r--cortex-m-rt/ci/install.sh4
-rw-r--r--cortex-m-rt/ci/script.sh54
-rw-r--r--cortex-m-rt/examples/alignment.rs2
-rw-r--r--cortex-m-rt/examples/data_overflow.rs2
-rw-r--r--cortex-m-rt/examples/device.rs2
-rw-r--r--cortex-m-rt/examples/divergent-default-handler.rs2
-rw-r--r--cortex-m-rt/examples/divergent-exception.rs2
-rw-r--r--cortex-m-rt/examples/entry-static.rs2
-rw-r--r--cortex-m-rt/examples/main.rs2
-rw-r--r--cortex-m-rt/examples/minimal.rs2
-rw-r--r--cortex-m-rt/examples/override-exception.rs2
-rw-r--r--cortex-m-rt/examples/pre_init.rs2
-rw-r--r--cortex-m-rt/examples/qemu.rs29
-rw-r--r--cortex-m-rt/examples/rand.rs2
-rw-r--r--cortex-m-rt/examples/state.rs2
-rw-r--r--cortex-m-rt/examples/unsafe-default-handler.rs2
-rw-r--r--cortex-m-rt/examples/unsafe-entry.rs2
-rw-r--r--cortex-m-rt/examples/unsafe-exception.rs2
-rw-r--r--cortex-m-rt/examples/unsafe-hard-fault.rs2
-rw-r--r--cortex-m-rt/examples/unsafety.rs2
-rw-r--r--cortex-m-rt/link.x.in6
-rw-r--r--cortex-m-rt/macros/Cargo.toml8
-rw-r--r--cortex-m-rt/macros/src/lib.rs7
-rw-r--r--cortex-m-rt/memory.x4
-rw-r--r--cortex-m-rt/tests/compile-fail/default-handler-bad-signature-1.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/default-handler-bad-signature-2.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/default-handler-hidden.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/default-handler-twice.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/entry-args.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/entry-bad-signature-1.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/entry-bad-signature-2.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/entry-bad-signature-3.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/entry-hidden.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/entry-soundness.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/entry-twice.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/exception-args.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/exception-bad-signature-1.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/exception-bad-signature-2.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/exception-hidden.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/exception-soundness.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/exception-twice.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/hard-fault-bad-signature-1.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/hard-fault-hidden.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/hard-fault-twice.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/pre-init-args.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/pre-init-bad-signature-1.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/pre-init-bad-signature-2.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/pre-init-hidden.rs2
-rw-r--r--cortex-m-rt/tests/compile-fail/pre-init-twice.rs2
53 files changed, 189 insertions, 104 deletions
diff --git a/cortex-m-rt/.cargo/config b/cortex-m-rt/.cargo/config
new file mode 100644
index 0000000..0d6b19c
--- /dev/null
+++ b/cortex-m-rt/.cargo/config
@@ -0,0 +1,31 @@
+[target.thumbv7m-none-eabi]
+# uncomment this to make `cargo run` execute programs on QEMU
+runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
+
+[target.thumbv6m-none-eabi]
+# uncomment this to make `cargo run` execute programs on QEMU
+# For now, we use cortex-m3 instead of cortex-m0 which are not supported by QEMU
+runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
+
+[target.'cfg(all(target_arch = "arm", target_os = "none"))']
+# uncomment ONE of these three option to make `cargo run` start a GDB session
+# which option to pick depends on your system
+# runner = "arm-none-eabi-gdb -q -x openocd.gdb"
+# runner = "gdb-multiarch -q -x openocd.gdb"
+# runner = "gdb -q -x openocd.gdb"
+
+rustflags = [
+ # LLD (shipped with the Rust toolchain) is used as the default linker
+ "-C", "link-arg=-Tlink.x",
+
+ # if you run into problems with LLD switch to the GNU linker by commenting out
+ # this line
+ # "-C", "linker=arm-none-eabi-ld",
+
+ # if you need to link to pre-compiled C libraries provided by a C toolchain
+ # use GCC as the linker by commenting out both lines above and then
+ # uncommenting the three lines below
+ # "-C", "linker=arm-none-eabi-gcc",
+ # "-C", "link-arg=-Wl,-Tlink.x",
+ # "-C", "link-arg=-nostartfiles",
+] \ No newline at end of file
diff --git a/cortex-m-rt/.travis.yml b/cortex-m-rt/.travis.yml
index fd45f63..4da6efc 100644
--- a/cortex-m-rt/.travis.yml
+++ b/cortex-m-rt/.travis.yml
@@ -3,29 +3,28 @@ language: rust
matrix:
include:
- env: TARGET=x86_64-unknown-linux-gnu
- # TODO switch to 1.30-beta
- rust: nightly
+ rust: beta
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- # TODO enable when 1.30-beta is out
- # - env: TARGET=thumbv6m-none-eabi
- # rust: beta
- # if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
+ - env: TARGET=thumbv6m-none-eabi
+ rust: beta
+ if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- # TODO enable when 1.30-beta is out
- # - env: TARGET=thumbv7m-none-eabi
- # rust: beta
- # if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
+ - env: TARGET=thumbv7m-none-eabi
+ rust: beta
+ if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- # TODO enable when 1.30-beta is out
- # - env: TARGET=thumbv7em-none-eabi
- # rust: beta
- # if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
+ - env: TARGET=thumbv7em-none-eabi
+ rust: beta
+ if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- # TODO enable when 1.30-beta is out
- # - env: TARGET=thumbv7em-none-eabihf
- # rust: beta
- # if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
+ - env: TARGET=thumbv7em-none-eabihf
+ rust: beta
+ if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
+
+ - env: TARGET=x86_64-unknown-linux-gnu
+ rust: nightly
+ if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- env: TARGET=thumbv6m-none-eabi
rust: nightly
@@ -47,7 +46,7 @@ before_install: set -e
install:
- bash ci/install.sh
- - export PATH="$PATH:$PWD/gcc/bin"
+ - export PATH="$PATH:$PWD/gcc/bin:$PWD/qemu"
script:
- bash ci/script.sh
diff --git a/cortex-m-rt/CHANGELOG.md b/cortex-m-rt/CHANGELOG.md
index 24caf41..91ef8cd 100644
--- a/cortex-m-rt/CHANGELOG.md
+++ b/cortex-m-rt/CHANGELOG.md
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+## [v0.6.4] - 2018-09-25
+
+### Changed
+
+- (macros) Improved the error message when any of the attribute is used on the
+ wrong kind of item.
+
+### Fixed
+
+- (macros) The expansion of the `exception` attribute now uses the `extern "C"`
+ ABI which is what the hardware expects.
+
+- (macros) `entry` and `exception` now respect the declared unsafety. That is
+ `#[entry] unsafe main() -> !` won't require `unsafe` blocks to use `unsafe`
+ API.
+
## [v0.6.3] - 2018-09-09
### Fixed
@@ -372,7 +388,9 @@ section size addr
Initial release
-[Unreleased]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.2...HEAD
+[Unreleased]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.4...HEAD
+[v0.6.4]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.3...v0.6.4
+[v0.6.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.2...v0.6.3
[v0.6.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.1...v0.6.2
[v0.6.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.0...v0.6.1
[v0.6.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.5.3...v0.6.0
diff --git a/cortex-m-rt/Cargo.toml b/cortex-m-rt/Cargo.toml
index 0123750..3fd61ee 100644
--- a/cortex-m-rt/Cargo.toml
+++ b/cortex-m-rt/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-authors = ["Jorge Aparicio <jorge@japaric.io>"]
+authors = ["Jorge Aparicio <jorge@japaric.io>", "Hideki Sekine <sekineh@me.com>"]
categories = ["embedded", "no-std"]
description = "Minimal runtime / startup for Cortex-M microcontrollers"
documentation = "https://rust-embedded.github.io/cortex-m-rt/"
@@ -8,17 +8,16 @@ license = "MIT OR Apache-2.0"
name = "cortex-m-rt"
readme = "README.md"
repository = "https://github.com/rust-embedded/cortex-m-rt"
-version = "0.6.3"
+version = "0.6.4"
[dependencies]
r0 = "0.2.1"
-cortex-m-rt-macros = { path = "macros", version = "0.1.1" }
+cortex-m-rt-macros = { path = "macros", version = "0.1.2" }
[dev-dependencies]
cortex-m = "0.5.4"
-panic-abort = "0.3.0"
-panic-semihosting = "0.4.0"
panic-halt = "0.2.0"
+cortex-m-semihosting = "0.3.1"
[dev-dependencies.rand]
default-features = false
diff --git a/cortex-m-rt/ci/install.sh b/cortex-m-rt/ci/install.sh
index e63e805..aa9f149 100644
--- a/cortex-m-rt/ci/install.sh
+++ b/cortex-m-rt/ci/install.sh
@@ -8,6 +8,10 @@ main() {
mkdir gcc
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
+
+ mkdir qemu
+ curl -L https://github.com/japaric/qemu-bin/raw/master/14.04/qemu-system-arm-2.12.0 > qemu/qemu-system-arm
+ chmod +x qemu/qemu-system-arm
}
main
diff --git a/cortex-m-rt/ci/script.sh b/cortex-m-rt/ci/script.sh
index 3cffcad..3569588 100644
--- a/cortex-m-rt/ci/script.sh
+++ b/cortex-m-rt/ci/script.sh
@@ -5,7 +5,7 @@ main() {
cargo check --target $TARGET --features device
- if [ $TARGET = x86_64-unknown-linux-gnu ]; then
+ if [ $TARGET = x86_64-unknown-linux-gnu ] && [ $TRAVIS_RUST_VERSION = nightly ]; then
( cd macros && cargo check && cargo test )
cargo test --features device --test compiletest
@@ -20,6 +20,7 @@ main() {
minimal
override-exception
pre_init
+ qemu
rand
state
unsafe-default-handler
@@ -34,54 +35,51 @@ main() {
# linking with GNU LD
for ex in "${examples[@]}"; do
cargo rustc --target $TARGET --example $ex -- \
- -C linker=arm-none-eabi-ld \
- -C link-arg=-Tlink.x
+ -C linker=arm-none-eabi-ld
cargo rustc --target $TARGET --example $ex --release -- \
- -C linker=arm-none-eabi-ld \
- -C link-arg=-Tlink.x
+ -C linker=arm-none-eabi-ld
done
for ex in "${fail_examples[@]}"; do
! cargo rustc --target $TARGET --example $ex -- \
- -C linker=arm-none-eabi-ld \
- -C link-arg=-Tlink.x
+ -C linker=arm-none-eabi-ld
! cargo rustc --target $TARGET --example $ex --release -- \
- -C linker=arm-none-eabi-ld \
- -C link-arg=-Tlink.x
+ -C linker=arm-none-eabi-ld
done
cargo rustc --target $TARGET --example device --features device -- \
- -C linker=arm-none-eabi-ld \
- -C link-arg=-Tlink.x
+ -C linker=arm-none-eabi-ld
cargo rustc --target $TARGET --example device --features device --release -- \
- -C linker=arm-none-eabi-ld \
- -C link-arg=-Tlink.x
+ -C linker=arm-none-eabi-ld
# linking with rustc's LLD
for ex in "${examples[@]}"; do
- cargo rustc --target $TARGET --example $ex -- \
- -C link-arg=-Tlink.x
-
- cargo rustc --target $TARGET --example $ex --release -- \
- -C link-arg=-Tlink.x
+ cargo rustc --target $TARGET --example $ex
+ cargo rustc --target $TARGET --example $ex --release
done
for ex in "${fail_examples[@]}"; do
- ! cargo rustc --target $TARGET --example $ex -- \
- -C link-arg=-Tlink.x
-
- ! cargo rustc --target $TARGET --example $ex --release -- \
- -C link-arg=-Tlink.x
+ ! cargo rustc --target $TARGET --example $ex
+ ! cargo rustc --target $TARGET --example $ex --release
done
- cargo rustc --target $TARGET --example device --features device -- \
- -C link-arg=-Tlink.x
-
- cargo rustc --target $TARGET --example device --features device --release -- \
- -C link-arg=-Tlink.x
+ cargo rustc --target $TARGET --example device --features device
+ cargo rustc --target $TARGET --example device --features device --release
fi
+ case $TARGET in
+ thumbv6m-none-eabi|thumbv7m-none-eabi)
+ # linking with GNU LD
+ env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" cargo run --target $TARGET --example qemu | grep "x = 42"
+ env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" cargo run --target $TARGET --example qemu --release | grep "x = 42"
+
+ # linking with rustc's LLD
+ cargo run --target $TARGET --example qemu | grep "x = 42"
+ cargo run --target $TARGET --example qemu --release | grep "x = 42"
+ ;;
+ esac
+
if [ $TARGET = x86_64-unknown-linux-gnu ]; then
./check-blobs.sh
fi
diff --git a/cortex-m-rt/examples/alignment.rs b/cortex-m-rt/examples/alignment.rs
index 25d755d..4421e69 100644
--- a/cortex-m-rt/examples/alignment.rs
+++ b/cortex-m-rt/examples/alignment.rs
@@ -5,7 +5,7 @@
#![no_std]
extern crate cortex_m_rt as rt;
-extern crate panic_abort;
+extern crate panic_halt;
use core::ptr;
diff --git a/cortex-m-rt/examples/data_overflow.rs b/cortex-m-rt/examples/data_overflow.rs
index ceec18b..ea48b23 100644
--- a/cortex-m-rt/examples/data_overflow.rs
+++ b/cortex-m-rt/examples/data_overflow.rs
@@ -6,7 +6,7 @@
#![no_std]
extern crate cortex_m_rt as rt;
-extern crate panic_abort;
+extern crate panic_halt;
use core::ptr;
diff --git a/cortex-m-rt/examples/device.rs b/cortex-m-rt/examples/device.rs
index 950a564..dc1c738 100644
--- a/cortex-m-rt/examples/device.rs
+++ b/cortex-m-rt/examples/device.rs
@@ -6,7 +6,7 @@
#![no_std]
extern crate cortex_m_rt as rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use rt::entry;
diff --git a/cortex-m-rt/examples/divergent-default-handler.rs b/cortex-m-rt/examples/divergent-default-handler.rs
index cbb8bb1..22fa437 100644
--- a/cortex-m-rt/examples/divergent-default-handler.rs
+++ b/cortex-m-rt/examples/divergent-default-handler.rs
@@ -4,7 +4,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/examples/divergent-exception.rs b/cortex-m-rt/examples/divergent-exception.rs
index 9998884..cb2247b 100644
--- a/cortex-m-rt/examples/divergent-exception.rs
+++ b/cortex-m-rt/examples/divergent-exception.rs
@@ -3,7 +3,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/examples/entry-static.rs b/cortex-m-rt/examples/entry-static.rs
index 1b2e118..55e7a89 100644
--- a/cortex-m-rt/examples/entry-static.rs
+++ b/cortex-m-rt/examples/entry-static.rs
@@ -6,7 +6,7 @@
#![no_std]
extern crate cortex_m_rt as rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use rt::entry;
diff --git a/cortex-m-rt/examples/main.rs b/cortex-m-rt/examples/main.rs
index e5ce3d1..b8ab66e 100644
--- a/cortex-m-rt/examples/main.rs
+++ b/cortex-m-rt/examples/main.rs
@@ -5,7 +5,7 @@
#![no_std]
extern crate cortex_m_rt as rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
#[no_mangle]
pub unsafe extern "C" fn main() -> ! {
diff --git a/cortex-m-rt/examples/minimal.rs b/cortex-m-rt/examples/minimal.rs
index 6f60180..bd0a6ad 100644
--- a/cortex-m-rt/examples/minimal.rs
+++ b/cortex-m-rt/examples/minimal.rs
@@ -6,7 +6,7 @@
#![no_std]
extern crate cortex_m_rt as rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use rt::entry;
diff --git a/cortex-m-rt/examples/override-exception.rs b/cortex-m-rt/examples/override-exception.rs
index 3e0af25..6da6c5e 100644
--- a/cortex-m-rt/examples/override-exception.rs
+++ b/cortex-m-rt/examples/override-exception.rs
@@ -7,7 +7,7 @@
extern crate cortex_m;
extern crate cortex_m_rt as rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m::asm;
use rt::{entry, exception, ExceptionFrame};
diff --git a/cortex-m-rt/examples/pre_init.rs b/cortex-m-rt/examples/pre_init.rs
index 00e2f2c..2c931bb 100644
--- a/cortex-m-rt/examples/pre_init.rs
+++ b/cortex-m-rt/examples/pre_init.rs
@@ -5,7 +5,7 @@
#![no_std]
extern crate cortex_m_rt as rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use rt::{entry, pre_init};
diff --git a/cortex-m-rt/examples/qemu.rs b/cortex-m-rt/examples/qemu.rs
new file mode 100644
index 0000000..e2cd895
--- /dev/null
+++ b/cortex-m-rt/examples/qemu.rs
@@ -0,0 +1,29 @@
+// #![feature(stdsimd)]
+#![no_main]
+#![no_std]
+
+extern crate cortex_m;
+
+extern crate cortex_m_rt as rt;
+extern crate cortex_m_semihosting as semihosting;
+extern crate panic_halt;
+
+use core::fmt::Write;
+use cortex_m::asm;
+use rt::entry;
+
+#[entry]
+fn main() -> ! {
+ let x = 42;
+
+ loop {
+ asm::nop();
+
+ // write something through semihosting interface
+ let mut hstdout = semihosting::hio::hstdout().unwrap();
+ write!(hstdout, "x = {}\n", x);
+
+ // exit from qemu
+ semihosting::debug::exit(semihosting::debug::EXIT_SUCCESS);
+ }
+}
diff --git a/cortex-m-rt/examples/rand.rs b/cortex-m-rt/examples/rand.rs
index e0cfd31..ec3afaa 100644
--- a/cortex-m-rt/examples/rand.rs
+++ b/cortex-m-rt/examples/rand.rs
@@ -7,7 +7,7 @@
extern crate cortex_m_rt as rt;
use rt::entry;
-extern crate panic_semihosting;
+extern crate panic_halt;
extern crate rand;
use rand::Rng;
diff --git a/cortex-m-rt/examples/state.rs b/cortex-m-rt/examples/state.rs
index 573914f..ee6224d 100644
--- a/cortex-m-rt/examples/state.rs
+++ b/cortex-m-rt/examples/state.rs
@@ -6,7 +6,7 @@
#![no_std]
extern crate cortex_m_rt as rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use rt::{entry, exception};
diff --git a/cortex-m-rt/examples/unsafe-default-handler.rs b/cortex-m-rt/examples/unsafe-default-handler.rs
index 48bd31e..a805c12 100644
--- a/cortex-m-rt/examples/unsafe-default-handler.rs
+++ b/cortex-m-rt/examples/unsafe-default-handler.rs
@@ -3,7 +3,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/examples/unsafe-entry.rs b/cortex-m-rt/examples/unsafe-entry.rs
index feb6f44..9dcbf33 100644
--- a/cortex-m-rt/examples/unsafe-entry.rs
+++ b/cortex-m-rt/examples/unsafe-entry.rs
@@ -3,7 +3,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::entry;
diff --git a/cortex-m-rt/examples/unsafe-exception.rs b/cortex-m-rt/examples/unsafe-exception.rs
index d67f06f..4212610 100644
--- a/cortex-m-rt/examples/unsafe-exception.rs
+++ b/cortex-m-rt/examples/unsafe-exception.rs
@@ -3,7 +3,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/examples/unsafe-hard-fault.rs b/cortex-m-rt/examples/unsafe-hard-fault.rs
index b091d47..b1d48f3 100644
--- a/cortex-m-rt/examples/unsafe-hard-fault.rs
+++ b/cortex-m-rt/examples/unsafe-hard-fault.rs
@@ -3,7 +3,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
diff --git a/cortex-m-rt/examples/unsafety.rs b/cortex-m-rt/examples/unsafety.rs
index a9f0234..cdb5aca 100644
--- a/cortex-m-rt/examples/unsafety.rs
+++ b/cortex-m-rt/examples/unsafety.rs
@@ -5,7 +5,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
diff --git a/cortex-m-rt/link.x.in b/cortex-m-rt/link.x.in
index 3d71811..fde4e70 100644
--- a/cortex-m-rt/link.x.in
+++ b/cortex-m-rt/link.x.in
@@ -129,6 +129,12 @@ SECTIONS
/* Place the heap right after `.bss` */
__sheap = ADDR(.bss) + SIZEOF(.bss);
+ /* Stack usage metadata emitted by LLVM */
+ .stack_sizes (INFO) :
+ {
+ KEEP(*(.stack_sizes));
+ }
+
/* ## .got */
/* Dynamic relocations are unsupported. This section is only used to detect relocatable code in
the input files and raise an error if relocatable code is found */
diff --git a/cortex-m-rt/macros/Cargo.toml b/cortex-m-rt/macros/Cargo.toml
index 8d7e517..1687c4d 100644
--- a/cortex-m-rt/macros/Cargo.toml
+++ b/cortex-m-rt/macros/Cargo.toml
@@ -7,18 +7,18 @@ keywords = ["arm", "cortex-m", "runtime", "startup"]
license = "MIT OR Apache-2.0"
name = "cortex-m-rt-macros"
repository = "https://github.com/japaric/cortex-m-rt"
-version = "0.1.1"
+version = "0.1.2"
[lib]
proc-macro = true
[dependencies]
-quote = "0.6.6"
-proc-macro2 = "0.4.15"
+quote = "0.6.8"
+proc-macro2 = "0.4.19"
[dependencies.syn]
features = ["extra-traits", "full"]
-version = "0.14.8"
+version = "0.15.4"
[dependencies.rand]
version = "0.5.5"
diff --git a/cortex-m-rt/macros/src/lib.rs b/cortex-m-rt/macros/src/lib.rs
index 8721010..56ec88c 100644
--- a/cortex-m-rt/macros/src/lib.rs
+++ b/cortex-m-rt/macros/src/lib.rs
@@ -6,6 +6,7 @@ extern crate rand;
extern crate quote;
extern crate core;
extern crate proc_macro2;
+#[macro_use]
extern crate syn;
use proc_macro2::Span;
@@ -77,7 +78,7 @@ use proc_macro::TokenStream;
/// ```
#[proc_macro_attribute]
pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
- let f: ItemFn = syn::parse(input).expect("`#[entry]` must be applied to a function");
+ let f = parse_macro_input!(input as ItemFn);
// check the function signature
assert!(
@@ -253,7 +254,7 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
/// ```
#[proc_macro_attribute]
pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
- let f: ItemFn = syn::parse(input).expect("`#[exception]` must be applied to a function");
+ let f = parse_macro_input!(input as ItemFn);
assert!(
args.to_string() == "",
@@ -599,7 +600,7 @@ pub fn interrupt(args: TokenStream, input: TokenStream) -> TokenStream {
/// ```
#[proc_macro_attribute]
pub fn pre_init(args: TokenStream, input: TokenStream) -> TokenStream {
- let f: ItemFn = syn::parse(input).expect("`#[pre_init]` must be applied to a function");
+ let f = parse_macro_input!(input as ItemFn);
// check the function signature
assert!(
diff --git a/cortex-m-rt/memory.x b/cortex-m-rt/memory.x
index 6268ea6..82cf9c7 100644
--- a/cortex-m-rt/memory.x
+++ b/cortex-m-rt/memory.x
@@ -7,8 +7,8 @@ MEMORY
{
/* FLASH and RAM are mandatory memory regions */
/* Update examples/data_overflow.rs if you change these sizes. */
- FLASH : ORIGIN = 0x08000000, LENGTH = 64K
- RAM : ORIGIN = 0x20000000, LENGTH = 20K
+ FLASH : ORIGIN = 0x00000000, LENGTH = 256K
+ RAM : ORIGIN = 0x20000000, LENGTH = 64K
/* More memory regions can declared: for example this is a second RAM region */
/* CCRAM : ORIGIN = 0x10000000, LENGTH = 8K */
diff --git a/cortex-m-rt/tests/compile-fail/default-handler-bad-signature-1.rs b/cortex-m-rt/tests/compile-fail/default-handler-bad-signature-1.rs
index 037e9c8..72ea0fa 100644
--- a/cortex-m-rt/tests/compile-fail/default-handler-bad-signature-1.rs
+++ b/cortex-m-rt/tests/compile-fail/default-handler-bad-signature-1.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/tests/compile-fail/default-handler-bad-signature-2.rs b/cortex-m-rt/tests/compile-fail/default-handler-bad-signature-2.rs
index 8fc4a7e..2e46a6b 100644
--- a/cortex-m-rt/tests/compile-fail/default-handler-bad-signature-2.rs
+++ b/cortex-m-rt/tests/compile-fail/default-handler-bad-signature-2.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/tests/compile-fail/default-handler-hidden.rs b/cortex-m-rt/tests/compile-fail/default-handler-hidden.rs
index 059c10b..e57cb31 100644
--- a/cortex-m-rt/tests/compile-fail/default-handler-hidden.rs
+++ b/cortex-m-rt/tests/compile-fail/default-handler-hidden.rs
@@ -5,7 +5,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/tests/compile-fail/default-handler-twice.rs b/cortex-m-rt/tests/compile-fail/default-handler-twice.rs
index 7d6ad98..ad1c3f9 100644
--- a/cortex-m-rt/tests/compile-fail/default-handler-twice.rs
+++ b/cortex-m-rt/tests/compile-fail/default-handler-twice.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/tests/compile-fail/entry-args.rs b/cortex-m-rt/tests/compile-fail/entry-args.rs
index 07cb4bd..b0d293c 100644
--- a/cortex-m-rt/tests/compile-fail/entry-args.rs
+++ b/cortex-m-rt/tests/compile-fail/entry-args.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::entry;
diff --git a/cortex-m-rt/tests/compile-fail/entry-bad-signature-1.rs b/cortex-m-rt/tests/compile-fail/entry-bad-signature-1.rs
index 5eeb49f..5fe9a1a 100644
--- a/cortex-m-rt/tests/compile-fail/entry-bad-signature-1.rs
+++ b/cortex-m-rt/tests/compile-fail/entry-bad-signature-1.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::entry;
diff --git a/cortex-m-rt/tests/compile-fail/entry-bad-signature-2.rs b/cortex-m-rt/tests/compile-fail/entry-bad-signature-2.rs
index 18bbaed..2b71a57 100644
--- a/cortex-m-rt/tests/compile-fail/entry-bad-signature-2.rs
+++ b/cortex-m-rt/tests/compile-fail/entry-bad-signature-2.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::entry;
diff --git a/cortex-m-rt/tests/compile-fail/entry-bad-signature-3.rs b/cortex-m-rt/tests/compile-fail/entry-bad-signature-3.rs
index 09b75e9..463e5b7 100644
--- a/cortex-m-rt/tests/compile-fail/entry-bad-signature-3.rs
+++ b/cortex-m-rt/tests/compile-fail/entry-bad-signature-3.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::entry;
diff --git a/cortex-m-rt/tests/compile-fail/entry-hidden.rs b/cortex-m-rt/tests/compile-fail/entry-hidden.rs
index 7d74063..836db0d 100644
--- a/cortex-m-rt/tests/compile-fail/entry-hidden.rs
+++ b/cortex-m-rt/tests/compile-fail/entry-hidden.rs
@@ -5,7 +5,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
mod hidden {
use cortex_m_rt::entry;
diff --git a/cortex-m-rt/tests/compile-fail/entry-soundness.rs b/cortex-m-rt/tests/compile-fail/entry-soundness.rs
index 5e40a8f..9fc8ec1 100644
--- a/cortex-m-rt/tests/compile-fail/entry-soundness.rs
+++ b/cortex-m-rt/tests/compile-fail/entry-soundness.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/tests/compile-fail/entry-twice.rs b/cortex-m-rt/tests/compile-fail/entry-twice.rs
index b2819f6..757083a 100644
--- a/cortex-m-rt/tests/compile-fail/entry-twice.rs
+++ b/cortex-m-rt/tests/compile-fail/entry-twice.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::entry;
diff --git a/cortex-m-rt/tests/compile-fail/exception-args.rs b/cortex-m-rt/tests/compile-fail/exception-args.rs
index 85613ff..472a583 100644
--- a/cortex-m-rt/tests/compile-fail/exception-args.rs
+++ b/cortex-m-rt/tests/compile-fail/exception-args.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/tests/compile-fail/exception-bad-signature-1.rs b/cortex-m-rt/tests/compile-fail/exception-bad-signature-1.rs
index 966493e..e1fbf31 100644
--- a/cortex-m-rt/tests/compile-fail/exception-bad-signature-1.rs
+++ b/cortex-m-rt/tests/compile-fail/exception-bad-signature-1.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/tests/compile-fail/exception-bad-signature-2.rs b/cortex-m-rt/tests/compile-fail/exception-bad-signature-2.rs
index 8504771..ed46cf6 100644
--- a/cortex-m-rt/tests/compile-fail/exception-bad-signature-2.rs
+++ b/cortex-m-rt/tests/compile-fail/exception-bad-signature-2.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/tests/compile-fail/exception-hidden.rs b/cortex-m-rt/tests/compile-fail/exception-hidden.rs
index 053c81c..6f57089 100644
--- a/cortex-m-rt/tests/compile-fail/exception-hidden.rs
+++ b/cortex-m-rt/tests/compile-fail/exception-hidden.rs
@@ -5,7 +5,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/tests/compile-fail/exception-soundness.rs b/cortex-m-rt/tests/compile-fail/exception-soundness.rs
index 07d73fa..aae2476 100644
--- a/cortex-m-rt/tests/compile-fail/exception-soundness.rs
+++ b/cortex-m-rt/tests/compile-fail/exception-soundness.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/tests/compile-fail/exception-twice.rs b/cortex-m-rt/tests/compile-fail/exception-twice.rs
index 5377fce..aabbe5a 100644
--- a/cortex-m-rt/tests/compile-fail/exception-twice.rs
+++ b/cortex-m-rt/tests/compile-fail/exception-twice.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception};
diff --git a/cortex-m-rt/tests/compile-fail/hard-fault-bad-signature-1.rs b/cortex-m-rt/tests/compile-fail/hard-fault-bad-signature-1.rs
index 83fda5f..c2e9c31 100644
--- a/cortex-m-rt/tests/compile-fail/hard-fault-bad-signature-1.rs
+++ b/cortex-m-rt/tests/compile-fail/hard-fault-bad-signature-1.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
diff --git a/cortex-m-rt/tests/compile-fail/hard-fault-hidden.rs b/cortex-m-rt/tests/compile-fail/hard-fault-hidden.rs
index 31237c4..956310b 100644
--- a/cortex-m-rt/tests/compile-fail/hard-fault-hidden.rs
+++ b/cortex-m-rt/tests/compile-fail/hard-fault-hidden.rs
@@ -5,7 +5,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
diff --git a/cortex-m-rt/tests/compile-fail/hard-fault-twice.rs b/cortex-m-rt/tests/compile-fail/hard-fault-twice.rs
index 90270e5..0bb6c8c 100644
--- a/cortex-m-rt/tests/compile-fail/hard-fault-twice.rs
+++ b/cortex-m-rt/tests/compile-fail/hard-fault-twice.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
diff --git a/cortex-m-rt/tests/compile-fail/pre-init-args.rs b/cortex-m-rt/tests/compile-fail/pre-init-args.rs
index 716b211..94d87bd 100644
--- a/cortex-m-rt/tests/compile-fail/pre-init-args.rs
+++ b/cortex-m-rt/tests/compile-fail/pre-init-args.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, pre_init};
diff --git a/cortex-m-rt/tests/compile-fail/pre-init-bad-signature-1.rs b/cortex-m-rt/tests/compile-fail/pre-init-bad-signature-1.rs
index 58d3022..249f477 100644
--- a/cortex-m-rt/tests/compile-fail/pre-init-bad-signature-1.rs
+++ b/cortex-m-rt/tests/compile-fail/pre-init-bad-signature-1.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, pre_init};
diff --git a/cortex-m-rt/tests/compile-fail/pre-init-bad-signature-2.rs b/cortex-m-rt/tests/compile-fail/pre-init-bad-signature-2.rs
index e47ed59..e942542 100644
--- a/cortex-m-rt/tests/compile-fail/pre-init-bad-signature-2.rs
+++ b/cortex-m-rt/tests/compile-fail/pre-init-bad-signature-2.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, pre_init};
diff --git a/cortex-m-rt/tests/compile-fail/pre-init-hidden.rs b/cortex-m-rt/tests/compile-fail/pre-init-hidden.rs
index f512d62..63ab90b 100644
--- a/cortex-m-rt/tests/compile-fail/pre-init-hidden.rs
+++ b/cortex-m-rt/tests/compile-fail/pre-init-hidden.rs
@@ -5,7 +5,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
mod hidden {
use cortex_m_rt::pre_init;
diff --git a/cortex-m-rt/tests/compile-fail/pre-init-twice.rs b/cortex-m-rt/tests/compile-fail/pre-init-twice.rs
index 5fb1ade..74a3f6b 100644
--- a/cortex-m-rt/tests/compile-fail/pre-init-twice.rs
+++ b/cortex-m-rt/tests/compile-fail/pre-init-twice.rs
@@ -2,7 +2,7 @@
#![no_std]
extern crate cortex_m_rt;
-extern crate panic_semihosting;
+extern crate panic_halt;
use cortex_m_rt::{entry, pre_init};