- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We're trying to create a single project template that can run on multiple machines and reference a set of common libraries without requiring manual intervention to set dozens of include paths on every machine individually. The ideal solution is to simply have each user create an environment variable with the same name that points to the library parent directory for their specific machine.
Is there a way to pass a system environment variable as an include path to the ARM-GCC compiler when it is invoked via PSoC Creator? From the command line I can just run
arm-none-eabi-gcc -I%MY_PATH% main.c
This evaluates just fine, however when invoked from within PSoC Creator MY_PATH does not get evaluated (I have verified that it does exist within the environment of the application). My guess is that it's something to do with the way in which PSoC Creator is spawning the app, it's not simply invoking a command line and it's passing the variable as a literal.
Alternatively is there a way to manually create a custom PSoC Creator build macro which does get evaluated before being passed to the compiler? (Such as ${OutputDir}, ${WorkspaceDir} etc.)
For reference setting C_INCLUDE_PATH as a system variable does work but it's not ideal as it will also pull those include directories into every other unrelated project built using any GCC version.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @PaSw_2578827,
Apologies for the delay in reply.
I tried to recreate this issue:-
In system environmental variables. At first, I added the variable name as MY_PATH and set the header file location in the variable value section.
I checked it in the command prompt. It was pointing to the correct location.
I created a project and tried to include a custom header file.
Yes, If we add the path directly the header file is recognized by the compiler.
But if we add the environmental variable, the header file is not recognized. The compiler actually receives the string %MY_PATH% instead of the value of that variable.
Warm Regards,
Gautami J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @PaSw_2578827,
"Is there a way to pass a system environment variable as an include path to the ARM-GCC compiler when it is invoked via PSoC Creator " can you please brief on this line?
Also, please attach the screenshot of the error message you are observing to better understand the issue.
Also please refer to:-
Warm Regards,
Gautami J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well the error I'm getting is that it can't find the header file. If I enable verbose output from the compiler and look at what that is telling me, it's saying that it can't find the directory %MyPath%
ignoring nonexistent directory "%MyPath%"
Which implies to me that it's getting the environment variable as a literal instead of the resolved path:
The forum post you pointed me to is somewhat helpful at pointing me in a direction, but to be honest I feel like that question is a little further down the path I'm trying to get too. I'm not sure I fully understand the use of the *.mk files.
In a normal PSoC Creator project the makefiles are all internal or generated, is there a way for me to provide a *.mk file that PSoC Creator will use and won't edit? I know I can export the PSoC project to a makefile, but AFAIK PSoC Creator still doesn't use that makefile when it builds right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Is there a way to pass a system environment variable as an include path to the ARM-GCC compiler when it is invoked via PSoC Creator " can you please brief on this line?
The include directory that I want to use is a system environment variable on my Windows machine names "MY_PATH". I want to use this as an include directory when executing the compiler. To do this from a commandline I just type:
arm-none-eabi-gcc -I%MY_PATH% main.c
I had hoped that I could simple enter %MY_PATH% into the "Additional Include Directories" under Project > Build Settings > CM0+ > Compiler > General
Unfortunately that does not work, the compiler actually receives the string %MY_PATH% instead of the value of that variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @PaSw_2578827,
Apologies for the delay in reply.
I tried to recreate this issue:-
In system environmental variables. At first, I added the variable name as MY_PATH and set the header file location in the variable value section.
I checked it in the command prompt. It was pointing to the correct location.
I created a project and tried to include a custom header file.
Yes, If we add the path directly the header file is recognized by the compiler.
But if we add the environmental variable, the header file is not recognized. The compiler actually receives the string %MY_PATH% instead of the value of that variable.
Warm Regards,
Gautami J