Skip to content

[Tools] Add environmental variables support for toolchain paths #2005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2016
Merged

[Tools] Add environmental variables support for toolchain paths #2005

merged 1 commit into from
Jun 27, 2016

Conversation

screamerbg
Copy link
Contributor

@screamerbg screamerbg commented Jun 24, 2016

This PR adds the ability to set/override ARM_PATH, GCC_ARM_PATH, IAR_PATH and GCC_CR_PATH build system variables through environmental variables. If the env variable points to invalid path then it's ignored.

For backwards compatibility mbed_settings.py is still respected, but environmental variables have higher prio.

Note that the latest mbed CLI supports global config setting for these variables.

Also updated license of settings.py and default_settings.py and added comments

@screamerbg
Copy link
Contributor Author

@mbed-bot: TEST

HOST_OSES=ALL
BUILD_TOOLCHAINS=ARMCC,GCC_ARM,IAR
TARGETS=K64F,NUCLEO_F411RE

@theotherjimmy
Copy link
Contributor

theotherjimmy commented Jun 24, 2016

👍 I need this. armcc on linux was broken by default for way too long.


ARM_CPPLIB = join(ARM_LIB, "cpplib")
MY_ARM_CLIB = join(ARM_PATH, "lib", "microlib")
#ARM_PATH = "C:/Program Files/ARM"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one day i'll convince you to set this path for Keil MDK rather than just the compiler... one day...

@sg-
Copy link
Contributor

sg- commented Jun 24, 2016

LGTM 👍

@bridadan
Copy link
Contributor

Awesome!

The CI won't test the ability to set environment variables, but it should test the ability of the tools to still respect the mbed_settings.py file. I'd like to run a few tests locally.

##############################################################################
# User Settings (env vars)
##############################################################################
_ENV_PATHS = ['ARM_PATH', 'GCC_ARM_PATH', 'GCC_CR_PATH', 'IAR_PATH']
Copy link
Contributor

@bridadan bridadan Jun 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should prefix the _ENV_PATHS with MBED_, so:

_ENV_PATHS = ['MBED_ARM_PATH', 'MBED_GCC_ARM_PATH', 'MBED_GCC_CR_PATH', 'MBED_IAR_PATH']

The reason is these variables are just general enough where they might conflict with some other environment variables on other people's machines.

Copy link
Contributor Author

@screamerbg screamerbg Jun 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Googled ARM_PATH and GCC_ARM_PATH env variable. Not a single result. Don't think these are general.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but if someone were to make a tool that used them, we would get unexpected behavior. I don't think anyone will klober our MBED_ prefixed environment variables.

@mbed-bot
Copy link

[Build 523]
FAILURE: Something went wrong when building and testing.

@bridadan
Copy link
Contributor

CI was goofed up, this will need to be re ran.

@screamerbg
Copy link
Contributor Author

@mbed-bot: TEST

HOST_OSES=windows
BUILD_TOOLCHAINS=GCC_ARM,IAR,ARM,uARM
TARGETS=K64F,NUCLEO_F411RE,LPC1768

@mbed-bot
Copy link

[Build ${MBED_BUILD_ID}]
FAILURE: Something went wrong when building and testing.

Also updated license of settings.py and default_settings.py and added
comments
@screamerbg
Copy link
Contributor Author

@mbed-bot: TEST

HOST_OSES=windows
BUILD_TOOLCHAINS=GCC_ARM,IAR,ARM,uARM
TARGETS=K64F,NUCLEO_F411RE,LPC1768

@bridadan
Copy link
Contributor

I tried setting an environment variable to override the settings, but it doesn't look like it's taking priority? Did I mess up setting the environment variable?

C:\mbed>set IAR_PATH="C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.2/arm"

C:\mbed>echo %IAR_PATH%
"C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.2/arm"

C:\mbed>python tools\singletest.py --auto --tc IAR -V --clean
WARNING: IAR_PATH set as environment variable but doesn't exist
MBEDLS: Detecting connected mbed-enabled devices...
MBEDLS: Detected K64F[9900], port: COM238, mounted: F:
Building library CMSIS (K64F, IAR)
Copy: arm_common_tables.h
Copy: arm_const_structs.h
Copy: arm_math.h
Copy: core_ca9.h
Copy: core_caFunc.h
Copy: core_caInstr.h
Copy: core_ca_mmu.h
Copy: core_cm0.h
Copy: core_cm0plus.h
Copy: core_cm3.h
Copy: core_cm4.h
Copy: core_cm4_simd.h
Copy: core_cm7.h
Copy: core_cmFunc.h
Copy: core_cmInstr.h
Copy: core_cmSecureAccess.h
Copy: core_cmSimd.h
Copy: core_sc000.h
Copy: core_sc300.h
Copy: cmsis.h
Copy: cmsis_nvic.h
Copy: fsl_device_registers.h
Copy: MK64F12.h
Copy: MK64F12_features.h
Copy: system_MK64F12.h
Copy: MK64FN1M0xxx12.icf
ERROR: run_cmd: Command 'C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.3/arm\bin\iasmarm' can't be found

