Skip to content

Commit 07b51da

Browse files
committed
Reorder and rewrite steps
1 parent f663954 commit 07b51da

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

docs/tutorials/porting.md

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,24 @@ Mbed Cloud Client provides reference implementation for three Mbed Enabled targe
77

88
### Summary of steps
99

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-
<span class="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.
1723
1. Add peripherals and pin names for the target.
1824
1. Compile with CLI on a supported compiler.
1925

2026

21-
### 1. Identify features, compiler, Mbed OS version, core, CPU name and other features in `targets.json`
27+
### Identify Target properties
2228

2329
Our sample target is identified by the following:
2430

@@ -35,25 +41,7 @@ Our sample target is identified by the following:
3541
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.
3642

3743

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:
45-
46-
```
47-
\mbed-os\targets\TARGET_<Manf>\<Device_Family>\<specific_MCU>\<specific_board>\
48-
```
49-
50-
Our sample implementation uses:
51-
```
52-
\mbed-os\targets\TARGET_MY_Vendor\TARGET_VendorMCUs\TARGET_VendorDevice1\TARGET_VendorBoard_1\
53-
```
54-
55-
56-
### 3. Add the target entry in `targets.json`
44+
### Add the target entry in `targets.json`
5745
```
5846
"MyTarget123": {
5947
"inherits":["Target"],
@@ -71,7 +59,25 @@ Our sample implementation uses:
7159
<span class="notes">**Note:** The `extra_labels` must mimic the exact directory structure used to define the new target.</span>
7260

7361

74-
### 4. Add an entry in `mbed_rtx.h`
62+
### Create the directory structure
63+
64+
The target’s directory structure has the following hierarchy:
65+
- The manufacturer is listed at the top level
66+
- The device family
67+
- A specific device in the family
68+
- The specific board that uses the MCU in the previous level:
69+
70+
```
71+
\mbed-os\targets\TARGET_<Manf>\<Device_Family>\<specific_MCU>\<specific_board>\
72+
```
73+
74+
Our sample implementation uses:
75+
```
76+
\mbed-os\targets\TARGET_MY_Vendor\TARGET_VendorMCUs\TARGET_VendorDevice1\TARGET_VendorBoard_1\
77+
```
78+
79+
80+
### Add an entry in `mbed_rtx.h`
7581

7682
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:
7783
```
@@ -100,7 +106,7 @@ The `mbed_rtx` header file defines the core requirements for the RTOS, such as c
100106
Please refer to your chosen MCU's reference manual for these values.
101107

102108

103-
### 5. Add startup code, device specific CMSIS headers, relevant drivers, APIs and HAL implementation
109+
### Implement startup and HAL
104110

105111
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.
106112

@@ -124,7 +130,7 @@ If the silicon vendor has already provided these for the MCU that you are using,
124130
- Add any board specific features at the `Board` level.
125131

126132

127-
### 6. Add toolchain specific linker descriptions
133+
### Add linker files
128134

129135
All three supported toolchains (uVision, GCC and IAR) need separate linker descriptions. These are:
130136
- The scatter `*.sct` files for uVision
@@ -134,7 +140,7 @@ All three supported toolchains (uVision, GCC and IAR) need separate linker descr
134140
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.
135141

136142

137-
### 7. Add peripherals and pin names for the target
143+
### Add pin names
138144

139145
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.
140146

@@ -211,7 +217,7 @@ typedef enum {
211217
```
212218

213219

214-
### 8. Compile with a supported compiler
220+
### Compile with a supported compiler
215221

216222
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.
217223

0 commit comments

Comments
 (0)