From dd376a239dc4f47b0ee7866810fcda151f3cf6dd Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 1 Sep 2017 15:25:29 +1000 Subject: [PATCH] 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. --- py/nlrthumb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/py/nlrthumb.c b/py/nlrthumb.c index 08a71ac7d6..8ff1bb2d22 100644 --- a/py/nlrthumb.c +++ b/py/nlrthumb.c @@ -67,7 +67,14 @@ __attribute__((naked)) unsigned int nlr_push(nlr_buf_t *nlr) { "str lr, [r0, #8] \n" // store lr into nlr_buf #endif +#if defined(__ARM_ARCH_6M__) + "ldr r1, nlr_push_tail_var \n" + "bx r1 \n" // do the rest in C + ".align 2 \n" + "nlr_push_tail_var: .word nlr_push_tail \n" +#else "b nlr_push_tail \n" // do the rest in C +#endif ); return 0; // needed to silence compiler warning