I am using a RIVERDI screen with an embedded STM32 microcontroller (STM32H7). I am generating the code through touchgfx framework and after that I am opening stm32cubeide, in order to make some changes to the program that has been generated from TouchGfx. The first thing I did is enabling the LwIP from STM32CubeMX and setting up a static IP address. The reason I am doing that is because I need to add an external PHY(LAN8720) to my board in order to establish ethernet connection. After that changes and ensuring that compiling in STM32CubeIDE is ok without any errors, when I am trying to flash the code to the screen I am getting an error which is saying that it cannot find the lwip/opt.h library.
I did a research on that and I realize that it contains a makefile_cm7, which I need to add some code in order to see it in compiling and not having this error code. Although, I cannot find a way how to do that. Could anyone help me add the header files that are in the folder location: "Middlewares/Third_Party/LwIP/src/Include/lwip".
This is my folder structure: enter image description here
and this is also my makefile which I need to add the path:
I have try to add some code based on something similar but I couldn't managed to overcome this obstacle. For example I have added those lines here:
# keep framework include and source out of this mess! :) include_paths := $(library_includes) \ $(foreach comp, $(all_components), $(comp)/include) \ $(foreach comp, $(touchgfx_generator_components), $(comp)/generated) \ $(framework_includes) \ $(cubemx_middlewares_path) \ $(application_path)/Utilities/JPEG \ $(application_path)/CM7/FATFS/App \ $(application_path)/CM7/FATFS/Target \ $(application_path)/CM7/USB_HOST/App \ $(application_path)/CM7/USB_HOST/Target \ $(application_path)/CM7/LIBJPEG/App \ $(application_path)/CM7/LIBJPEG/Target \ $(application_path)/CM7/LWIP/App \ $(application_path)/CM7/LWIP/Target \ $(application_path)/Middlewares/Third_Party/LwIP/src/include/lwip \ #HERE $(application_path)/Middlewares/Third_Party/LwIP/src/include/compat \ #HERE $(application_path)/Middlewares/Third_Party/LwIP/src/include/netif \ #HERE $(application_path)/CM7/TouchGFX/generated/videos/include \ $(touchgfx_middlewares_path) \ $(LwIP_path) \ $(touchgfx_generator_components)
But I am getting the same error message:
c:/TouchGFXProjects/charxConnection/CM7/LWIP/App/lwip.h:29:10: fatal error: lwip/opt.h: No such file or directory #include "lwip/opt.h" ^~~~~~~~~~~~ compilation terminated. gcc/makefile_cm7:515: recipe for target 'CM7/TouchGFX/build/Riverdi_70STM32H7/CM7/Core/Src/main.o' failed make: *** [CM7/TouchGFX/build/Riverdi_70STM32H7/CM7/Core/Src/main.o] Error 1 make: Leaving directory 'c:/TouchGFXProjects/charxConnection' gcc/makefile_cm7:434: recipe for target 'generate_assets' failed make: Leaving directory 'c:/TouchGFXProjects/charxConnection' make: *** [generate_assets] Error 2 Makefile_cm7:55: recipe for target 'all' failed make: Leaving directory 'C:/TouchGFXProjects/charxConnection/gcc' make: *** [all] Error 2 make: *** [flash] Error 2 ../../gcc/Makefile:10: recipe for target 'flash' failed Failed Failed
I need to mention that in STM32CubeIDE I dont have error message, It is compiling without errors and warnings. Furthermore, I had tried to flash the program through STM32CubeIDE, it flashes the code correctly but I it turned a black screen instead of the proper UI.
I am using: i) TouchGFX Designer 4.22.0 ii) STM32CubeIDE 1.13.1
Could anyone help me with that? Thank you in advance!
After a lot of hard study and analyzing the makefile of touchgfx I managed to add the libraries and it compiles the program successfully.
The first think I did was getting the file path that the LwIP library was into the variable lwip_os_path.
I added the generated folder from CubeMX that its location is at the application path of the project, into the inluce_paths from the makefile like this:
Further more I put all the .c files that the LwIP folder has into the board_c_files += \ area with the proper path to the destination file.
and also I placed the .h paths into the os_include_paths += .
The final step was to copy and paste the include/lwip-app-netif folders that contains all the .h files from lwip into the src folder of the application in the cubeIDE. I opened after the file location from the IDE, made a cut into those three folders and placed them into the CM7/Core/inc folder.
After that I compile the code that has been generated from CubeMX successfully, via the touchgfx.