|
1 | 1 | """ |
2 | 2 | mbed SDK |
3 | | -Copyright (c) 2011-2013 ARM Limited |
| 3 | +Copyright (c) 2016 ARM Limited |
| 4 | +
|
4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 6 | you may not use this file except in compliance with the License. |
6 | 7 | You may obtain a copy of the License at |
7 | | - http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +
|
| 9 | +http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +
|
8 | 11 | Unless required by applicable law or agreed to in writing, software |
9 | 12 | distributed under the License is distributed on an "AS IS" BASIS, |
10 | 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
11 | 14 | See the License for the specific language governing permissions and |
12 | 15 | limitations under the License. |
13 | 16 | """ |
14 | 17 |
|
15 | | -from os.path import join, abspath, dirname |
| 18 | +from os import getenv |
| 19 | +from os.path import join, abspath, dirname, exists |
16 | 20 | import logging |
17 | 21 |
|
18 | 22 | ROOT = abspath(join(dirname(__file__), "..")) |
19 | 23 |
|
20 | | -# These default settings have two purposes: |
21 | | -# 1) Give a template for writing local "mbed_settings.py" |
22 | | -# 2) Give default initialization fields for the "toolchains.py" constructors |
23 | 24 |
|
24 | 25 | ############################################################################## |
25 | | -# Build System Settings |
| 26 | +# Toolchains and Build System Settings |
26 | 27 | ############################################################################## |
27 | 28 | BUILD_DIR = abspath(join(ROOT, ".build")) |
28 | 29 |
|
29 | | -# ARM |
30 | | -armcc = "standalone" # "keil", or "standalone", or "ds-5" |
31 | | - |
32 | | -if armcc == "keil": |
33 | | - ARM_PATH = "C:/Keil_v5/ARM/ARMCC" |
34 | | - ARM_BIN = join(ARM_PATH, "bin") |
35 | | - ARM_INC = join(ARM_PATH, "incldue") |
36 | | - ARM_LIB = join(ARM_PATH, "lib") |
37 | | - |
38 | | -elif armcc == "standalone": |
39 | | - ARM_PATH = "C:/Program Files (x86)/ARM_Compiler_5.06u1" |
40 | | - ARM_BIN = join(ARM_PATH, "bin") |
41 | | - ARM_INC = join(ARM_PATH, "include") |
42 | | - ARM_LIB = join(ARM_PATH, "lib") |
43 | | - |
44 | | -elif armcc == "ds-5": |
45 | | - ARM_PATH = "C:/Program Files (x86)/DS-5" |
46 | | - ARM_BIN = join(ARM_PATH, "bin") |
47 | | - ARM_INC = join(ARM_PATH, "include") |
48 | | - ARM_LIB = join(ARM_PATH, "lib") |
49 | | - |
50 | | -ARM_CPPLIB = join(ARM_LIB, "cpplib") |
51 | | -MY_ARM_CLIB = join(ARM_PATH, "lib", "microlib") |
| 30 | +# ARM Compiler 5 |
| 31 | +ARM_PATH = "C:/Keil_v5/ARM/ARMCC" |
52 | 32 |
|
53 | 33 | # GCC ARM |
54 | 34 | GCC_ARM_PATH = "" |
|
71 | 51 | # mbed.org username |
72 | 52 | MBED_ORG_USER = "" |
73 | 53 |
|
| 54 | + |
| 55 | +############################################################################## |
| 56 | +# User Settings (file) |
| 57 | +############################################################################## |
| 58 | +try: |
| 59 | + # Allow to overwrite the default settings without the need to edit the |
| 60 | + # settings file stored in the repository |
| 61 | + from mbed_settings import * |
| 62 | +except ImportError: |
| 63 | + pass |
| 64 | + |
| 65 | + |
| 66 | +############################################################################## |
| 67 | +# User Settings (env vars) |
| 68 | +############################################################################## |
| 69 | +_ENV_PATHS = ['ARM_PATH', 'GCC_ARM_PATH', 'GCC_CR_PATH', 'IAR_PATH'] |
| 70 | + |
| 71 | +for _n in _ENV_PATHS: |
| 72 | + if getenv(_n): |
| 73 | + if exists(getenv(_n)): |
| 74 | + globals()[_n] = getenv(_n) |
| 75 | + else: |
| 76 | + print "WARNING: %s set as environment variable but doesn't exist" % _n |
| 77 | + |
| 78 | + |
| 79 | +############################################################################## |
| 80 | +# ARM Compiler Paths |
| 81 | +############################################################################## |
| 82 | + |
| 83 | +ARM_BIN = join(ARM_PATH, "bin") |
| 84 | +ARM_INC = join(ARM_PATH, "include") |
| 85 | +ARM_LIB = join(ARM_PATH, "lib") |
| 86 | +ARM_CPPLIB = join(ARM_LIB, "cpplib") |
| 87 | +MY_ARM_CLIB = join(ARM_LIB, "lib", "microlib") |
| 88 | + |
| 89 | + |
74 | 90 | ############################################################################## |
75 | 91 | # Test System Settings |
76 | 92 | ############################################################################## |
|
92 | 108 | "peripherals": ["TMP102", "digital_loop", "port_loop", "analog_loop", "SD"] |
93 | 109 | }, |
94 | 110 | } |
95 | | - |
96 | | -############################################################################## |
97 | | -# Private Settings |
98 | | -############################################################################## |
99 | | -try: |
100 | | - # Allow to overwrite the default settings without the need to edit the |
101 | | - # settings file stored in the repository |
102 | | - from mbed_settings import * |
103 | | -except ImportError: |
104 | | - print '[WARNING] Using default settings. Define your settings in the file "./mbed_settings.py"' |
|
0 commit comments