Skip to content

Commit d461197

Browse files
committed
Incorporated review comments
1 parent 2e21f71 commit d461197

File tree

5 files changed

+44
-32
lines changed

5 files changed

+44
-32
lines changed

TESTS/configs/baremetal.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,27 @@
3535
"qspif"
3636
],
3737
"target_overrides": {
38-
"*": {
38+
"K64F": {
39+
"target.default_lib": "small",
40+
"mbed-trace.fea-ipv6": false
41+
},
42+
"K66F": {
43+
"target.default_lib": "small",
44+
"mbed-trace.fea-ipv6": false
45+
},
46+
"NUCLEO_F303RE": {
47+
"target.default_lib": "small",
48+
"mbed-trace.fea-ipv6": false
49+
},
50+
"NUCLEO_F411RE": {
51+
"target.default_lib": "small",
52+
"mbed-trace.fea-ipv6": false
53+
},
54+
"NUCLEO_F429ZI": {
55+
"target.default_lib": "small",
56+
"mbed-trace.fea-ipv6": false
57+
},
58+
"DISCO_L475VG_IOT01A": {
3959
"target.default_lib": "small",
4060
"mbed-trace.fea-ipv6": false
4161
}

targets/targets.json

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,12 +2136,7 @@
21362136
"init-us-ticker-at-boot": true
21372137
},
21382138
"OUTPUT_EXT": "hex",
2139-
"bootloader_supported": true,
2140-
"supported_c_libs": {
2141-
"arm": ["std", "small"],
2142-
"gcc_arm": ["std", "small"],
2143-
"iar": ["std"]
2144-
}
2139+
"bootloader_supported": true
21452140
},
21462141
"LPC55S69_S": {
21472142
"inherits": ["SPE_Target", "LPC55S69"],
@@ -3569,12 +3564,7 @@
35693564
],
35703565
"release_versions": ["2", "5"],
35713566
"bootloader_supported": true,
3572-
"device_name": "STM32L073RZ",
3573-
"supported_c_libs": {
3574-
"arm": ["std", "small"],
3575-
"gcc_arm": ["std", "small"],
3576-
"iar": ["std"]
3577-
}
3567+
"device_name": "STM32L073RZ"
35783568
},
35793569
"NUCLEO_L152RE": {
35803570
"inherits": ["FAMILY_STM32"],

tools/test/toolchains/test_toolchains.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from tools.toolchains.arm import ARM_STD, ARM_MICRO, ARMC6
2121
from tools.toolchains.gcc import GCC_ARM
2222
from tools.toolchains.iar import IAR
23-
from tools.toolchains.mbed_toolchain import UNSUPPORTED_C_LIB_EXECPTION_STRING
23+
from tools.toolchains.mbed_toolchain import UNSUPPORTED_C_LIB_EXCEPTION_STRING
2424
from tools.utils import NotSupportedException
2525

2626
class TestArmToolchain(TestCase):
@@ -69,31 +69,31 @@ def test_arm_default_lib(self):
6969
self.assertIn("--library_type=microlib", arm_c6_obj.flags["asm"])
7070

7171
def test_arm_default_lib_std_exception(self):
72-
"""Test that exception raised when default_lib is std but supported_c_libs parameter arm is not suppoted std lib."""
72+
"""Test that an exception raised if the default_lib is std but it is not listed in supported_c_libs."""
7373
mock_target = mock.MagicMock()
7474
mock_target.core = "Cortex-M4"
7575
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
7676
mock_target.default_toolchain = "ARM"
7777
mock_target.default_lib = "std"
7878
mock_target.supported_c_libs = {"arm": ["small"]}
79-
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXECPTION_STRING.format(mock_target.default_lib)):
79+
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
8080
ARM_STD(mock_target)
81-
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXECPTION_STRING.format(mock_target.default_lib)):
81+
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
8282
ARMC6(mock_target)
8383

8484

8585
def test_arm_default_lib_small_exception(self):
86-
"""Test that exception raised when default_lib is small but supported_c_libs parameter arm is not suppoted small lib."""
86+
"""Test that an exception raised if the default_lib is small but it is not listed in supported_c_libs."""
8787
mock_target = mock.MagicMock()
8888
mock_target.core = "Cortex-M4"
8989
mock_target.default_lib = "small"
9090
mock_target.supported_c_libs = {"arm": ["std"]}
9191
mock_target.default_toolchain = "ARM"
9292
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
93-
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXECPTION_STRING.format(mock_target.default_lib)):
93+
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
9494
ARM_STD(mock_target)
9595
mock_target.default_toolchain = "ARMC6"
96-
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXECPTION_STRING.format(mock_target.default_lib)):
96+
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
9797
ARMC6(mock_target)
9898

9999
class TestGccToolchain(TestCase):
@@ -141,24 +141,24 @@ def test_gcc_arm_default_lib(self):
141141
self.assertIn("--specs=nano.specs", gcc_arm_obj.flags["ld"])
142142

