cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 - Not all initialization code generated

JDesm
Associate

After starting a new project for STM32H745ZI, i have had a lot of issues with code that is generated incompletely:

  • GPIO initialization is missing
  • FreeRTOS initialization is missing (depending on code generation settings)
  • HAL_IncTick() is sometimes not called automatically in SysTick

For example, my gpio.c file looks like this below. (Similar for CM7 and CM4 core)

The small test project I generated has defined 3 GPIO outputs on port E.

So some parts are generated, but not completely.

/**
  ******************************************************************************
  * File Name          : gpio.c
  * Description        : This file provides code for the configuration
  *                      of all used GPIO pins.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under Ultimate Liberty license
  * SLA0044, the "License"; You may not use this file except in compliance with
  * the License. You may obtain a copy of the License at:
  *                             www.st.com/SLA0044
  *
  ******************************************************************************
  */
 
/* Includes ------------------------------------------------------------------*/
#include "gpio.h"
/* USER CODE BEGIN 0 */
 
/* USER CODE END 0 */
 
/*----------------------------------------------------------------------------*/
/* Configure GPIO                                                             */
/*----------------------------------------------------------------------------*/
/* USER CODE BEGIN 1 */
 
/* USER CODE END 1 */
 
/** Configure pins as 
        * Analog 
        * Input 
        * Output
        * EVENT_OUT
        * EXTI
        * Free pins are configured automatically as Analog (this feature is enabled through 
        * the Code Generation settings)
*/
void MX_GPIO_Init(void)
{
 
  /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOH_CLK_ENABLE();
  __HAL_RCC_GPIOA_CLK_ENABLE();
  __HAL_RCC_GPIOB_CLK_ENABLE();
 
}
 
/* USER CODE BEGIN 2 */
 
/* USER CODE END 2 */
 
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Second example:

freertos.c contains no generation of tasks:

/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * File Name          : freertos.c
  * Description        : Code for freertos applications
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under Ultimate Liberty license
  * SLA0044, the "License"; You may not use this file except in compliance with
  * the License. You may obtain a copy of the License at:
  *                             www.st.com/SLA0044
  *
  ******************************************************************************
  */
/* USER CODE END Header */
 
/* Includes ------------------------------------------------------------------*/
#include "FreeRTOS.h"
#include "task.h"
#include "main.h"
 
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */     
 
/* USER CODE END Includes */
 
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
 
/* USER CODE END PTD */
 
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
 
/* USER CODE END PD */
 
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
 
/* USER CODE END PM */
 
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN Variables */
 
/* USER CODE END Variables */
 
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN FunctionPrototypes */
   
/* USER CODE END FunctionPrototypes */
 
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
 
/**
  * @brief  FreeRTOS initialization
  * @param  None
  * @retval None
  */
void MX_FREERTOS_Init(void) {
  /* USER CODE BEGIN Init */
       
  /* USER CODE END Init */
}
 
/* Private application code --------------------------------------------------*/
/* USER CODE BEGIN Application */
     
/* USER CODE END Application */
 
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

I'm pretty sure this is not something obvious I'm doing wrong. I have experience with a lot of STM32 controller generations in the past.

Things I've tried so far:

  • Reinstall CubeMX
  • Delete STM32Cube/Repository directory
  • Restarted project
  • Played with code generation settings (generate as seperate .c/.h files or not)
  • Tried a different version of STM32H7 firmware

Versions used:

CubeMX V5.3

STM32H7 V1.5

Log file and .ioc file are added in attachment.

Any help in finding what the problem is would be appreciated!

As I don't find any people with similar issues, I guess there is some kind of problem with my installation?

EDIT:

Just generated a similar test project for STM32H743 and code generation was as expected.

It seems like the issue is not related to my installation of H7.

Could it be MCU specific? (or due to the fact that the 745 is dual core?)

2 REPLIES 2
T J
Lead

I found using the latest Cube 5.3.0 , that I have to copy this folder over to the project

on H7 and F7

C:\Users\trevor\STM32Cube\Repository\STM32Cube_FW_F7_V1.15.0\Drivers\CMSIS\Device\ST\STM32F7xx\Source\Templates

to

C:\Users\trevor\STM32Cube\Repository\STM32Cube_FW_F7_V1.15.0\Projects\F722_DualR1\Drivers\CMSIS\Device\ST\STM32F7xx\Source

Thanks for your input.

I've tried this, but it made no difference.

The files that are available at this location are actually generated OK in my project.