Skip to main content
MQi.1
Senior II
January 20, 2021
Solved

Should these be these?

  • January 20, 2021
  • 4 replies
  • 922 views

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 */
}

This topic has been closed for replies.
Best answer by Piranha

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

4 replies

KnarfB
Super User
January 20, 2021

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
MQi.1Author
Senior II
January 20, 2021

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

KnarfB
Super User
January 20, 2021

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.

Piranha
PiranhaBest answer
Principal III
January 20, 2021

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