Hi. I’m developing software on nRF51822 with SoftDevice s130-v2.0.1 and SDK v12.3.
I want to apply RTX to the software. In the case of building it using arm-gcc, the software stops before reaching main(). I set macro "__START=pre_main" to asm/C compiler in order to call software_init_hook() in the pre_main() function. By using gdb remote debugger, I found that the software stops at the line of atexit after __init_fini_array() in software_init_handle() of RTX_CM_lib.h.
My environments is macOS (Sierra) and arm-none-eabi-gcc version is "gcc version 6.3.1 20170215 (release) [ARM/embedded-6-branch revision 245512] (GNU Tools for ARM Embedded Processors 6-2017-q1-update)".
I examined some other arm-none-eabi-gcc versions. I also tested the case of linking library (libRTX_CM0.a) and that of compiling the RTX related source codes. But, in any cases, the results are the same.
Here is the output of gdb when I press Ctrl-C.
0x00000000 in ?? ()
Breakpoint 1 at 0x1b1a8: file ../src/app/main.c, line 39.
Resetting target
(gdb) c
Continuing.
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
0x000261ea in HardFault_Handler ()
(gdb) backtrace
#0 0x000261ea in HardFault_Handler ()
#1 <signal handler called>
#2 0x00029dca in __register_exitproc ()
#3 0x00029c6a in atexit ()
#4 0x000266ce in software_init_hook () at ../SDK/external/rtx/include/RTX_CM_lib.h:345
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
How can I make the software start normally?