- cd /bin
- mv make.exe make-3.81.exe
- cp make-4.1.exe make.exe
The command "make -v" should now print a text containing "GNU Make 4.1".
If you based your project Makefile on a TouchGFX makefile from TouchGFX 4.3.0 or later, your Makefile should work with make version 3.81 as well as make version 4.1. If you based your Makefile on an earlier version of TouchGFX, you need to update it by going through the appropriate Makefile in the latest release of TouchGFX and applying the changes to your own Makefile.
With the new make version 4.1 in place, you can start parallel build simply by adding "-j N" where N is the number of simultaneous compilations to invoke. Setting N to the number of cores on your PC is a good number. On a Windows system you can find the number of cores by starting the Task Manager and on the "Performance" tab look for "Logical processors".
Now you can start a quick compilation by writing:
- make -f simulator/gcc/Makefile -j8 clean all
- no "-j N": 180 seconds
- "-j2": 94 seconds
- "-j4": 63 seconds
- "-j8": 60 seconds
So there is a significant gain, especially on larger projects, from switching to make version 4.1 and compiling in parallel.
- documentation of the final application
- check screen layout
- compare with screenshots during development
In order to put a skin on the simulator, you must be sure that you are using TouchGFX 4.7.0 or later, and that your project has been upgraded to use SDL2. If you created your project from one of the examples or demos that comes with TouchGFX 4.7.0, your application is already using SDL2. Otherwise you need to migrate your application, see Migrating from SDL to SDL2.
Start by creating the images that you want your simulator to run “inside”. Make sure that you have a rectangular area the size of the frame buffer in the image. If your application can switch between portrait mode and landscape mode, two skins are required in order to have skins in both orientations. Make sure that you save the images in .png format, and place the files in the simulator folder under the names portrait.png and landscape.png.
To apply the skins to your simulator, insert the following lines in your
static_cast<HALSDL2&>(hal).loadSkin(touchgfx::ORIENTATION_LANDSCAPE, 20, 44); static_cast<HALSDL2&>(hal).loadSkin(touchgfx::ORIENTATION_PORTRAIT, 24, 41);
It is important that the lines are inserted after the call to
sdl_init() and before the call to
Simply pass the orientation and the coordinates of the upper left corner where the frame buffer should be drawn. the
- A window with a skin does not have a title bar which will allow the window to be dragged on the screen. Instead use the right mouse button anywhere inside the window to drag the simulator on the screen.
- You can still use F2 to make the invalidated areas of the frame buffer flash briefly every time the screen is redrawn. You can also press F4 to disable the skin. Press F4 again to re-enable the skin.
- If you do not have a skin on your application, the border of the application is enabled/disabled when F4 is pressed.
If you want your window to have a special non-rectangular shape, just make areas in the .png files transparent. The display_orientation_example shows an example of how this can be done.
Note that SDL2 does not support semi-transparent areas, so any pixel with any amount of transparency is completely transparent.
Also note, that shaped windows do not appear to work for Linux, but this is under investigation.
Printing using printf() and std::cout
As of TouchGFX version 4.8.0, simulator programs on the Windows platform are no longer console applications but windows applications. This means that it is not possible to write debug output using printf() or std::cout (nor is it possible to read text input using fgets or std::cin).
To solve this, simply use the function touchgfx_printf() which has the same syntax as printf() with a few benefits. This function is available by including Utils.h
- It automatically creates a console window and the prints the output. The console window is not opened until the first touchgfx_printf() is encountered.
- When compiling the application for a target, touchgfx_printf() does nothing, and thus it does not have to be inside #ifdef SIMULATOR / #endif tags. Also, #include <stdio.h> can be removed.
If you already have an application that uses printf() or std::cout in several places, it is possible to create a console window from main.cpp by simply calling touchgfx_enable_stdio(). This function is also completely removed from target code.
Please note that unlinke printf(), touchgfx_printf() does not return the number of characters written.