When creating a new TouchGFX project, either through the TouchGFX Designer or CubeMX, the following project files and libraries for using proprietary IDEs are available:
- Keil uVision (Target only)
- IAR Embedded Workbench (Target only)
- CubeIDE (Target only)
- Microsoft Visual Studio (Simulator only)
Note that not all project files are present in your project at the same time. The tool chain selected in CubeMX is the one that will be generated, by default CubeIDE is selected.
In addition makefiles and libraries for shell-based compilation with a GCC cross compiler for ARM targets are also provided. This article will help you configure third-party GCC-based IDEs for TouchGFX application development. Basically any IDE which is able to invoke the GCC cross compiler should be useable.
This article will describe two different approaches to getting TouchGFX to work with other IDEs. One approach is to invoke the TouchGFX Makefile from within the IDE. This is probably the easiest approach, but is not always desirable if you want to have more control over the compilation process and file locations. Alternatively you can manually add the necessary TouchGFX files and configuration options to your existing project.
This article assumes that you will use either the GCC cross compiler toolchain distributed with the TouchGFX environment shell, or alternatively your own GCC toolchain of a flavor that is able to link with the TouchGFX core library compiled using the environment shell toolchain.
The GCC compiler used:
The compiler can be obtained from https://launchpad.net/gcc-arm-embedded.
A hopefully quick-and-dirty way of compiling TouchGFX applications from within your IDE is to simply invoke the Makefile included in the projects created by the TouchGFX Designer. To use the TouchGFX environment shell to compile an application for target, you must navigate to the TouchGFX application root folder and execute the following command:
Now, instead of invoking the make command from the TouchGFX environment shell, it is also possible to invoke it from within your IDE. The executables used by the shell (make, arm-none-eabi-gcc, ..) are actually normal Windows x86 executables, so the make application can be executed by a normal command prompt, provided that the following environment variables have been configured.
After setting up the needed Windows environment variables it is now possible to invoke the
make command on the appropriate TouchGFX makefile directly from within your IDE. The exact command you need to execute is the same as when compiling from the shell, namely:
If you instead wish to have more control over the build process and file locations, you can instead integrate the relevant TouchGFX code files into your own existing project, and add the necessary include paths and compiler switches in order to make it compile.
Basically you will need to add the same TouchGFX files to your IDE project as are compiled when building with make from the TouchGFX environment shell. Exactly which files to include depend on your target board, since the low-level drivers are different for each board. In order to determine what files you need, the recommended approach is to simply try compiling the application using the TouchGFX environment shell for the appropriate board. The compilation process will mention each file being compiled, thereby giving you a list of exactly the files you need to add.
You will need to add the following include paths to your compilation (here mentioned relative to the directory where you have unpacked TouchGFX):
target/gcc/Makefilefor this information.
Like with include paths, there are some generic compiler switches which must be enabled, and also some that are specific for the processor core and concrete board. The compiler switches used to compile the TouchGFX core library are listed below, for each core. Some of these options will be mandatory for the compilation of your code as well in order for the linker to work, and some are optional. Those that are known to be mandatory are marked in bold.
-mcpu=cortex-m3 -march=armv7-m -Wno-psabi -DCORE_M3 -D__irq="" -fno-rtti -fno-exceptions -fno-strict-aliasing -fdata-sections -ffunction-sections
-fno-rtti -fno-exceptions -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -mcpu=cortex-m4 -D__irq=”“ -mthumb -mno-thumb-interwork -std=c99 -Os -fno-strict-aliasing -fdata-sections -ffunction-sections -Wno-psabi -DCORE_M4 -march=armv7e-m
-fno-rtti -fno-exceptions -mfpu=fpv5-sp-d16 -mfloat-abi=softfp -mcpu=cortex-m7 -D__irq=”“ -mthumb -mno-thumb-interwork -std=c99 -Os -fno-strict-aliasing -fdata-sections -ffunction-sections -Wno-psabi -DCORE_M7
You must link with the TouchGFX core library. Depending on your MCU, this would be either
In addition, you will need a few linker options. The following options are what TouchGFX uses:
To compile a project, assets must be generated as well. This can be done either by invoking the generated Makefile with the option 'assets':
Another way to generate assets, is to use the imageconverter and text/font-converter directly.
The imageconverter can be found in your projects touchgfx folder
touchgfx/framework/tools/imageconvert/build built for Linux and Windows.
When calling the imageconvert.out executable, it will look for a configfile (
application.config) file in the folder it is called from.
The textconverter can be found in your projects touchgfx folder
touchgfx\framework\tools\textconvert as a ruby file:
Depending on your linker settings, you will most likely get an
.hex file produced as output. It is possible to deploy and debug TouchGFX applications from within most IDEs, typically using a GDB server, or whichever other approach your IDE provides. Concrete pointers for each available IDE cannot be provided, but you might find inspiration in the Compiling & Flashing article, which explains how to flash a board with a GCC-produced ELF/HEX file.