When starting a C++ int main(void) project in debug mode, the routine _sys_command_string gets called. Why? The main routine has no parameters. And why is there a breakpoint instruction in this routine? Using c11 and c++11.
0x08017632 B51C PUSH {r2-r4,lr} 0x08017634 4604 MOV r4,r0 0x08017636 E9CD0100 STRD r0,r1,[sp,#0] 0x0801763A 4669 MOV r1,sp 0x0801763C 2015 MOVS r0,#0x15 0x0801763E BEAB BKPT 0xAB 0x08017640 B108 CBZ r0,0x08017646 0x08017642 2000 MOVS r0,#0x00 0x08017644 BD1C POP {r2-r4,pc} 0x08017646 4620 MOV r0,r4 0x08017648 BD1C POP {r2-r4,pc} 0x0801764A B510 PUSH {r4,lr} 0x0801764C F7FFFF32 BL.W __rt_SIGRTMEM_inner (0x080174B4) 0x08017650 E8BD4010 POP {r4,lr} 0x08017654 F7FFBF09 B.W __sig_exit (0x0801746A) 88: static uint32_t EventFlagsCheck (os_event_flags_t *ef, uint32_t flags, uint32_t options) {
It's because of semihosting.
Refer below link to avoid it: http://www.keil.com/support/docs/3614.htm