Infinite loop created by PE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Infinite loop created by PE

606 Views
jpetersen
Contributor I

Why does Processor expert generate an infinite loop in an area that is controlled by the code generation tool?

I'm using MC9S08EL32CTL.

Below is the code it generates for the main function. Near the bottom is the forever loop it creates where it says DON'T MODIFY THIS CODE!! . If I comment this out and generate the code again, it gets replaced just as before.  I don't want an infinite loop here.  Why is PE doing this? Is there a setting I need to change?

 

void main(void)
{
  /* Write your local variable definition here */

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  PE_low_level_init();
  /*** End of Processor Expert internal initialization.                    ***/

  /* Write your code here */
  /* For example: for(;:smileywink: { } */

  /*** Don't write any code pass this line, or it will be deleted during code generation. ***/
  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
  for(;:smileywink:{}
  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/

Labels (1)
Tags (1)
0 Kudos
3 Replies

396 Views
BlackNight
NXP Employee
NXP Employee

In embedded systems, it is common that you do not leave mean (main() never returns).

As such, the startup code which initializes variables/etc is performed only once, enters main and does not expect to return.

Of course this is implementation defined, and this is the case for code here.

Processor Expert just adds the for(;:smileywink: at the end to prevent that the function ever returns to the startup code.

If it would, the startup code would not be able to deal with this (unless you change the startup code).

 

BK

0 Kudos

396 Views
jpetersen
Contributor I

I buy that, but the problem is that it says not to modify the code where the infinite loop is.  Instead I'm instructed to modify code before the infinite loop, i.e. the startup code. So am I supposed to make my startup code into the main code to prevent ever getting to the generated for(;:smileywink:?

0 Kudos

396 Views
CrasyCat
Specialist III

Hello

 

According to my understanding you should add your code where ProcessorExpert onserted teh comment

 

 /* Write your code here */

 

CrasyCat

0 Kudos