From c489c213a7ce0245f31ffd325883047853a46ae2 Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Fri, 15 May 2020 16:52:50 +0100 Subject: [PATCH 1/9] build api: fix release version This is non trivial fix as the function is being used outside of this repository. Tools rely on it to return list of targets for 2 or 5. As we removed release_version from many targets, this broke the logic. To keep the logic as it was, without updating all tools out there now, lets just return full set of targets - all are supported. In case for Mbed 2, returning all targets does not make sense, but rather raise an exception here. Not supported. This avoids suprised. If you look at build api functions there are many checks for 2 or 5 so more clean up needed to actually get release_version out of the tools. --- tools/build_api.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tools/build_api.py b/tools/build_api.py index 8da1666d48..b7c3a2158b 100755 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -411,26 +411,25 @@ def get_mbed_official_release(version): RELEASE_VERSIONS """ + # we ignore version for Mbed 6 as all targets in targets.json file are being supported + # if someone passes 2, we return emtpy tuple, if 5, we keep the behavior the same as + # release version is deprecated and all targets are being supported that are present + # in targets.json file + + if version == `2`: + raise InvalidReleaseTargetException("Mbed 2 not supported anymore with this version of tools") + mbed_official_release = ( tuple( tuple( [ TARGET_MAP[target].name, - tuple(transform_release_toolchains( - TARGET_MAP[target], version)) + tuple('ARM', 'GCC_ARM') ] - ) for target in TARGET_NAMES \ - if (hasattr(TARGET_MAP[target], 'release_versions') - and version in TARGET_MAP[target].release_versions) + ) for target in TARGET_NAMES ) ) - for target in mbed_official_release: - is_official, reason = is_official_target(target[0], version) - - if not is_official: - raise InvalidReleaseTargetException(reason) - return mbed_official_release def target_supports_toolchain(target, toolchain_name): From caf58a7a441a80a0675a8a8060add0f598bc7926 Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Fri, 15 May 2020 22:26:54 +0200 Subject: [PATCH 2/9] tools/build_api: fix wording Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com> --- tools/build_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_api.py b/tools/build_api.py index b7c3a2158b..45df128488 100755 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -417,7 +417,7 @@ def get_mbed_official_release(version): # in targets.json file if version == `2`: - raise InvalidReleaseTargetException("Mbed 2 not supported anymore with this version of tools") + raise InvalidReleaseTargetException("Mbed 2 is no longer supported with this version of the tools") mbed_official_release = ( tuple( From 6e59bdd64dfa4aee39c7a9c1529e345bbbd45d3e Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Sat, 16 May 2020 10:12:06 +0200 Subject: [PATCH 3/9] build: fix error syntax --- tools/build_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_api.py b/tools/build_api.py index 45df128488..cf27755fbb 100755 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -416,7 +416,7 @@ def get_mbed_official_release(version): # release version is deprecated and all targets are being supported that are present # in targets.json file - if version == `2`: + if version == '2': raise InvalidReleaseTargetException("Mbed 2 is no longer supported with this version of the tools") mbed_official_release = ( From 810b0262c15e96cb08b6ce6cd8f4b3251acde0fb Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Mon, 18 May 2020 07:37:23 +0100 Subject: [PATCH 4/9] tools build: fix toolchain tuple, should be list --- tools/build_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_api.py b/tools/build_api.py index cf27755fbb..5f6ed3af67 100755 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -424,7 +424,7 @@ def get_mbed_official_release(version): tuple( [ TARGET_MAP[target].name, - tuple('ARM', 'GCC_ARM') + tuple(['ARM', 'GCC_ARM']) ] ) for target in TARGET_NAMES ) From 59db9f692ff24aa16f062092d9428fb44d768e34 Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Mon, 18 May 2020 08:17:14 +0100 Subject: [PATCH 5/9] tools build: return empty list for mbed2 We cant afford to raise an exception now. As anyone using this out there do not catch it. Rather an empty list, as it can work after this fix - won't do anything. --- tools/build_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build_api.py b/tools/build_api.py index 5f6ed3af67..2206f229b2 100755 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -412,12 +412,12 @@ def get_mbed_official_release(version): """ # we ignore version for Mbed 6 as all targets in targets.json file are being supported - # if someone passes 2, we return emtpy tuple, if 5, we keep the behavior the same as + # if someone passes 2, we return empty tuple, if 5, we keep the behavior the same as # release version is deprecated and all targets are being supported that are present # in targets.json file if version == '2': - raise InvalidReleaseTargetException("Mbed 2 is no longer supported with this version of the tools") + return tuple(tuple([])) mbed_official_release = ( tuple( From 5df3c91e1d685d8cca7fe8976fc5c5d7f0e8db57 Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Mon, 18 May 2020 11:17:29 +0100 Subject: [PATCH 6/9] RZ_A1XX: public set to false as its base target --- targets/targets.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/targets/targets.json b/targets/targets.json index 78b5074bc7..1a2353df0b 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -4745,6 +4745,7 @@ "inherits": [ "Target" ], + "public": false, "core": "Cortex-A9", "supported_toolchains": [ "ARM", @@ -7496,4 +7497,4 @@ "version": "1", "public": false } -} \ No newline at end of file +} From 07084a5212ffa133ac4912928ca21895c2159921 Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Mon, 18 May 2020 19:31:19 +0100 Subject: [PATCH 7/9] tools build: add profile To select supported_application_profiles attribute from targets --- tools/build_api.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/build_api.py b/tools/build_api.py index 2206f229b2..20ec02f4c4 100755 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -400,7 +400,7 @@ def transform_release_toolchains(target, version): else: return target.supported_toolchains -def get_mbed_official_release(version): +def get_mbed_official_release(version, profile=None): """ Given a release version string, return a tuple that contains a target and the supported toolchains for that release. Ex. Given '2', return (('LPC1768', ('ARM', 'GCC_ARM')), @@ -426,7 +426,8 @@ def get_mbed_official_release(version): TARGET_MAP[target].name, tuple(['ARM', 'GCC_ARM']) ] - ) for target in TARGET_NAMES + ) for target in TARGET_NAMES \ + if not profile or profile in TARGET_MAP[target].supported_application_profiles ) ) From d6fbda35d7df6c0025e6ee22004e09c5ccf5c04c Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Mon, 18 May 2020 19:39:40 +0100 Subject: [PATCH 8/9] targets: add rtos profile by default Every target is assumed to supported Mbed OS. If its not the case, it supports only baremetal. Thus removing rtos, and adding bare-metal to the app profile. --- targets/targets.json | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/targets/targets.json b/targets/targets.json index 1a2353df0b..fb9cdab44b 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -32,6 +32,9 @@ "std" ] }, + "supported_application_profiles": [ + "rtos" + ], "config": { "console-uart": { "help": "Target has UART console on pins STDIO_UART_TX, STDIO_UART_RX. Value is only significant if target has SERIAL device.", @@ -313,7 +316,12 @@ ] }, "c_lib": "small", - "supported_application_profiles": ["bare-metal"], + "supported_application_profiles_add": [ + "bare-metal" + ], + "supported_application_profiles_remove": [ + "rtos" + ], "device_name": "LPC1114FN28/102", "detect_code": [ "1114" @@ -1225,9 +1233,12 @@ ], "public": false, "c_lib": "small", - "supported_application_profiles": [ + "supported_application_profiles_add": [ "bare-metal" ], + "supported_application_profiles_remove": [ + "rtos" + ], "overrides": { "boot-stack-size": "0x400" } @@ -5915,9 +5926,12 @@ ] }, "c_lib": "small", - "supported_application_profiles": [ + "supported_application_profiles_add": [ "bare-metal" ], + "supported_application_profiles_remove": [ + "rtos" + ], "sectors": [ [ 0, @@ -6023,9 +6037,12 @@ ] }, "c_lib": "small", - "supported_application_profiles": [ + "supported_application_profiles_add": [ "bare-metal" ], + "supported_application_profiles_remove": [ + "rtos" + ], "device_name": "NANO130KE3BN", "overrides": { "deep-sleep-latency": 1, From 9b4cddd16a31d153ad4e2e0275233a05c095b0a0 Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Mon, 18 May 2020 19:47:38 +0100 Subject: [PATCH 9/9] targets: enable baremetal by default For only baremetal targets, just drop in replace. Don't need to add/remove. --- targets/targets.json | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/targets/targets.json b/targets/targets.json index fb9cdab44b..6dba5b75b2 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -33,7 +33,8 @@ ] }, "supported_application_profiles": [ - "rtos" + "rtos", + "bare-metal" ], "config": { "console-uart": { @@ -316,12 +317,9 @@ ] }, "c_lib": "small", - "supported_application_profiles_add": [ + "supported_application_profiles": [ "bare-metal" ], - "supported_application_profiles_remove": [ - "rtos" - ], "device_name": "LPC1114FN28/102", "detect_code": [ "1114" @@ -1233,12 +1231,9 @@ ], "public": false, "c_lib": "small", - "supported_application_profiles_add": [ + "supported_application_profiles": [ "bare-metal" ], - "supported_application_profiles_remove": [ - "rtos" - ], "overrides": { "boot-stack-size": "0x400" } @@ -5926,12 +5921,9 @@ ] }, "c_lib": "small", - "supported_application_profiles_add": [ + "supported_application_profiles": [ "bare-metal" ], - "supported_application_profiles_remove": [ - "rtos" - ], "sectors": [ [ 0, @@ -6037,12 +6029,9 @@ ] }, "c_lib": "small", - "supported_application_profiles_add": [ + "supported_application_profiles": [ "bare-metal" ], - "supported_application_profiles_remove": [ - "rtos" - ], "device_name": "NANO130KE3BN", "overrides": { "deep-sleep-latency": 1,