@screamerbg
Copy link
Contributor Author

Can you try setting the variable without quotes?

@screamerbg
Copy link
Contributor Author

screamerbg commented Jun 24, 2016

First setting this up incorrectly

> set IAR_PATH=C:\Program Files\IAR Workbench 7.0\arm-wrong-path

>mbed compile -t IAR -m K64F
[mbed WARNING] Could not find mbed program in current path "D:\Work\sdk\mbed-sdk-fork".
[mbed WARNING] You can fix this by calling "mbed new ." or "mbed config root ." in the root of your program.
---
WARNING: IAR_PATH set as environment variable but doesn't exist
Building project mbed-sdk-fork (K64F, IAR)
WARNING: IAR_PATH set as environment variable but doesn't exist
WARNING: IAR_PATH set as environment variable but doesn't exist
WARNING: IAR_PATH set as environment variable but doesn't exist
WARNING: IAR_PATH set as environment variable but doesn't exist
WARNING: IAR_PATH set as environment variable but doesn't exist
....

Now correctly

>set IAR_PATH=C:\Program Files\IAR Workbench 7.0\arm

>mbed compile -t IAR -c
[mbed WARNING] Could not find mbed program in current path "D:\Work\sdk\mbed-sdk-fork".
[mbed WARNING] You can fix this by calling "mbed new ." or "mbed config root ." in the root of your program.
---
Building project mbed-sdk-fork (K64F, IAR)
Compile: CAN.cpp
Compile: CallChain.cpp
Compile: AnalogIn.cpp
Compile: BusIn.cpp
Compile: BusOut.cpp
Compile: BusInOut.cpp
Compile: Ethernet.cpp
Compile: FileLike.cpp
Compile: FilePath.cpp
Compile: FileBase.cpp
Compile: FileSystemLike.cpp
Compile: I2C.cpp
Compile: I2CSlave.cpp
...

Are you sure that you're using my branch?

@bridadan
Copy link
Contributor

Setting the environment variable without quotes fixed it!

@mbed-bot
Copy link

[Build 530]
FAILURE: Something went wrong when building and testing.

@screamerbg
Copy link
Contributor Author

@mbed-bot: TEST

HOST_OSES=windows
BUILD_TOOLCHAINS=GCC_ARM,IAR,ARM
TARGETS=K64F

@screamerbg
Copy link
Contributor Author

What's up with the CI?

@mbed-bot
Copy link

[Build ${MBED_BUILD_ID}]
FAILURE: Something went wrong when building and testing.

@sg-
Copy link
Contributor

sg- commented Jun 26, 2016

@mbed-bot: TEST

HOST_OSES=windows
BUILD_TOOLCHAINS=GCC_ARM,IAR,ARM,uARM
TARGETS=K64F,NUCLEO_F411RE,LPC1768

@mbed-bot
Copy link

[Build 533]
SUCCESS: Building succeeded and tests were run! Be sure to check the test results

@sg-
Copy link
Contributor

sg- commented Jun 27, 2016

Follow up patch to add MBED_

@sg- sg- merged commit f7ad7d2 into ARMmbed:master Jun 27, 2016
@SeppoTakalo
Copy link
Contributor

Just why?
Why did you do this? On any given operating system there is already PATH variable used to find executables.
Why do it differently?
And do not always assume Windows operating system.

@bridadan
Copy link
Contributor

bridadan commented Jun 29, 2016

@SeppoTakalo Discovering compiler executables in the PATH is a slightly different issue that needs to be addressed. I started doing that here (though the PR is not ready yet): #2057. The reason why that is non-trivial is because the build system needs to be able to find the include directories for the toolchains, so it needs to find the directories where the executables are located.

This provides a method to override both the settings file and (eventually) the toolchains found in your PATH. This is especially useful if you have multiple versions of a compiler and both can't live in your PATH.

@SeppoTakalo
Copy link
Contributor

@bridadan Why do you need to know the includepaths of standard libraries? Compiler should know.

I don't think that I have ever needed to tell compiler where to find <stdio.h> for example.

@bridadan
Copy link
Contributor

