[riot-notifications] [RIOT-OS/RIOT] cpu/stm32: move stmclk in its own module, remove useless ifdefs (#14131)

Alexandre Abadie notifications at github.com
Mon May 25 10:27:59 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 small cleanup of the STM32 clock configuration implementations:
- all implementations are moved in their own module within the stm32 directory
- the module only build the file corresponding to the cpu families (f*, l0/l1, l4/wb). This allows to removed all the global ifdefs in the *.c files.
- `stmclk.c` is now called `stmclk_fx.c` to make it more explicit what it is about.

<!--
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, of course
- Verify that the firmware size is unchanged and the application is still functional, on several platforms:

<details><summary>iotlab-m3</summary>

- this PR
```
RIOT_VERSION=test make BOARD=iotlab-m3 -C examples/default flash term --no-print-directory IOTLAB_NODE=auto-ssh
Building application "default" for "iotlab-m3" with MCU "stm32".

"make" -C /work/riot/RIOT/boards/iotlab-m3
"make" -C /work/riot/RIOT/boards/common/iotlab
"make" -C /work/riot/RIOT/core
"make" -C /work/riot/RIOT/cpu/stm32
"make" -C /work/riot/RIOT/cpu/cortexm_common
"make" -C /work/riot/RIOT/cpu/cortexm_common/periph
"make" -C /work/riot/RIOT/cpu/stm32/periph
"make" -C /work/riot/RIOT/cpu/stm32/stmclk
"make" -C /work/riot/RIOT/cpu/stm32/vectors
"make" -C /work/riot/RIOT/drivers
"make" -C /work/riot/RIOT/drivers/at86rf2xx
"make" -C /work/riot/RIOT/drivers/isl29020
"make" -C /work/riot/RIOT/drivers/l3g4200d
"make" -C /work/riot/RIOT/drivers/lpsxxx
"make" -C /work/riot/RIOT/drivers/lsm303dlhc
"make" -C /work/riot/RIOT/drivers/netdev_ieee802154
"make" -C /work/riot/RIOT/drivers/periph_common
"make" -C /work/riot/RIOT/drivers/saul
"make" -C /work/riot/RIOT/drivers/saul/init_devs
"make" -C /work/riot/RIOT/sys
"make" -C /work/riot/RIOT/sys/auto_init
"make" -C /work/riot/RIOT/sys/div
"make" -C /work/riot/RIOT/sys/fmt
"make" -C /work/riot/RIOT/sys/isrpipe
"make" -C /work/riot/RIOT/sys/luid
"make" -C /work/riot/RIOT/sys/net/gnrc
"make" -C /work/riot/RIOT/sys/net/gnrc/netapi
"make" -C /work/riot/RIOT/sys/net/gnrc/netif
"make" -C /work/riot/RIOT/sys/net/gnrc/netif/hdr
"make" -C /work/riot/RIOT/sys/net/gnrc/netif/ieee802154
"make" -C /work/riot/RIOT/sys/net/gnrc/netif/init_devs
"make" -C /work/riot/RIOT/sys/net/gnrc/netreg
"make" -C /work/riot/RIOT/sys/net/gnrc/pkt
"make" -C /work/riot/RIOT/sys/net/gnrc/pktbuf
"make" -C /work/riot/RIOT/sys/net/gnrc/pktbuf_static
"make" -C /work/riot/RIOT/sys/net/gnrc/pktdump
"make" -C /work/riot/RIOT/sys/net/link_layer/ieee802154
"make" -C /work/riot/RIOT/sys/net/link_layer/l2util
"make" -C /work/riot/RIOT/sys/net/netif
"make" -C /work/riot/RIOT/sys/newlib_syscalls_default
"make" -C /work/riot/RIOT/sys/od
"make" -C /work/riot/RIOT/sys/phydat
"make" -C /work/riot/RIOT/sys/pm_layered
"make" -C /work/riot/RIOT/sys/ps
"make" -C /work/riot/RIOT/sys/random
"make" -C /work/riot/RIOT/sys/random/tinymt32
"make" -C /work/riot/RIOT/sys/saul_reg
"make" -C /work/riot/RIOT/sys/shell
"make" -C /work/riot/RIOT/sys/shell/commands
"make" -C /work/riot/RIOT/sys/stdio_uart
"make" -C /work/riot/RIOT/sys/tsrb
"make" -C /work/riot/RIOT/sys/xtimer
   text	   data	    bss	    dec	    hex	filename
  46344	    132	   6264	  52740	   ce04	/work/riot/RIOT/examples/default/bin/iotlab-m3/default.elf
iotlab-node --jmespath='keys(@)[0]' --format='int'  --list saclay,m3,10 --flash /work/riot/RIOT/examples/default/bin/iotlab-m3/default.bin | grep 0
0
ssh -t abadie at saclay.iot-lab.info 'socat - tcp:m3-10.saclay.iot-lab.info:20000'
help
help
Command              Description
---------------------------------------
reboot               Reboot the node
version              Prints current RIOT_VERSION
pm                   interact with layered PM subsystem
ps                   Prints information about running threads.
random_init          initializes the PRNG
random_get           returns 32 bit of pseudo randomness
rtc                  control RTC peripheral interface
ifconfig             Configure network interfaces
txtsnd               Sends a custom string as is over the link layer
saul                 interact with sensors and actuators using SAUL
> 
```
=> firmware size:
```
   text	   data	    bss	    dec	    hex	filename
  46344	    132	   6264	  52740	   ce04	/work/riot/RIOT/examples/default/bin/iotlab-m3/default.elf
```

- master
```
   text	   data	    bss	    dec	    hex	filename
  46344	    132	   6264	  52740	   ce04	/work/riot/RIOT/examples/default/bin/iotlab-m3/default.elf
```

</details>


<details><summary>b-l072z-lrwan1</summary>

- this PR
```
RIOT_VERSION=test make BOARD=b-l072z-lrwan1 -C examples/default flash term --no-print-directory IOTLAB_NODE=auto-ssh
Building application "default" for "b-l072z-lrwan1" with MCU "stm32".

"make" -C /work/riot/RIOT/boards/b-l072z-lrwan1
"make" -C /work/riot/RIOT/core
"make" -C /work/riot/RIOT/cpu/stm32
"make" -C /work/riot/RIOT/cpu/cortexm_common
"make" -C /work/riot/RIOT/cpu/cortexm_common/periph
"make" -C /work/riot/RIOT/cpu/stm32/periph
"make" -C /work/riot/RIOT/cpu/stm32/stmclk
"make" -C /work/riot/RIOT/cpu/stm32/vectors
"make" -C /work/riot/RIOT/drivers
"make" -C /work/riot/RIOT/drivers/periph_common
"make" -C /work/riot/RIOT/drivers/saul
"make" -C /work/riot/RIOT/drivers/saul/init_devs
"make" -C /work/riot/RIOT/drivers/sx127x
"make" -C /work/riot/RIOT/sys
"make" -C /work/riot/RIOT/sys/auto_init
"make" -C /work/riot/RIOT/sys/div
"make" -C /work/riot/RIOT/sys/fmt
"make" -C /work/riot/RIOT/sys/iolist
"make" -C /work/riot/RIOT/sys/isrpipe
"make" -C /work/riot/RIOT/sys/net/gnrc
"make" -C /work/riot/RIOT/sys/net/gnrc/netapi
"make" -C /work/riot/RIOT/sys/net/gnrc/netif
"make" -C /work/riot/RIOT/sys/net/gnrc/netif/hdr
"make" -C /work/riot/RIOT/sys/net/gnrc/netif/init_devs
"make" -C /work/riot/RIOT/sys/net/gnrc/netreg
"make" -C /work/riot/RIOT/sys/net/gnrc/pkt
"make" -C /work/riot/RIOT/sys/net/gnrc/pktbuf
"make" -C /work/riot/RIOT/sys/net/gnrc/pktbuf_static
"make" -C /work/riot/RIOT/sys/net/gnrc/pktdump
"make" -C /work/riot/RIOT/sys/net/link_layer/l2util
"make" -C /work/riot/RIOT/sys/net/netif
"make" -C /work/riot/RIOT/sys/newlib_syscalls_default
"make" -C /work/riot/RIOT/sys/od
"make" -C /work/riot/RIOT/sys/phydat
"make" -C /work/riot/RIOT/sys/pm_layered
"make" -C /work/riot/RIOT/sys/ps
"make" -C /work/riot/RIOT/sys/saul_reg
"make" -C /work/riot/RIOT/sys/shell
"make" -C /work/riot/RIOT/sys/shell/commands
"make" -C /work/riot/RIOT/sys/stdio_uart
"make" -C /work/riot/RIOT/sys/tsrb
"make" -C /work/riot/RIOT/sys/xtimer
   text	   data	    bss	    dec	    hex	filename
  48668	    132	   6156	  54956	   d6ac	/work/riot/RIOT/examples/default/bin/b-l072z-lrwan1/default.elf
iotlab-node --jmespath='keys(@)[0]' --format='int'  --list saclay,st-lrwan1,10 --flash /work/riot/RIOT/examples/default/bin/b-l072z-lrwan1/default.bin | grep 0
0
ssh -t abadie at saclay.iot-lab.info 'socat - tcp:st-lrwan1-10.saclay.iot-lab.info:20000'
This is RIOT! (Version: 2020.07-devel-722-g63a79a-pr/cpu/stmclk_cleanup)
Welcome to RIOT!
> main(): This is RIOT! (Version: 2020.07-devel-722-g63a79a-pr/cpu/stmclk_cleanup)
Welcome to RIOT!
> main(): This is RIOT! (Version: test)
Welcome to RIOT!
> help
help
Command              Description
---------------------------------------
reboot               Reboot the node
version              Prints current RIOT_VERSION
pm                   interact with layered PM subsystem
ps                   Prints information about running threads.
rtc                  control RTC peripheral interface
ifconfig             Configure network interfaces
txtsnd               Sends a custom string as is over the link layer
saul                 interact with sensors and actuators using SAUL
> 
```

=> firmware size:
```
   text	   data	    bss	    dec	    hex	filename
  48668	    132	   6156	  54956	   d6ac	/work/riot/RIOT/examples/default/bin/b-l072z-lrwan1/default.elf
```

- master
```
   text	   data	    bss	    dec	    hex	filename
  48664	    132	   6156	  54952	   d6a8	/work/riot/RIOT/examples/default/bin/b-l072z-lrwan1/default.elf
```

</details>

<details><summary>b-475e-iot01a</summary>

- this PR
```
RIOT_VERSION=test make BOARD=b-l475e-iot01a -C examples/default flash term --no-print-directory IOTLAB_NODE=auto-ssh
Building application "default" for "b-l475e-iot01a" with MCU "stm32".

"make" -C /work/riot/RIOT/boards/b-l475e-iot01a
"make" -C /work/riot/RIOT/core
"make" -C /work/riot/RIOT/cpu/stm32
"make" -C /work/riot/RIOT/cpu/cortexm_common
"make" -C /work/riot/RIOT/cpu/cortexm_common/periph
"make" -C /work/riot/RIOT/cpu/stm32/periph
"make" -C /work/riot/RIOT/cpu/stm32/stmclk
"make" -C /work/riot/RIOT/cpu/stm32/vectors
"make" -C /work/riot/RIOT/drivers
"make" -C /work/riot/RIOT/drivers/hts221
"make" -C /work/riot/RIOT/drivers/lis3mdl
"make" -C /work/riot/RIOT/drivers/lpsxxx
"make" -C /work/riot/RIOT/drivers/lsm6dsl
"make" -C /work/riot/RIOT/drivers/periph_common
"make" -C /work/riot/RIOT/drivers/saul
"make" -C /work/riot/RIOT/drivers/saul/init_devs
"make" -C /work/riot/RIOT/sys
"make" -C /work/riot/RIOT/sys/auto_init
"make" -C /work/riot/RIOT/sys/div
"make" -C /work/riot/RIOT/sys/fmt
"make" -C /work/riot/RIOT/sys/isrpipe
"make" -C /work/riot/RIOT/sys/newlib_syscalls_default
"make" -C /work/riot/RIOT/sys/phydat
"make" -C /work/riot/RIOT/sys/pm_layered
"make" -C /work/riot/RIOT/sys/ps
"make" -C /work/riot/RIOT/sys/saul_reg
"make" -C /work/riot/RIOT/sys/shell
"make" -C /work/riot/RIOT/sys/shell/commands
"make" -C /work/riot/RIOT/sys/stdio_uart
"make" -C /work/riot/RIOT/sys/tsrb
"make" -C /work/riot/RIOT/sys/xtimer
   text	   data	    bss	    dec	    hex	filename
  26544	    132	   2900	  29576	   7388	/work/riot/RIOT/examples/default/bin/b-l475e-iot01a/default.elf
iotlab-node --jmespath='keys(@)[0]' --format='int'  --list saclay,st-iotnode,10 --flash /work/riot/RIOT/examples/default/bin/b-l475e-iot01a/default.bin | grep 0
0
ssh -t abadie at saclay.iot-lab.info 'socat - tcp:st-iotnode-10.saclay.iot-lab.info:20000'
�main(): This is RIOT! (Version: test)
Welcome to RIOT!
> help
help
Command              Description
---------------------------------------
reboot               Reboot the node
version              Prints current RIOT_VERSION
pm                   interact with layered PM subsystem
ps                   Prints information about running threads.
rtc                  control RTC peripheral interface
saul                 interact with sensors and actuators using SAUL
```

=> firmware size
```
   text	   data	    bss	    dec	    hex	filename
  26544	    132	   2900	  29576	   7388	/work/riot/RIOT/examples/default/bin/b-l475e-iot01a/default.elf
```

- master
```
   text	   data	    bss	    dec	    hex	filename
  26544	    132	   2900	  29576	   7388	/work/riot/RIOT/examples/default/bin/b-l475e-iot01a/default.elf
```

</details>

<!--
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

None

<!--
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/14131

-- Commit Summary --

  * cpu/stm32: move stmclk in its own module, remove useless ifdefs

-- File Changes --

    M cpu/stm32/Makefile (2)
    M cpu/stm32/Makefile.dep (4)
    A cpu/stm32/stmclk/Makefile (14)
    R cpu/stm32/stmclk/stmclk_common.c (0)
    R cpu/stm32/stmclk/stmclk_fx.c (11)
    R cpu/stm32/stmclk/stmclk_l0l1.c (6)
    R cpu/stm32/stmclk/stmclk_l4wb.c (5)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/14131.patch
https://github.com/RIOT-OS/RIOT/pull/14131.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/14131
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200525/b814f48b/attachment-0001.htm>


More information about the notifications mailing list