Clone of official tools
Diff: settings.py
- Revision:
- 13:ab47a20b66f0
- Parent:
- 3:02a8b145dcb7
- Child:
- 20:835f6355470d
--- a/settings.py Tue Jun 14 11:33:06 2016 +0100 +++ b/settings.py Thu Jul 14 20:21:19 2016 +0100 @@ -1,10 +1,13 @@ """ mbed SDK -Copyright (c) 2011-2013 ARM Limited +Copyright (c) 2016 ARM Limited + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + +http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -12,43 +15,20 @@ limitations under the License. """ -from os.path import join, abspath, dirname +from os import getenv +from os.path import join, abspath, dirname, exists import logging ROOT = abspath(join(dirname(__file__), "..")) -# These default settings have two purposes: -# 1) Give a template for writing local "private_settings.py" -# 2) Give default initialization fields for the "toolchains.py" constructors ############################################################################## -# Build System Settings +# Toolchains and Build System Settings ############################################################################## BUILD_DIR = abspath(join(ROOT, ".build")) -# ARM -armcc = "standalone" # "keil", or "standalone", or "ds-5" - -if armcc == "keil": - ARM_PATH = "C:/Keil_4_54/ARM" - ARM_BIN = join(ARM_PATH, "BIN40") - ARM_INC = join(ARM_PATH, "RV31", "INC") - ARM_LIB = join(ARM_PATH, "RV31", "LIB") - -elif armcc == "standalone": - ARM_PATH = "C:/Program Files/ARM/armcc_4.1_791" - ARM_BIN = join(ARM_PATH, "bin") - ARM_INC = join(ARM_PATH, "include") - ARM_LIB = join(ARM_PATH, "lib") - -elif armcc == "ds-5": - ARM_PATH = "C:/Program Files (x86)/DS-5" - ARM_BIN = join(ARM_PATH, "bin") - ARM_INC = join(ARM_PATH, "include") - ARM_LIB = join(ARM_PATH, "lib") - -ARM_CPPLIB = join(ARM_LIB, "cpplib") -MY_ARM_CLIB = join(ARM_PATH, "lib", "microlib") +# ARM Compiler 5 +ARM_PATH = "C:/Keil_v5/ARM/ARMCC" # GCC ARM GCC_ARM_PATH = "" @@ -57,9 +37,9 @@ GCC_CR_PATH = "C:/code_red/RedSuite_4.2.0_349/redsuite/Tools/bin" # IAR -IAR_PATH = "C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0/arm" +IAR_PATH = "C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.3/arm" -# Goanna static analyser. Please overload it in private_settings.py +# Goanna static analyser. Please overload it in mbed_settings.py GOANNA_PATH = "c:/Program Files (x86)/RedLizards/Goanna Central 3.2.3/bin" # cppcheck path (command) and output message format @@ -71,6 +51,42 @@ # mbed.org username MBED_ORG_USER = "" + +############################################################################## +# User Settings (file) +############################################################################## +try: + # Allow to overwrite the default settings without the need to edit the + # settings file stored in the repository + from mbed_settings import * +except ImportError: + pass + + +############################################################################## +# User Settings (env vars) +############################################################################## +_ENV_PATHS = ['ARM_PATH', 'GCC_ARM_PATH', 'GCC_CR_PATH', 'IAR_PATH'] + +for _n in _ENV_PATHS: + if getenv('MBED_'+_n): + if exists(getenv('MBED_'+_n)): + globals()[_n] = getenv('MBED_'+_n) + else: + print "WARNING: MBED_%s set as environment variable but doesn't exist" % _n + + +############################################################################## +# ARM Compiler Paths +############################################################################## + +ARM_BIN = join(ARM_PATH, "bin") +ARM_INC = join(ARM_PATH, "include") +ARM_LIB = join(ARM_PATH, "lib") +ARM_CPPLIB = join(ARM_LIB, "cpplib") +MY_ARM_CLIB = join(ARM_LIB, "lib", "microlib") + + ############################################################################## # Test System Settings ############################################################################## @@ -92,13 +108,3 @@ "peripherals": ["TMP102", "digital_loop", "port_loop", "analog_loop", "SD"] }, } - -############################################################################## -# Private Settings -############################################################################## -try: - # Allow to overwrite the default settings without the need to edit the - # settings file stored in the repository - from mbed_settings import * -except ImportError: - print '[WARNING] Using default settings. Define your settings in the file "./mbed_settings.py"'