Skip to content

Commit 1a2b719

Browse files
Use Pydantic schemas to validate Mbed's JSON files (part 1) (#516)
* Start on using pydantic schemas. mbed_lib.json schema working! * Start on schema for targets.json5 * Schema almost done, start removing old stuff from targets.json5 * Add memory bank schema * Still crunching away on targets.json5 * Finish targets.json5 logic, appears to generate config correctly! * Implement schema for mbed_app.json5 * Fix tests * Use `Self` * Use legacy Union * Install eval_type_backport * Fix another union to be legacy * Import future annotations * Another one * Another * OK let's do this for every remaining python file * Fix compatibility with pydantic<2.12 * Fix test building in baremetal (due to previously ignored JSON configs now being used) * One more * options -> accepted_values * Resolve lint errors * Fix wdt-reset-workaround option * Baremetal for everything! * Fix trying to build emac test on baremetal * Also fix wifi test building * Disable building BlueNRG tests with baremetal * Fix infinite recursion, disable kvstore test on baremetal * Respond to comments
1 parent 85dbbac commit 1a2b719

File tree

61 files changed

+1291
-2047
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1291
-2047
lines changed

.github/workflows/greentea_cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ jobs:
133133
apt-get update
134134
apt-get install -y python3-venv
135135
136+
# Always build with baremetal profile, as it should work with every target
136137
- name: Build ${{ matrix.target }} with baremetal profile
137-
if: ${{ matrix.profile == 'baremetal' }}
138138
# Note: We have to set a wifi network name and password so that the test will compile on devices that use wifi
139139
run: |
140140
rm -rf __build

TESTS/configs/greentea_baremetal.json5

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
{
2-
"target_overrides": {
3-
"*": {
4-
"target.c_lib": "small",
5-
"target.application-profile": "bare-metal"
6-
}
7-
},
82
"overrides": {
3+
"target.c_lib": "small",
4+
5+
"target.application-profile": "bare-metal",
6+
97
// Enable Mbed Stats tests
108
"platform.all-stats-enabled": 1,
119

cmsis/device/rtos/mbed_lib.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
22
"name": "rtos",
33
"config": {
4-
"rtos": {
5-
"help": "Select RTOS (RTX or N/A)",
6-
"value": "RTX"
7-
},
8-
"present": 1,
4+
"rtos": {
5+
"help": "Select RTOS (RTX or N/A)",
6+
"value": "RTX"
7+
},
98
"main-thread-stack-size": {
109
"help": "The size of the main thread's stack",
1110
"value": 4096

connectivity/FEATURE_BLE/mbed_lib.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "ble",
3-
"requires": ["ble-api-implementation"],
43
"config": {
54
"present": 1,
65
"ble-role-observer": {

connectivity/FEATURE_BLE/source/cordio/TESTS/cordio_hci/driver/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
if("BlueNRG_2" IN_LIST MBED_TARGET_LABELS OR "BlueNRG_MS" IN_LIST MBED_TARGET_LABELS)
5+
if(APPLICATION_PROFILE_CONFIG_BAREMETAL)
6+
set(TEST_SKIPPED "BlueNRG bluetooth modules require an RTOS!")
7+
endif()
8+
endif()
9+
10+
411
mbed_greentea_add_test(
512
TEST_NAME
613
mbed-connectivity-ble-cordio-hci-driver
14+
TEST_SKIPPED
15+
${TEST_SKIPPED}
716
TEST_SOURCES
817
main.cpp
918
TEST_REQUIRED_LIBS

connectivity/FEATURE_BLE/source/cordio/TESTS/cordio_hci/transport/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ if("CORDIO_ZERO_COPY_HCI" IN_LIST MBED_CONFIG_DEFINITIONS OR "CORDIO_ZERO_COPY_H
55
set(TEST_SKIPPED "Test not relevant for zero copy hci.")
66
endif()
77

8+
if("BlueNRG_2" IN_LIST MBED_TARGET_LABELS OR "BlueNRG_MS" IN_LIST MBED_TARGET_LABELS)
9+
if(APPLICATION_PROFILE_CONFIG_BAREMETAL)
10+
set(TEST_SKIPPED "BlueNRG bluetooth modules require an RTOS!")
11+
endif()
12+
endif()
13+
814
mbed_greentea_add_test(
915
TEST_NAME
1016
mbed-connectivity-ble-cordio-hci-transport

connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ ble::SecurityManager &BLEInstanceBase::getSecurityManager()
317317

318318
const ble::SecurityManager &BLEInstanceBase::getSecurityManager() const
319319
{
320-
const BLEInstanceBase &self = const_cast<BLEInstanceBase &>(*this);
320+
BLEInstanceBase &self = const_cast<BLEInstanceBase &>(*this);
321321
return const_cast<const ble::SecurityManager &>(self.getSecurityManager());
322322
}
323323
#endif // BLE_FEATURE_SECURITY

connectivity/drivers/ble/FEATURE_BLE/COMPONENT_BlueNRG_2/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
# This driver needs the RTOS
5+
if(APPLICATION_PROFILE_CONFIG_BAREMETAL)
6+
return()
7+
endif()
8+
49
add_library(mbed-bluenrg2 STATIC EXCLUDE_FROM_ALL
510
BlueNrg2HCIDriver.cpp)
611

connectivity/drivers/ble/FEATURE_BLE/COMPONENT_BlueNRG_MS/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
# This driver needs the RTOS
5+
if(APPLICATION_PROFILE_CONFIG_BAREMETAL)
6+
return()
7+
endif()
8+
49
add_library(mbed-bluenrg-ms STATIC EXCLUDE_FROM_ALL
510
BlueNrgMsHCIDriver.cpp)
611

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"name": "cordio-stm32wb",
3-
"requires": ["cordio", "ble"]
2+
"name": "cordio-stm32wb"
43
}

0 commit comments

Comments
 (0)