You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/porting/target/cmake.md
+46-14Lines changed: 46 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,8 @@ Note: All the CMake variables above are generated by mbed-tools and their values
17
17
18
18
We still support mbed-cli 1 and its requirements for the folders naming. To stay backward compatible, we still use the same naming even with CMake.
19
19
20
+
Each Mbed OS target should be prefixed with `mbed-`. We translate automatically Mbed OS target names from targets.json to CMake targets. A target from targets.json named `CYSBSYSKIT_01` has CMake target `mbed-cysbsyskit-01`.
21
+
20
22
### Vendor selection
21
23
22
24
Vendor selection is handled in [`targets/CMakeLists.txt`](https://github.com/ARMmbed/mbed-os/blob/master/targets/CMakeLists.txt). The matching directory is added to directories to build.
# Add the include directories accessible from this directory that are not specific to an MCU family or Mbed target
52
-
target_include_directories(mbed-core
50
+
target_include_directories(mbed-psoc6
53
51
INTERFACE
54
52
...
55
53
)
56
54
57
55
# Add the source files accessible from this directory that are not specific to an MCU family or Mbed target
58
-
target_sources(mbed-core
56
+
target_sources(mbed-psoc6
59
57
INTERFACE
60
58
...
61
59
)
62
60
```
63
61
62
+
The board target can link to `mbed-psoc6`. Let's take `mbed-cysbsyskit-01` target:
63
+
64
+
```
65
+
add_library(mbed-cysbsyskit-01 INTERFACE)
66
+
67
+
target_include_directories(mbed-cysbsyskit-01
68
+
INTERFACE
69
+
.
70
+
device
71
+
)
72
+
73
+
target_sources(mbed-cysbsyskit-01
74
+
INTERFACE
75
+
PeripheralPins.c
76
+
cybsp.c
77
+
)
78
+
79
+
target_link_libraries(mbed-cysbsyskit-01
80
+
INTERFACE
81
+
mbed-cat1a
82
+
mbed-cysbsyskit-01-cm4
83
+
mbed-cysbsyskit-01-bsp-design-modus
84
+
mbed-psoc6
85
+
mbed-cy-psoc6-scl
86
+
)
87
+
88
+
target_compile_definitions(mbed-cysbsyskit-01
89
+
INTERFACE
90
+
"CY8C624AFNI_S2D43F"
91
+
)
92
+
93
+
mbed_post_build_psoc6_merge_hex("CYSBSYSKIT_01")
94
+
```
95
+
64
96
## Add target's CMakeLists.txt
65
97
66
98
Add `CMakeLists.txt` files to the top level directory of a given vendor directory. List all files found in the directory in this CMake input source file, adding additional CMake input source file if it is MCU or Mbed target specific and has a great number of files which will make the top level `CMakeLists.txt` too complex. Think when you decide to create functions in a computer software code to remove complexity.
0 commit comments