Skip to content

Commit bab6f3e

Browse files
committed
hack to make device crates compilable on x86
the global_asm! block, which is behind the "rt" feature, contains ARM specific assembly that won't compile on x86 so we make that conditional (ARM only) and provide a different DH_TRAMPOLINE when compiling for x86
1 parent 72cc2db commit bab6f3e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/generate.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,20 @@ pub fn interrupt(
242242
match *target {
243243
Target::CortexM => {
244244
mod_items.push(quote! {
245-
#[cfg(feature = "rt")]
245+
#[cfg(all(target_arch = "arm", feature = "rt"))]
246246
global_asm!("
247247
.thumb_func
248248
DH_TRAMPOLINE:
249249
b DEFAULT_HANDLER
250250
");
251251

252+
/// Hack to compile on x86
253+
#[cfg(all(target_arch = "x86_64", feature = "rt"))]
254+
global_asm!("
255+
DH_TRAMPOLINE:
256+
jmp DEFAULT_HANDLER
257+
");
258+
252259
#[cfg(feature = "rt")]
253260
global_asm!(#aliases);
254261

0 commit comments

Comments
 (0)