summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2021-10-01 23:16:46 +0000
committerCommit Bot <commit-bot@chromium.org>2021-10-05 16:47:49 +0000
commit228cc80d943d33fe31007736da45db8f1a0ac15d (patch)
tree5d1c098e5c79a213bee4413fedbfbc403704d0a9
parent10ae0d7296f115c9e6d4182da0b69cb0dacc6b8c (diff)
downloadchrome-ec-228cc80d943d33fe31007736da45db8f1a0ac15d.tar.gz
board/zinger: fix compiler error when building with clang
When compiling with clang, it reports the following error: board/zinger/runtime.c:271:2: error: non-ASM statement in naked function is not supported cpu_reset(); ^ board/zinger/runtime.c:258:43: note: attribute is here void exception_panic(void) __attribute__((naked)); This is a partial revert of commit 28c034e69e6610602ef592b89476ce48e7ce58e8. Instead of replacing the "b cpu_reset" with a C call to cpu_reset(), change to "bl cpu_reset", which is the same thing. The code generated by gcc for exception_panic is the same before and after this change: 00000000 <exception_panic>: 0: 4b04 ldr r3, [pc, #16] ; (14 <exception_panic+0x14>) 2: 1c18 adds r0, r3, #0 4: 466b mov r3, sp 6: 6999 ldr r1, [r3, #24] 8: 695a ldr r2, [r3, #20] a: f7ff fffe bl 0 <debug_printf> e: f7ff fffe bl 0 <exception_panic> 12: 46c0 nop ; (mov r8, r8) 14: 00000000 .word 0x00000000 BRANCH=none BUG=b:172020503, b:172343310 TEST=make CC=arm-none-eabi-clang BOARD=zinger -j TEST=make buildall -j Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I590ba4d2caabc77f04288d9f566286e87d08df02 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3198205 Reviewed-by: Eric Yilun Lin <yllin@google.com>
-rw-r--r--board/zinger/runtime.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/board/zinger/runtime.c b/board/zinger/runtime.c
index 5d17bfda04..cb27cc0f03 100644
--- a/board/zinger/runtime.c
+++ b/board/zinger/runtime.c
@@ -258,17 +258,17 @@ void system_reset(int flags)
void exception_panic(void) __attribute__((naked));
void exception_panic(void)
{
-#ifdef CONFIG_DEBUG_PRINTF
asm volatile(
+#ifdef CONFIG_DEBUG_PRINTF
"mov r0, %0\n"
/* TODO: Should this be SP_process instead of SP_main? */
"mov r3, sp\n"
"ldr r1, [r3, #6*4]\n" /* retrieve exception PC */
"ldr r2, [r3, #5*4]\n" /* retrieve exception LR */
"bl debug_printf\n"
- : : "r"("PANIC PC=%08x LR=%08x\n\n"));
#endif
- cpu_reset();
+ "bl cpu_reset\n"
+ : : "r"("PANIC PC=%08x LR=%08x\n\n"));
}
void panic_reboot(void)