From c3dbc7225d666043a57ca0cb36b32e938a06c7e6 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Fri, 11 May 2018 22:24:37 +0200 Subject: add CI, add device specific check of the vector table size, .. - document the `main` symbol as an alternative to `entry!` - document `ResetTrampoline` - fix: `PendSV` is available on ARMv6-M - document that `entry!` and `exception!` must be called from accessible modules. - add a deny lint to `entry!` and `exception!` to prevent them from being invoked from inaccessible modules. --- cortex-m-rt/examples/main.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 cortex-m-rt/examples/main.rs (limited to 'cortex-m-rt/examples/main.rs') diff --git a/cortex-m-rt/examples/main.rs b/cortex-m-rt/examples/main.rs new file mode 100644 index 0000000..d319249 --- /dev/null +++ b/cortex-m-rt/examples/main.rs @@ -0,0 +1,28 @@ +//! Directly plug a `main` symbol instead of using `entry!` + +#![deny(warnings)] +#![no_main] +#![no_std] + +#[macro_use(exception)] +extern crate cortex_m_rt as rt; +extern crate panic_semihosting; + +use rt::ExceptionFrame; + +#[no_mangle] +pub unsafe extern "C" fn main() -> ! { + loop {} +} + +// the hard fault handler +exception!(HardFault, hard_fault); + +fn hard_fault(_ef: &ExceptionFrame) -> ! { + loop {} +} + +// the default exception handler +exception!(*, default_handler); + +fn default_handler(_irqn: i16) {} -- cgit v1.2.3 From 3b25e71a78c6ac8514f3d59dc6e124a57439dcb6 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 11 Aug 2018 20:41:46 -0500 Subject: v0.5.2 --- cortex-m-rt/CHANGELOG.md | 64 +++++++++++++++++------------- cortex-m-rt/Cargo.toml | 3 +- cortex-m-rt/ci/script.sh | 1 + cortex-m-rt/examples/alignment.rs | 14 +------ cortex-m-rt/examples/device.rs | 16 +------- cortex-m-rt/examples/main.rs | 15 ------- cortex-m-rt/examples/minimal.rs | 16 +------- cortex-m-rt/examples/override-exception.rs | 35 ++++++++++++++++ cortex-m-rt/examples/state.rs | 14 ------- 9 files changed, 78 insertions(+), 100 deletions(-) create mode 100644 cortex-m-rt/examples/override-exception.rs (limited to 'cortex-m-rt/examples/main.rs') diff --git a/cortex-m-rt/CHANGELOG.md b/cortex-m-rt/CHANGELOG.md index 16958e0..e0de1a4 100644 --- a/cortex-m-rt/CHANGELOG.md +++ b/cortex-m-rt/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [v0.5.2] - 2018-08-11 + +### Changed + +- The `entry!` and `exception!` macros now also accept a closure instead of a path. + +- `DefaultHandler` and `UserHardFault` now default to an infinite loop if left undefined. + ## [v0.5.1] - 2018-05-14 ### Fixed @@ -319,30 +327,32 @@ section size addr Initial release -[Unreleased]: https://github.com/japaric/cortex-m-rt/compare/v0.5.0...HEAD -[v0.5.0]: https://github.com/japaric/cortex-m-rt/compare/v0.4.0...v0.3.0 -[v0.4.0]: https://github.com/japaric/cortex-m-rt/compare/v0.3.15...v0.4.0 -[v0.3.15]: https://github.com/japaric/cortex-m-rt/compare/v0.3.14...v0.3.15 -[v0.3.14]: https://github.com/japaric/cortex-m-rt/compare/v0.3.13...v0.3.14 -[v0.3.13]: https://github.com/japaric/cortex-m-rt/compare/v0.3.12...v0.3.13 -[v0.3.12]: https://github.com/japaric/cortex-m-rt/compare/v0.3.11...v0.3.12 -[v0.3.11]: https://github.com/japaric/cortex-m-rt/compare/v0.3.10...v0.3.11 -[v0.3.10]: https://github.com/japaric/cortex-m-rt/compare/v0.3.9...v0.3.10 -[v0.3.9]: https://github.com/japaric/cortex-m-rt/compare/v0.3.8...v0.3.9 -[v0.3.8]: https://github.com/japaric/cortex-m-rt/compare/v0.3.7...v0.3.8 -[v0.3.7]: https://github.com/japaric/cortex-m-rt/compare/v0.3.6...v0.3.7 -[v0.3.6]: https://github.com/japaric/cortex-m-rt/compare/v0.3.5...v0.3.6 -[v0.3.5]: https://github.com/japaric/cortex-m-rt/compare/v0.3.4...v0.3.5 -[v0.3.4]: https://github.com/japaric/cortex-m-rt/compare/v0.3.3...v0.3.4 -[v0.3.3]: https://github.com/japaric/cortex-m-rt/compare/v0.3.2...v0.3.3 -[v0.3.2]: https://github.com/japaric/cortex-m-rt/compare/v0.3.1...v0.3.2 -[v0.3.1]: https://github.com/japaric/cortex-m-rt/compare/v0.3.0...v0.3.1 -[v0.3.0]: https://github.com/japaric/cortex-m-rt/compare/v0.2.4...v0.3.0 -[v0.2.4]: https://github.com/japaric/cortex-m-rt/compare/v0.2.3...v0.2.4 -[v0.2.3]: https://github.com/japaric/cortex-m-rt/compare/v0.2.2...v0.2.3 -[v0.2.2]: https://github.com/japaric/cortex-m-rt/compare/v0.2.1...v0.2.2 -[v0.2.1]: https://github.com/japaric/cortex-m-rt/compare/v0.2.0...v0.2.1 -[v0.2.0]: https://github.com/japaric/cortex-m-rt/compare/v0.1.3...v0.2.0 -[v0.1.3]: https://github.com/japaric/cortex-m-rt/compare/v0.1.2...v0.1.3 -[v0.1.2]: https://github.com/japaric/cortex-m-rt/compare/v0.1.1...v0.1.2 -[v0.1.1]: https://github.com/japaric/cortex-m-rt/compare/v0.1.0...v0.1.1 +[Unreleased]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.5.2...HEAD +[v0.5.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.5.1...v0.5.2 +[v0.5.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.5.0...v0.5.1 +[v0.5.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.4.0...v0.5.0 +[v0.4.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.15...v0.4.0 +[v0.3.15]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.14...v0.3.15 +[v0.3.14]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.13...v0.3.14 +[v0.3.13]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.12...v0.3.13 +[v0.3.12]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.11...v0.3.12 +[v0.3.11]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.10...v0.3.11 +[v0.3.10]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.9...v0.3.10 +[v0.3.9]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.8...v0.3.9 +[v0.3.8]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.7...v0.3.8 +[v0.3.7]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.6...v0.3.7 +[v0.3.6]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.5...v0.3.6 +[v0.3.5]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.4...v0.3.5 +[v0.3.4]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.3...v0.3.4 +[v0.3.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.2...v0.3.3 +[v0.3.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.1...v0.3.2 +[v0.3.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.0...v0.3.1 +[v0.3.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.4...v0.3.0 +[v0.2.4]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.3...v0.2.4 +[v0.2.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.2...v0.2.3 +[v0.2.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.1...v0.2.2 +[v0.2.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.0...v0.2.1 +[v0.2.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.1.3...v0.2.0 +[v0.1.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.1.2...v0.1.3 +[v0.1.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.1.1...v0.1.2 +[v0.1.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.1.0...v0.1.1 diff --git a/cortex-m-rt/Cargo.toml b/cortex-m-rt/Cargo.toml index 9cd9d19..7027da3 100644 --- a/cortex-m-rt/Cargo.toml +++ b/cortex-m-rt/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["arm", "cortex-m", "runtime", "startup"] license = "MIT OR Apache-2.0" name = "cortex-m-rt" repository = "https://github.com/japaric/cortex-m-rt" -version = "0.5.1" +version = "0.5.2" [build-dependencies] cc = "1.0.10" @@ -18,6 +18,7 @@ r0 = "0.2.1" [dev-dependencies] panic-semihosting = "0.3.0" panic-abort = "0.2.0" +cortex-m = "0.5.3" [features] device = [] diff --git a/cortex-m-rt/ci/script.sh b/cortex-m-rt/ci/script.sh index 2515b8f..902468d 100644 --- a/cortex-m-rt/ci/script.sh +++ b/cortex-m-rt/ci/script.sh @@ -9,6 +9,7 @@ main() { alignment minimal main + override-exception state ) if [ $TRAVIS_RUST_VERSION = nightly ]; then diff --git a/cortex-m-rt/examples/alignment.rs b/cortex-m-rt/examples/alignment.rs index ef1beaa..5635851 100644 --- a/cortex-m-rt/examples/alignment.rs +++ b/cortex-m-rt/examples/alignment.rs @@ -4,14 +4,12 @@ #![no_main] #![no_std] -#[macro_use(entry, exception)] +#[macro_use(entry)] extern crate cortex_m_rt as rt; extern crate panic_abort; use core::ptr; -use rt::ExceptionFrame; - entry!(main); static mut BSS1: u16 = 0; @@ -33,13 +31,3 @@ fn main() -> ! { loop {} } - -exception!(HardFault, hard_fault); - -fn hard_fault(_ef: &ExceptionFrame) -> ! { - loop {} -} - -exception!(*, default_handler); - -fn default_handler(_irqn: i16) {} diff --git a/cortex-m-rt/examples/device.rs b/cortex-m-rt/examples/device.rs index cf91f21..4395db2 100644 --- a/cortex-m-rt/examples/device.rs +++ b/cortex-m-rt/examples/device.rs @@ -5,12 +5,10 @@ #![no_main] #![no_std] -#[macro_use(entry, exception)] +#[macro_use(entry)] extern crate cortex_m_rt as rt; extern crate panic_semihosting; -use rt::ExceptionFrame; - // the program entry point entry!(main); @@ -18,18 +16,6 @@ fn main() -> ! { loop {} } -// the hard fault handler -exception!(HardFault, hard_fault); - -fn hard_fault(_ef: &ExceptionFrame) -> ! { - loop {} -} - -// the default exception handler -exception!(*, default_handler); - -fn default_handler(_irqn: i16) {} - // interrupts portion of the vector table pub union Vector { handler: unsafe extern "C" fn(), diff --git a/cortex-m-rt/examples/main.rs b/cortex-m-rt/examples/main.rs index d319249..e5ce3d1 100644 --- a/cortex-m-rt/examples/main.rs +++ b/cortex-m-rt/examples/main.rs @@ -4,25 +4,10 @@ #![no_main] #![no_std] -#[macro_use(exception)] extern crate cortex_m_rt as rt; extern crate panic_semihosting; -use rt::ExceptionFrame; - #[no_mangle] pub unsafe extern "C" fn main() -> ! { loop {} } - -// the hard fault handler -exception!(HardFault, hard_fault); - -fn hard_fault(_ef: &ExceptionFrame) -> ! { - loop {} -} - -// the default exception handler -exception!(*, default_handler); - -fn default_handler(_irqn: i16) {} diff --git a/cortex-m-rt/examples/minimal.rs b/cortex-m-rt/examples/minimal.rs index c12d12d..a036046 100644 --- a/cortex-m-rt/examples/minimal.rs +++ b/cortex-m-rt/examples/minimal.rs @@ -5,27 +5,13 @@ #![no_main] #![no_std] -#[macro_use(entry, exception)] +#[macro_use(entry)] extern crate cortex_m_rt as rt; extern crate panic_semihosting; -use rt::ExceptionFrame; - // the program entry point entry!(main); fn main() -> ! { loop {} } - -// the hard fault handler -exception!(HardFault, hard_fault); - -fn hard_fault(_ef: &ExceptionFrame) -> ! { - loop {} -} - -// the default exception handler -exception!(*, default_handler); - -fn default_handler(_irqn: i16) {} diff --git a/cortex-m-rt/examples/override-exception.rs b/cortex-m-rt/examples/override-exception.rs new file mode 100644 index 0000000..2f100a2 --- /dev/null +++ b/cortex-m-rt/examples/override-exception.rs @@ -0,0 +1,35 @@ +//! How to override the hard fault exception handler and the default exception handler + +#![deny(unsafe_code)] +#![deny(warnings)] +#![no_main] +#![no_std] + +extern crate cortex_m; +#[macro_use(entry, exception)] +extern crate cortex_m_rt as rt; +extern crate panic_semihosting; + +use cortex_m::asm; +use rt::ExceptionFrame; + +// the program entry point +entry!(main); + +fn main() -> ! { + loop {} +} + +exception!(*, default_handler); + +fn default_handler(_irqn: i16) { + asm::bkpt(); +} + +exception!(HardFault, hard_fault); + +fn hard_fault(_ef: &ExceptionFrame) -> ! { + asm::bkpt(); + + loop {} +} diff --git a/cortex-m-rt/examples/state.rs b/cortex-m-rt/examples/state.rs index 0b5eeeb..dbacdaf 100644 --- a/cortex-m-rt/examples/state.rs +++ b/cortex-m-rt/examples/state.rs @@ -9,8 +9,6 @@ extern crate cortex_m_rt as rt; extern crate panic_semihosting; -use rt::ExceptionFrame; - // the program entry point entry!(main); @@ -24,15 +22,3 @@ exception!(SysTick, sys_tick, state: u32 = 0); fn sys_tick(state: &mut u32) { *state += 1; } - -// the hard fault handler -exception!(HardFault, hard_fault); - -fn hard_fault(_ef: &ExceptionFrame) -> ! { - loop {} -} - -// the default exception handler -exception!(*, default_handler); - -fn default_handler(_irqn: i16) {} -- cgit v1.2.3 From 85ba898dc80d14dc35dd21abab7684bb1ea0f4c8 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 17 Sep 2018 23:38:18 +0200 Subject: use panic-halt instead of panic-{abort,semihosting} the former requires a feature gate; the later pulls in the cortex-m crate --- cortex-m-rt/Cargo.toml | 3 +-- cortex-m-rt/examples/alignment.rs | 2 +- cortex-m-rt/examples/data_overflow.rs | 2 +- cortex-m-rt/examples/device.rs | 2 +- cortex-m-rt/examples/divergent-default-handler.rs | 2 +- cortex-m-rt/examples/divergent-exception.rs | 2 +- cortex-m-rt/examples/entry-static.rs | 2 +- cortex-m-rt/examples/main.rs | 2 +- cortex-m-rt/examples/minimal.rs | 2 +- cortex-m-rt/examples/override-exception.rs | 2 +- cortex-m-rt/examples/pre_init.rs | 2 +- cortex-m-rt/examples/rand.rs | 2 +- cortex-m-rt/examples/state.rs | 2 +- cortex-m-rt/examples/unsafe-default-handler.rs | 2 +- cortex-m-rt/examples/unsafe-entry.rs | 2 +- cortex-m-rt/examples/unsafe-exception.rs | 2 +- cortex-m-rt/examples/unsafe-hard-fault.rs | 2 +- cortex-m-rt/tests/compile-fail/default-handler-bad-signature-1.rs | 2 +- cortex-m-rt/tests/compile-fail/default-handler-bad-signature-2.rs | 2 +- cortex-m-rt/tests/compile-fail/default-handler-hidden.rs | 2 +- cortex-m-rt/tests/compile-fail/default-handler-twice.rs | 2 +- cortex-m-rt/tests/compile-fail/entry-args.rs | 2 +- cortex-m-rt/tests/compile-fail/entry-bad-signature-1.rs | 2 +- cortex-m-rt/tests/compile-fail/entry-bad-signature-2.rs | 2 +- cortex-m-rt/tests/compile-fail/entry-bad-signature-3.rs | 2 +- cortex-m-rt/tests/compile-fail/entry-hidden.rs | 2 +- cortex-m-rt/tests/compile-fail/entry-soundness.rs | 2 +- cortex-m-rt/tests/compile-fail/entry-twice.rs | 2 +- cortex-m-rt/tests/compile-fail/exception-args.rs | 2 +- cortex-m-rt/tests/compile-fail/exception-bad-signature-1.rs | 2 +- cortex-m-rt/tests/compile-fail/exception-bad-signature-2.rs | 2 +- cortex-m-rt/tests/compile-fail/exception-hidden.rs | 2 +- cortex-m-rt/tests/compile-fail/exception-soundness.rs | 2 +- cortex-m-rt/tests/compile-fail/exception-twice.rs | 2 +- cortex-m-rt/tests/compile-fail/hard-fault-bad-signature-1.rs | 2 +- cortex-m-rt/tests/compile-fail/hard-fault-hidden.rs | 2 +- cortex-m-rt/tests/compile-fail/hard-fault-twice.rs | 2 +- cortex-m-rt/tests/compile-fail/pre-init-args.rs | 2 +- cortex-m-rt/tests/compile-fail/pre-init-bad-signature-1.rs | 2 +- cortex-m-rt/tests/compile-fail/pre-init-bad-signature-2.rs | 2 +- cortex-m-rt/tests/compile-fail/pre-init-hidden.rs | 2 +- cortex-m-rt/tests/compile-fail/pre-init-twice.rs | 2 +- 42 files changed, 42 insertions(+), 43 deletions(-) (limited to 'cortex-m-rt/examples/main.rs') diff --git a/cortex-m-rt/Cargo.toml b/cortex-m-rt/Cargo.toml index 41a958d..ae72260 100644 --- a/cortex-m-rt/Cargo.toml +++ b/cortex-m-rt/Cargo.toml @@ -16,8 +16,7 @@ cortex-m-rt-macros = { path = "macros", version = "0.1.1" } [dev-dependencies] cortex-m = "0.5.4" -panic-abort = "0.3.0" -panic-semihosting = "0.4.0" +panic-halt = "0.2.0" [dev-dependencies.rand] default-features = false 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/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/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}; -- cgit v1.2.3 From 77d205c3209aa5e4ed8821374e43b6bd1657d547 Mon Sep 17 00:00:00 2001 From: chrysn Date: Thu, 24 Jan 2019 19:43:16 +0100 Subject: doc: Remove obsolete references to entry! --- cortex-m-rt/examples/main.rs | 2 +- cortex-m-rt/src/lib.rs | 27 +++++++-------------------- 2 files changed, 8 insertions(+), 21 deletions(-) (limited to 'cortex-m-rt/examples/main.rs') diff --git a/cortex-m-rt/examples/main.rs b/cortex-m-rt/examples/main.rs index b8ab66e..58e3cb4 100644 --- a/cortex-m-rt/examples/main.rs +++ b/cortex-m-rt/examples/main.rs @@ -1,4 +1,4 @@ -//! Directly plug a `main` symbol instead of using `entry!` +//! Directly plug a `main` symbol instead of using `#[entry]` #![deny(warnings)] #![no_main] diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs index 9f2a20a..1dd686f 100644 --- a/cortex-m-rt/src/lib.rs +++ b/cortex-m-rt/src/lib.rs @@ -194,11 +194,11 @@ //! One will always find the following (unmangled) symbols in `cortex-m-rt` applications: //! //! - `Reset`. This is the reset handler. The microcontroller will executed this function upon -//! booting. This function will call the user program entry point (cf. [`entry!`]) using the `main` +//! booting. This function will call the user program entry point (cf. [`#[entry]`]) using the `main` //! symbol so you may also find that symbol in your program; if you do, `main` will contain your //! application code. Some other times `main` gets inlined into `Reset` so you won't find it. //! -//! [`entry!`]: macro.entry.html +//! [`#[entry]`]: https://docs.rs/cortex-m-rt-macros/0.1.5/cortex_m_rt_macros/attr.entry.html //! //! - `DefaultHandler`. This is the default handler. If not overridden using `#[exception] fn //! DefaultHandler(..` this will be an infinite loop. @@ -245,26 +245,13 @@ //! //! ## Setting the program entry point //! -//! This section describes how `entry!` is implemented. This information is useful to developers who -//! want to provide an alternative to `entry!` that provides extra guarantees. +//! This section describes how `#[entry]` is implemented. This information is useful to developers who +//! want to provide an alternative to `#[entry]` that provides extra guarantees. //! //! The `Reset` handler will call a symbol named `main` (unmangled) *after* initializing `.bss` and -//! `.data`, and enabling the FPU (if the target is `thumbv7em-none-eabihf`). `entry!` provides this -//! symbol in its expansion: -//! -//! ``` ignore -//! entry!(path::to::main); -//! -//! // expands into -//! -//! #[export_name = "main"] -//! pub extern "C" fn __impl_main() -> ! { -//! // validate the signature of the program entry point -//! let f: fn() -> ! = path::to::main; -//! -//! f() -//! } -//! ``` +//! `.data`, and enabling the FPU (if the target is `thumbv7em-none-eabihf`). A function with the +//! `entry` attribute will be set to have the export name "`main`"; in addition, its mutable +//! statics are turned into safe mutable references (see [`#[entry]`] for details). //! //! The unmangled `main` symbol must have signature `extern "C" fn() -> !` or its invocation from //! `Reset` will result in undefined behavior. -- cgit v1.2.3