Skip to content

Commit 652a0bd

Browse files
tymoteuszblochmobicaLukasz GniadzikATmobica
authored
Chip uses new Mbed (#179)
* Enable CHIP to use latest Mbed * Update third_party/mbed-os/repo submodule branch * Improve apps CMakeLists - set correct MBED_PATH Fix pigweed app CMakeLists * Add .elf extension to executable file for DISCO debug option * Cleanup apps CMakeLists * Set -Wno-error for mbed pigweed build * Fix pigweed app building Remove -Wno-error for mbed pigweed build Remove passing mbed-cy-psoc6-common-network compilation flags * Improve target's condition in CMakeLists Co-authored-by: Lukasz Gniadzik <lukasz.gniadzik@mobica.com> Co-authored-by: ATmobica <artur.tynecki@mobica.com>
1 parent daf37ce commit 652a0bd

File tree

21 files changed

+89
-130
lines changed

21 files changed

+89
-130
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
[submodule "mbed-os"]
8282
path = third_party/mbed-os/repo
8383
url = https://github.com/ARMmbed/mbed-os.git
84-
branch = feature-chip
84+
branch = master
8585
[submodule "wifi-ism43362"]
8686
path = third_party/wifi-ism43362/repo
8787
url = https://github.com/ATmobica/wifi-ism43362.git

.vscode/launch.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"type": "cortex-debug",
9191
"request": "launch",
9292
"cwd": "${workspaceRoot}/examples/${input:mbedApp}/mbed",
93-
"executable": "./build-CY8CPROTO_062_4343W/${input:mbedDebugProfile}/chip-mbed-${input:mbedApp}-example",
93+
"executable": "./build-CY8CPROTO_062_4343W/${input:mbedDebugProfile}/chip-mbed-${input:mbedApp}-example.elf",
9494
"servertype": "openocd",
9595
"searchDir": [
9696
"${workspaceRoot}/config/mbed/scripts",
@@ -121,7 +121,7 @@
121121
"type": "cortex-debug",
122122
"request": "launch",
123123
"cwd": "${workspaceRoot}/examples/${input:mbedApp}/mbed",
124-
"executable": "./build-CY8CPROTO_062_4343W/${input:mbedDebugProfile}/chip-mbed-${input:mbedApp}-example",
124+
"executable": "./build-CY8CPROTO_062_4343W/${input:mbedDebugProfile}/chip-mbed-${input:mbedApp}-example.elf",
125125
"servertype": "external",
126126
"gdbTarget": "host.docker.internal:3334", //port 3333 for the CM0+, 3334 for the CM4
127127
"overrideLaunchCommands": [
@@ -147,7 +147,7 @@
147147
"type": "cortex-debug",
148148
"request": "launch",
149149
"cwd": "${workspaceRoot}/examples/${input:mbedApp}/mbed",
150-
"executable": "./build-CY8CPROTO_062_4343W/${input:mbedFlashProfile}/chip-mbed-${input:mbedApp}-example",
150+
"executable": "./build-CY8CPROTO_062_4343W/${input:mbedFlashProfile}/chip-mbed-${input:mbedApp}-example.elf",
151151
"servertype": "openocd",
152152
"searchDir": [
153153
"${workspaceRoot}/config/mbed/scripts",
@@ -170,7 +170,7 @@
170170
"type": "cortex-debug",
171171
"request": "launch",
172172
"cwd": "${workspaceRoot}/examples/${input:mbedApp}/mbed",
173-
"executable": "./build-CY8CPROTO_062_4343W/${input:mbedFlashProfile}/chip-mbed-${input:mbedApp}-example.hex",
173+
"executable": "./build-CY8CPROTO_062_4343W/${input:mbedFlashProfile}/chip-mbed-${input:mbedApp}-example.elf",
174174
"servertype": "external",
175175
"gdbTarget": "host.docker.internal:3334", //port 3333 for the CM0+, 3334 for the CM4
176176
"overrideLaunchCommands": [
@@ -187,7 +187,7 @@
187187
"type": "cortex-debug",
188188
"request": "launch",
189189
"cwd": "${workspaceRoot}/examples/${input:mbedApp}/mbed",
190-
"executable": "./build-DISCO_L475VG_IOT01A/${input:mbedDebugProfile}/chip-mbed-${input:mbedApp}-example",
190+
"executable": "./build-DISCO_L475VG_IOT01A/${input:mbedDebugProfile}/chip-mbed-${input:mbedApp}-example.elf",
191191
"servertype": "openocd",
192192
"searchDir": [
193193
"${workspaceRoot}/config/mbed/scripts",
@@ -209,7 +209,7 @@
209209
"type": "cortex-debug",
210210
"request": "launch",
211211
"cwd": "${workspaceRoot}/examples/${input:mbedApp}/mbed",
212-
"executable": "./build-DISCO_L475VG_IOT01A/${input:mbedDebugProfile}/chip-mbed-${input:mbedApp}-example",
212+
"executable": "./build-DISCO_L475VG_IOT01A/${input:mbedDebugProfile}/chip-mbed-${input:mbedApp}-example.elf",
213213
"servertype": "external",
214214
"gdbTarget": "host.docker.internal:3333",
215215
"overrideLaunchCommands": [
@@ -227,7 +227,7 @@
227227
"type": "cortex-debug",
228228
"request": "launch",
229229
"cwd": "${workspaceRoot}/examples/${input:mbedApp}/mbed",
230-
"executable": "./build-DISCO_L475VG_IOT01A/${input:mbedFlashProfile}/chip-mbed-${input:mbedApp}-example",
230+
"executable": "./build-DISCO_L475VG_IOT01A/${input:mbedFlashProfile}/chip-mbed-${input:mbedApp}-example.elf",
231231
"servertype": "openocd",
232232
"searchDir": [
233233
"${workspaceRoot}/config/mbed/scripts",
@@ -248,7 +248,7 @@
248248
"type": "cortex-debug",
249249
"request": "launch",
250250
"cwd": "${workspaceRoot}/examples/${input:mbedApp}/mbed",
251-
"executable": "./build-DISCO_L475VG_IOT01A/${input:mbedFlashProfile}/chip-mbed-${input:mbedApp}-example.hex",
251+
"executable": "./build-DISCO_L475VG_IOT01A/${input:mbedFlashProfile}/chip-mbed-${input:mbedApp}-example.elf",
252252
"servertype": "external",
253253
"gdbTarget": "host.docker.internal:3333",
254254
"overrideLaunchCommands": [
@@ -265,7 +265,7 @@
265265
"type": "cortex-debug",
266266
"request": "launch",
267267
"cwd": "${workspaceRoot}/src/test_driver/mbed/unit_tests",
268-
"executable": "./build-DISCO_L475VG_IOT01A/${input:mbedDebugProfile}/chip-mbed-unit-tests",
268+
"executable": "./build-DISCO_L475VG_IOT01A/${input:mbedDebugProfile}/chip-mbed-unit-tests.elf",
269269
"servertype": "openocd",
270270
"searchDir": [
271271
"${workspaceRoot}/config/mbed/scripts",
@@ -287,7 +287,7 @@
287287
"type": "cortex-debug",
288288
"request": "launch",
289289
"cwd": "${workspaceRoot}/src/test_driver/mbed/unit_tests",
290-
"executable": "./build-CY8CPROTO_062_4343W/${input:mbedDebugProfile}/chip-mbed-unit-tests",
290+
"executable": "./build-CY8CPROTO_062_4343W/${input:mbedDebugProfile}/chip-mbed-unit-tests.elf",
291291
"servertype": "openocd",
292292
"searchDir": [
293293
"${workspaceRoot}/config/mbed/scripts",

config/mbed/CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,32 @@ mbed_get_lang_compile_flags(CHIP_CFLAGS_C mbed-core C)
142142
list(APPEND CHIP_CFLAGS_C ${CMAKE_C_FLAGS_INIT})
143143
mbed_get_lang_compile_flags(CHIP_CFLAGS_CC mbed-core CXX)
144144
list(APPEND CHIP_CFLAGS_CC ${CMAKE_CXX_FLAGS_INIT})
145+
mbed_get_target_common_compile_flags(CHIP_MBEDCMSISCM_CFLAGS mbed-cmsis-cortex-m)
146+
list(APPEND CHIP_CFLAGS ${CHIP_MBEDCMSISCM_CFLAGS})
147+
148+
if(MBED_TARGET STREQUAL "CY8CPROTO_062_4343W")
149+
mbed_get_target_common_compile_flags(CHIP_MBEDCMSISCY8_CFLAGS mbed-cy8cproto-062-4343w)
150+
list(APPEND CHIP_CFLAGS ${CHIP_MBEDCMSISCY8_CFLAGS})
151+
mbed_get_target_common_compile_flags(CHIP_MBEDPSOC6_CFLAGS mbed-psoc6)
152+
list(APPEND CHIP_CFLAGS ${CHIP_MBEDPSOC6_CFLAGS})
153+
mbed_get_target_common_compile_flags(CHIP_MBEDCAT1_CFLAGS mbed-cat1a)
154+
list(APPEND CHIP_CFLAGS ${CHIP_MBEDCAT1_CFLAGS})
155+
mbed_get_target_common_compile_flags(CHIP_MBEDCMSISCY8MODUS_CFLAGS mbed-cy8cproto-062-4343w-bsp-design-modus)
156+
list(APPEND CHIP_CFLAGS ${CHIP_MBEDCMSISCY8MODUS_CFLAGS})
157+
endif()
158+
159+
if(MBED_TARGET STREQUAL "DISCO_L475VG_IOT01A")
160+
mbed_get_target_common_compile_flags(CHIP_MBEDSTM_CFLAGS mbed-stm )
161+
list(APPEND CHIP_CFLAGS ${CHIP_MBEDSTM_CFLAGS})
162+
mbed_get_target_common_compile_flags(CHIP_MBEDCMSISCM_CFLAGS mbed-stm32l4)
163+
list(APPEND CHIP_CFLAGS ${CHIP_MBEDCMSISCM_CFLAGS})
164+
mbed_get_target_common_compile_flags(CHIP_MBEDCSTMCUBE_CFLAGS mbed-stm32l4cube-fw)
165+
list(APPEND CHIP_CFLAGS ${CHIP_MBEDCSTMCUBE_CFLAGS})
166+
mbed_get_target_common_compile_flags(CHIP_MBEDSTML4_CFLAGS mbed-stm32l475xg)
167+
list(APPEND CHIP_CFLAGS ${CHIP_MBEDSTML4_CFLAGS})
168+
mbed_get_target_common_compile_flags(CHIP_MBEDSTML4IOT_CFLAGS mbed-disco-l475vg-iot01a)
169+
list(APPEND CHIP_CFLAGS ${CHIP_MBEDSTML4IOT_CFLAGS})
170+
endif()
145171

146172
# Add support for Mbed BLE
147173
mbed_get_target_common_compile_flags(CHIP_MBEDBLE_CFLAGS mbed-ble)

examples/all-clusters-app/mbed/CMakeLists.txt

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ configure_file(
1414
@ONLY
1515
)
1616

17-
set(MBED_PATH $ENV{MBED_OS_PATH} CACHE INTERNAL "")
17+
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
1818
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
1919
set(APP_TARGET chip-mbed-all-clusters-app-example)
2020

2121
include(${MBED_PATH}/tools/cmake/app.cmake)
2222
add_subdirectory(${MBED_PATH} ./mbed_build)
2323

24-
if("wifi_ism43362" IN_LIST MBED_TARGET_LABELS)
24+
if(MBED_TARGET STREQUAL "DISCO_L475VG_IOT01A")
2525
add_subdirectory(wifi-ism43362)
2626
endif()
2727

@@ -99,29 +99,17 @@ add_subdirectory(${CHIP_ROOT}/config/mbed ./chip_build)
9999

100100
mbed_configure_app_target(${APP_TARGET})
101101

102-
mbed_set_mbed_target_linker_script(${APP_TARGET})
103-
104102
project(${APP_TARGET})
105103

106-
if("wifi_ism43362" IN_LIST MBED_TARGET_LABELS)
107-
target_link_libraries(${APP_TARGET}
108-
wifi-ism43362
109-
)
110-
endif()
111-
112-
if("BlueNRG_MS" IN_LIST MBED_TARGET_LABELS)
113-
target_link_libraries(${APP_TARGET}
114-
mbed-ble-blue_nrg
115-
)
104+
if(MBED_TARGET STREQUAL "DISCO_L475VG_IOT01A")
105+
target_link_libraries(${APP_TARGET} wifi-ism43362)
116106
endif()
117107

118-
if("WHD" IN_LIST MBED_TARGET_LABELS)
119-
target_link_libraries(${APP_TARGET}
120-
mbed-cy_psoc6_common_network mbed-emac mbed-cy_psoc6_whd
121-
)
108+
if(MBED_TARGET STREQUAL "CY8CPROTO_062_4343W")
109+
target_link_libraries(${APP_TARGET} mbed-cy-psoc6-common-network)
122110
endif()
123111

124-
target_link_libraries(${APP_TARGET} mbed-os mbed-ble mbed-events mbed-netsocket mbed-storage mbed-storage-kv-global-api mbed-mbedtls mbed-mbedtls-cryptocell310 chip)
112+
target_link_libraries(${APP_TARGET} mbed-os mbed-ble mbed-events mbed-netsocket mbed-storage mbed-storage-kv-global-api mbed-mbedtls mbed-emac chip)
125113

126114
mbed_set_post_build(${APP_TARGET})
127115

examples/lighting-app/mbed/CMakeLists.txt

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ configure_file(
1414
@ONLY
1515
)
1616

17-
set(MBED_PATH $ENV{MBED_OS_PATH} CACHE INTERNAL "")
17+
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
1818
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
1919
set(APP_TARGET chip-mbed-lighting-app-example)
2020

2121
include(${MBED_PATH}/tools/cmake/app.cmake)
2222
add_subdirectory(${MBED_PATH} ./mbed_build)
2323

24-
if("wifi_ism43362" IN_LIST MBED_TARGET_LABELS)
24+
if(MBED_TARGET STREQUAL "DISCO_L475VG_IOT01A")
2525
add_subdirectory(wifi-ism43362)
2626
endif()
2727

@@ -72,27 +72,15 @@ add_subdirectory(${CHIP_ROOT}/config/mbed ./chip_build)
7272

7373
mbed_configure_app_target(${APP_TARGET})
7474

75-
mbed_set_mbed_target_linker_script(${APP_TARGET})
76-
75+
7776
project(${APP_TARGET})
7877

79-
if("wifi_ism43362" IN_LIST MBED_TARGET_LABELS)
80-
target_link_libraries(${APP_TARGET}
81-
wifi-ism43362
82-
)
83-
endif()
84-
85-
if("BlueNRG_MS" IN_LIST MBED_TARGET_LABELS)
86-
target_link_libraries(${APP_TARGET}
87-
mbed-ble-blue_nrg
88-
)
78+
if(MBED_TARGET STREQUAL "DISCO_L475VG_IOT01A")
79+
target_link_libraries(${APP_TARGET} wifi-ism43362)
8980
endif()
9081

91-
92-
if("WHD" IN_LIST MBED_TARGET_LABELS)
93-
target_link_libraries(${APP_TARGET}
94-
mbed-cy_psoc6_common_network mbed-emac mbed-cy_psoc6_whd
95-
)
82+
if(MBED_TARGET STREQUAL "CY8CPROTO_062_4343W")
83+
target_link_libraries(${APP_TARGET} mbed-cy-psoc6-common-network)
9684
endif()
9785

9886
if("capsense" IN_LIST MBED_TARGET_LABELS)
@@ -106,7 +94,7 @@ if("capsense" IN_LIST MBED_TARGET_LABELS)
10694
target_link_libraries(${APP_TARGET} capsense ${CAPSENSE_LIB})
10795
endif()
10896

109-
target_link_libraries(${APP_TARGET} mbed-os mbed-ble mbed-events mbed-netsocket mbed-storage mbed-storage-kv-global-api mbed-mbedtls mbed-mbedtls-cryptocell310 chip)
97+
target_link_libraries(${APP_TARGET} mbed-os mbed-ble mbed-events mbed-netsocket mbed-storage mbed-storage-kv-global-api mbed-mbedtls mbed-emac chip)
11098

11199
mbed_set_post_build(${APP_TARGET})
112100

examples/lighting-app/mbed/mbed_app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"CORDIO"
3131
],
3232
"led-active-state": 1,
33-
"lighting-button": "USER_BUTTON",
33+
"lighting-button": "BUTTON1",
3434
"function-button": "NC"
3535
},
3636
"CY8CPROTO_062_4343W": {

examples/lock-app/mbed/CMakeLists.txt

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ configure_file(
1414
@ONLY
1515
)
1616

17-
set(MBED_PATH $ENV{MBED_OS_PATH} CACHE INTERNAL "")
17+
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
1818
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
1919
set(APP_TARGET chip-mbed-lock-app-example)
2020

2121
include(${MBED_PATH}/tools/cmake/app.cmake)
2222
add_subdirectory(${MBED_PATH} ./mbed_build)
2323

24-
if("wifi_ism43362" IN_LIST MBED_TARGET_LABELS)
24+
if(MBED_TARGET STREQUAL "DISCO_L475VG_IOT01A")
2525
add_subdirectory(wifi-ism43362)
2626
endif()
2727

@@ -71,26 +71,14 @@ add_subdirectory(${CHIP_ROOT}/config/mbed ./chip_build)
7171

7272
mbed_configure_app_target(${APP_TARGET})
7373

74-
mbed_set_mbed_target_linker_script(${APP_TARGET})
75-
7674
project(${APP_TARGET})
7775

78-
if("wifi_ism43362" IN_LIST MBED_TARGET_LABELS)
79-
target_link_libraries(${APP_TARGET}
80-
wifi-ism43362
81-
)
82-
endif()
83-
84-
if("BlueNRG_MS" IN_LIST MBED_TARGET_LABELS)
85-
target_link_libraries(${APP_TARGET}
86-
mbed-ble-blue_nrg
87-
)
76+
if(MBED_TARGET STREQUAL "DISCO_L475VG_IOT01A")
77+
target_link_libraries(${APP_TARGET} wifi-ism43362)
8878
endif()
8979

90-
if("WHD" IN_LIST MBED_TARGET_LABELS)
91-
target_link_libraries(${APP_TARGET}
92-
mbed-cy_psoc6_common_network mbed-emac mbed-cy_psoc6_whd
93-
)
80+
if(MBED_TARGET STREQUAL "CY8CPROTO_062_4343W")
81+
target_link_libraries(${APP_TARGET} mbed-cy-psoc6-common-network)
9482
endif()
9583

9684
if("capsense" IN_LIST MBED_TARGET_LABELS)
@@ -104,7 +92,7 @@ if("capsense" IN_LIST MBED_TARGET_LABELS)
10492
target_link_libraries(${APP_TARGET} capsense ${CAPSENSE_LIB})
10593
endif()
10694

107-
target_link_libraries(${APP_TARGET} mbed-os mbed-ble mbed-events mbed-netsocket mbed-storage mbed-storage-kv-global-api mbed-mbedtls mbed-mbedtls-cryptocell310 chip)
95+
target_link_libraries(${APP_TARGET} mbed-os mbed-ble mbed-events mbed-netsocket mbed-storage mbed-storage-kv-global-api mbed-mbedtls mbed-emac chip)
10896

10997
mbed_set_post_build(${APP_TARGET})
11098

examples/lock-app/mbed/mbed_app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"CORDIO"
3131
],
3232
"led-active-state": 1,
33-
"lock-button": "USER_BUTTON",
33+
"lock-button": "BUTTON1",
3434
"function-button": "NC"
3535
},
3636
"CY8CPROTO_062_4343W": {

examples/pigweed-app/mbed/CMakeLists.txt

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ configure_file(
1313
@ONLY
1414
)
1515

16-
set(MBED_PATH $ENV{MBED_OS_PATH} CACHE INTERNAL "")
16+
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
1717
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
1818
set(APP_TARGET chip-mbed-pigweed-app-example)
1919

2020
include(${MBED_PATH}/tools/cmake/app.cmake)
2121
add_subdirectory(${MBED_PATH} ./mbed_build)
2222

23-
if("wifi_ism43362" IN_LIST MBED_TARGET_LABELS)
23+
if(MBED_TARGET STREQUAL "DISCO_L475VG_IOT01A")
2424
add_subdirectory(wifi-ism43362)
2525
endif()
2626

@@ -42,29 +42,17 @@ add_subdirectory(${CHIP_ROOT}/config/mbed ./chip_build)
4242

4343
mbed_configure_app_target(${APP_TARGET})
4444

45-
mbed_set_mbed_target_linker_script(${APP_TARGET})
46-
4745
project(${APP_TARGET})
4846

49-
if("wifi_ism43362" IN_LIST MBED_TARGET_LABELS)
50-
target_link_libraries(${APP_TARGET}
51-
wifi-ism43362
52-
)
53-
endif()
54-
55-
if("BlueNRG_MS" IN_LIST MBED_TARGET_LABELS)
56-
target_link_libraries(${APP_TARGET}
57-
mbed-ble-blue_nrg
58-
)
47+
if(MBED_TARGET STREQUAL "DISCO_L475VG_IOT01A")
48+
target_link_libraries(${APP_TARGET} wifi-ism43362)
5949
endif()
6050

61-
if("WHD" IN_LIST MBED_TARGET_LABELS)
62-
target_link_libraries(${APP_TARGET}
63-
mbed-cy_psoc6_common_network mbed-emac mbed-cy_psoc6_whd
64-
)
51+
if(MBED_TARGET STREQUAL "CY8CPROTO_062_4343W")
52+
target_link_libraries(${APP_TARGET} mbed-cy-psoc6-common-network)
6553
endif()
6654

67-
target_link_libraries(${APP_TARGET} mbed-os mbed-ble mbed-events mbed-netsocket mbed-storage mbed-storage-kv-global-api mbed-mbedtls mbed-mbedtls-cryptocell310 chip)
55+
target_link_libraries(${APP_TARGET} mbed-os mbed-ble mbed-events mbed-netsocket mbed-storage mbed-storage-kv-global-api mbed-mbedtls mbed-emac chip)
6856

6957
mbed_set_post_build(${APP_TARGET})
7058

0 commit comments

Comments
 (0)