FreeRTOS+TCP based project can't build after editing the ioc file in STM32CubeIDE

Hello,
I used the STM32_Nucleo_H723ZG_FreeRTOS_TCP project as starting point to make a TCP server on the base of the NUCLEO-H743ZI2 board. I was able to compile it and run in STM32Cube IDE 1.18.1. After that I decided to try to change MCU STM32H723ZGT6 to STM32H743ZIT6 in the project files. I changed MCU in all project’s configuration files by hand, replaced *.ld and *.s files etc - so the project was working nicely after all this manual corrections.

But as the last step I decided to try to open in IDE the ioc file. It asked me to migrate to a new version of CubeMX- after that I see the MCU drawing and I can change settings. After that I close ioc file and some files in the project automatically are regenerating - I see it as the contents of e.g. main.c changing. But after that I can’t build my project anymore.
The beginning of errors looks next:

C:/Users/irek/STM32CubeIDE/workspace_1.18.0/CmdBoard/Libraries/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/STM32Hxx/NetworkInterface.c:64:6: error: #error stm32hxx_hal_eth.h is possibly not included
64 | #error stm32hxx_hal_eth.h is possibly not included
| ^~~~~
C:/Users/irek/STM32CubeIDE/workspace_1.18.0/CmdBoard/Libraries/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/STM32Hxx/NetworkInterface.c:111:8: error: unknown type name ‘ETH_HandleTypeDef’
111 | static ETH_HandleTypeDef xEthHandle;
| ^~~~~~~~~~~~~~~~~

The first error follows me into the file workspace_1.18.0\CmdBoard\Libraries\FreeRTOS-Plus-TCP\source\portable\NetworkInterface\STM32Hxx\NetworkInterface.c
which is very deep inside FreeRTOS+TCP. The code is next

#ifndef STM32Hxx_HAL_ETH_H

/*

  • The ST HAL library provides stm32h7xx_hal_eth.{c,h}.
  • This FreeRTOS+TCP driver renamed these files to stm32hxx_hal_eth.{c,h}
  • by removing the ‘7’.
  • Please make sure that “portable/NetworkInterface/STM32Hxx” is included
  • in the include paths earlier than “STM32H7xx_HAL_Driver/Inc”.
  • and also make sure that you have defined ‘HAL_ETH_MODULE_ENABLED’
  • in your copy of “stm32h7xx_hal_conf”.
    */
    #error stm32hxx_hal_eth.h is possibly not included
    #endif

The STM32Hxx_HAL_ETH_H defined in the stm32hxx_hal_eth.h which is in the same folder.
So I really do not understand why ioc file kills the link with the FreeRTOS+TCP.
Just raw idea. In ioc file I left Ethernet connection disabled (as it was in the original project). Could it be that ioc disables Network adapter in the FreeRTOS+TCP? But how? And how to correct it?
Thank you in advance!

So I found that after ioc file closing the #define HAL_ETH_MODULE_ENABLED was commented in stm32h7xx_hal_conf.h file.

I enabled this line and after that I checked all points of the next part of NetworkInterface.c file:

  • Please make sure that “portable/NetworkInterface/STM32Hxx” is included
  • in the include paths earlier than “STM32H7xx_HAL_Driver/Inc”.
  • and also make sure that you have defined ‘HAL_ETH_MODULE_ENABLED’
  • in your copy of “stm32h7xx_hal_conf”.

And as a last step I found that the file \workspace_1.18.0\CmdBoard\Drivers\STM32H7xx_HAL_Driver\Inc\stm32h7xx_hal_eth_ex.h file disappeared from my project. Magic…

So after correcting all these problems now I can build my project.

But will all these problems appear again if I use ioc file - I’ll test it tomorrow.

Did you update the version of FreeRTOS+TCP as well or just the MCU and CubeMX version?

So I found that after ioc file closing the #define HAL_ETH_MODULE_ENABLED was commented in stm32h7xx_hal_conf.h file.

This could be because the ETH module was disabled in the IOC file in the original project, and the ETH init code was manually added instead of the IOC-generated one.

I believe this has to do with the migration of the CubeMX to the newer version.

They likly can as Cube re-writes the project file - I’d suggest confirming with ST. In any case, you should use git or a diff tool to examine the changes made by CubeMX and then pick the ones you need and discard the remaining.