1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-15 01:23:49 +01:00

cpu/cortexm_common: call hard_fault_handler using bl

Fixes this error when building with Clang 3.7.1:

fatal error: error in backend: unsupported relocation on symbol
x86_64-pc-linux-gnu-clang-3.7: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 3.7.1 (tags/RELEASE_371/final)
Target: arm-none--eabi
Thread model: posix
x86_64-pc-linux-gnu-clang-3.7: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
x86_64-pc-linux-gnu-clang-3.7: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
x86_64-pc-linux-gnu-clang-3.7: note: diagnostic msg: /tmp/vectors_cortexm-54333e.c
x86_64-pc-linux-gnu-clang-3.7: note: diagnostic msg: /tmp/vectors_cortexm-54333e.sh
x86_64-pc-linux-gnu-clang-3.7: note: diagnostic msg:

********************
This commit is contained in:
Joakim Nohlgård 2016-03-02 10:28:10 +01:00
parent efa5cd4066
commit 0ae11cc9bc

View File

@ -141,6 +141,8 @@ static inline int _stack_size_left(uint32_t required)
return ((int)((uint32_t)sp - (uint32_t)&_sstack) - required);
}
void hard_fault_handler(uint32_t* sp, uint32_t corrupted, uint32_t exc_return, uint32_t* r4_to_r11_stack);
/* Trampoline function to save stack pointer before calling hard fault handler */
__attribute__((naked)) void hard_fault_default(void)
{
@ -181,7 +183,7 @@ __attribute__((naked)) void hard_fault_default(void)
"push {r4-r11} \n" /* save r4..r11 to the stack */
#endif
"mov r3, sp \n" /* r4_to_r11_stack parameter */
"b hard_fault_handler \n" /* hard_fault_handler(r0) */
"bl hard_fault_handler \n" /* hard_fault_handler(r0) */
:
: [sram] "r" (&_sram + HARDFAULT_HANDLER_REQUIRED_STACK_SPACE),
[eram] "r" (&_eram),