143143
def test_gcc_arm_default_lib_std_exception(self):
144-
"""Test that exception raised when default_lib is std but supported_c_libs parameter arm is not suppoted std lib."""
144+
"""Test that an exception raised if the default_lib is std but it is not listed in supported_c_libs."""
145145
mock_target = mock.MagicMock()
146146
mock_target.core = "Cortex-M4"
147147
mock_target.default_toolchain = "ARM"
148148
mock_target.default_lib = "std"
149149
mock_target.supported_c_libs = {"arm": ["small"]}
150-
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXECPTION_STRING.format(mock_target.default_lib)):
150+
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
151151
GCC_ARM(mock_target)
152152

153153
def test_gcc_arm_default_lib_small_exception(self):
154-
"""Test that exception raised when default_lib is small but supported_c_libs parameter arm is not suppoted small lib."""
154+
"""Test that an exception raised if the default_lib is small but it is not listed in supported_c_libs."""
155155
mock_target = mock.MagicMock()
156156
mock_target.core = "Cortex-M4"
157157
mock_target.default_lib = "small"
158158
mock_target.supported_c_libs = {"arm": ["std"]}
159159
mock_target.default_toolchain = "ARM"
160160
mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
161-
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXECPTION_STRING.format(mock_target.default_lib)):
161+
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
162162
GCC_ARM(mock_target)
163163

164164
class TestIarToolchain(TestCase):
@@ -189,26 +189,26 @@ def test_iar_default_lib(self):
189189
try:
190190
IAR(mock_target)
191191
except NotSupportedException:
192-
self.fail(UNSUPPORTED_C_LIB_EXECPTION_STRING.format(mock_target.default_lib))
192+
self.fail(UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib))
193193

194194
def test_iar_default_lib_std_exception(self):
195-
"""Test that exception raised when default_lib is small but supported_c_libs parameter iar is not supported small lib."""
195+
"""Test that an exception raised if the default_lib is std but it is not listed in supported_c_libs."""
196196
mock_target = mock.MagicMock()
197197
mock_target.core = "Cortex-M4"
198198
mock_target.microlib_supported = False
199199
mock_target.default_lib = "std"
200200
mock_target.supported_c_libs = {"iar": ["small"]}
201201
mock_target.supported_toolchains = ["IAR"]
202-
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXECPTION_STRING.format(mock_target.default_lib)):
202+
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
203203
IAR(mock_target)
204204

205205
def test_iar_default_lib_small_exception(self):
206-
"""Test that exception raised when default_lib is small but supported_c_libs parameter iar is not supported small lib."""
206+
"""Test that an exception raised if the default_lib is small but it is not listed in supported_c_libs."""
207207
mock_target = mock.MagicMock()
208208
mock_target.core = "Cortex-M4"
209209
mock_target.microlib_supported = False
210210
mock_target.default_lib = "small"
211211
mock_target.supported_c_libs = {"iar": ["std"]}
212212
mock_target.supported_toolchains = ["IAR"]
213-
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXECPTION_STRING.format(mock_target.default_lib)):
213+
with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.default_lib)):
214214
IAR(mock_target)

tools/toolchains/gcc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
5454
default_lib = target.default_lib
5555
elif hasattr(target, "default_build"):
5656
default_lib = target.default_build
57+
else:
58+
raise NotSupportedException("default_lib is an empty")
5759

5860
if default_lib == "small":
5961
common_flags = ["-DMBED_RTOS_SINGLE_THREAD", "-D__NEWLIB_NANO"]

tools/toolchains/mbed_toolchain.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"__MBED_CMSIS_RTOS_CM", "__DSP_PRESENT=1U"],
110110
}
111111

112-
UNSUPPORTED_C_LIB_EXECPTION_STRING = "{} C library option not supported for this target."
112+
UNSUPPORTED_C_LIB_EXCEPTION_STRING = "{} C library option not supported for this target."
113113

114114
class mbedToolchain(with_metaclass(ABCMeta, object)):
115115
OFFICIALLY_SUPPORTED = False
@@ -1099,7 +1099,7 @@ def check_c_lib_supported(self, target, toolchain):
10991099
Check and raise an exception if the requested C library is not supported,
11001100
11011101
target.default_lib is modified to have the lowercased string of its original string.
1102-
This is done to be case insensitvie when validating.
1102+
This is done to be case insensitive when validating.
11031103
"""
11041104
if hasattr(target, "default_lib"):
11051105
target.default_lib = target.default_lib.lower()
@@ -1109,7 +1109,7 @@ def check_c_lib_supported(self, target, toolchain):
11091109
or target.default_lib not in target.supported_c_libs[toolchain]
11101110
):
11111111
raise NotSupportedException(
1112-
UNSUPPORTED_C_LIB_EXECPTION_STRING.format(target.default_lib)
1112+
UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(target.default_lib)
11131113
)
11141114

11151115
@staticmethod

0 commit comments

Comments
 (0)