1
- ## README for mbed-os STM32 targets
1
+ # README for Mbed OS STM32 targets
2
2
3
- ### MBED Wiki pages
3
+ ## ST TOOLS
4
4
5
- https://os.mbed.com/teams/ST/wiki/
5
+ ### USB drivers
6
+
7
+ Mandatory: get the latest USB driver in order to make available all the USB interfaces provided by the ST-LINK:
8
+ - ST Debug
9
+ - Virtual COM port
10
+ - ST Bridge interfaces
11
+
12
+ Default Windows USB drivers will not setup full capabilities.
13
+
14
+ https://www.st.com/en/development-tools/stsw-link009.html
15
+
16
+
17
+ ### ST-Link FW
18
+
19
+ Mandatory: get the latest ST-Link Firmware:
20
+
21
+ https://www.st.com/en/development-tools/stsw-link007.html
22
+
23
+ You could have some issue to connect your board if you didn't install full USB drivers.
24
+
25
+
26
+ Note that with the latest FW version, you are able to check the version number easily with a simple "mbedls":
27
+
28
+ ```
29
+ $ mbedls
30
+ | platform_name | platform_name_unique | mount_point | serial_port | target_id | interface_version |
31
+ |---------------------|------------------------|-------------|-------------|--------------------------|-------------------|
32
+ | DISCO_H747I | DISCO_H747I[0] | D: | COM13 | 081402210D03E72132477E08 | V3J7M2 |
33
+ | DISCO_L475VG_IOT01A | DISCO_L475VG_IOT01A[0] | E: | COM9 | 07640221683B630A577FF553 | V2J37M26 |
34
+ ```
6
35
7
36
### STM32 Cube
8
37
9
38
https://www.st.com/en/embedded-software/stm32cube-mcu-packages.html
10
39
11
- This table summarizes the STM32Cube versions currently used :
40
+ There is one STM32Cube package for each individual STM32 MCU family.
12
41
13
- | STM32 Serie | Cube version | GitHub source |
42
+ It includes:
43
+ - The hardware abstraction layer (HAL) enabling portability between different STM32 devices via standardized API calls
44
+ - Low-layer (LL) APIs, a light-weight, optimized, expert oriented set of APIs designed for both performance and runtime efficiency
45
+ - A collection of middleware components including RTOS, USB library, file system, TCP/IP stack, touch-sensing library or graphics library (depending on the STM32 series)
46
+ - BSP drivers, based on HAL drivers.
47
+
48
+ Part of STM32Cube files are copied in each targets/TARGET_STM/TARGET_STM32\< xx\> /STM32Cube_FW directory:
49
+ - CMSIS header files in CMSIS sub-directory
50
+ - HAL and LL files in STM32\< XX\> xx_HAL_Driver sub-directory
51
+
52
+ Mbed OS HAL calls ST porting layer, which calls ST HAL and LL API.
53
+
54
+ Note that all ST HAL and LL files are available:
55
+ - you can then develop some applications with direct ST HAL and LL call, even if feature is not supported in Mbed OS
56
+ - BSP for LCD, AUDIO, SENSORS, etc... are not available in Mbed OS, but you should be able to use it in your local application.
57
+
58
+
59
+ Each STM32Cube package is also available in Github.
60
+ This table summarizes the STM32Cube versions currently used in Mbed OS master branch :
61
+
62
+ | STM32 Serie | Cube version | Github source |
14
63
| -------------| --------------| ---------------------------------------------------|
15
64
| F0 | 1.9.0 | https://github.com/STMicroelectronics/STM32CubeF0 |
16
65
| F1 | 1.6.1 | https://github.com/STMicroelectronics/STM32CubeF1 |
@@ -25,3 +74,235 @@ This table summarizes the STM32Cube versions currently used :
25
74
| L4 | 1.11.0 | https://github.com/STMicroelectronics/STM32CubeL4 |
26
75
| L5 | 1.1.0 | https://github.com/STMicroelectronics/STM32CubeL5 |
27
76
| WB | 1.4.0 | https://github.com/STMicroelectronics/STM32CubeWB |
77
+
78
+ In Mbed OS repository, we try to minimize the difference between "official" and copied files.
79
+
80
+
81
+ ### STM32CubeMX
82
+
83
+ STM32CubeMX is a graphical tool that allows a very easy configuration of all STM32
84
+
85
+ https://www.st.com/en/development-tools/stm32cubemx.html
86
+
87
+ Tool is not used in Mbed OS, but it can be useful for you.
88
+
89
+
90
+ ### STM32CubeProgrammer
91
+
92
+ It provides an easy-to-use and efficient environment for reading, writing and verifying device memory.
93
+
94
+ https://www.st.com/en/development-tools/stm32cubeprog.html
95
+
96
+ Tool is not used in Mbed OS, but it can be useful for you.
97
+
98
+
99
+ ## STM32 families
100
+
101
+ ### STM32WB
102
+
103
+ [ STM32WB README] ( TARGET_STM32WB/README.md )
104
+
105
+ ### STM32H7
106
+
107
+ [ STM32H7 README] ( TARGET_STM32H7/README.md )
108
+
109
+
110
+
111
+ ## Custom boards
112
+
113
+ It should be "easy" to add your custom board with a STM32 MCU in Mbed OS
114
+
115
+ ### STM32 organisation
116
+
117
+ STM32 root directory is https://github.com/ARMmbed/mbed-os/tree/master/targets/TARGET_STM
118
+
119
+ This contains:
120
+ - all STM32 families directories: F0, F1, F2, F3, F4, F7, G0, H7, L0, L1, L4, WB
121
+ - Mbed OS porting layer common for all
122
+
123
+ Each STM32 family contains several "sub-families".
124
+
125
+ Each STM32 Part Number defines a sub-family: STM32F401 / STM32F407 / STM32F429 / ...
126
+
127
+ But also each STM32 Part Number with different FLASH size : STM32F401xC / STM32F401xE
128
+
129
+ Mbed OS porting layer specific for this family are placed here.
130
+
131
+ Example in TARGET_STM32G0:
132
+ - TARGET_STM32G031xx
133
+ - TARGET_STM32G071xx
134
+ - ...
135
+
136
+ Each STM32 sub-family contains:
137
+ - toolchains files
138
+ - board specific files
139
+
140
+
141
+ ### Add a custom board
142
+
143
+ ST provides the complete support for few NUCLEO and DISCO boards.
144
+
145
+ Locate one of these boards with the minimum difference with your chosen MCU.
146
+
147
+ Copy paste, and update!
148
+
149
+
150
+ ### Board specific files (pinmap)
151
+
152
+ 2 files in Mbed OS:
153
+ - PeripheralPins.c
154
+ - PinNames.h
155
+
156
+ It is recommended to use a python script to generate those files
157
+
158
+ https://github.com/ARMmbed/mbed-os/blob/master/tools/targets/STM32_gen_PeripheralPins.py
159
+
160
+ STM32CubeMX has to be installed first. Path has to be specified in the ` cube_path.json ` file.
161
+
162
+ ```
163
+ $ python tools/targets/STM32_gen_PeripheralPins.py -h
164
+
165
+ Script version 1.9
166
+ usage: STM32_gen_PeripheralPins.py [-h] [-l | -b | -m xml | -t HW | -c CUSTOM]
167
+
168
+ Script will generate PeripheralPins.c thanks to the xml files description available in
169
+ STM32CubeMX directory defined in 'cube_path.json':
170
+ C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX
171
+
172
+ optional arguments:
173
+ -h, --help show this help message and exit
174
+ -l, --list list available mcu xml files description in STM32CubeMX
175
+ -b, --boards list available boards description in STM32CubeMX
176
+ -m xml, --mcu xml specify the mcu xml file description in STM32CubeMX to use (use double quotes).
177
+ Parameter can be a filter like L496 if you want to parse all L496 chips (-m STM32 to parse all).
178
+ -t HW, --target HW specify the board file description in STM32CubeMX to use (use double quotes).
179
+ Parameter can be a filter like L496 (only the first file found will be parsed).
180
+ -c CUSTOM, --custom CUSTOM
181
+ specify a custom board .ioc file description to use (use double quotes).
182
+
183
+ Once generated, you have to check and comment pins that can not be used (specific HW, internal ADC channels, remove PWM using us ticker timer, ...)
184
+ ```
185
+
186
+ How to generate files for a custom boards based on a STM32F427 MCU:
187
+ ```
188
+ $ python tools/targets/STM32_gen_PeripheralPins.py -l | grep F427
189
+ STM32F427A(G-I)Hx.xml
190
+ STM32F427I(G-I)Hx.xml
191
+ STM32F427I(G-I)Tx.xml
192
+ STM32F427V(G-I)Tx.xml
193
+ STM32F427Z(G-I)Tx.xml
194
+
195
+ $ python tools/targets/STM32_gen_PeripheralPins.py -m "STM32F427V(G-I)Tx.xml"
196
+
197
+ Script version 1.9
198
+ CubeMX DB version DB.5.0.60
199
+
200
+ * Output directory: C:\github\mbed\STM32F427V(G-I)Tx
201
+ * Generating PeripheralPins.c and PinNames.h with 'STM32F427V(G-I)Tx.xml'
202
+ * GPIO file: C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX\db\mcu\IP\GPIO-STM32F427_gpio_v1_0_Modes.xml
203
+ * I/O pins found: 82 connected: 0
204
+ ```
205
+
206
+ ### Use of custom_targets.json
207
+
208
+ https://os.mbed.com/docs/mbed-os/v6.0/porting/porting-a-custom-board.html
209
+
210
+ Example with a board based on STM32F103C8 (like BluePill):
211
+ - MCU_STM32F103x8 generic configuration is already available in targets.json file
212
+
213
+ ```
214
+ $ python tools/targets/STM32_gen_PeripheralPins.py -m "STM32F103C(8-B)Tx.xml"
215
+ // PeripheralPins.c and PinNames.h template files are created in STM32H745ZITx directory
216
+
217
+ $ mv STM32F103C\(8-B\)Tx/ TARGET_BLUEPILL_F103C8
218
+ // Edit PeripheralPins.c and PinNames.h to match your board configuration
219
+
220
+ // Create a custom_targets.json with:
221
+ {
222
+ "BLUEPILL_F103C8": {
223
+ "inherits": [
224
+ "MCU_STM32F103x8"
225
+ ],
226
+ "overrides": {
227
+ "clock_source": "USE_PLL_HSE_XTAL"
228
+ },
229
+ "device_has_remove": [
230
+ "STDIO_MESSAGES"
231
+ ],
232
+ "device_name": "STM32F103C8"
233
+ }
234
+ }
235
+ ```
236
+
237
+ Example with a board based on STM32H745ZI
238
+ - this is dual core MCU with CM4 and CM7
239
+ - MCU_STM32H745I_CM4 and MCU_STM32H745I_CM7 generic configuration is already available in targets.json file
240
+
241
+ ```
242
+ $ python tools/targets/STM32_gen_PeripheralPins.py -m "STM32H745ZITx.xml"
243
+ // PeripheralPins.c and PinNames.h template files are created in STM32H745ZITx directory
244
+
245
+ $ mv STM32H745ZITx TARGET_H745ZI_BOARD
246
+ // Edit PeripheralPins.c and PinNames.h to match your board configuration
247
+
248
+ // Create a custom_targets.json with:
249
+ {
250
+ "H745ZI_BOARD_CM4": {
251
+ "inherits": [
252
+ "MCU_STM32H745I_CM4"
253
+ ],
254
+ "extra_labels_add": [
255
+ "H745ZI_BOARD"
256
+ ]
257
+ },
258
+ "H745ZI_BOARD_CM7": {
259
+ "inherits": [
260
+ "MCU_STM32H745I_CM7"
261
+ ],
262
+ "extra_labels_add": [
263
+ "H745ZI_BOARD"
264
+ ]
265
+ }
266
+ }
267
+ ```
268
+
269
+
270
+ ## ST specific implementation
271
+
272
+ ### WiFi configuration
273
+
274
+ https://github.com/ARMmbed/wifi-ism43362
275
+
276
+ https://os.mbed.com/teams/ST/wiki/How-to-make-wifi-tests
277
+
278
+
279
+ ### Ethernet configuration
280
+
281
+ Depending on your PHY, you will have to customize several configuration values:
282
+ - the number of RX buffers
283
+ - the number of TX buffers
284
+ - thread size
285
+ - PHY address
286
+ - media interface
287
+ - AutoNegotiation mode
288
+ - DuplexMode mode
289
+ - Speed mode
290
+ - PHY register Offset
291
+ - Speed mask information in the PHY status register
292
+ - Duplex mask information in the PHY status register
293
+
294
+ Check the default values in:
295
+ https://github.com/ARMmbed/mbed-os/blob/master/features/netsocket/emac-drivers/TARGET_STM/mbed_lib.json
296
+
297
+ Option is also to define your own ` HAL_ETH_MspInit ` function,
298
+ you then have to add ** USE_USER_DEFINED_HAL_ETH_MSPINIT** macro.
299
+
300
+
301
+
302
+ ## Mbed OS Wiki pages
303
+
304
+ https://os.mbed.com/teams/ST/wiki/
305
+
306
+ https://os.mbed.com/teams/ST/wiki/How-to-enable-flash-dual-bank
307
+
308
+ https://os.mbed.com/teams/ST/wiki/Nucleo-144pins-ethernet-spi-conflict
0 commit comments