cancel
Showing results for 
Search instead for 
Did you mean: 

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

Irek
Associate III

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 manipulation.

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 I can't build my project anymore! So 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;
      |        ^~~~~~~~~~~~~~~~~
In file included from ../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_def.h:30,
                 from ../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h:27,
                 from ../Core/Inc/stm32h7xx_hal_conf.h:246,
                 from ../Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h:29,
                 from C:/Users/irek/STM32CubeIDE/workspace_1.18.0/CmdBoard/Libraries/Config/FreeRTOSIPConfig.h:43,
                 from C:/Users/irek/STM32CubeIDE/workspace_1.18.0/CmdBoard/Libraries/FreeRTOS-Plus-TCP/source/include/FreeRTOS_IP.h:35,
                 from C:/Users/irek/STM32CubeIDE/workspace_1.18.0/CmdBoard/Libraries/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/STM32Hxx/NetworkInterface.c:40:
../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h:1638:35: error: unknown type name 'ETH_TxPacketConfigTypeDef'
 1638 | #define ETH_TxPacketConfig        ETH_TxPacketConfigTypeDef   /* Transmit Packet Configuration structure definition */
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/irek/STM32CubeIDE/workspace_1.18.0/CmdBoard/Libraries/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/STM32Hxx/NetworkInterface.c:112:8: note: in expansion of macro 'ETH_TxPacketConfig'
  112 | static ETH_TxPacketConfig xTxConfig;
      |        ^~~~~~~~~~~~~~~~~~
C:/Users/irek/STM32CubeIDE/workspace_1.18.0/CmdBoard/Libraries/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/STM32Hxx/NetworkInterface.c:132:1: error: unknown type name 'ETH_DMADescTypeDef'
  132 | ETH_DMADescTypeDef DMARxDscrTab[ ETH_RX_DESC_CNT ]    __attribute__( ( section( ".ethernet_data" ), aligned( 32 ) ) );
      | ^~~~~~~~~~~~~~~~~~
C:/Users/irek/STM32CubeIDE/workspace_1.18.0/CmdBoard/Libraries/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/STM32Hxx/NetworkInterface.c:140:1: error: unknown type name 'ETH_DMADescTypeDef'
  140 | ETH_DMADescTypeDef DMATxDscrTab[ ETH_TX_DESC_CNT ]    __attribute__( ( section( ".ethernet_data" ), aligned( 32 ) ) );
      | ^~~~~~~~~~~~~~~~~~
C:/Users/irek/STM32CubeIDE/workspace_1.18.0/CmdBoard/Libraries/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/STM32Hxx/NetworkInterface.c:180:34: error: unknown type name 'ETH_HandleTypeDef'; did you mean 'EXTI_HandleTypeDef'?
  180 |     static size_t uxGetOwnCount( ETH_HandleTypeDef * heth );
      |                                  ^~~~~~~~~~~~~~~~~
      |                                  EXTI_HandleTypeDef

So it looks like that after closing ioc file IDE damage some link to FreeRTOS+TCP libraries and files.

Could you please help me to recover this problem?
Thank you in advance!

 

 

6 REPLIES 6
Pavel A.
Evangelist III

Editing of the .ioc file without (re) generating project should not affect the Eclipse project and sources. It's not obvious why this change occurred. Try to compare against your last good state in the version control or backup, and undo bad changes.

 

 


@Irek wrote:
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

 


So you're hitting that #error line.

Look in the source code to what causes that to be hit - it will probably be a #if or #ifdef that's failing ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

@Andrew Neil

Of course I've done it before - this 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 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?

@Pavel A. 

When I close the ioc file in the editor the code in the project automatically is regenerating -  I see it as the contents of main.c changing. But I could not find up to now the place where the connection to the FreeRTOS+TCP library is changing. 

Pavel A.
Evangelist III

Just idea. In ioc file I left Ethernet connection disabled (as it was in the original project). Could it be that ioc disables Network adapter

Basically yes. But enabling ETH there can bring a whole rats nest of other stuff so be careful. Using your version control or backup, compare what changed. Especially in the ...hal_conf.h file.

@Pavel A.

Thank you for pointing me to the stm32h7xx_hal_conf.h file in my case!
So I found that after ioc file closing the #define HAL_ETH_MODULE_ENABLED was commented in this 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.
Thank you for your help again!