STM32CubeIDE generates a main.c with confusing comments?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-09 7:19 AM
It is not realy a bug as the code works fine even if any comment is placed at a wrong line but comments should make life easier.
Steps done to generate a main.c with STM32CubeIDE 1.7.0:
- New STM32 project
- selected a NUCLEO-F44rRE board and chose default initialization
- on Clock Config tab for Code Generator set "Gen. peripheral init as a pair of c/h files..."
Generated code of main.c at line 90ff:
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
What I think it should look like:
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
while (1)
{
/* USER CODE BEGIN WHILE */
/* USER CODE END WHILE */
}
/* USER CODE BEGIN 3 */
/* USER CODE END 3 */
Solved! Go to Solution.
- Labels:
-
Bug-report
-
STM32CubeMX
-
STM32F4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-09 7:27 AM
That's not a bug, that's a feature. CubeMX will place sometimes generated code in the middle of the while loop, e.g. code for periodic background activities. The two user comment blocks leave you a choice placing your code before or after that generated code.
hth
KnarfB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-09 7:27 AM
That's not a bug, that's a feature. CubeMX will place sometimes generated code in the middle of the while loop, e.g. code for periodic background activities. The two user comment blocks leave you a choice placing your code before or after that generated code.
hth
KnarfB
