Code is getting executed before 'Run' in the debug mode


I am working with ARM cortex M4 on Keil MDK.

1) As soon as I start debug session, the code is getting executed before I run by pressing F5.

2) Also, the program is kind of halted at while loop(can be seen in figure) and once I give command 'DIR' in command window, I am receiving response as highlighted in the figure

can someone tells me why the program is getting executed even before I run it(F5)?. During this, the printf functions are not getting displayed in the 'Debug(printf) viewer'. Also once i stop and rerun the code, the program is getting halted at the line mentioned in the figure. can someone tell me why it is happening?

More questions in this forum