@@ -103,46 +103,51 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
103
103
104
104
let mut fields = TokenStream :: new ( ) ;
105
105
let mut exprs = TokenStream :: new ( ) ;
106
- if config. target == Target :: CortexM {
107
- out. extend ( quote ! {
108
- pub use cortex_m:: peripheral:: Peripherals as CorePeripherals ;
109
- #[ cfg( feature = "rt" ) ]
110
- pub use cortex_m_rt:: interrupt;
111
- #[ cfg( feature = "rt" ) ]
112
- pub use self :: Interrupt as interrupt;
113
- } ) ;
106
+ match config. target {
107
+ Target :: CortexM => {
108
+ if config. reexport_core_peripherals {
109
+ let fpu = fpu_present. then ( || quote ! ( FPU , ) ) ;
110
+ out. extend ( quote ! {
111
+ pub use cortex_m:: peripheral:: Peripherals as CorePeripherals ;
112
+ pub use cortex_m:: peripheral:: {
113
+ CBP , CPUID , DCB , DWT , FPB , #fpu ITM , MPU , NVIC , SCB , SYST , TPIU ,
114
+ } ;
115
+ } ) ;
116
+ }
114
117
115
- if fpu_present {
116
- out. extend ( quote ! {
117
- pub use cortex_m:: peripheral:: {
118
- CBP , CPUID , DCB , DWT , FPB , FPU , ITM , MPU , NVIC , SCB , SYST , TPIU ,
119
- } ;
120
- } ) ;
121
- } else {
122
- out. extend ( quote ! {
123
- pub use cortex_m:: peripheral:: {
124
- CBP , CPUID , DCB , DWT , FPB , ITM , MPU , NVIC , SCB , SYST , TPIU ,
125
- } ;
126
- } ) ;
118
+ if config. reexport_interrupt {
119
+ out. extend ( quote ! {
120
+ #[ cfg( feature = "rt" ) ]
121
+ pub use cortex_m_rt:: interrupt;
122
+ #[ cfg( feature = "rt" ) ]
123
+ pub use self :: Interrupt as interrupt;
124
+ } ) ;
125
+ }
127
126
}
128
- }
129
127
130
- if config. target == Target :: Msp430 {
131
- out. extend ( quote ! {
128
+ Target :: Msp430 => {
132
129
// XXX: Are there any core peripherals, really? Requires bump of msp430 crate.
133
130
// pub use msp430::peripheral::Peripherals as CorePeripherals;
134
- #[ cfg( feature = "rt" ) ]
135
- pub use msp430_rt:: interrupt;
136
- #[ cfg( feature = "rt" ) ]
137
- pub use self :: Interrupt as interrupt;
138
- } ) ;
139
- }
131
+ if config. reexport_interrupt {
132
+ out. extend ( quote ! {
133
+ #[ cfg( feature = "rt" ) ]
134
+ pub use msp430_rt:: interrupt;
135
+ #[ cfg( feature = "rt" ) ]
136
+ pub use self :: Interrupt as interrupt;
137
+ } ) ;
138
+ }
139
+ }
140
140
141
- if config. target == Target :: Mips {
142
- out. extend ( quote ! {
143
- #[ cfg( feature = "rt" ) ]
144
- pub use mips_rt:: interrupt;
145
- } ) ;
141
+ Target :: Mips => {
142
+ if config. reexport_interrupt {
143
+ out. extend ( quote ! {
144
+ #[ cfg( feature = "rt" ) ]
145
+ pub use mips_rt:: interrupt;
146
+ } ) ;
147
+ }
148
+ }
149
+
150
+ _ => { }
146
151
}
147
152
148
153
let generic_file = include_str ! ( "generic.rs" ) ;
0 commit comments