Skip to content

Commit

Permalink
cpu/cortexm_common: only set naked attribute on DEVELHELP hardfault h…
Browse files Browse the repository at this point in the history
…andler

Fixes error on LLVM/Clang:

   cpu/cortexm_common/vectors_cortexm.c:287:5: error: non-ASM statement in naked function is not supported
       core_panic(PANIC_HARD_FAULT, "HARD FAULT HANDLER");
       ^
   cpu/cortexm_common/include/vectors_cortexm.h:65:46: note: attribute is here
   void hard_fault_default(void) __attribute__((naked));
                                                ^
   1 error generated.
  • Loading branch information
Joakim Nohlgård committed Oct 28, 2015
1 parent 7490dc2 commit a5449bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cpu/cortexm_common/include/vectors_cortexm.h
Expand Up @@ -62,7 +62,7 @@ void nmi_default(void);
* causes of hard faults are access to un-aligned pointers on Cortex-M0 CPUs
* and calls of function pointers that are set to NULL.
*/
void hard_fault_default(void) __attribute__((naked));
void hard_fault_default(void);

/* The following four exceptions are only present for Cortex-M3 and -M4 CPUs */
#if defined(CPU_ARCH_CORTEX_M3) || defined(CPU_ARCH_CORTEX_M4) || \
Expand Down
2 changes: 1 addition & 1 deletion cpu/cortexm_common/vectors_cortexm.c
Expand Up @@ -134,7 +134,7 @@ static inline int _stack_size_left(uint32_t required)
}

/* Trampoline function to save stack pointer before calling hard fault handler */
void hard_fault_default(void)
__attribute__((naked)) void hard_fault_default(void)
{
/* Get stack pointer where exception stack frame lies */
__ASM volatile
Expand Down

0 comments on commit a5449bc

Please sign in to comment.