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-06-19 07:32 AM
Hello @nico23 ,
You can debug the simulator using Visual Studio if you have it.
Regards,
2024-06-19 07:51 AM - edited 2024-06-19 07:51 AM
yeah, I've tried that but, I would prefer to use VS Code because its multi platform support (can't use VS on Mac)
2024-06-20 01:50 AM
Hello @nico23 ,
Did you include #include <stdlib.h> in your OSWrapper.hpp/cpp?
Regards,
2024-06-20 01:55 AM - edited 2024-06-20 02:07 AM
Sorry for the delay, this is the launch.json file I use in VS Code:
{
"configurations": [
{
"name": "Debug Simulator",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/TouchGFX/build/bin/simulator.exe",
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:/TouchGFX/4.23.0/env/MinGW/bin/gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "BuildSimulator"
}
],
"version": "2.0.0"
}
The pre-launch-task is optional and can be removed. In my case it is a task to build the Simulator executable, which you can also do manually in the TouchGFX Designer.
2024-06-20 01:58 AM - edited 2024-06-20 03:38 AM
Amazing, thanks a lot. I'll try it right away
Could you let me know the configuration for the preLaunchTask as well as, I would like to have everything concerning the simulatore on VS Code?
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-07-01 01:36 AM
Wonderful, everything works. Thank's a lot!