[riot-notifications] [RIOT-OS/RIOT] pkg/stm32cube: retrieve STM32 CMSIS header from a package (#14152)

Alexandre Abadie notifications at github.com
Wed May 27 09:30:38 CEST 2020


<!--
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
-->

### Contribution description

This PR is a POC that adds stm32cube repositories as a single external package (example: the [F4 repository](https://github.com/STMicroelectronics/STM32CubeF4)). Each stm32cube repository contains all the CMSIS headers of each STM32 families (for F4 it's in "Drivers/CMSIS/Device/ST/STM32F4xx/Include").

The stm32cube package is only used for fetching the headers automatically when building an application targetting an STM32 microcontroller. Thus, this PR also removes all STM32 vendor headers from the codebase.

Not everything is perfect, there are pros and cons:
- pros:
  - updating the CMSIS headers for a given STM32 family can be done by simply changing the corresponding commit hash of the package. All CMSIS headers are kept in sync.
  - all headers are available, so there's no need to add new ones for each new STM32 cpu support added
  - they are kept unchanged, so easier to maintain
  - if we could have a more generic solution for vectors and IRQs, this opens the door for the basic support of any cpu model of an already supported family
  - the changeset of this PR is fun: `68 additions and 708,552 deletions.`

- cons:
  - a network connection is required for building any application, for a given STM32, the first time, even for a simple hello-world application
  - some versions of stm32cube are huge (hundreds of MB). This is the case for F4, F7, L4. Because the repository also contains a big bunch of blobs (sample audio files, video, etc) which are used as samples in example applications. Fetching the package can take ages and I have no idea of the disk usage increase on Murdock.

I think the pros are very important and here are some ideas I have to mitigate a bit the cons. All of them try to fetch the stm32cube only once in a single location. This way, only the very first build of an application will fetch the stm32cube code (for a given family), the next builds will just reuse the already downloaded headers.
- add some logic to the package to copy the headers from the package location (in bin/pkg/...) to `cpu/stm32/include/vendor`. The package will also contains some logic to prevent the fetch if the vendors headers are already there or maybe if a lock file is already there and contains the same version.
- add this specific download logic in `cpu/stm32/stm32cube.inc.mk` and don't use the usual package mechanism.

There might be other solutions I haven't thought of so any suggestion is very welcome.

If you think that this PR is useless or that the cons are too much a pain. Then we can close this and continue the usual STM32 way.

<!--
Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes
-->


### Testing procedure

- A green Murdock
- Very the total Murdock jobs time doesn't increase too much

<!--
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
-->


### Issues/PRs references

Based on #14144 

<!--
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/14152

-- Commit Summary --

  * cpu/stm32: adapt timer driver to common CMSIS timer structure
  * pkg/stm32cube: add package for STM32Cube
  * cpu/stm32: restore timer structure in vendor headers
  * cpu/cortexm_common: add special case for SVC interrupt configuration
  * cpu/stm32: retrieve CMSIS headers from stm32cube package
  * cpu/stm32: remove not needed CMSIS vendor headers

-- File Changes --

    M cpu/cortexm_common/cortexm_init.c (5)
    M cpu/stm32/Makefile.dep (4)
    M cpu/stm32/include/cpu_conf.h (20)
    D cpu/stm32/include/vendor/stm32f030x4.h (5368)
    D cpu/stm32/include/vendor/stm32f030x8.h (5395)
    D cpu/stm32/include/vendor/stm32f030xc.h (5852)
    D cpu/stm32/include/vendor/stm32f031x6.h (5646)
    D cpu/stm32/include/vendor/stm32f042x6.h (10659)
    D cpu/stm32/include/vendor/stm32f051x8.h (6763)
    D cpu/stm32/include/vendor/stm32f070xb.h (5759)
    D cpu/stm32/include/vendor/stm32f072xb.h (11247)
    D cpu/stm32/include/vendor/stm32f091xc.h (11864)
    D cpu/stm32/include/vendor/stm32f0xx.h (218)
    D cpu/stm32/include/vendor/stm32f103xb.h (10234)
    D cpu/stm32/include/vendor/stm32f103xe.h (6444)
    D cpu/stm32/include/vendor/stm32f1xx.h (212)
    D cpu/stm32/include/vendor/stm32f205xx.h (13713)
    D cpu/stm32/include/vendor/stm32f207xx.h (15004)
    D cpu/stm32/include/vendor/stm32f215xx.h (13968)
    D cpu/stm32/include/vendor/stm32f217xx.h (15259)
    D cpu/stm32/include/vendor/stm32f2xx.h (183)
    D cpu/stm32/include/vendor/stm32f302x8.h (12296)
    D cpu/stm32/include/vendor/stm32f303x8.h (12085)
    D cpu/stm32/include/vendor/stm32f303xc.h (13393)
    D cpu/stm32/include/vendor/stm32f303xe.h (15247)
    D cpu/stm32/include/vendor/stm32f334x8.h (15100)
    D cpu/stm32/include/vendor/stm32f3xx.h (224)
    D cpu/stm32/include/vendor/stm32f401xe.h (8533)
    D cpu/stm32/include/vendor/stm32f405xx.h (14256)
    D cpu/stm32/include/vendor/stm32f407xx.h (15468)
    D cpu/stm32/include/vendor/stm32f410rx.h (7259)
    D cpu/stm32/include/vendor/stm32f411xe.h (8573)
    D cpu/stm32/include/vendor/stm32f412zx.h (14518)
    D cpu/stm32/include/vendor/stm32f413xx.h (14990)
    D cpu/stm32/include/vendor/stm32f415xx.h (14469)
    D cpu/stm32/include/vendor/stm32f423xx.h (15277)
    D cpu/stm32/include/vendor/stm32f429xx.h (17019)
    D cpu/stm32/include/vendor/stm32f437xx.h (17109)
    D cpu/stm32/include/vendor/stm32f446xx.h (15826)
    D cpu/stm32/include/vendor/stm32f4xx.h (245)
    D cpu/stm32/include/vendor/stm32f722xx.h (15458)
    D cpu/stm32/include/vendor/stm32f723xx.h (15552)
    D cpu/stm32/include/vendor/stm32f746xx.h (17565)
    D cpu/stm32/include/vendor/stm32f767xx.h (18595)
    D cpu/stm32/include/vendor/stm32f769xx.h (21765)
    D cpu/stm32/include/vendor/stm32f7xx.h (205)
    D cpu/stm32/include/vendor/stm32l010x4.h (5799)
    D cpu/stm32/include/vendor/stm32l010x6.h (5856)
    D cpu/stm32/include/vendor/stm32l010x8.h (5852)
    D cpu/stm32/include/vendor/stm32l010xb.h (5928)
    D cpu/stm32/include/vendor/stm32l031xx.h (6092)
    D cpu/stm32/include/vendor/stm32l052xx.h (7344)
    D cpu/stm32/include/vendor/stm32l053xx.h (7504)
    D cpu/stm32/include/vendor/stm32l072xx.h (7679)
    D cpu/stm32/include/vendor/stm32l073xx.h (7841)
    D cpu/stm32/include/vendor/stm32l0xx.h (225)
    D cpu/stm32/include/vendor/stm32l151xb.h (8070)
    D cpu/stm32/include/vendor/stm32l151xba.h (8146)
    D cpu/stm32/include/vendor/stm32l151xc.h (9054)
    D cpu/stm32/include/vendor/stm32l152xe.h (9350)
    D cpu/stm32/include/vendor/stm32l1xx.h (246)
    D cpu/stm32/include/vendor/stm32l412xx.h (10902)
    D cpu/stm32/include/vendor/stm32l432xx.h (14853)
    D cpu/stm32/include/vendor/stm32l433xx.h (15967)
    D cpu/stm32/include/vendor/stm32l452xx.h (16065)
    D cpu/stm32/include/vendor/stm32l475xx.h (18372)
    D cpu/stm32/include/vendor/stm32l476xx.h (18523)
    D cpu/stm32/include/vendor/stm32l496xx.h (19768)
    D cpu/stm32/include/vendor/stm32l4r5xx.h (20141)
    D cpu/stm32/include/vendor/stm32l4xx.h (254)
    D cpu/stm32/include/vendor/stm32wb55xx.h (13717)
    D cpu/stm32/include/vendor/stm32wbxx.h (174)
    M cpu/stm32/periph/pwm.c (5)
    M cpu/stm32/periph/qdec.c (4)
    M cpu/stm32/periph/timer.c (2)
    A pkg/stm32cube/Makefile (10)
    A pkg/stm32cube/Makefile.include (4)
    A pkg/stm32cube/doc.txt (5)
    A pkg/stm32cube/stm32cube.inc.mk (19)
    A pkg/stm32cube/stm32cube.mk (5)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/14152.patch
https://github.com/RIOT-OS/RIOT/pull/14152.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/14152
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200527/2bf80dd8/attachment-0001.htm>


More information about the notifications mailing list