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/tutorials/porting.md
+38-32Lines changed: 38 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -7,18 +7,24 @@ Mbed Cloud Client provides reference implementation for three Mbed Enabled targe
7
7
8
8
### Summary of steps
9
9
10
-
1. Identify the target’s features. Identify whether it derives from any existing supported target, as well as the macros and features that need to be supported at a bare minimum. You should also identify supported compilers and the Mbed OS release version.
11
-
1. Create the directory structure.
12
-
1. Add the target entry in `targets.json`.
13
-
1. Add an entry for the target in `mbed_rtx.h`.
14
-
1. Add startup code and CMSIS headers, such as device specific register definitions, NVIC headers and **all** relevant drivers from CMSIS specifications: GPIOs, peripheral names, pin maps and others. You will also want to add APIs, HAL implementation, and other required headers for the system clocks and any other additional clocks.
15
-
<spanclass="tips">**Tip:** You can find screenshots for the sample implementation that show what the result should look like at the end of this section.</span>
16
-
1. Add toolchain-specific linker descriptions.
10
+
1. Add your target to `targets.json`
11
+
1. Identify the your target’s features.
12
+
1. Identify any existing parent targets.
13
+
1. Identify macros required for you target's compilation
14
+
1. Identify supported compilers and the Mbed OS release version.
15
+
1. Add the target entry in `targets.json`.
16
+
1. Verify that you can now pass your target to `mbed compile`.
17
+
1. Add your target port
18
+
1. Create the directory structure.
19
+
1. Add an entry for the target in `mbed_rtx.h`.
20
+
1. Add startup code and CMSIS headers, NVIC headers and **all** relevant drivers from CMSIS specifications
21
+
1. Implement APIs, HAL, the system clock configuration and any other additional clocks.
22
+
1. Add toolchain-specific linker descriptions.
17
23
1. Add peripherals and pin names for the target.
18
24
1. Compile with CLI on a supported compiler.
19
25
20
26
21
-
### 1. Identify features, compiler, Mbed OS version, core, CPU name and other features in `targets.json`
27
+
### Identify Target properties
22
28
23
29
Our sample target is identified by the following:
24
30
@@ -35,25 +41,7 @@ Our sample target is identified by the following:
35
41
All of these requirements are directly mapped to relevant tags in the `targets.json` entry for our target. This is shown in step 3 below.
36
42
37
43
38
-
### 2. Create the directory structure
39
-
40
-
The target’s directory structure has the following hierarchy:
41
-
- The manufacturer is listed at the top level
42
-
- The device family
43
-
- A specific device in the family
44
-
- The specific board that uses the MCU in the previous level:
The `mbed_rtx` header file defines the core requirements for the RTOS, such as clock frequency, initial stack pointer, stack size, task counts and other macros. The sample target implemented here has the following specs:
77
83
```
@@ -100,7 +106,7 @@ The `mbed_rtx` header file defines the core requirements for the RTOS, such as c
100
106
Please refer to your chosen MCU's reference manual for these values.
101
107
102
108
103
-
### 5. Add startup code, device specific CMSIS headers, relevant drivers, APIs and HAL implementation
109
+
### Implement startup and HAL
104
110
105
111
If the silicon vendor has already provided these for the MCU that you are using, then you can skip this step. However, you should still ensure that the drivers are present at the correct level in the directory structure.
106
112
@@ -124,7 +130,7 @@ If the silicon vendor has already provided these for the MCU that you are using,
124
130
- Add any board specific features at the `Board` level.
125
131
126
132
127
-
### 6. Add toolchain specific linker descriptions
133
+
### Add linker files
128
134
129
135
All three supported toolchains (uVision, GCC and IAR) need separate linker descriptions. These are:
130
136
- The scatter `*.sct` files for uVision
@@ -134,7 +140,7 @@ All three supported toolchains (uVision, GCC and IAR) need separate linker descr
134
140
You need to add these files at the `Device` level under `/device`. Also, make sure the `supported_toolchains` key in `targets.json` specifies all the supported toolchains for the new target. If the silicon vendor has already provided these for the MCU that you are using, then you can skip this step. However, you should still ensure that the drivers are present at the correct level in the directory structure.
135
141
136
142
137
-
### 7. Add peripherals and pin names for the target
143
+
### Add pin names
138
144
139
145
You must add peripheral names and pin names at the `Board` level, and you must follow standard naming conventions for common peripherals, such as BUTTONs and LEDs. These are defined in the `PinNames.h` header file at the board level. Please refer to Figure 6 below for the directory structure.
140
146
@@ -211,7 +217,7 @@ typedef enum {
211
217
```
212
218
213
219
214
-
### 8. Compile with a supported compiler
220
+
### Compile with a supported compiler
215
221
216
222
The last step is to verify that the new board port compiles. Use an example application, such as [Blinky](https://github.com/ARMmbed/mbed-os-example-blinky), and checkout the branch containing your port in the `mbed-os` sub-directory.
0 commit comments