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

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

Merged
merged 4 commits into from Jun 19, 2018

Conversation

Projects
None yet
7 participants
@jeromecoutant
Contributor

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.

Wiki 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
STM32 : script to generate PeripheralPins.c for new target addition
$ 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, ...)
@ithinuel

ithinuel suggested changes May 18, 2018 edited

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

@0xc0170 0xc0170 added needs: work and removed needs: review labels May 18, 2018

@theotherjimmy

The style of this file is different from the tools.

@jeromecoutant

This comment has been minimized.

Contributor

jeromecoutant commented Jun 5, 2018

Let's merge ? :-)

@@ -0,0 +1,1214 @@
import argparse

This comment has been minimized.

@0xc0170

0xc0170 Jun 6, 2018

Member

Can you add a license to this new file?

@0xc0170

license missing, otherwise looks good

@jeromecoutant

This comment has been minimized.

Contributor

jeromecoutant commented Jun 7, 2018

license missing

done

@cmonr cmonr added needs: CI and removed needs: work labels Jun 7, 2018

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Jun 9, 2018

/morph build

@mbed-ci

This comment has been minimized.

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

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@kjbracey-arm kjbracey-arm removed the needs: CI label Jun 11, 2018

@kjbracey-arm

This comment has been minimized.

Contributor

kjbracey-arm commented Jun 11, 2018

CI passed, reviewers please recheck.

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

This comment has been minimized.

@0xc0170

0xc0170 Jun 12, 2018

Member

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

@jeromecoutant jeromecoutant force-pushed the jeromecoutant:PR_SCRIPT branch from 29e8e70 to 5fba2e4 Jun 12, 2018

@cmonr

cmonr approved these changes Jun 18, 2018

License questions addressed.

@cmonr

This comment has been minimized.

Contributor

cmonr commented Jun 18, 2018

/morph build

@mbed-ci

This comment has been minimized.

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

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@0xc0170 0xc0170 added ready for merge and removed needs: CI labels Jun 19, 2018

@0xc0170 0xc0170 merged commit eb3d3fd into ARMmbed:master Jun 19, 2018

14 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
travis-ci/astyle Passed, 921 files
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 9587 cycles (+456 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 9964B (+0.00%)
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details

@jeromecoutant jeromecoutant deleted the jeromecoutant:PR_SCRIPT branch Jun 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment