Skip to main content
DMoim.1
Associate
July 10, 2024
Solved

STM32CubeMX 6.12.0 and FW 1.6.0 for U5 bug in MX_FLASH_Init generated code

  • July 10, 2024
  • 3 replies
  • 1846 views

Hi,

after upgrading the whole suite to last release (as 09-jul-2024), code generation breaks code in function MX_FLASH_Init (main.c file).

If without condition is generated at line 19, no indentation on following block (which closes at line 53).

/**
 * @brief FLASH Initialization Function
 * @PAram None
 * @retval None
 */
static void MX_FLASH_Init(void)
{

 /* USER CODE BEGIN FLASH_Init 0 */

 /* USER CODE END FLASH_Init 0 */

 FLASH_OBProgramInitTypeDef pOBInit = {0};

 /* USER CODE BEGIN FLASH_Init 1 */

 /* USER CODE END FLASH_Init 1 */
 HAL_FLASHEx_OBGetConfig(&pOBInit);
 if ()
 {
 if (HAL_FLASH_Unlock() != HAL_OK)
 {
 Error_Handler();
 }

 /* Option Bytes settings */

 if (HAL_FLASH_OB_Unlock() != HAL_OK)
 {
 Error_Handler();
 }
 pOBInit.OptionType = OPTIONBYTE_USER|OPTIONBYTE_BOOTADDR;
 pOBInit.USERType = OB_USER_BOR_LEV;
 pOBInit.USERConfig = OB_BOR_LEVEL_4;
 pOBInit.BootAddrConfig = OB_BOOTADDR_NS0;
 pOBInit.BootAddr = 0x08000000;
 if (HAL_FLASHEx_OBProgram(&pOBInit) != HAL_OK)
 {
 Error_Handler();
 }
 if (HAL_FLASH_OB_Lock() != HAL_OK)
 {
 Error_Handler();
 }
 if (HAL_FLASH_Lock() != HAL_OK)
 {
 Error_Handler();
 }

 /* Launch Option Bytes Loading */
 /*HAL_FLASH_OB_Launch(); */

 }
 /* USER CODE BEGIN FLASH_Init 2 */

 /* USER CODE END FLASH_Init 2 */

}

Attached the IOC file.

Best regards,

 Diego

 

Best answer by STTwo-32

Hello @DMoim.1 

This issue has been fixed on the STM32CubeMX V6.12.1 available for download here

Best Regards.

STTwo-32

3 replies

STTwo-32
Technical Moderator
July 10, 2024

Hello @DMoim.1 

I've been able Reproduce this behavior and I've reported to the concerned team for correction ASAP (under internal ticket number 186268). Thank you for reporting the issue.

Best Regards.

STTwo-32

Ghofrane GSOURI
Technical Moderator
July 12, 2024

Hello @DMoim.1 

To temporarily fix this issue , simply activate only the user Configuration (as mentioned below).

It will have the same result of an empty project.

GhofraneGSOURI_0-1720794381550.png

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
DMoim.1
DMoim.1Author
Associate
July 15, 2024

Thanks!

STTwo-32
STTwo-32Best answer
Technical Moderator
September 18, 2024

Hello @DMoim.1 

This issue has been fixed on the STM32CubeMX V6.12.1 available for download here

Best Regards.

STTwo-32