2024-05-27 06:11 AM
I'm trying to build myself a TouchGFX project
The project runs and builds correctly via TouchGFX Designer but I'm unable to compile it with VSCode (cmake, ninja gcc)
[build] C:/TouchGFXProjects/Circle_UI/Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/sdl2/OSWrappers.cpp: In static member function 'static void touchgfx::OSWrappers::initialize()':
[build] C:/TouchGFXProjects/Circle_UI/Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/sdl2/OSWrappers.cpp:24:24: error: 'atexit' was not declared in this scope
[build] atexit(deinitialize);
[build] ^
[build] [174/177] Building CXX object CMakeFiles/TouchGFX.dir/C_/TouchGFXProjects/Circle_UI/Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/sdl2/HALSDL2_icon.cpp.obj
[build] [175/177] Building CXX object CMakeFiles/TouchGFX.dir/C_/TouchGFXProjects/Circle_UI/Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/sdl2/HALSDL2.cpp.obj
[build] C:/TouchGFXProjects/Circle_UI/Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/sdl2/HALSDL2.cpp: In member function 'virtual bool touchgfx::HALSDL2::sdl_init(int, char**)':
[build] C:/TouchGFXProjects/Circle_UI/Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/sdl2/HALSDL2.cpp:314:21: warning: unused variable 'transfer_thread' [-Wunused-variable]
[build] SDL_Thread* transfer_thread = SDL_CreateThread(transferThreadFunc, "FB TransferThread", (void*)NULL);
[build] ^~~~~~~~~~~~~~~
[build] [176/177] Building CXX object CMakeFiles/TouchGFX.dir/simulator/main.cpp.obj
[build] ninja: build stopped: subcommand failed.
versions are:
Solved! Go to Solution.
2024-07-01 01:06 AM
Sure, its just two steps:
This should be in the tasks.json:
{
"type": "shell",
"label": "BuildSimulator",
"command": "mingw32-make",
"args": [
"-f",
"simulator\\gcc\\Makefile",
"-j8"
],
"options": {
"cwd": "${workspaceFolder}\\TouchGFX",
"env": {
"PATH": "C:/TouchGFX/4.23.0/env/MinGW/bin;C:/TouchGFX/4.23.0/env/MinGW/msys/1.0/Ruby30-x64/bin;C:/TouchGFX/4.23.0/env/MinGW/msys/1.0/bin;C:/TouchGFX/4.23.0/env/MinGW/msys/1.0/gnu-arm-gcc/bin"
}
},
"problemMatcher": "$gcc",
}
2024-05-28 12:05 AM
In my setup I only build for the target using CMake. When I want to run / debug the stimulator I just use the Makefile that is generated by the Designer (simulator/gcc/Makefile). Maybe you can also check the differences between the Makefile and your CMakeLists.txt.
2024-05-28 01:45 AM
Could you please go a bit more in deep on how you do the run / debug of the simulator with the Makefile?
2024-05-28 08:50 AM - edited 2024-05-29 12:41 AM
Hello @nico23 ,
I cannot help you with that, but @Aquamarine is also trying to compile TouchGFX projects on VSCode.
Regards,
2024-05-28 09:54 AM
Thanks, I'll look into it
I was following this tutorial/project built by one of your employees but it seems outdated and it generates exactly my error
https://github.com/MaJerle/touchgfx-cmake-vscode-stm32-simulator
2024-05-29 12:43 AM
Yes this project seems to be 2 years old, things have changed since then.
I think it can still be a good starting point but it is only for simulator.
2024-05-29 05:10 AM
I'm trying to build TouchGFX with STM32 using VS Code and is able to archive build pass using https://github.com/MaJerle/touchgfx-cmake-vscode-stm32-simulator , However, I never tried building standalone TouchGFX project nor simulator.
I encountered similar problem during my set up, in this case, I would try to search the definition of atexit and check if it's corresponding source file was there or was in the build list.
This is my post if you think it might be useful: https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/how-to-set-up-touchgfx-for-stm32cubemx-generated-cmake-project/td-p/678889
2024-05-29 02:19 PM
Thanks!
Yes, my goal was to build and debug the simulator via VSCode.
@Aquamarine wrote:I encountered similar problem during my set up, in this case, I would try to search the definition of atexit and check if it's corresponding source file was there or was in the build list.
I'll try to have a look at the MakeList file, maybe is missing something
2024-05-29 10:49 PM
The atexit method is not part of the TouchGFX project, but a system include which should be part of your compiler.
Will share my non-CMake approach later here, when I have some time.
2024-06-19 02:51 AM
Could you please share it? Thanks
Still figuring it out