In the nRF SDK version 11 (specifically, this download) some functions are either declared or defined to be __WEAK.
I will use app_error_fault_handler(uint32_t, uint32_t, uint32_t) declared in app_error_weak.h and defined in app_error_weak.c as an example.
app_error_fault_handler is both declared and defined as __WEAK. According to the inline documentation, this is supposed to make it possible to override the weak symbol if I would like to in my main.c file.
I'm using the ARM GCC toolchain:
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 5.2.1 20151202 (release) [ARM/embedded-5-branch revision 231848]
The problem, it seems, is that declaring it __WEAK in the header file, which ultimately is included in main.c, makes the declaration in main.c weak as well, and then it is the version in app_error_weak.c that actually ends up in the finished binary.
Is this the intended behavior, or am I missing something here? It seems to me that the header file shouldn't be declaring it __WEAK.
I noticed also that in app_error_weak.h is the following:
#ifdef __CC_ARM
void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info);
#else
__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info);
#endif
So, if __CC_ARM had been defined, it would not have been declared __WEAK. Should __CC_ARM be defined in my build? I'm using the Makefile that came with the ble_app_uart example.