Skip to content

STM32 : script to generate PeripheralPins.c for new target addition #6929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 19, 2018

Conversation

jeromecoutant
Copy link
Collaborator

@jeromecoutant jeromecoutant commented May 16, 2018

Description

Goal is to help users to add a new STM32 MCU in MBED.

One tricky point is to build PeripheralPins.c and PinNames.h files.

If you have installed STM32CubeMX tool from:
http://www.st.com/en/development-tools/stm32cubemx.html

we have implemented a script to build the 2 MBED files from the ST description files.

Uncyclo page will be updated after PR merge:
https://os.mbed.com/teams/ST/wiki/steps-to-create-a-new-STM32-platform

$ python STM32_gen_PeripheralPins.py -h
usage: STM32_gen_PeripheralPins.py [-h] [-l | -b | -m xml | -t HW]

Script will generate PeripheralPins.c thanks to the xml files description available in
STM32CubeMX directory defined in 'cube_path.json':
C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeMX\db

optional arguments:
-h, --help show this help message and exit
-l, --list list available mcu xml files description in STM32CubeMX
-b, --boards list available boards description in STM32CubeMX
-m xml, --mcu xml specify the mcu xml file description in STM32CubeMX to use (use double quotes).
Parameter can be a filter like L496 if you want to parse all L496 chips (-m STM32 to parse all).
-t HW, --target HW specify the board file description in STM32CubeMX to use (use double quotes).
Parameter can be a filter like L496 (only the first file found will be parsed).

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, ...)

Pull request type

[ ] Fix
[ ] Refactor
[ ] New target
[X] Feature
[ ] Breaking change

$ python genpinmap_mbed.py -h
usage: genpinmap_mbed.py [-h] [-l | -b | -m xml | -t HW]

Script will generate PeripheralPins.c thanks to the xml files description available in
STM32CubeMX directory defined in 'cube_path.json':
        C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeMX\db

optional arguments:
  -h, --help          show this help message and exit
  -l, --list          list available mcu xml files description in STM32CubeMX
  -b, --boards        list available boards description in STM32CubeMX
  -m xml, --mcu xml   specify the mcu xml file description in STM32CubeMX to use (use double quotes).
                         Parameter can be a filter like L496 if you want to parse all L496 chips (-m STM32 to parse all).
  -t HW, --target HW  specify the board file description in STM32CubeMX to use (use double quotes).
                         Parameter can be a filter like L496 (only the first file found will be parsed).

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, ...)
Copy link
Member

@ithinuel ithinuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would probable be better placed in ./tools/targets.
Other wise the generated output LGTM.

theotherjimmy
theotherjimmy previously approved these changes May 21, 2018
Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The style of this file is different from the tools.

ithinuel
ithinuel previously approved these changes May 22, 2018
@jeromecoutant
Copy link
Collaborator Author

Let's merge ? :-)

@@ -0,0 +1,1214 @@
import argparse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a license to this new file?

0xc0170
0xc0170 previously requested changes Jun 6, 2018
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license missing, otherwise looks good

@jeromecoutant
Copy link
Collaborator Author

license missing

done

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 9, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jun 9, 2018

Build : SUCCESS

Build number : 2293
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6929/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Jun 9, 2018

@mbed-ci
Copy link

mbed-ci commented Jun 9, 2018

@kjbracey
Copy link
Contributor

CI passed, reviewers please recheck.

@@ -0,0 +1,1244 @@
"""
*******************************************************************************
* Copyright (c) 2018, STMicroelectronics
Copy link
Contributor

@0xc0170 0xc0170 Jun 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As these are mbed implementation files (also what it generates), why not Apache license?

@cmonr cmonr dismissed 0xc0170’s stale review June 18, 2018 23:26

License questions addressed.

@cmonr
Copy link
Contributor

cmonr commented Jun 18, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jun 19, 2018

Build : SUCCESS

Build number : 2376
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6929/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Jun 19, 2018

@mbed-ci
Copy link

mbed-ci commented Jun 19, 2018

@0xc0170 0xc0170 merged commit eb3d3fd into ARMmbed:master Jun 19, 2018
@jeromecoutant jeromecoutant deleted the PR_SCRIPT branch June 20, 2018 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants