Skip to content

Commit d2f7a0f

Browse files
committed
Remove bare-metal dependency from generated crates
The only dependency on `bare-metal` was the implementation of the `Nr` trait which has been removed from version 1.0.0 (rust-embedded/bare-metal#32). Closes #453 Signed-off-by: Daniel Egger <[email protected]>
1 parent 714ed98 commit d2f7a0f

File tree

6 files changed

+10
-62
lines changed

6 files changed

+10
-62
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2626
use the `msp430_rt::interrupt` attribute macro and `device.x` for interrupt
2727
support. The `INTERRUPT` array has been renamed `__INTERRUPT`.
2828

29+
- [breaking-change] Remove use of `bare_metal::Nr` trait and consecutively the
30+
use of `bare-metal`.
31+
2932
## [v0.17.0] - 2019-12-31
3033

3134
### Fixed

ci/script.sh

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ main() {
7676

7777
case $VENDOR in
7878
Atmel)
79-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
80-
echo 'version = "0.2.0"' >> $td/Cargo.toml
81-
8279
# BAD-SVD missing resetValue
8380
# test_svd AT91SAM9CN11
8481
# test_svd AT91SAM9CN12
@@ -162,9 +159,6 @@ main() {
162159
;;
163160

164161
Freescale)
165-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
166-
echo 'version = "0.2.0"' >> $td/Cargo.toml
167-
168162
# BAD-SVD bad enumeratedValue value
169163
# test_svd MKV56F20
170164
# test_svd MKV56F22
@@ -313,9 +307,6 @@ main() {
313307
;;
314308

315309
Fujitsu)
316-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
317-
echo 'version = "0.2.0"' >> $td/Cargo.toml
318-
319310
# OK
320311
test_svd MB9AF10xN
321312
test_svd MB9AF10xR
@@ -420,19 +411,13 @@ main() {
420411
;;
421412

422413
Holtek)
423-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
424-
echo 'version = "0.2.0"' >> $td/Cargo.toml
425-
426414
# OK
427415
test_svd ht32f125x
428416
test_svd ht32f175x
429417
test_svd ht32f275x
430418
;;
431419

432420
Nordic)
433-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
434-
echo 'version = "0.2.0"' >> $td/Cargo.toml
435-
436421
# BAD-SVD two enumeratedValues have the same value
437422
# test_svd nrf52
438423

@@ -441,18 +426,12 @@ main() {
441426
;;
442427

443428
Nuvoton)
444-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
445-
echo 'version = "0.2.0"' >> $td/Cargo.toml
446-
447429
# OK
448430
test_svd M051_Series
449431
test_svd NUC100_Series
450432
;;
451433

452434
NXP)
453-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
454-
echo 'version = "0.2.0"' >> $td/Cargo.toml
455-
456435
test_svd MK22F25612
457436
test_svd MKW41Z4
458437

@@ -493,9 +472,6 @@ main() {
493472

494473
# test other targets (architectures)
495474
OTHER)
496-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
497-
echo 'version = "0.1.0"' >> $td/Cargo.toml
498-
499475
echo '[dependencies.msp430]' >> $td/Cargo.toml
500476
echo 'version = "0.2.2"' >> $td/Cargo.toml
501477

@@ -505,9 +481,6 @@ main() {
505481

506482
# Community-provided RISC-V SVDs
507483
RISC-V)
508-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
509-
echo 'version = "0.2.0"' >> $td/Cargo.toml
510-
511484
echo '[dependencies.riscv]' >> $td/Cargo.toml
512485
echo 'version = "0.5.0"' >> $td/Cargo.toml
513486

@@ -520,9 +493,6 @@ main() {
520493
;;
521494

522495
SiliconLabs)
523-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
524-
echo 'version = "0.2.0"' >> $td/Cargo.toml
525-
526496
# #99 regression tests
527497
test_svd SIM3C1x4_SVD
528498
test_svd SIM3C1x6_SVD
@@ -539,9 +509,6 @@ main() {
539509
;;
540510

541511
Spansion)
542-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
543-
echo 'version = "0.2.0"' >> $td/Cargo.toml
544-
545512
# OK
546513
test_svd MB9AF12xK
547514
test_svd MB9AF12xL
@@ -637,9 +604,6 @@ main() {
637604
;;
638605

639606
STMicro)
640-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
641-
echo 'version = "0.2.0"' >> $td/Cargo.toml
642-
643607
# OK
644608
test_svd STM32F030
645609
test_svd STM32F031x
@@ -679,9 +643,6 @@ main() {
679643
;;
680644

681645
Toshiba)
682-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
683-
echo 'version = "0.2.0"' >> $td/Cargo.toml
684-
685646
# BAD-SVD resetValue is bigger than the register size
686647
# test_svd M365
687648
# test_svd M367
@@ -694,9 +655,6 @@ main() {
694655
;;
695656

696657
Espressif)
697-
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
698-
echo 'version = "0.2.0"' >> $td/Cargo.toml
699-
700658
echo '[dependencies.xtensa-lx6]' >> $td/Cargo.toml
701659
echo 'version = "0.1.0"' >> $td/Cargo.toml
702660

ci/svd2rust-regress/src/svd_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ use std::io::prelude::*;
66
use std::path::PathBuf;
77
use std::process::{Command, Output};
88

9-
static CRATES_ALL: &[&str] = &["bare-metal = \"0.2.0\"", "vcell = \"0.1.0\""];
9+
static CRATES_ALL: &[&str] = &["vcell = \"0.1.0\""];
1010
static CRATES_MSP430: &[&str] = &["msp430 = \"0.1.0\""];
1111
static CRATES_CORTEX_M: &[&str] = &["cortex-m = \"0.5.0\"", "cortex-m-rt = \"0.5.0\""];
1212
static CRATES_RISCV: &[&str] = &["riscv = \"0.4.0\"", "riscv-rt = \"0.4.0\""];
1313
static CRATES_XTENSALX6: &[&str] = &["xtensa-lx6-rt = \"0.2.0\"", "xtensa-lx6 = \"0.1.0\""];
1414
static PROFILE_ALL: &[&str] = &["[profile.dev]", "incremental = false"];
1515
static FEATURES_ALL: &[&str] = &["[features]"];
1616
static FEATURES_CORTEX_M: &[&str] =
17-
&["const-fn = [\"bare-metal/const-fn\", \"cortex-m/const-fn\"]"];
17+
&["const-fn = [\"cortex-m/const-fn\"]"];
1818
static FEATURES_EMPTY: &[&str] = &[];
1919

2020
fn path_helper(input: &[&str]) -> PathBuf {

src/generate/device.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ pub fn render(
108108
}
109109

110110
out.extend(quote! {
111-
extern crate bare_metal;
112111
extern crate vcell;
113112

114113
use core::ops::Deref;

src/generate/interrupt.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,10 @@ pub fn render(
152152
Target::None => {}
153153
}
154154

155-
let self_token = quote!(self);
156-
let (enum_repr, nr_expr) = if variants.is_empty() {
157-
(quote!(), quote!(match *#self_token {}))
155+
let enum_repr = if variants.is_empty() {
156+
quote!()
158157
} else {
159-
(quote!(#[repr(u8)]), quote!(*#self_token as u8))
158+
quote!(#[repr(u8)])
160159
};
161160

162161
let interrupt_enum = quote! {
@@ -166,13 +165,6 @@ pub fn render(
166165
pub enum Interrupt {
167166
#variants
168167
}
169-
170-
unsafe impl bare_metal::Nr for Interrupt {
171-
#[inline(always)]
172-
fn nr(&#self_token) -> u8 {
173-
#nr_expr
174-
}
175-
}
176168
};
177169

178170
if target == Target::CortexM || target == Target::Msp430 {

src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@
5353
//! ```
5454
//!
5555
//! The resulting crate must provide an opt-in "rt" feature and depend on these crates:
56-
//! `bare-metal` v0.2.x, `cortex-m` v0.5.x, `cortex-m-rt` >=v0.6.5 and `vcell` v0.1.x. Furthermore
56+
//! `cortex-m` v0.5.x, `cortex-m-rt` >=v0.6.5 and `vcell` v0.1.x. Furthermore
5757
//! the "device" feature of `cortex-m-rt` must be enabled when the "rt" feature is enabled. The
5858
//! `Cargo.toml` of the device crate will look like this:
5959
//!
6060
//! ``` toml
6161
//! [dependencies]
62-
//! bare-metal = "0.2.0"
6362
//! cortex-m = "0.5.8"
6463
//! vcell = "0.1.0"
6564
//!
@@ -106,13 +105,12 @@
106105
//! ```
107106
//!
108107
//! The resulting crate must provide an opt-in "rt" feature and depend on these crates:
109-
//! `bare-metal` v0.2.x, `msp430` v0.2.x, `msp430-rt` v0.2.x and `vcell` v0.1.x. Furthermore
108+
//! `msp430` v0.2.x, `msp430-rt` v0.2.x and `vcell` v0.1.x. Furthermore
110109
//! the "device" feature of `msp430-rt` must be enabled when the "rt" feature is enabled. The
111110
//! `Cargo.toml` of the device crate will look like this:
112111
//!
113112
//! ``` toml
114113
//! [dependencies]
115-
//! bare-metal = "0.2.0"
116114
//! msp430 = "0.2.0"
117115
//! vcell = "0.1.0"
118116
//!
@@ -131,7 +129,6 @@
131129
//!
132130
//! The resulting crate must provide an opt-in "rt" feature and depend on these crates:
133131
//!
134-
//! - [`bare-metal`](https://crates.io/crates/bare-metal) v0.2.x
135132
//! - [`vcell`](https://crates.io/crates/vcell) v0.1.x
136133
//! - [`riscv`](https://crates.io/crates/riscv) v0.4.x if target = riscv.
137134
//! - [`riscv-rt`](https://crates.io/crates/riscv-rt) v0.4.x if target = riscv.
@@ -141,7 +138,6 @@
141138
//!
142139
//! ``` toml
143140
//! [dependencies]
144-
//! bare-metal = "0.2.0"
145141
//! riscv = "0.4.0"
146142
//! vcell = "0.1.0"
147143
//!

0 commit comments

Comments
 (0)