Skip to content

Commit 5861058

Browse files
bors[bot]japaricadamgreig
committed
Merge #88
88: v0.5.2 r=therealprof a=japaric changes required for a new release this commit also simplifies the examples by removing the exception handler overrides and adds an example that overrides the exception handlers. r? @adamgreig (chosen at random) Co-authored-by: Jorge Aparicio <[email protected]> Co-authored-by: Adam Greig <[email protected]>
2 parents 1089ef3 + be0152f commit 5861058

File tree

9 files changed

+87
-100
lines changed

9 files changed

+87
-100
lines changed

cortex-m-rt/CHANGELOG.md

+46-27
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
## [v0.5.2] - 2018-08-11
11+
12+
### Added
13+
14+
* A `pre_init!` macro and related functionality to run a function immediately
15+
after reset, before memory initialisation
16+
17+
### Changed
18+
19+
- The `entry!` and `exception!` macros now also accept a closure instead of a path.
20+
21+
- `DefaultHandler` and `UserHardFault` now default to an infinite loop if left undefined.
22+
23+
### Fixed
24+
25+
* Linked script modified to correctly detect `FLASH` overflow caused by `.data`
26+
1027
## [v0.5.1] - 2018-05-14
1128

1229
### Fixed
@@ -319,30 +336,32 @@ section size addr
319336

320337
Initial release
321338

