From 6959f4f4f4b2d71d09ecee9f3c1c1846d29bd05a Mon Sep 17 00:00:00 2001 From: Tomasz Wozniak Date: Tue, 19 Sep 2017 15:21:48 +0200 Subject: [PATCH] Fix setjmp/longjmp implementation for thumb mode (i.e.: tiva, which is Cortex M3, based on armv7-m architecture). Compiles for armv7-a/r in both arm and thumb modes and for armv7-m. --- os/arch/arm/src/common/setjmp.S | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/os/arch/arm/src/common/setjmp.S b/os/arch/arm/src/common/setjmp.S index bdac7d2..3acd669 100644 --- a/os/arch/arm/src/common/setjmp.S +++ b/os/arch/arm/src/common/setjmp.S @@ -151,12 +151,19 @@ longjmp: ldr r14, [r0, #((_JB_REG_R14 - _JB_REG_R4) * 4)] #endif +#ifndef __thumb__ /* Validate sp and r14 */ teq sp, #0 it ne teqne r14, #0 it eq beq botch +#else + cmp sp, #0 + beq botch + cmp lr, #0 + beq botch +#endif /* Set return value */ movs r0, r1 -- 2.7.4