Merge pull request #272 from ARMmbed/device-feature-rebase

Rebase FEATURE_ functionality and apply device_has patch
Mihail Stoyanov 2016-06-09 17:28:47 +01:00
commit 3f22400a89
13 changed files with 23 additions and 21 deletions

View File

@ -1 +1 @@
https://github.com/mbedmicro/mbed/#d7a196e89e14144bb749ebc9227f0704f4712323
https://github.com/mbedmicro/mbed/#24e767c10f1beb4ad9d2496360ea972be2c02595

View File

@ -58,7 +58,7 @@ def cached(func):
class Target:
# Cumulative attributes can have values appended to them, so they
# need to be computed differently than regular attributes
__cumulative_attributes = ['extra_labels', 'macros', 'features']
__cumulative_attributes = ['extra_labels', 'macros', 'device_has', 'features']
# {target_name: target_instance} map for all the targets in the system
__target_map = {}

View File

@ -1,8 +1,8 @@
{
"custom_targets": {
"b1": {
"inherits": ["Target"],
"core": "Cortex-M0",
"extra_labels": [],
"config": {
"base1_1": "v_base1_1_b1",
"base1_2": "v_base1_2_b1",

View File

@ -1,8 +1,8 @@
{
"custom_targets": {
"b1": {
"inherits": ["Target"],
"core": "Cortex-M0",
"extra_labels": [],
"config": {
"base1_1": "v_base1_1_b1",
"base1_2": "v_base1_2_b1",

View File

@ -1,8 +1,8 @@
{
"custom_targets": {
"b1": {
"inherits": ["Target"],
"core": "Cortex-M0",
"extra_labels": [],
"config": {
"base1_1": "v_base1_1_b1",
"base1_2": "v_base1_2_b1",

View File

@ -1,8 +1,8 @@
{
"custom_targets": {
"b1": {
"inherits": ["Target"],
"core": "Cortex-M0",
"extra_labels": [],
"config": {
"base1_1": "v_base1_1_b1",
"base1_2": "v_base1_2_b1",
@ -21,8 +21,8 @@
}
},
"b2": {
"inherits": ["Target"],
"core": "Cortex-M0",
"extra_labels": [],
"config": {
"base2_1": "v_base2_1_b2",
"base2_2": "v_base2_2_b2",

View File

@ -1,8 +1,8 @@
{
"custom_targets": {
"base": {
"core": "Cortex-M0",
"extra_labels": []
"inherits": ["Target"],
"core": "Cortex-M0"
},
"b1": {
"inherits": ["base"],

View File

@ -1,8 +1,8 @@
{
"custom_targets": {
"base": {
"core": "Cortex-M0",
"extra_labels": []
"inherits": ["Target"],
"core": "Cortex-M0"
},
"b1": {
"inherits": ["base"],

View File

@ -1,8 +1,8 @@
{
"custom_targets": {
"base": {
"core": "Cortex-M0",
"extra_labels": []
"inherits": ["Target"],
"core": "Cortex-M0"
},
"b1": {
"inherits": ["base"],

View File

@ -1,8 +1,8 @@
{
"custom_targets": {
"base": {
"inherits": ["Target"],
"core": "Cortex-M0",
"extra_labels": [],
"config": {
"par1": "v_par1_base",
"par2": "v_par2_base",

View File

@ -1,8 +1,8 @@
{
"custom_targets": {
"base": {
"core": "Cortex-M0",
"extra_labels": []
"inherits": ["Target"],
"core": "Cortex-M0"
},
"b1": {
"inherits": ["base"],

View File

@ -1,8 +1,8 @@
{
"custom_targets": {
"base": {
"inherits": ["Target"],
"core": "Cortex-M0",
"extra_labels": [],
"config": {
"par1": "v_par1_base",
"par2": "v_par2_base",

View File

@ -307,6 +307,7 @@ class mbedToolchain:
# Target and Toolchain symbols
labels = self.get_labels()
self.symbols = ["TARGET_%s" % t for t in labels['TARGET']]
self.symbols.extend(["FEATURE_%s" % t for t in labels['FEATURE']])
self.symbols.extend(["TOOLCHAIN_%s" % t for t in labels['TOOLCHAIN']])
# Config support
@ -325,10 +326,9 @@ class mbedToolchain:
# Add target's symbols
self.symbols += self.target.macros
# Add target's hardware
try :
self.symbols += ["DEVICE_" + feature + "=1" for feature in self.target.features]
except AttributeError :
pass
self.symbols += ["DEVICE_" + data + "=1" for data in self.target.device_has]
# Add target's features
self.symbols += ["FEATURE_" + data + "=1" for data in self.target.features]
# Add extra symbols passed via 'macros' parameter
self.symbols += self.macros
@ -348,6 +348,7 @@ class mbedToolchain:
toolchain_labels.remove('mbedToolchain')
self.labels = {
'TARGET': self.target.get_labels() + ["DEBUG" if "debug-info" in self.options else "RELEASE"],
'FEATURE': self.target.features,
'TOOLCHAIN': toolchain_labels
}
return self.labels
@ -415,6 +416,7 @@ class mbedToolchain:
if ((d.startswith('.') or d in self.legacy_ignore_dirs) or
(d.startswith('TARGET_') and d[7:] not in labels['TARGET']) or
(d.startswith('FEATURE_') and d[8:] not in labels['FEATURE']) or
(d.startswith('TOOLCHAIN_') and d[10:] not in labels['TOOLCHAIN']) or
(d == 'TESTS')):
dirs.remove(d)