There is an issue (it's not a bug because of reasons) where if you use armclang at -O0 optimisation with no parameters specified in the main function, the initialisation code contains a coded breakpoint. This will stop the code from running before main is reached.
There are multiple work arounds including:
1) Using MicroLib
2) Disabling semihosting manually:
__asm(".global __use_no_semihosting\n\t");
Note that the following funcitons will need to be retargeted:
extern "C" void _sys_exit(int ch) { } extern "C" void _sys_command_string(int ch) { } extern "C" void _ttywrch(int ch) { }
3) Use the following, which apparently is used automatically by armclang on higher optimisation levels:
__asm(".global __ARM_use_no_argv");
Apparently the coming fix "will be a better documentation about the symbol __ARM_use_no_argv and why it is needed when using -O0."
Just wanted to let people know in case it happens to them.
Thanks for sharing it!
Appreciate it!