Merge pull request #13655 from jeromecoutant/PR_GENPERIPH_1_17

STM32_gen_PeripheralPins.py v1.17
pull/13692/head
Martin Kojtal 2020-10-16 09:08:27 +01:00 committed by GitHub
commit aa0cd631a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 712 additions and 466 deletions

View File

@ -156,20 +156,22 @@ Copy paste, and update!
It is recommended to use a python script to generate those files
https://github.com/ARMmbed/mbed-os/blob/master/tools/targets/STM32_gen_PeripheralPins.py
https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/tools/STM32_gen_PeripheralPins.py
STM32CubeMX has to be installed first. Path has to be specified in the `cube_path.json` file.
```
$ python tools/targets/STM32_gen_PeripheralPins.py -h
$ python targets/TARGET_STM/tools/STM32_gen_PeripheralPins.py -h
Script version 1.9
usage: STM32_gen_PeripheralPins.py [-h] [-l | -b | -m xml | -t HW | -c CUSTOM]
Script version 1.17
usage: STM32_gen_PeripheralPins.py [-h] (-l | -b | -m xml | -t HW | -c CUSTOM)
Script will generate PeripheralPins.c thanks to the xml files description available in
STM32CubeMX directory defined in 'cube_path.json':
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX
More information in targets/TARGET_STM/README.md
optional arguments:
-h, --help show this help message and exit
-l, --list list available mcu xml files description in STM32CubeMX
@ -182,26 +184,33 @@ optional arguments:
specify a custom board .ioc file description to use (use double quotes).
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, ...)
```
How to generate files for a custom boards based on a STM32F427 MCU:
```
$ python tools/targets/STM32_gen_PeripheralPins.py -l | grep F427
$ python targets/TARGET_STM/tools/STM32_gen_PeripheralPins.py -l | grep F427
STM32F427A(G-I)Hx.xml
STM32F427I(G-I)Hx.xml
STM32F427I(G-I)Tx.xml
STM32F427V(G-I)Tx.xml
STM32F427Z(G-I)Tx.xml
$ python tools/targets/STM32_gen_PeripheralPins.py -m "STM32F427V(G-I)Tx.xml"
$ python targets/TARGET_STM/tools/STM32_gen_PeripheralPins.py -m "STM32F427V(G-I)Tx.xml"
Script version 1.9
CubeMX DB version DB.5.0.60
Script version 1.17
CubeMX DB version DB.6.0.0
* Output directory: C:\github\mbed\STM32F427V(G-I)Tx
* Generating PeripheralPins.c and PinNames.h with 'STM32F427V(G-I)Tx.xml'
* Output directory: targets_custom\TARGET_STM\TARGET_STM32F4\TARGET_STM32F427xG\TARGET_STM32F427VGT
* Generating PeripheralPins.c and PinNames.h with 'C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX\db\mcu\STM32F427V(G-I)Tx.xml'
* GPIO file: C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX\db\mcu\IP\GPIO-STM32F427_gpio_v1_0_Modes.xml
* I/O pins found: 82 connected: 0
* I/O pins found: 135 connected: 0
* Output directory: targets_custom\TARGET_STM\TARGET_STM32F4\TARGET_STM32F427xI\TARGET_STM32F427VIT
* Generating PeripheralPins.c and PinNames.h with 'C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX\db\mcu\STM32F427V(G-I)Tx.xml'
* GPIO file: C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX\db\mcu\IP\GPIO-STM32F427_gpio_v1_0_Modes.xml
* I/O pins found: 135 connected: 0
```
### Use of custom_targets.json
@ -212,10 +221,10 @@ Example with a board based on STM32F103C8 (like BluePill):
- MCU_STM32F103x8 generic configuration is already available in targets.json file
```
$ python tools/targets/STM32_gen_PeripheralPins.py -m "STM32F103C(8-B)Tx.xml"
// PeripheralPins.c and PinNames.h template files are created in STM32H745ZITx directory
$ python targets/TARGET_STM/tools/STM32_gen_PeripheralPins.py -m "STM32F103C(8-B)Tx.xml"
// PeripheralPins.c and PinNames.h template files are created in targets_custom/TARGET_STM/TARGET_STM32F1/TARGET_STM32F103x8/TARGET_STM32F103C8T directory
$ mv STM32F103C\(8-B\)Tx/ TARGET_BLUEPILL_F103C8
$ mv TARGET_STM32F103C8T TARGET_BLUEPILL_F103C8
// Edit PeripheralPins.c and PinNames.h to match your board configuration
// Create a custom_targets.json with:
@ -240,10 +249,10 @@ Example with a board based on STM32H745ZI
- MCU_STM32H745I_CM4 and MCU_STM32H745I_CM7 generic configuration is already available in targets.json file
```
$ python tools/targets/STM32_gen_PeripheralPins.py -m "STM32H745ZITx.xml"
// PeripheralPins.c and PinNames.h template files are created in STM32H745ZITx directory
$ python targets/TARGET_STM/tools/STM32_gen_PeripheralPins.py -m "STM32H745ZITx.xml"
// PeripheralPins.c and PinNames.h template files are created in targets_custom/TARGET_STM/TARGET_STM32H7/TARGET_STM32H745xI/TARGET_STM32H745ZIT directory
$ mv STM32H745ZITx TARGET_H745ZI_BOARD
$ mv TARGET_STM32H745ZIT TARGET_H745ZI_BOARD
// Edit PeripheralPins.c and PinNames.h to match your board configuration
// Create a custom_targets.json with: