cancel
Showing results for 
Search instead for 
Did you mean: 

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

DMoim.1
Associate II

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

Hello @DMoim.1 

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

Best Regards.

STTwo-32

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.

View solution in original post

4 REPLIES 4
STTwo-32
ST Employee

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

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.

Ghofrane GSOURI
ST Employee

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

Thanks!

STTwo-32
ST Employee

Hello @DMoim.1 

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

Best Regards.

STTwo-32

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.