Skip to content

Commit d80eec5

Browse files
Weak aliases should only point to defined symbols.
Add an extra function as a possible solution for https://github.com/japaric/cortex-m-rtfm/issues/39
1 parent 3415d4c commit d80eec5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/generate.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ pub fn device(
3636
if *target != Target::None {
3737
items.push(quote! {
3838
#![cfg_attr(feature = "rt", feature(global_asm))]
39-
#![cfg_attr(feature = "rt", feature(linkage))]
4039
#![cfg_attr(feature = "rt", feature(macro_reexport))]
4140
#![cfg_attr(feature = "rt", feature(used))]
4241
});
@@ -235,14 +234,20 @@ pub fn interrupt(
235234
let aliases = names.iter()
236235
.map(|n| format!("
237236
.weak {0}
238-
{0} = DEFAULT_HANDLER", n))
237+
{0} = DH_TRAMPOLINE", n))
239238
.collect::<Vec<_>>()
240239
.concat();
241240

242241
let n = util::unsuffixed(u64(pos));
243242
match *target {
244243
Target::CortexM => {
245244
mod_items.push(quote! {
245+
#[cfg(feature = "rt")]
246+
global_asm!("
247+
DH_TRAMPOLINE:
248+
b DEFAULT_HANDLER
249+
");
250+
246251
#[cfg(feature = "rt")]
247252
global_asm!(#aliases);
248253

@@ -264,6 +269,12 @@ pub fn interrupt(
264269
}
265270
Target::Msp430 => {
266271
mod_items.push(quote! {
272+
#[cfg(feature = "rt")]
273+
global_asm!("
274+
DH_TRAMPOLINE:
275+
jmp DEFAULT_HANDLER
276+
");
277+
267278
#[cfg(feature = "rt")]
268279
global_asm!(#aliases);
269280

0 commit comments

Comments
 (0)