@SeppoTakalo I'm not familiar with the requirements here (this has been the mbedmicro/mbed code base since before I started), so it may be possible that this could be refactored. For the case of the ARM toolchain, here is one instance where the include path is used: https://github.com/mbedmicro/mbed/blob/master/tools/toolchains/arm.py#L38.

It's linking to libs as well. Here are the lines I found after a quick search:

artokin pushed a commit to artokin/mbed-os that referenced this pull request May 21, 2019
…..0345477

0345477 Remove test file eapol_helper_stub from release
2f7767a Merge branch 'release_internal' into release_external
fdd6c2d wi-sun address registration fix:
48330ea Disabled TLS platform memory
794e053 Wi-sun config sol message handler update
c69a41d Removed ETX unknow neighbour trace.
7a5b2a7 Wi-sun State machine update
bfc7843 Enabled non-blocking ECC calculation on TLS server
ce36f2c Fix issues found by coverity (ARMmbed#2087)
2c4981b DHCP client fix's
6c00aa2 Correcting timeout handling
d04523e Added timer to supplicant to filter EAP-TLS re-transmission bursts
3524877 Fix issues found by coverity (ARMmbed#2082)
e5f1627 Increased TLS queue size, corrected EUI-64 read and added traces
67bb748 Codereview cleaning's
9350293 DHCPv6 client server address update.
de00ace Reduced EAP-TLS retries to from four to two
bff9c6e Previous BR EUI-64 is now used on second authentication attempt
a2019f4 RPL target address publish update
cea03d6 DHCPc6 client cancel support
f562de5 Corrected supplicant EAP-TLS sequence id validation
bf36b5a Added traces to EAP-TLS delay and TLS protocol
203fdae Removed RSL check from ETX for testing purpose.
c1bfeb6 Added print for debugging why SRH validate check fail.
fc429e7 Corrected function parameter check
0aef534 Added support for fourth network key to MAC helper and WS bootstrap
d861208 Added validation for ETX Acceleration definitions.
cbb4acf Accept do faster ETX caclculation after last ETX probe or unicast traffic.
202e579 Removed debug trace print which may affect crash.
68c3d7b Fix missing RPL Prefix Slaac delete handler.
588c385 Drop only non trusted devices when life is over 60 seconds old.
99e8ce7 Cleaned trace print.
8c57c10 Code clean and Keep time update at 16-bit.
9ff35ab ETX calculate and sampling update.
535c005 Corrected EAPOL key reuse on supplicant bootstrap restart
01058c0 Fix for valid lifetime for slaac based address. (ARMmbed#2071)
ed4d0c0 Merge pull request ARMmbed#2067 from ARMmbed/IOTTHD-3413
b3ec1f3 MAC: iotthd-3413 Review updates
dce4e25 Merge pull request ARMmbed#2068 from ARMmbed/ws_dhcp_update
06fe62e Fixed static definition.
14a244d Wi-sun BBR, bootsrap and RPL Prefix calback update
669b325 DHCPV6 client update
d03187e NEW API for do address decrecation
7864962 Added comment for dhcp client configure at Wi-SUN bootstrap.
890f955 Dio prefix handler fix
9f7bf49 Code style, added missing function stub  and function rename fix.
78c4ae9 MAC: Added address and pan id filtering for 802.15.4-2015
0ebd37a Wi-sun DHCPV6, RPL DIO forwarding, dhcpv6 client  update
85f9a81 Added generation of SLAAC address on BBR (ARMmbed#2065)
561aefa Created Wi-SUN specific NA handler
30bce91 MAC: Moved MAC filters in data ind callback
b961948 MAC: Cleaning data indication callback
318ab48 Merge pull request ARMmbed#2064 from ARMmbed/IOTTHD-3426
1a9be20 MAC unit tests: updated cca prepare test
fd5683d FHSS WS: Removed temporary debug traces
6527e05 MAC: Fixed multi csma
1e1f69a modified trickle analyse function for pan configuration
b7a8268 Merge pull request ARMmbed#2063 from ARMmbed/fhss_mac_retry_correct
a21bede CCA RETRY and and TX reretry clear calculation when FHSS re-send packet at new channel.
c7235f8 Merge pull request ARMmbed#2062 from ARMmbed/ns_aro_fix
4489dda Merge pull request ARMmbed#2060 from ARMmbed/IOTTHD-3426_traces
b1484d8 Corrected GAK generation flagging
db51b73 Configure Thread neighbour and destination cache (ARMmbed#2057)
0306276 FHSS WS: Added temporary debug traces
7d88d7f Enabled Multicast NS to trig NA for wi-sun.
609086d Do not add ack callback for multicast NS.
be18109 Fixed missing address re registration.
7d8dab4 IPv6 routing cache configuration update (ARMmbed#2056)
f701d39 Corrected PAN ID checking for NVM keys and MAC key remove on discovery
1eda5e3 Enabled mbed TLS to use nsdynmemlib on simulator
42c154d Merge pull request ARMmbed#2054 from ARMmbed/IOTTHD-3374
75cce02 Add bootstrap Down event when re-starting network discovery
aab7191 MAC: Use minimum CSMA for Asynch
3d93f64 Merge pull request ARMmbed#2053 from ARMmbed/ws_eapol_bootstrap
d29dfa7 Merge pull request ARMmbed#2052 from ARMmbed/IOTTHD-3375
7689c8c FHSS WS: Added maximum drift compensation step
7b55332 PAN Configuration failure fix and enabler
1a798ab FHHS old synch disable
47f65aa Merge pull request ARMmbed#2051 from ARMmbed/IOTTHD-3415
324902d Merge pull request ARMmbed#2048 from ARMmbed/IOTTHD-3388
142a32a Update Trickle expiration
c5f5fa7 omit NA messages from NS
5d29046 Merge pull request ARMmbed#2040 from ARMmbed/fix_compiler_warnings
8c0b6db FHSS WS: Fixed drifting TX trig timer
708a7d5 Review corrections
1f63902 Merge pull request ARMmbed#2047 from ARMmbed/eapol_bt
e9759e8 Added trigger to authenticator to re-start delayed EAP-TLS
30c538a Modified MLR handling
c56fa8d Code style fix
f298cd3 Parent synch fix and EAPOL synch fix
02942b0 Merge pull request ARMmbed#2046 from ARMmbed/iotthd-3260
5020291 Wi-sun dicovery trickle update
572861b Merge pull request ARMmbed#2041 from ARMmbed/iotthd-3309
e32d3c1 Merge pull request ARMmbed#2038 from ARMmbed/IOTTHD-3341
a2addf8 EAPOL parent synch update
b9e3ee0 FHSS WS: Implemented fhss retry logic
1c25c24 Corrected 4WH and GKH replay counters
45a76e1 Corrected eapol key length
39582e8 Merge pull request ARMmbed#2039 from ARMmbed/iotthd-3352
a428ba7 wi-sun LLC update
5ad1743 EAPOL helper update
db2e2cd Fix compiler warnings in MDNS service
924acad Fix armc6 compiler warnings
64e924e Check object before usage (ARMmbed#2036)
2d7e923 Corrected supplicant 4WH timeout after Message 1
6cde07a Merge pull request ARMmbed#2034 from ARMmbed/ws_aro_lifetime_fix
9c97cac Merge pull request ARMmbed#2032 from ARMmbed/ws_enable_multi_csma
80ecfdc WS: Enable checking CCA twice on TX channel
780e521 Fixxed ARO lifetime /60 +1 . now resolution is OK.
fe4073b Merge pull request ARMmbed#2030 from ARMmbed/IOTTHD-3340
902fdd8 create multicast forward check for PBBR
420c5be Disabled initial EAPOL-Key retry on GTK lifetime mismatch
25ae74e Merge pull request ARMmbed#2029 from ARMmbed/fhss_compensation_fix
6023d7b WS: change csma periods to 1 to make tests pass
b5a71c4 MAC unit tests: Updated CCA prepare test
a1f3ceb MAC: Make multi CSMA configurable
f4e9a1b Disable fhss compensation at parent selection if fixed channel mode is enabled for broadcast.
2417093 Added limits to number of EAP-TLS and TLS sessions
6845ab8 Corrected EAP-TLS retries and ids and initial EAPOL-Key handling
50961c9 Removed random from EAPOL PAN version increment
b862823 Fixed interop findings for DUA handling
a91a2b4 Thread discovery response update (ARMmbed#2024)
ffd4db2 MAC: Implemented double cca check
4ac7842 Corrected authenticator GTK setting
32af62b Merge pull request ARMmbed#2021 from ARMmbed/fhss_synch_fix
5c81b36 ws FHSS synch fix
9dfe724 Corrected 4WH retries and timeouts
b47c583 Added check for MBEDTLS_NIST_KW_C flag to nist KW module
2be2634 Merge pull request ARMmbed#2019 from ARMmbed/fhss_warnings_fix
342ca76 FHSS: Fixed IAR warnings from channel functions
359c7b9 Merge pull request ARMmbed#2017 from ARMmbed/IOTTHD-3065
570123d Merge pull request ARMmbed#2015 from ARMmbed/tls_free
1d7693b Change the re-registration delay (ARMmbed#2016)
b33e0c1 FHSS WS: Fixed large broadcast interval issue
9640ec0 Merge pull request ARMmbed#2014 from ARMmbed/IOTTHD-3338
798b513 Corrected TLS library free on failure cases
f6d1299 FHSS WS: Fixed compensation when on BC channel
5fa004c address entry removal updated (ARMmbed#2013)
a8e3e73 Test mode updates for BBR (ARMmbed#2011)
d8cc9b5 Merge pull request ARMmbed#2012 from ARMmbed/dhcp_fix
33cd6bf Typo realay->relay.
90a77aa DHCP relay and Renew update
bd12214 DHCP client address request update
74dc531 Merge pull request ARMmbed#1994 from ARMmbed/enable_eapol
e921dcd Merge pull request ARMmbed#2007 from ARMmbed/ws_mpl_fix
17e27a4 MTD status check added (ARMmbed#2010)
a0e893b Merge pull request ARMmbed#2008 from ARMmbed/IOTTHD-3234
274abdd address registration and coap port updates (ARMmbed#2009)
ae91f87 MAC: Increase backoff exponent when retry count grows
f871797 Merge pull request ARMmbed#2001 from ARMmbed/iotthd-2949
2b6ddf0 Corrected traces and coverity error
b0b804d Corrected security protocol data alignment
439e051 Corrected HMAC calculation
6962f42 Corrected traces
ff765cf Changed some hex traces to decimals for readability
bc3f4f1 Added session message counter check to supplicant 4WH
d963915 Corrected four way handshake Message 2 retry
1bcf070 Enable EAPOL flags
83fc53a Security policy check added. (ARMmbed#2004)
7b7e67c MPL SEED ID compres disable for wi-sun.
345c34f Merge pull request ARMmbed#2003 from ARMmbed/fix_rsl_out
716851d Thread uri updated. (ARMmbed#2005)
c4d81f4 WS neigh: Fixed reading RSL out
ac266e8 Merge pull request ARMmbed#2006 from ARMmbed/merge_nanostack_v10.1.1_changes_back_to_master
aaad726 Merge branch 'release_internal'
b4fc3f9 Update README (ARMmbed#2002)
64c5f23 Update Pan information when it heard from Parent.
2b61377 RPL DAO target request Update
bba1105 Merge pull request ARMmbed#1999 from ARMmbed/IOTTHD-3246
08dfcfc Merge branch 'release_internal'
4edc186 Extra security policy bits handling  (ARMmbed#1995)
5a42e88 Corrected PAE controller stop
ac2425c Corrected compiling errors
d4fded3 Merge pull request ARMmbed#1996 from ARMmbed/ws_bbr_pan_size
da6fd12 Fixed Default small network setup set to follow standard.
90a335b Merge pull request ARMmbed#1982 from ARMmbed/iotthd-3258
df2b98e Merge pull request ARMmbed#1979 from ARMmbed/IOTTHD-3233
2b356e0 Added next GTK set to empty functions
3ece393 Corrected compilation warnings from tracing and UT stubs
13e68c3 Corrected defects
ac51ec5 Corrected coverity, compiler and astyle errors
96c5496 Added GTK, PMK, PTK lifecycles and node's access of revocation
8f10a6e Fixed tlv length check. (ARMmbed#1992)
f2ba36d MAC unit tests: Missing stub added
1ef8dd6 Added public configuration API for Wi-SUN BBR
16d52fb Merge pull request ARMmbed#1991 from ARMmbed/aro_failure_fix
187ad94 Neighbour remove clear active Nud table if neighbor is at list.
5e89e16 Fix ARO register failure handler:
81cd273 Added an extra byte to security policy. (ARMmbed#1989)
cd1afb1 MAC: Fixed aborting active TX when sending Ack
b0a3c70 WS/MAC: removed trace causing crash, fixed MAC min BE set
3f0e56c FHSS WS: TX poll improvement to enhance hidden node situations
22cbb02 Merge pull request ARMmbed#1983 from ARMmbed/iothhd-2950
3835702 Address policy update's
aba9dd6 Updated new rule to address source select
2ed0f76 Fixed Echo request handle
6e31d0a Fix DHCPv6 relay:
f40f518 Added prefence time back to ULA prefix add wi-sun.
0bee3db Changed debug traces to info traces
1c45286 Fixed defects and coding style
553fbb1 Corrected memory error on security protocol finish
f47ad87 PAE supplicant and authenticator GTK update procedure
b4091c0 Defined WS RPL default configure

git-subtree-dir: features/nanostack/sal-stack-nanostack
git-subtree-split: 0345477
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants