File tree 4 files changed +26
-19
lines changed
4 files changed +26
-19
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ set -euxo pipefail
2
2
3
3
main () {
4
4
rustup target add $TARGET
5
-
6
- cargo install cargo-edit || true
7
5
}
8
6
9
7
main
Original file line number Diff line number Diff line change 17
17
18
18
local examples=(
19
19
crash
20
- # device
21
20
hello
22
- itm
23
21
override-exception-handler
24
22
panic
25
23
)
28
26
cargo build --target $TARGET --example $ex --release
29
27
done
30
28
31
- cargo add alloc-cortex-m
29
+ # ITM is not available on Cortex-M0
30
+ if [ $TARGET != thumbv6m-none-eabi ]; then
31
+ local ex=itm
32
+ cargo build --target $TARGET --example $ex
33
+ cargo build --target $TARGET --example $ex --release
32
34
33
- cargo build --target $TARGET --example allocator
34
- cargo build --target $TARGET --example allocator --release
35
+ examples+=( $ex )
35
36
36
- examples+=( allocator )
37
+ fi
38
+
39
+ # Allocator example needs an extra dependency
40
+ cat >> Cargo.toml << 'EOF '
41
+ [dependencies.alloc-cortex-m]
42
+ version = "0.3.3"
43
+ EOF
37
44
45
+ local ex=allocator
46
+ cargo build --target $TARGET --example $ex
47
+ cargo build --target $TARGET --example $ex --release
48
+
49
+ examples+=( $ex )
50
+
51
+ # Device example needs an extra dependency
38
52
if [ $TARGET = thumbv7m-none-eabi ]; then
39
53
cat >> Cargo.toml << 'EOF '
40
54
[dependencies.stm32f103xx]
41
55
features = ["rt"]
42
56
version = "0.9.0"
43
57
EOF
44
58
45
- cargo build --target $TARGET --example device
46
- cargo build --target $TARGET --example device --release
59
+ local ex=device
60
+ cargo build --target $TARGET --example $ex
61
+ cargo build --target $TARGET --example $ex --release
47
62
48
- examples+=( device )
63
+ examples+=( $ex )
49
64
fi
50
65
51
66
IFS=,; eval arm-none-eabi-size target/$TARGET /release/examples/" {${examples[*]} }"
Original file line number Diff line number Diff line change 18
18
#[ macro_use]
19
19
extern crate cortex_m;
20
20
extern crate cortex_m_rt;
21
- extern crate panic_itm ; // panicking behavior
21
+ extern crate panic_abort ; // panicking behavior
22
22
23
23
use cortex_m:: { asm, Peripherals } ;
24
24
@@ -27,9 +27,6 @@ fn main() {
27
27
let mut itm = p. ITM ;
28
28
29
29
iprintln ! ( & mut itm. stim[ 0 ] , "Hello, world!" ) ;
30
-
31
- // Also prints the panic message to the ITM
32
- panic ! ( "Oops" ) ;
33
30
}
34
31
35
32
// As we are not using interrupts, we just register a dummy catch all handler
Original file line number Diff line number Diff line change 20
20
//! #[macro_use]
21
21
//! extern crate cortex_m;
22
22
//! extern crate cortex_m_rt;
23
- //! extern crate panic_itm ; // panicking behavior
23
+ //! extern crate panic_abort ; // panicking behavior
24
24
//!
25
25
//! use cortex_m::{asm, Peripherals};
26
26
//!
29
29
//! let mut itm = p.ITM;
30
30
//!
31
31
//! iprintln!(&mut itm.stim[0], "Hello, world!");
32
- //!
33
- //! // Also prints the panic message to the ITM
34
- //! panic!("Oops");
35
32
//! }
36
33
//!
37
34
//! // As we are not using interrupts, we just register a dummy catch all handler
You can’t perform that action at this time.
0 commit comments