@@ -10,29 +10,35 @@ set(MBED_APP_JSON_PATH mbed_app.json5)
10
10
include (mbed-os/tools/cmake/app.cmake)
11
11
add_subdirectory (mbed-os)
12
12
13
- project (ArduinoCore-mbed-ce VERSION 1.0 .0) # This is the version of the Mbed CE Arduino core, not of Mbed CE
13
+ project (ArduinoCore-mbed-ce VERSION 1.1 .0) # This is the version of the Mbed CE Arduino core, not of Mbed CE
14
14
15
15
# Figure out variant name. This is generally the same as the mbed target, but we need
16
16
# to handle a few variations (e.g. the _SWD variants of the mbed targets)
17
17
if ("ARDUINO_NANO33BLE" IN_LIST MBED_TARGET_LABELS)
18
18
set (ARDUINO_VARIANT_NAME "ARDUINO_NANO33BLE" )
19
19
elseif ("RASPBERRY_PI_PICO" IN_LIST MBED_TARGET_LABELS)
20
20
set (ARDUINO_VARIANT_NAME "RASPBERRY_PI_PICO" )
21
+ elseif ("ARDUINO_NICLA_SENSE_ME" IN_LIST MBED_TARGET_LABELS)
22
+ set (ARDUINO_VARIANT_NAME "ARDUINO_NICLA_SENSE_ME" )
21
23
else ()
22
24
message (FATAL_ERROR "This MBED_TARGET is currently not supported by the arduino core!" )
23
25
endif ()
24
26
25
27
message (STATUS "Will install Arduino core for ${ARDUINO_VARIANT_NAME} at ${CMAKE_INSTALL_PREFIX} " )
26
28
27
-
28
29
# Compile and install libraries needed by Arduino
29
30
# ---------------------------------------------------------
30
31
31
32
# Pass in version defines for the core
32
- target_compile_definitions (mbed-core-flags INTERFACE
33
- CORE_MAJOR=${ArduinoCore-mbed-ceVERSION_MAJOR}
34
- CORE_MINOR=${ArduinoCore-mbed-ceVERSION_MINOR}
35
- CORE_PATCH=${ArduinoCore-mbed-ceVERSION_PATCH})
33
+ target_compile_definitions (mbed-os PUBLIC
34
+ CORE_MAJOR=${ArduinoCore-mbed-ce_VERSION_MAJOR}
35
+ CORE_MINOR=${ArduinoCore-mbed-ce_VERSION_MINOR}
36
+ CORE_PATCH=${ArduinoCore-mbed-ce_VERSION_PATCH})
37
+
38
+ # Flag to some Mbed and Arduino code that Arduino and Mbed are being used together.
39
+ # It can't be added as a "regular" Mbed define in mbed-target.config.h because there's
40
+ # some code in ArduinoBLE that looks for this define without including Arduino.h.
41
+ target_compile_definitions (mbed-os PUBLIC ARDUINO_ARCH_MBED=1)
36
42
37
43
# Create static library out of mbed-os
38
44
# Note that this library MUST be linked with -Wl,--whole-archive to work.
@@ -62,13 +68,30 @@ set(MBED_LIBS_TO_INSTALL
62
68
mbed-storage-littlefs-v2
63
69
mbed-storage-securestore
64
70
mbed-storage-tdbstore
65
-
66
- # USB
67
- mbed-usb
68
- mbed-usb-cdc-ecm
69
- mbed-usb-msd
70
71
)
71
72
73
+ if ("TARGET_USBDEVICE" IN_LIST MBED_TARGET_LABELS)
74
+ list (APPEND MBED_LIBS_TO_INSTALL
75
+ mbed-usb
76
+ mbed-usb-cdc-ecm
77
+ mbed-usb-msd)
78
+ endif ()
79
+
80
+ if ("FEATURE_BLE=1" IN_LIST MBED_TARGET_DEFINITIONS)
81
+
82
+ # Note: There are circular dependencies between the BLE libraries, so we have to list some of them twice.
83
+ list (APPEND MBED_LIBS_TO_INSTALL
84
+ mbed-ble
85
+ mbed-ble-cordio_ll
86
+ mbed-ble-cordio
87
+ mbed-ble
88
+ mbed-ble-cordio_ll
89
+ mbed-ble-cordio
90
+ mbed-ble
91
+ mbed-ble-cordio_ll
92
+ mbed-ble-cordio)
93
+ endif ()
94
+
72
95
# We also need to know about any precompiled .a files
73
96
# under variants/xxx/libs
74
97
if ("ARDUINO_NANO33BLE" IN_LIST MBED_TARGET_LABELS)
@@ -80,17 +103,20 @@ else()
80
103
set (ARDUINO_PRECOMPILED_A_FILES "" )
81
104
endif ()
82
105
106
+ set (MBED_UNIQUE_LIBS_TO_INSTALL ${MBED_LIBS_TO_INSTALL} )
107
+ list (REMOVE_DUPLICATES MBED_UNIQUE_LIBS_TO_INSTALL)
108
+
83
109
# Minor hack: all of the Mbed optional libraries are marked as EXCLUDE_FROM_ALL, so they won't get built during the build
84
110
# phase, so it will error when trying to install them. To fix this, mark them as dependencies of a target that is in ALL.
85
- add_dependencies (mbed-os-static ${MBED_LIBS_TO_INSTALL } )
111
+ add_dependencies (mbed-os-static ${MBED_UNIQUE_LIBS_TO_INSTALL } )
86
112
87
- install (TARGETS ${MBED_LIBS_TO_INSTALL } DESTINATION "variants/${ARDUINO_VARIANT_NAME} /libs" )
113
+ install (TARGETS ${MBED_UNIQUE_LIBS_TO_INSTALL } DESTINATION "variants/${ARDUINO_VARIANT_NAME} /libs" )
88
114
89
115
# Generate compile option files for Arduino IDE
90
116
# ---------------------------------------------------------
91
117
92
118
# Iterate though the Mbed main build target and the optional targets and collect include dirs / defines / etc.
93
- set (TARGETS_TO_SCAN mbed-os ${MBED_LIBS_TO_INSTALL } )
119
+ set (TARGETS_TO_SCAN mbed-os ${MBED_UNIQUE_LIBS_TO_INSTALL } )
94
120
set (SCANNED_INCLUDE_DIRS "" )
95
121
set (SCANNED_DEFINES "" )
96
122
foreach (TARGET ${TARGETS_TO_SCAN} )
@@ -253,6 +279,7 @@ add_subdirectory(variants)
253
279
add_subdirectory (cores)
254
280
add_subdirectory (svd)
255
281
add_subdirectory (libraries)
282
+ add_subdirectory (debugger)
256
283
257
284
# Set up packaging. We want CMake to build a zip file containing the core.
258
285
set (CPACK_PACKAGE_NAME "ArduinoCore-mbed-ce-${ARDUINO_VARIANT_NAME} -${CMAKE_BUILD_TYPE} " )
0 commit comments