Skip to content

Commit 3f22400

Browse files
committed
Merge pull request #272 from ARMmbed/device-feature-rebase
Rebase FEATURE_ functionality and apply device_has patch
2 parents 36206c1 + 92b88f4 commit 3f22400

File tree

13 files changed

+23
-21
lines changed

13 files changed

+23
-21
lines changed

mbed.lib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://github.com/mbedmicro/mbed/#d7a196e89e14144bb749ebc9227f0704f4712323
1+
https://github.com/mbedmicro/mbed/#24e767c10f1beb4ad9d2496360ea972be2c02595

tools/targets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def wrapper(*args, **kwargs):
5858
class Target:
5959
# Cumulative attributes can have values appended to them, so they
6060
# need to be computed differently than regular attributes
61-
__cumulative_attributes = ['extra_labels', 'macros', 'features']
61+
__cumulative_attributes = ['extra_labels', 'macros', 'device_has', 'features']
6262

6363
# {target_name: target_instance} map for all the targets in the system
6464
__target_map = {}

tools/test/config_test/test01/mbed_app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"custom_targets": {
33
"b1": {
4+
"inherits": ["Target"],
45
"core": "Cortex-M0",
5-
"extra_labels": [],
66
"config": {
77
"base1_1": "v_base1_1_b1",
88
"base1_2": "v_base1_2_b1",

tools/test/config_test/test02/mbed_app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"custom_targets": {
33
"b1": {
4+
"inherits": ["Target"],
45
"core": "Cortex-M0",
5-
"extra_labels": [],
66
"config": {
77
"base1_1": "v_base1_1_b1",
88
"base1_2": "v_base1_2_b1",

tools/test/config_test/test03/mbed_app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"custom_targets": {
33
"b1": {
4+
"inherits": ["Target"],
45
"core": "Cortex-M0",
5-
"extra_labels": [],
66
"config": {
77
"base1_1": "v_base1_1_b1",
88
"base1_2": "v_base1_2_b1",

tools/test/config_test/test04/mbed_app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"custom_targets": {
33
"b1": {
4+
"inherits": ["Target"],
45
"core": "Cortex-M0",
5-
"extra_labels": [],
66
"config": {
77
"base1_1": "v_base1_1_b1",
88
"base1_2": "v_base1_2_b1",
@@ -21,8 +21,8 @@
2121
}
2222
},
2323
"b2": {
24+
"inherits": ["Target"],
2425
"core": "Cortex-M0",
25-
"extra_labels": [],
2626
"config": {
2727
"base2_1": "v_base2_1_b2",
2828
"base2_2": "v_base2_2_b2",

tools/test/config_test/test05/mbed_app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"custom_targets": {
33
"base": {
4-
"core": "Cortex-M0",
5-
"extra_labels": []
4+
"inherits": ["Target"],
5+
"core": "Cortex-M0"
66
},
77
"b1": {
88
"inherits": ["base"],

tools/test/config_test/test06/mbed_app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"custom_targets": {
33
"base": {
4-
"core": "Cortex-M0",
5-
"extra_labels": []
4+
"inherits": ["Target"],
5+
"core": "Cortex-M0"
66
},
77
"b1": {
88
"inherits": ["base"],

tools/test/config_test/test07/mbed_app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"custom_targets": {
33
"base": {
4-
"core": "Cortex-M0",
5-
"extra_labels": []
4+
"inherits": ["Target"],
5+
"core": "Cortex-M0"
66
},
77
"b1": {
88
"inherits": ["base"],

tools/test/config_test/test08/mbed_app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"custom_targets": {
33
"base": {
4+
"inherits": ["Target"],
45
"core": "Cortex-M0",
5-
"extra_labels": [],
66
"config": {
77
"par1": "v_par1_base",
88
"par2": "v_par2_base",

tools/test/config_test/test09/mbed_app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"custom_targets": {
33
"base": {
4-
"core": "Cortex-M0",
5-
"extra_labels": []
4+
"inherits": ["Target"],
5+
"core": "Cortex-M0"
66
},
77
"b1": {
88
"inherits": ["base"],

tools/test/config_test/test10/mbed_app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"custom_targets": {
33
"base": {
4+
"inherits": ["Target"],
45
"core": "Cortex-M0",
5-
"extra_labels": [],
66
"config": {
77
"par1": "v_par1_base",
88
"par2": "v_par2_base",

tools/toolchains/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ def get_symbols(self):
307307
# Target and Toolchain symbols
308308
labels = self.get_labels()
309309
self.symbols = ["TARGET_%s" % t for t in labels['TARGET']]
310+
self.symbols.extend(["FEATURE_%s" % t for t in labels['FEATURE']])
310311
self.symbols.extend(["TOOLCHAIN_%s" % t for t in labels['TOOLCHAIN']])
311312

312313
# Config support
@@ -325,10 +326,9 @@ def get_symbols(self):
325326
# Add target's symbols
326327
self.symbols += self.target.macros
327328
# Add target's hardware
328-
try :
329-
self.symbols += ["DEVICE_" + feature + "=1" for feature in self.target.features]
330-
except AttributeError :
331-
pass
329+
self.symbols += ["DEVICE_" + data + "=1" for data in self.target.device_has]
330+
# Add target's features
331+
self.symbols += ["FEATURE_" + data + "=1" for data in self.target.features]
332332
# Add extra symbols passed via 'macros' parameter
333333
self.symbols += self.macros
334334

@@ -348,6 +348,7 @@ def get_labels(self):
348348
toolchain_labels.remove('mbedToolchain')
349349
self.labels = {
350350
'TARGET': self.target.get_labels() + ["DEBUG" if "debug-info" in self.options else "RELEASE"],
351+
'FEATURE': self.target.features,
351352
'TOOLCHAIN': toolchain_labels
352353
}
353354
return self.labels
@@ -415,6 +416,7 @@ def scan_resources(self, path, exclude_paths=None):
415416

416417
if ((d.startswith('.') or d in self.legacy_ignore_dirs) or
417418
(d.startswith('TARGET_') and d[7:] not in labels['TARGET']) or
419+
(d.startswith('FEATURE_') and d[8:] not in labels['FEATURE']) or
418420
(d.startswith('TOOLCHAIN_') and d[10:] not in labels['TOOLCHAIN']) or
419421
(d == 'TESTS')):
420422
dirs.remove(d)

0 commit comments

Comments
 (0)