[RESOLVED] Access to STM32CubeIDE env vars when building from the command line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-08-15 9:25 AM
I have a script in my project that generates code prior to a build that works great. However, I'm trying to set up command line builds and I'm getting an error when I build from the command line:
Contains: Variable references empty selection: ${project_loc}
I tried to set this variable in the shell prior to building but no luck.
I can probably work around this in one of two ways:
- Hard code the path to the project (but this may break build on other machines)
- Disable the script and call it on the command line (but this break the build in the IDE)
Command line:
/opt/st/stm32cubeide_1.4.0/stm32cubeide --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -cleanBuild my_project/Release -data ~/stm32/workspace -D CMD_LINE_VAR
If anyone has any suggestions that would be great.
Builder setup:
Project -> Properties -> Builders -> Main
Solved! Go to Solution.
- Labels:
-
STM32CubeIDE
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-08-17 9:39 AM
EDIT: Realized I was working through this as I was writing the details so the start of the message didn't line up with the end so I edited it to so that it makes more sense.
Thanks for the tip. The environment variable ${project_loc}
doesn't work here so I have to hardcode the path to the script.
Interestingly this working path of this script is the {project_loc}/{Configuration}. I was able to get this to work by doing the following.
Make the path to the script ../ like this:
../utilities/build/pre-build.sh
Then in the script I have to back up to the project directory like this:
cd ..
This then allows the script to run in the IDE and from the command line builds while being agnostic to the absolute path to the project. This in turn accomplished my goal so that it can run on multiple computers and build both from the command line and from within STM32CubeIDE.
Thanks,
Jacob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-08-16 2:19 AM
Not all fields inside Eclipse/CDT are able to interpret environmental variables, but try this:
${env_var:project_loc}
That would fetch the value stored in the variable project_loc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-08-16 7:51 AM
Thanks for the suggestion but it didn't work. When I tried to build in Eclipse I got the following error:
Errors occurred during the build.
Errors running builder 'Integrated External Tool Builder' on project 'apm-dongle-bootloader-stm32f446re'.
The file does not exist for the external tool named git_repoversion.
The file does not exist for the external tool named git_repoversion.
Jacob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-08-17 1:43 AM
May be you could try to use the pre build step instead of the launch configuration.
The pre build step is intended to be use in this case.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-08-17 9:39 AM
EDIT: Realized I was working through this as I was writing the details so the start of the message didn't line up with the end so I edited it to so that it makes more sense.
Thanks for the tip. The environment variable ${project_loc}
doesn't work here so I have to hardcode the path to the script.
Interestingly this working path of this script is the {project_loc}/{Configuration}. I was able to get this to work by doing the following.
Make the path to the script ../ like this:
../utilities/build/pre-build.sh
Then in the script I have to back up to the project directory like this:
cd ..
This then allows the script to run in the IDE and from the command line builds while being agnostic to the absolute path to the project. This in turn accomplished my goal so that it can run on multiple computers and build both from the command line and from within STM32CubeIDE.
Thanks,
Jacob
