AnsweredAssumed Answered

SOS:Why the main function will automatically cycle three times??

Question asked by nate lee on Apr 20, 2017
Latest reply on Apr 21, 2017 by nate lee

To who may help:

    I am a beginer with stm32. Today, I have some promble with my board(stm32f407xx): the main fuction will automatically cycle three times. codes are follow:

#include "stm32f4xx.h"

int main(void)
{

   /* this function just do some init work for uart1 */

   uart_init(115200);

   /* printf already redirect to UART1 */
   printf("please....\r\n\r\n");
   return 0;
}

    the result from Serial debugging assistant:

        My friend told me I should add while(1) at the end of code. But I have write some test code without while(1) before, and it work well. It is really puzzled me. Why?Why?Why?  By the way, I use Keil MDK5 to build my code. hope someone can help me.

Outcomes