cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get TouchGFX Designer "Compile Target Command" to do headless build

 

I can build using

 

C:\ST\STM32CubeIDE_1.11.2\STM32CubeIDE\headless-build.bat -import ./.. -cleanBuild PROJECTNAME/Debug

 

or

 

C:\ST\STM32CubeIDE_1.11.2\STM32CubeIDE\headless-build.bat -import ./.. -build PROJECTNAME/Debug

 

In PowerShell or older command prompt running from the Source/TouchGFX folder in my project.

However if I copy the exact line into "Compile Target Command" in TouchGFX Designer I get the following error:

 

URI: file:/C:/source/CUSTOMER_NAME/PROJECTNAME/Source is not valid in the workspace!

 

I tried the following:

  • putting it in a batch file Build.cmd
  • Running it with cmd.exe /c "MY COMMAND"
  • running the batchfile with cmd.exe /c "Build.cmd"
  • Using the full path of the project instead of "./..".

Batch file:

 

 OFF
echo incrementally building...
SET var=%cd%
ECHO %var%

C:\ST\STM32CubeIDE_1.11.2\STM32CubeIDE\headless-build.bat -import ./.. -build PROJECTNAME/Debug

 

It does run the batch file and I had it print the current directory, which was the Source/TouchGFX folder in my project. But I get the same error.

I don't know what magic TouchGFX Designer does with the command area, but there must be a difference. Environment variables perhaps?

Can someone help me with this?

 

 

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
1 ACCEPTED SOLUTION

Accepted Solutions

Incremental build doesn't work if I use a temporary folder that I delete later. Eclipse apparently doesn't look into the build folder alone to check the build state. So for incremental build I don't bother deleting the folder or trying to get a unique folder. I've got it to work:

 

@Echo off
echo incrementally building...
set PROJECT_DIR=%cd%\..

set PROJECT_NAME=MY_PROJECT_NAME
set BUILD_TYPE=Debug

set workspace_folder=%temp%\%PROJECT_NAME%_workspace
mkdir %workspace_folder%

C:\ST\STM32CubeIDE_1.11.2\STM32CubeIDE\headless-build.bat -no-indexer -data %workspace_folder% -import %PROJECT_DIR% -build %PROJECT_NAME%/%BUILD_TYPE%

exit /b %ERRORLEVEL%

 

I did have a problem with the script sometimes freezing, but I created another topic for this and solved it there: https://community.st.com/t5/stm32cubeide-mcus/stm32cubeide-1-11-2-headless-build-freezes-for-20-seconds-after/m-p/665855#M26609

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

View solution in original post

6 REPLIES 6
GaetanGodart
ST Employee

Hello @unsigned_char_array ,

 

To build and compile from within Designer you have to use a Makefile.
Here is an example from a project I am working on :

GaetanGodart_0-1713367992432.png

A good starting point for you could be to create a new project by selecting a discovery or evaluation board with the same MCU that you are using (if there is one) and look for the Makefile in the GCC folder to get inspired (copying it completely could work but I am not sure).

 

If this answer you issue, I invite you to select this comment as "best answer".

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)
MM..1
Chief II

i use this 

 

cd c:\\ST\\STM32CubeIDE_1.?.0\\STM32CubeIDE && c: && headless-build.bat -project PROJNAMEinIDE/Debug -workspace C:\\Users\\Public\\CubeWorkspace -build -console

 

change to your paths use only one \ in designer or replace in touchgfx file in editor as here

Your command doesn't even work in the regular terminal.

 

      Error: Unknown argument: -project

 

The paths already have one \. And in the file it already has escaped the backslashes.
I use TouchGFX 4.23.2 and  STM32CubeIDE 1.11.2

depending on how I enter my paths I get one of these errors:

URI: file:/C:/source/PROJECT/Source is not valid in the workspace!

or

org.eclipse.core.runtime.CoreException: No file system is defined for scheme: C

 

 

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

Sorry i use this on old IDE version. Now syntax little diff, and i cant locate where i store new one. I dont use compile in TGFX often.

I've got it to work. Eclipse doesn't like being called from inside a project folder. I CDed to a different folder (after saving the current folder path in a variable) and then called headless build and now it works. It will create a workspace folder there. I want to avoid that and want to use a temporary folder for the workspace and delete that one. I don't want to use an existing workspace, because eclipse will complain if I have STM32CubeIDE open during build, so I'm glad it creates a new one. Now I just need to figure out how to create a temporary folder in the batch file and cleaning up afterwards. Once I got that to work I will post a solution.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

Incremental build doesn't work if I use a temporary folder that I delete later. Eclipse apparently doesn't look into the build folder alone to check the build state. So for incremental build I don't bother deleting the folder or trying to get a unique folder. I've got it to work:

 

@Echo off
echo incrementally building...
set PROJECT_DIR=%cd%\..

set PROJECT_NAME=MY_PROJECT_NAME
set BUILD_TYPE=Debug

set workspace_folder=%temp%\%PROJECT_NAME%_workspace
mkdir %workspace_folder%

C:\ST\STM32CubeIDE_1.11.2\STM32CubeIDE\headless-build.bat -no-indexer -data %workspace_folder% -import %PROJECT_DIR% -build %PROJECT_NAME%/%BUILD_TYPE%

exit /b %ERRORLEVEL%

 

I did have a problem with the script sometimes freezing, but I created another topic for this and solved it there: https://community.st.com/t5/stm32cubeide-mcus/stm32cubeide-1-11-2-headless-build-freezes-for-20-seconds-after/m-p/665855#M26609

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.