2025-11-04 2:01 AM - edited 2025-11-04 2:13 AM
The STM32CubeMX generated main.c has the function MX_TouchGFX_PreOSInit() called directly after the MX_xxx_Init() functions, before I can insert my External Flash Initialisation (in /* USER CODE BEGIN 2 */).
This prevents the use of the External Flash for the TextFlashSection defined by TouchGFX.
It would be better to call MX_TouchGFX_PreOSInit() immediatly before MX_xxx_Init() (in my case MX_ThreadX_Init()).
2025-11-04 2:10 AM
Hello @MHoll.2
What MCU are you using? Or could you provide your IOC in order to investigate further the issue.
BR, Souhaib
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.
2025-11-04 2:27 AM
Hi Souhaib,
I'm using the STM32H725IEK.
Attached a small example ioc file that generates
/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
  /* USER CODE BEGIN 1 */
  /* USER CODE END 1 */
  /* MPU Configuration--------------------------------------------------------*/
  MPU_Config();
  /* MCU Configuration--------------------------------------------------------*/
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
  /* USER CODE BEGIN Init */
  /* USER CODE END Init */
  /* Configure the system clock */
  SystemClock_Config();
  /* USER CODE BEGIN SysInit */
  /* USER CODE END SysInit */
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_OCTOSPI1_Init();
  /* Call PreOsInit function */
  MX_TouchGFX_PreOSInit();
  /* USER CODE BEGIN 2 */
  /* USER CODE END 2 */
  MX_ThreadX_Init();
  /* We should never get here as control is now taken by the scheduler */
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}I'm using STMCubeIDE 1.18.1, beause of this problem: https://community.st.com/t5/stm32cubeide-mcus/stm32cubeide-1-19-0-problem-migrating-octospi2-stm32h730-from-1/td-p/819983
Martin