322-
[Unreleased]: https://github.com/japaric/cortex-m-rt/compare/v0.5.0...HEAD
323-
[v0.5.0]: https://github.com/japaric/cortex-m-rt/compare/v0.4.0...v0.3.0
324-
[v0.4.0]: https://github.com/japaric/cortex-m-rt/compare/v0.3.15...v0.4.0
325-
[v0.3.15]: https://github.com/japaric/cortex-m-rt/compare/v0.3.14...v0.3.15
326-
[v0.3.14]: https://github.com/japaric/cortex-m-rt/compare/v0.3.13...v0.3.14
327-
[v0.3.13]: https://github.com/japaric/cortex-m-rt/compare/v0.3.12...v0.3.13
328-
[v0.3.12]: https://github.com/japaric/cortex-m-rt/compare/v0.3.11...v0.3.12
329-
[v0.3.11]: https://github.com/japaric/cortex-m-rt/compare/v0.3.10...v0.3.11
330-
[v0.3.10]: https://github.com/japaric/cortex-m-rt/compare/v0.3.9...v0.3.10
331-
[v0.3.9]: https://github.com/japaric/cortex-m-rt/compare/v0.3.8...v0.3.9
332-
[v0.3.8]: https://github.com/japaric/cortex-m-rt/compare/v0.3.7...v0.3.8
333-
[v0.3.7]: https://github.com/japaric/cortex-m-rt/compare/v0.3.6...v0.3.7
334-
[v0.3.6]: https://github.com/japaric/cortex-m-rt/compare/v0.3.5...v0.3.6
335-
[v0.3.5]: https://github.com/japaric/cortex-m-rt/compare/v0.3.4...v0.3.5
336-
[v0.3.4]: https://github.com/japaric/cortex-m-rt/compare/v0.3.3...v0.3.4
337-
[v0.3.3]: https://github.com/japaric/cortex-m-rt/compare/v0.3.2...v0.3.3
338-
[v0.3.2]: https://github.com/japaric/cortex-m-rt/compare/v0.3.1...v0.3.2
339-
[v0.3.1]: https://github.com/japaric/cortex-m-rt/compare/v0.3.0...v0.3.1
340-
[v0.3.0]: https://github.com/japaric/cortex-m-rt/compare/v0.2.4...v0.3.0
341-
[v0.2.4]: https://github.com/japaric/cortex-m-rt/compare/v0.2.3...v0.2.4
342-
[v0.2.3]: https://github.com/japaric/cortex-m-rt/compare/v0.2.2...v0.2.3
343-
[v0.2.2]: https://github.com/japaric/cortex-m-rt/compare/v0.2.1...v0.2.2
344-
[v0.2.1]: https://github.com/japaric/cortex-m-rt/compare/v0.2.0...v0.2.1
345-
[v0.2.0]: https://github.com/japaric/cortex-m-rt/compare/v0.1.3...v0.2.0
346-
[v0.1.3]: https://github.com/japaric/cortex-m-rt/compare/v0.1.2...v0.1.3
347-
[v0.1.2]: https://github.com/japaric/cortex-m-rt/compare/v0.1.1...v0.1.2
348-
[v0.1.1]: https://github.com/japaric/cortex-m-rt/compare/v0.1.0...v0.1.1
339+
[Unreleased]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.5.2...HEAD
340+
[v0.5.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.5.1...v0.5.2
341+
[v0.5.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.5.0...v0.5.1
342+
[v0.5.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.4.0...v0.5.0
343+
[v0.4.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.15...v0.4.0
344+
[v0.3.15]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.14...v0.3.15
345+
[v0.3.14]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.13...v0.3.14
346+
[v0.3.13]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.12...v0.3.13
347+
[v0.3.12]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.11...v0.3.12
348+
[v0.3.11]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.10...v0.3.11
349+
[v0.3.10]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.9...v0.3.10
350+
[v0.3.9]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.8...v0.3.9
351+
[v0.3.8]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.7...v0.3.8
352+
[v0.3.7]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.6...v0.3.7
353+
[v0.3.6]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.5...v0.3.6
354+
[v0.3.5]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.4...v0.3.5
355+
[v0.3.4]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.3...v0.3.4
356+
[v0.3.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.2...v0.3.3
357+
[v0.3.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.1...v0.3.2
358+
[v0.3.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.0...v0.3.1
359+
[v0.3.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.4...v0.3.0
360+
[v0.2.4]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.3...v0.2.4
361+
[v0.2.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.2...v0.2.3
362+
[v0.2.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.1...v0.2.2
363+
[v0.2.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.0...v0.2.1
364+
[v0.2.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.1.3...v0.2.0
365+
[v0.1.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.1.2...v0.1.3
366+
[v0.1.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.1.1...v0.1.2
367+
[v0.1.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.1.0...v0.1.1

cortex-m-rt/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ keywords = ["arm", "cortex-m", "runtime", "startup"]
77
license = "MIT OR Apache-2.0"
88
name = "cortex-m-rt"
99
repository = "https://github.com/japaric/cortex-m-rt"
10-
version = "0.5.1"
10+
version = "0.5.2"
1111

1212
[build-dependencies]
1313
cc = "1.0.10"
@@ -18,6 +18,7 @@ r0 = "0.2.1"
1818
[dev-dependencies]
1919
panic-semihosting = "0.3.0"
2020
panic-abort = "0.2.0"
21+
cortex-m = "0.5.4"
2122

2223
[features]
2324
device = []

cortex-m-rt/ci/script.sh

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ main() {
99
alignment
1010
minimal
1111
main
12+
override-exception
1213
pre_init
1314
state
1415
)

cortex-m-rt/examples/alignment.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
#![no_main]
55
#![no_std]
66

7-
#[macro_use(entry, exception)]
7+
#[macro_use(entry)]
88
extern crate cortex_m_rt as rt;
99
extern crate panic_abort;
1010

1111
use core::ptr;
1212

13-
use rt::ExceptionFrame;
14-
1513
entry!(main);
1614

1715
static mut BSS1: u16 = 0;
@@ -33,13 +31,3 @@ fn main() -> ! {
3331

3432
loop {}
3533
}
36-
37-
exception!(HardFault, hard_fault);
38-
39-
fn hard_fault(_ef: &ExceptionFrame) -> ! {
40-
loop {}
41-
}
42-
43-
exception!(*, default_handler);
44-
45-
fn default_handler(_irqn: i16) {}

cortex-m-rt/examples/device.rs

+1-15
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,17 @@
55
#![no_main]
66
#![no_std]
77

8-
#[macro_use(entry, exception)]
8+
#[macro_use(entry)]
99
extern crate cortex_m_rt as rt;
1010
extern crate panic_semihosting;
1111

12-
use rt::ExceptionFrame;
13-
1412
// the program entry point
1513
entry!(main);
1614

1715
fn main() -> ! {
1816
loop {}
1917
}
2018

21-
// the hard fault handler
22-
exception!(HardFault, hard_fault);
23-
24-
fn hard_fault(_ef: &ExceptionFrame) -> ! {
25-
loop {}
26-
}
27-
28-
// the default exception handler
29-
exception!(*, default_handler);
30-
31-
fn default_handler(_irqn: i16) {}
32-
3319
// interrupts portion of the vector table
3420
pub union Vector {
3521
handler: unsafe extern "C" fn(),

cortex-m-rt/examples/main.rs

-15
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,10 @@
44
#![no_main]
55
#![no_std]
66

7-
#[macro_use(exception)]
87
extern crate cortex_m_rt as rt;
98
extern crate panic_semihosting;
109

11-
use rt::ExceptionFrame;
12-
1310
#[no_mangle]
1411
pub unsafe extern "C" fn main() -> ! {
1512
loop {}
1613
}
17-
18-
// the hard fault handler
19-
exception!(HardFault, hard_fault);
20-
21-
fn hard_fault(_ef: &ExceptionFrame) -> ! {
22-
loop {}
23-
}
24-
25-
// the default exception handler
26-
exception!(*, default_handler);
27-
28-
fn default_handler(_irqn: i16) {}

cortex-m-rt/examples/minimal.rs

+1-15
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,13 @@
55
#![no_main]
66
#![no_std]
77

8-
#[macro_use(entry, exception)]
8+
#[macro_use(entry)]
99
extern crate cortex_m_rt as rt;
1010
extern crate panic_semihosting;
1111

12-
use rt::ExceptionFrame;
13-
1412
// the program entry point
1513
entry!(main);
1614

1715
fn main() -> ! {
1816
loop {}
1917
}
20-
21-
// the hard fault handler
22-
exception!(HardFault, hard_fault);
23-
24-
fn hard_fault(_ef: &ExceptionFrame) -> ! {
25-
loop {}
26-
}
27-
28-
// the default exception handler
29-
exception!(*, default_handler);
30-
31-
fn default_handler(_irqn: i16) {}
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//! How to override the hard fault exception handler and the default exception handler
2+
3+
#![deny(unsafe_code)]
4+
#![deny(warnings)]
5+
#![no_main]
6+
#![no_std]
7+
8+
extern crate cortex_m;
9+
#[macro_use(entry, exception)]
10+
extern crate cortex_m_rt as rt;
11+
extern crate panic_semihosting;
12+
13+
use cortex_m::asm;
14+
use rt::ExceptionFrame;
15+
16+
// the program entry point
17+
entry!(main);
18+
19+
fn main() -> ! {
20+
loop {}
21+
}
22+
23+
exception!(*, default_handler);
24+
25+
fn default_handler(_irqn: i16) {
26+
asm::bkpt();
27+
}
28+
29+
exception!(HardFault, hard_fault);
30+
31+
fn hard_fault(_ef: &ExceptionFrame) -> ! {
32+
asm::bkpt();
33+
34+
loop {}
35+
}

cortex-m-rt/examples/state.rs

-14
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
extern crate cortex_m_rt as rt;
1010
extern crate panic_semihosting;
1111

12-
use rt::ExceptionFrame;
13-
1412
// the program entry point
1513
entry!(main);
1614

@@ -24,15 +22,3 @@ exception!(SysTick, sys_tick, state: u32 = 0);
2422
fn sys_tick(state: &mut u32) {
2523
*state += 1;
2624
}
27-
28-
// the hard fault handler
29-
exception!(HardFault, hard_fault);
30-
31-
fn hard_fault(_ef: &ExceptionFrame) -> ! {
32-
loop {}
33-
}
34-
35-
// the default exception handler
36-
exception!(*, default_handler);
37-
38-
fn default_handler(_irqn: i16) {}

0 commit comments

Comments
 (0)