diff --git a/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S b/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S index 42bf683f32..4b83d08814 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S +++ b/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S @@ -163,6 +163,9 @@ .thumb_func .global _crt0_entry _crt0_entry: + ldr R0, =__entry_hook + blx R0 + /* Interrupts are globally masked initially.*/ cpsid i diff --git a/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S b/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S index 4abe00a999..860b59272a 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S +++ b/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S @@ -201,6 +201,9 @@ .thumb_func .global _crt0_entry _crt0_entry: + ldr R0, =__entry_hook + blx R0 + /* Interrupts are globally masked initially.*/ cpsid i diff --git a/os/common/startup/ARMCMx/compilers/GCC/crt1.c b/os/common/startup/ARMCMx/compilers/GCC/crt1.c index ae15b3216e..9a2d03e168 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/crt1.c +++ b/os/common/startup/ARMCMx/compilers/GCC/crt1.c @@ -147,6 +147,20 @@ void __cpu_init(void) { } /** + * @brief called immediately at Reset + * @details This hook is invoked immediately after the Reset Handler + * + * @note This function is a weak symbol. + */ +#if !defined(__DOXYGEN__) +__attribute__((weak)) +#endif +/*lint -save -e9075 [8.4] All symbols are invoked from asm context.*/ +#ifndef __ARDUPILOT__ +void __entry_hook(void) {} +#endif + +/** * @brief Early initialization. * @details This hook is invoked immediately after the stack and core * initialization and before the DATA and BSS segments