Currently the compiler paths are defined by hardcoding them into mbed_settings.py. Unfortunately this means re-creating or a keeping a local copy of this file and copying into any new application/module that you create. It would make more sense to require the user to define specific environment variables for the compilers which are then just read from the python script.
I think it makes sense to implement a hierarchy here (listed here from lowest to highest priority):
settings.py filembed_settings.py
MBED_ARM_PATH=...
MBED_GCC_ARM_PATH=...
MBED_IAR_PATH=...
I think I would order it as:
1 Use the PATH
There is even an argument to making the environment variables the first choice as these would have to have been specifically set which would imply conscious decision to override other options
I'm sorry I think I was confusing with my ordering, let me rearrange. 1 is now the highest priority and 3 is the lowest:
MBED_ARM_PATH=...
MBED_GCC_ARM_PATH=...
MBED_IAR_PATH=...
mbed_settings.pyPATH if no settings file specified.settings.py fileSo if you start a new project, you don't have specific environment variables set, and you don't have an mbed_settings.py, it will search in the PATH to find the compilers.
If you then add an mbed_settings.py file, it will use these settings. If it can't find the compiler at the path you specified in the file, it will fallback to searching the PATH variable
If you then set an environment variable for the compiler, it will try to use that. If it can't find the compiler there, it will fallback to mbed_settings.py if it exists, then fallback to searching the PATH variable.
My rationale behind this is it gives the most priority to the settings that are the most deliberately set.
PATH is lowest because this is often set upon compiler installation (usually not controlled by the user)mbed_settings.py is the next highest because this can be set at a project level, but you usually don't want to change it once its been set, even across sessions and loginsThis makes the most sense to me, but I'm open to other options :)
That sounds good to me
@bridadan isn't this against the tools? mbed CLI does nothing special for make.py/build.py?
@screamerbg You're right, this discussion is related to mbed tools, not mbed-cli. Would you like @adbridge or me to take the conclusion from this thread over to the other repo?
@bridadan yes, that would be more clean to track.
Created an issue on mbed-os: https://github.com/ARMmbed/mbed-os/issues/125
Closing the issue here.
Most helpful comment
I'm sorry I think I was confusing with my ordering, let me rearrange. 1 is now the highest priority and 3 is the lowest:
MBED_ARM_PATH=... MBED_GCC_ARM_PATH=... MBED_IAR_PATH=...mbed_settings.pyPATHif no settings file specified.settings.pyfileSo if you start a new project, you don't have specific environment variables set, and you don't have an
mbed_settings.py, it will search in thePATHto find the compilers.If you then add an
mbed_settings.pyfile, it will use these settings. If it can't find the compiler at the path you specified in the file, it will fallback to searching thePATHvariableIf you then set an environment variable for the compiler, it will try to use that. If it can't find the compiler there, it will fallback to
mbed_settings.pyif it exists, then fallback to searching thePATHvariable.