From f53e12d2da3f9730dd842bdf7d1e680cb5877a15 Mon Sep 17 00:00:00 2001 From: keepkeyjon Date: Wed, 7 Mar 2018 07:53:11 -0700 Subject: [PATCH] cm3: Only inline asm is allowed in naked functions According to: https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/ARM-Function-Attributes.html "Only basic asm statements can safely be included in naked functions (see Basic Asm). While using extended asm or a mixture of basic asm and C code may appear to work, they cannot be depended upon to work reliably and are not supported." --- include/libopencm3/cm3/scb.h | 4 ++-- lib/cm3/vector.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/libopencm3/cm3/scb.h b/include/libopencm3/cm3/scb.h index 416ff963..8c2465da 100644 --- a/include/libopencm3/cm3/scb.h +++ b/include/libopencm3/cm3/scb.h @@ -437,11 +437,11 @@ struct scb_exception_stack_frame { : [frameptr]"=r" (f)); \ } while (0) -void scb_reset_system(void) __attribute__((noreturn, naked)); +void scb_reset_system(void) __attribute__((noreturn)); /* Those defined only on ARMv7 and above */ #if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) -void scb_reset_core(void) __attribute__((noreturn, naked)); +void scb_reset_core(void) __attribute__((noreturn)); void scb_set_priority_grouping(uint32_t prigroup); #endif diff --git a/lib/cm3/vector.c b/lib/cm3/vector.c index 97217787..af92ed72 100644 --- a/lib/cm3/vector.c +++ b/lib/cm3/vector.c @@ -59,7 +59,7 @@ vector_table_t vector_table = { } }; -void __attribute__ ((weak, naked)) reset_handler(void) +void __attribute__ ((weak)) reset_handler(void) { volatile unsigned *src, *dest; funcp_t *fp;