cancel
Showing results for 
Search instead for 
Did you mean: 

Should these be these?

MQi.1
Senior II

I found these prompt in my "main.c" of NonSecure generated by MX for NUCLEO L552ZE-Q:

  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

should it be this?

  /* USER CODE BEGIN WHILE */
  while (1)
  {
/* USER CODE BEGIN 3 */
 
  /* USER CODE END 3 */
  }
    /* USER CODE END WHILE */
}

1 ACCEPTED SOLUTION

Accepted Solutions

Except, if break is used. Or even goto... :)

View solution in original post

4 REPLIES 4
KnarfB
Principal III

No. These are 2 user code blocks around the beginning and ending of the loop. Some additional software packs may generate code inbetween those (near line 5), do not use it for user code.

MQi.1
Senior II

So, if one need insert code behind while(), where should it be pasted?

KnarfB
Principal III

You can add user code by inserting new lines between 1 and 2 (before while), 3 and 4 (inside while), 6 and 7 (inside while), or 7 and 8 (after while) as you like.

Code behind while(1) {...} is unreachable however.

Except, if break is used. Or even goto... :)