Skip to content

Commit dd376a2

Browse files
committed
py/nlrthumb: Get working again on standard Thumb arch (ie not Thumb2).
"b" on Thumb might not be long enough for the jump to nlr_push_tail so it must be done indirectly.
1 parent 860eeee commit dd376a2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

py/nlrthumb.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ __attribute__((naked)) unsigned int nlr_push(nlr_buf_t *nlr) {
6767
"str lr, [r0, #8] \n" // store lr into nlr_buf
6868
#endif
6969

70+
#if defined(__ARM_ARCH_6M__)
71+
"ldr r1, nlr_push_tail_var \n"
72+
"bx r1 \n" // do the rest in C
73+
".align 2 \n"
74+
"nlr_push_tail_var: .word nlr_push_tail \n"
75+
#else
7076
"b nlr_push_tail \n" // do the rest in C
77+
#endif
7178
);
7279

7380
return 0; // needed to silence compiler warning

0 commit comments

Comments
 (0)