cancel
Showing results for 
Search instead for 
Did you mean: 

program exit reached

1527046732
Associate II
Posted on May 18, 2015 at 09:42

Hi,all!Rencently ,I transformed my program from stm32f1 tostm32f4 using iar embedded workbench

.I met a problem

,

The debug log showed that

:program exit reached.The main function reached the end of the code but interrupt was still working.Can someone help me solve this problem?Thank you!

#stm32-iar-program-exit-reached
4 REPLIES 4
qwer.asdf
Senior
Posted on May 18, 2015 at 10:45

The main function is not supposed to reach its end, you should have a ''forever loop'' inside it. In any case, we need to see your code to help you. Or just try to simplify your program until it works then you can localize the problem.

1527046732
Associate II
Posted on May 18, 2015 at 13:15

Thank you!There is a forever loop :while(1) in main function.It jumped out of main function for some reason.I can not just put my code here bacause it consists many .c file and .h file.You are right,i should simply my program to located my problem.I don't know whether there is a mistake in my project settings considering the difference between stm32f1 and stm32f4.My project functions well on stm32f1.Thank you!

Posted on May 18, 2015 at 15:07

You can't return from main(), and you can't exit()/abort(), ponder where these go.

If you are breaking/corrupting the stack make sure it's big enough for your local/auto variable requirements.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
1527046732
Associate II
Posted on May 22, 2015 at 06:42

Thank you!The problem had been solved.The error appears when I using iar of version 7.4,but everything goes well with version 6.30.Thank you,all!