18.2.11 Call the Main Function
The program's main()
function is called after all the
other startup steps.
Should the main()
function return, its return value is unused and control
will pass to the startup's Reset_Handler()
function. This function will
call _on_exit()
if it has been provided by the application using the
prototype void __attribute__((weak,long_call)) _on_exit(void);
.
Alternatively, Reset_Handler()
will execute an infinite loop. On devices
that support the Thumb-2 instruction set, the preprocessor macro __DEBUG
can be defined when building the startup code to insert a software breakpoint instruction
(BKPT
) immediately before the infinite loop is entered.