To run the project in Eclipse:
Run cmake to create build directory. Create inside build sys folder and copy all assets to it (e.g path for font: sys/assets/fonts/gt_pressura_regular_16.mpf). A faster way to do this is to run ./rebuild script command in the main directory.
Open project properties and in tab C/C++ Build->Builder Settings set build directory to: ${workspace_loc:/PurePhone}/build
Create debug configuration (right click on project and select Debug as: local c/c++ application)
Open new debug configuration and in Arguments tab set Working directory to ${workspace_loc:PurePhone/build}
In Debugger tab set GDB command file to ${project_loc}/.gdbinit
Build, Execution, Deployment -> ToolchainSystem type
Name: Linux
which cmakegdb/usr/bin/gdbName: RT1051
which cmakegdb~/gcc-arm-eabi…Build, Execution, Deployment -> CMake-DCMAKE_EXPORT_COMPILE_COMMANDS=True
-DCMAKE_TOOLCHAIN_FILE=../Target_Linux.cmake
-DCMAKE_EXPORT_COMPILE_COMMANDS=1
build-linux-j8Note: you can set Generation path to build if you don't plan to configure CLion for RT1051.
-DCMAKE_EXPORT_COMPILE_COMMANDS=True
-DCMAKE_TOOLCHAIN_FILE=../Target_RT1051.cmake
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 ../
build-rt1051-j8Important
Before 1st run, execute Build All in 'Linux' to generate the service_renderer utility.
Go to Edit Configurations… (double shift) and select CMakeApplication -> PurePhone. This is your configuration for Linux executable.
In Working directory append /build.
Now you can run/debug this configuration.
Use file .idea/JLink_server.xml to setup IDE. It's already in the project folder, so CLion should pick it up automatically.
You'll also need .gdbinit-1051-clion file modified for CLion (source).
This file needs to be present in $HOME/.gdbinit.
Try this command to input it there ln -s %project_root%/.gdbinit-1051-clion ~/.gdbinit.
In the debuging configuration dropdown select a pair of and ([ <exec> | <toolchn> ]):
Note: RT1051 doesn't have run configuration. Only debug is available.

It's possible to see logs from a RT1051 booted from eMMC and not from RAM.
To do so select JLink server (no upload) configuration.
Open JLinkRTTClient in a separate terminal.
Note: remember to stop this debug session when you want to switch to regular JLink server (with upload), otherwise they will collide.
To properly debug a running target you need to reset it first. Attaching to an already running target won't work.
To build separately for each architecture you need to:
Build, Execution, Deployment -> CMakeLinuxEnvironment: PROJECT_BUILD_DIRECTORY=build-linuxGeneration Path to: build-linuxand
Build, Execution, Deployment -> CMakert1051Environment: PROJECT_BUILD_DIRECTORY=build-rt1051Generation Path to: build-rt1051After the above steps:
Working directory for Linux configuration. (Edit configurations… -> PurePhone)Working directory from …/PurePhone/build to …PurePhone/build-linuxQtCreator version 3.5 or laterCMake version 3.19.5 or laterNinja as it will radically decrease rebuild times.CMake is setup in QtCreatorGo to File -> Open File or Project... and select the CMakeLists.txt project file.
After selecting the kits you wish to use select the Projects button on the left bar.
Ensure PureOS is the active project.
Select Build under the name of the kit you wish to configure.
At the top of the Build Settings page, select the build configuration you want to modify.
In the Initial CMake parameters: field, append one of the following:
For Linux Target:
-DCMAKE_TOOLCHAIN_FILE:STRING=Target_Linux.cmake
-DPRODUCT:STRING=PurePhone
For RT1051 Target:
-DCMAKE_TOOLCHAIN_FILE:STRING=Target_RT1051.cmake
-DPRODUCT:STRING=PurePhone
Build project normally.
If you want to prevent git from suggesting you to commit changes to the configuration files where we place local paths and other data, please cast following spell: git update-index --skip-worktree env.cmake
This will tell git to ignore local changes to the file. In above example we are preventing commiting changes to file called env.cmake where you probably want to place local path to Arm's toolchain.
By default both targets (Linux & RT1051) are build into the same destination (the build folder).
With this configuration you have to run ./rebuild.sh every time you want to change target. Also you can't debug simultaneously Linux and RT1051.
There is an option for both targets to have separate build folders.
To enable it, set the environmental variable SEPARATE_BUILDS to any value (e.g. =1) inside ./rebuild.sh.
Examples:
env SEPARATE_BUILDS=1 ./rebuild.sh rt1051 will cause RT1051 to be build into a separate build-rt1051 folder.
By default ./rebuild.sh rt1051 builds into build
You can build only the Linux build inside its separate folder, and leave RT1051 in place, thus maintain compatibility with ./run.sh.
> env SEPARATE_BUILDS=1 ./rebuild.sh linux
> cd build-linux; ./PurePhone.elf
> cd ..
> ./rebuild.sh rt1051 # will be built to the default `build` folder
> StartJLinkServer.sh &
> ./run.sh
Guide for CLion has a dedicated section entitled "Separate build folders in CLion".
By default ./rebuild.sh copies assets and generates CMakes to generic build.
SEPARATE_BUILDS=1 overrides it.
Then comes CMake. CMake uses persistent (CACHED) variable PROJECT_BUILD_DIRECTORY to build every module.
You can set it either in cmake-gui or by passing environmental variable to cmake.
This works like a toggle. You don't have to specify it every time. The new build path gets embedded into every CMakeCache.txt, so any following make command doesn't require any extra arguments.