Building a TouchGFX UI often involves a lot of tweeking of the graphics details to match the specification of the UI.
To speed up the development process it is important to have a fast turnaround time when trying out and debugging your application. Flashing a board can often take quite some time so doing this each time you have made a small change to your application will really slow down the development. To alleviate this, the TouchGFX PC simulator is a great addition to your development tools.
You simply compile your application for your PC and run the application there. The code executed is exactly the same as on target hardware except for the Board Bring Up code and Abstraction Layer which are made for the PC instead of your board. This means that you can test things like placement of widgets, interactions, animations, state machines and so on just as precise as on target hardware. You can even debug your code using IDEs like Visual Studio if you like. Of course things like performance analysis and interactions with real backend systems must be done on your board.
How To Run
Using TouchGFX Designer
To launch the simulator from within TouchGFX Designer, simply press the "Run Simulator" button in the top right corner or press
F5 on your keyboard.
Using TouchGFX Environment
To launch the simulator using the TouchGFX environment, follow these steps:
- Open the TouchGFX Environment
- Navigate to the location of your TouchGFX application
- Run the command
make -f simulator/gcc/Makefile -j6to compile the simulator
- Run the command
./build/bin/simulator.exeto launch the simulator
Run steps 3 and 4 whenever you have made a change to your TouchGFX application.
Apart from capturing mouse input, the TouchGFX simulator also includes other useful features, listed below:
|Enables/disables debug info.|
|Enables/disables highlighting invalidated area.|
|Takes a screenshot and places the image under the |
|Takes screenshots of the next 50 frames and places the images under the |
|Takes a screenshot and places it in your clipboard.|
|If a simulator skin is used - enables/disables the simulator skin.|
If a simulator skin is not used - enables/disables window border.
|Pauses the simulator by preventing ticks to be sent to the application. Pressing F9 again will resume normal execution.|
|While the simulator is paused (after pressing F9) it is possible to send a single tick to the application by pressing F10 thereby "single step" the application.|
|Close the simulator.|
Simulator Only User Code
If you have some code that should only run when using TouchGFX simulator, you can use
#IFDEF Simulator in your C++ code:
If you want to output a debug text to the console you can use the
touchgfx_printf function. This is a printf like function that will only be included when building simulator code and thus will not interfere when running on target hardware. Therefore there is no need to use
#IFDEF Simulator in this case.