@@ -23,19 +23,23 @@ pub fn device(d: &Device, items: &mut Vec<Tokens>) -> Result<()> {
23
23
) ;
24
24
items. push (
25
25
quote ! {
26
+ #![ cfg_attr( feature = "rt" , feature( asm) ) ]
27
+ #![ cfg_attr( feature = "rt" , feature( core_intrinsics) ) ]
28
+ #![ cfg_attr( feature = "rt" , feature( linkage) ) ]
29
+ #![ cfg_attr( feature = "rt" , feature( macro_reexport) ) ]
30
+ #![ cfg_attr( feature = "rt" , feature( naked_functions) ) ]
31
+ #![ cfg_attr( feature = "rt" , feature( used) ) ]
26
32
#![ doc = #doc]
27
33
#![ deny( missing_docs) ]
28
34
#![ deny( warnings) ]
29
35
#![ allow( non_camel_case_types) ]
30
- #![ feature( asm) ]
31
- #![ feature( core_intrinsics) ]
32
36
#![ feature( const_fn) ]
33
- #![ feature( linkage) ]
34
- #![ feature( naked_functions) ]
35
- #![ feature( used) ]
36
37
#![ no_std]
37
38
38
39
extern crate cortex_m;
40
+ #[ macro_reexport( default_handler, exception) ]
41
+ #[ cfg( feature = "rt" ) ]
42
+ extern crate cortex_m_rt;
39
43
extern crate vcell;
40
44
41
45
use core:: ops:: Deref ;
@@ -149,6 +153,7 @@ pub fn interrupt(peripherals: &[Peripheral], items: &mut Vec<Tokens>) {
149
153
#(
150
154
#[ allow( non_snake_case) ]
151
155
#[ allow( private_no_mangle_fns) ]
156
+ #[ cfg( feature = "rt" ) ]
152
157
#[ linkage = "weak" ]
153
158
#[ naked]
154
159
#[ no_mangle]
@@ -160,10 +165,13 @@ pub fn interrupt(peripherals: &[Peripheral], items: &mut Vec<Tokens>) {
160
165
}
161
166
) *
162
167
168
+ #[ allow( private_no_mangle_statics) ]
169
+ #[ cfg( feature = "rt" ) ]
170
+ #[ doc( hidden) ]
163
171
#[ link_section = ".vector_table.interrupts" ]
164
172
#[ no_mangle]
165
173
#[ used]
166
- static INTERRUPTS : [ Option <extern "C" fn ( ) >; #n] = [
174
+ pub static INTERRUPTS : [ Option <extern "C" fn ( ) >; #n] = [
167
175
#( #elements, ) *
168
176
] ;
169
177
@@ -181,6 +189,7 @@ pub fn interrupt(peripherals: &[Peripheral], items: &mut Vec<Tokens>) {
181
189
}
182
190
}
183
191
192
+ #[ cfg( feature = "rt" ) ]
184
193
#[ macro_export]
185
194
macro_rules! interrupt {
186
195
( $NAME : ident, $f: ident, local: {
@@ -232,7 +241,9 @@ pub fn interrupt(peripherals: &[Peripheral], items: &mut Vec<Tokens>) {
232
241
if interrupts. len ( ) > 0 {
233
242
items. push (
234
243
quote ! {
235
- /// Interrupts
244
+ pub use interrupt:: Interrupt ;
245
+
246
+ #[ doc( hidden) ]
236
247
pub mod interrupt {
237
248
#( #mod_items) *
238
249
}
0 commit comments