Skip to content
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

cpu/stm32: merge f0/f1/f3 clock configuration headers #15650

Merged
merged 3 commits into from
Dec 20, 2020

Conversation

aabadie
Copy link
Contributor

@aabadie aabadie commented Dec 16, 2020

Contribution description

In master, the configuration is separated between f0 and f1/f3 although they share a lot and the clock initialization code is shared (stmclk_f0f1f3.c).

This PR is merging both files in a single header.

There's also a commit that replace the include of f0/cfg_clock_default.h with clk_conf.h for the stm32f0 boards. This fixes a leftover from previous refactorings.

Testing procedure

  • Green CI
  • Check that hello-world is working on stm32f0/f1/f3 boards:
nucleo-f091rc
$ BUILD_IN_DOCKER=1 RYOT_CI=1 make BOARD=nucleo-f091rc -C examples/hello-world flash term --no-print-directory
Launching build container using image "riot/riotbuild:latest".
docker run --rm --tty --user $(id -u) -v '/usr/share/zoneinfo/Europe/Paris:/etc/localtime:ro' -v '/work/riot/RIOT:/data/riotbuild/riotbase:delegated' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'      -e 'BOARD=nucleo-f091rc'  -w '/data/riotbuild/riotbase/examples/hello-world/' 'riot/riotbuild:latest' make 'BOARD=nucleo-f091rc'    
Building application "hello-world" for "nucleo-f091rc" with MCU "stm32".

"make" -C /data/riotbuild/riotbase/boards/nucleo-f091rc
"make" -C /data/riotbuild/riotbase/boards/common/nucleo
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/cpu/stm32
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common/periph
"make" -C /data/riotbuild/riotbase/cpu/stm32/periph
"make" -C /data/riotbuild/riotbase/cpu/stm32/stmclk
"make" -C /data/riotbuild/riotbase/cpu/stm32/vectors
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/auto_init
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/pm_layered
"make" -C /data/riotbuild/riotbase/sys/stdio_uart
   text	   data	    bss	    dec	    hex	filename
   8676	    112	   2324	  11112	   2b68	/data/riotbuild/riotbase/examples/hello-world/bin/nucleo-f091rc/hello-world.elf
rsync --chmod=ugo=rwX /work/riot/RIOT/examples/hello-world/bin/nucleo-f091rc/hello-world.elf ci@ci-riot-tribe.saclay.inria.fr:/builds/boards/bin/nucleo-f091rc_flashfile.elf
ssh ci@ci-riot-tribe.saclay.inria.fr 'IMAGE_OFFSET= BOARD=nucleo-f091rc QUIET=1 make --no-print-directory -C /builds/boards flash-only FLASHFILE=/builds/boards/bin/nucleo-f091rc_flashfile.elf'
/builds/boards/RIOT/dist/tools/openocd/openocd.sh flash /builds/boards/bin/nucleo-f091rc_flashfile.elf
### Flashing Target ###
Open On-Chip Debugger 0.10.0+dev-g68611ef-dirty (2020-07-20-09:42)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_assert_srst

Info : clock speed 1000 kHz
Info : STLINK V2J23M9 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.260407
Info : stm32f0x.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : starting gdb server for stm32f0x.cpu on 0
Info : Listening on port 41927 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f0x.cpu       hla_target little stm32f0x.cpu       reset

Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0x08000764 msp: 0x20000200
Info : device id = 0x10006442
Info : flash size = 256kbytes
auto erase enabled
wrote 10240 bytes from file /builds/boards/bin/nucleo-f091rc_flashfile.elf in 0.484760s (20.629 KiB/s)

verified 8788 bytes in 0.157481s (54.496 KiB/s)

Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
shutdown command invoked
Done flashing
ssh -t ci@ci-riot-tribe.saclay.inria.fr 'BOARD=nucleo-f091rc QUIET=1 make --no-print-directory -C /builds/boards term' 
/builds/boards/RIOT/dist/tools/pyterm/pyterm -p "/dev/riot/tty-nucleo-f091rc" -b "115200"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2020-12-16 14:43:45,231 # Connect to serial port /dev/riot/tty-nucleo-f091rc
Welcome to pyterm!
Type '/exit' to exit.
2020-12-16 14:43:47,280 # main(): This is RIOT! (Version: 2021.01-devel-1601-gde88e2-pr/cpu/stm32_clk_merge_f0f1f3)
2020-12-16 14:43:47,281 # Hello World!
2020-12-16 14:43:47,285 # You are running RIOT on a(n) nucleo-f091rc board.
2020-12-16 14:43:47,287 # This board features a(n) stm32 MCU.
2020-12-16 14:43:49,612 # Exiting Pyterm
Connection to ci-riot-tribe.saclay.inria.fr closed.
nucleo-f103rb
$ BUILD_IN_DOCKER=1 RYOT_CI=1 make BOARD=nucleo-f103rb -C examples/hello-world flash term --no-print-directory
Launching build container using image "riot/riotbuild:latest".
docker run --rm --tty --user $(id -u) -v '/usr/share/zoneinfo/Europe/Paris:/etc/localtime:ro' -v '/work/riot/RIOT:/data/riotbuild/riotbase:delegated' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'      -e 'BOARD=nucleo-f103rb'  -w '/data/riotbuild/riotbase/examples/hello-world/' 'riot/riotbuild:latest' make 'BOARD=nucleo-f103rb'    
Building application "hello-world" for "nucleo-f103rb" with MCU "stm32".

[INFO] updating stm32cmsis /data/riotbuild/riotbase/cpu/stm32/include/vendor/cmsis/f1/.pkg-state.git-downloaded
echo 2948138428461c0621fd53b269862c6e6bb043ce   > /data/riotbuild/riotbase/cpu/stm32/include/vendor/cmsis/f1/.pkg-state.git-downloaded
[INFO] patch stm32cmsis
"make" -C /data/riotbuild/riotbase/boards/nucleo-f103rb
"make" -C /data/riotbuild/riotbase/boards/common/nucleo
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/cpu/stm32
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common/periph
"make" -C /data/riotbuild/riotbase/cpu/stm32/periph
"make" -C /data/riotbuild/riotbase/cpu/stm32/stmclk
"make" -C /data/riotbuild/riotbase/cpu/stm32/vectors
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/auto_init
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/pm_layered
"make" -C /data/riotbuild/riotbase/sys/stdio_uart
   text	   data	    bss	    dec	    hex	filename
   8440	    112	   2324	  10876	   2a7c	/data/riotbuild/riotbase/examples/hello-world/bin/nucleo-f103rb/hello-world.elf
rsync --chmod=ugo=rwX /work/riot/RIOT/examples/hello-world/bin/nucleo-f103rb/hello-world.elf ci@ci-riot-tribe.saclay.inria.fr:/builds/boards/bin/nucleo-f103rb_flashfile.elf
ssh ci@ci-riot-tribe.saclay.inria.fr 'IMAGE_OFFSET= BOARD=nucleo-f103rb QUIET=1 make --no-print-directory -C /builds/boards flash-only FLASHFILE=/builds/boards/bin/nucleo-f103rb_flashfile.elf'
/builds/boards/RIOT/dist/tools/openocd/openocd.sh flash /builds/boards/bin/nucleo-f103rb_flashfile.elf
### Flashing Target ###
Open On-Chip Debugger 0.10.0+dev-g68611ef-dirty (2020-07-20-09:42)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_assert_srst

Info : clock speed 1000 kHz
Info : STLINK V2J29M18 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.261093
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 0
Info : Listening on port 37265 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f1x.cpu       hla_target little stm32f1x.cpu       reset

target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08000648 msp: 0x20000200
Info : device id = 0x20036410
Info : flash size = 128kbytes
auto erase enabled
wrote 9216 bytes from file /builds/boards/bin/nucleo-f103rb_flashfile.elf in 0.558304s (16.120 KiB/s)

verified 8552 bytes in 0.174141s (47.959 KiB/s)

shutdown command invoked
Done flashing
ssh -t ci@ci-riot-tribe.saclay.inria.fr 'BOARD=nucleo-f103rb QUIET=1 make --no-print-directory -C /builds/boards term' 
/builds/boards/RIOT/dist/tools/pyterm/pyterm -p "/dev/riot/tty-nucleo-f103rb" -b "115200"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2020-12-16 14:45:33,402 # Connect to serial port /dev/riot/tty-nucleo-f103rb
Welcome to pyterm!
Type '/exit' to exit.
2020-12-16 14:45:37,398 # main(): This is RIOT! (Version: 2021.01-devel-1601-gde88e2-pr/cpu/stm32_clk_merge_f0f1f3)
2020-12-16 14:45:37,399 # Hello World!
2020-12-16 14:45:37,403 # You are running RIOT on a(n) nucleo-f103rb board.
2020-12-16 14:45:37,407 # This board features a(n) stm32 MCU.
nucleo-f303re
$ BUILD_IN_DOCKER=1 RYOT_CI=1 make BOARD=nucleo-f303re -C examples/hello-world flash term --no-print-directory
Launching build container using image "riot/riotbuild:latest".
docker run --rm --tty --user $(id -u) -v '/usr/share/zoneinfo/Europe/Paris:/etc/localtime:ro' -v '/work/riot/RIOT:/data/riotbuild/riotbase:delegated' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'      -e 'BOARD=nucleo-f303re'  -w '/data/riotbuild/riotbase/examples/hello-world/' 'riot/riotbuild:latest' make 'BOARD=nucleo-f303re'    
Building application "hello-world" for "nucleo-f303re" with MCU "stm32".

[INFO] updating stm32cmsis /data/riotbuild/riotbase/cpu/stm32/include/vendor/cmsis/f3/.pkg-state.git-downloaded
echo aa2333a5313f65eb1a63bd876edb455197b38f91   > /data/riotbuild/riotbase/cpu/stm32/include/vendor/cmsis/f3/.pkg-state.git-downloaded
[INFO] patch stm32cmsis
"make" -C /data/riotbuild/riotbase/boards/nucleo-f303re
"make" -C /data/riotbuild/riotbase/boards/common/nucleo
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/cpu/stm32
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common/periph
"make" -C /data/riotbuild/riotbase/cpu/stm32/periph
"make" -C /data/riotbuild/riotbase/cpu/stm32/stmclk
"make" -C /data/riotbuild/riotbase/cpu/stm32/vectors
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/auto_init
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/pm_layered
"make" -C /data/riotbuild/riotbase/sys/stdio_uart
   text	   data	    bss	    dec	    hex	filename
   8920	    112	   2324	  11356	   2c5c	/data/riotbuild/riotbase/examples/hello-world/bin/nucleo-f303re/hello-world.elf
rsync --chmod=ugo=rwX /work/riot/RIOT/examples/hello-world/bin/nucleo-f303re/hello-world.elf ci@ci-riot-tribe.saclay.inria.fr:/builds/boards/bin/nucleo-f303re_flashfile.elf
ssh ci@ci-riot-tribe.saclay.inria.fr 'IMAGE_OFFSET= BOARD=nucleo-f303re QUIET=1 make --no-print-directory -C /builds/boards flash-only FLASHFILE=/builds/boards/bin/nucleo-f303re_flashfile.elf'
/builds/boards/RIOT/dist/tools/openocd/openocd.sh flash /builds/boards/bin/nucleo-f303re_flashfile.elf
### Flashing Target ###
Open On-Chip Debugger 0.10.0+dev-g68611ef-dirty (2020-07-20-09:42)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_assert_srst

Info : clock speed 1000 kHz
Info : STLINK V2J25M14 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.241803
Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f3x.cpu on 0
Info : Listening on port 37131 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f3x.cpu       hla_target little stm32f3x.cpu       reset

Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800083c msp: 0x20000200
Info : device id = 0x10036446
Info : flash size = 512kbytes
auto erase enabled
wrote 10240 bytes from file /builds/boards/bin/nucleo-f303re_flashfile.elf in 0.614133s (16.283 KiB/s)

verified 9032 bytes in 0.242502s (36.372 KiB/s)

Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
shutdown command invoked
Done flashing
ssh -t ci@ci-riot-tribe.saclay.inria.fr 'BOARD=nucleo-f303re QUIET=1 make --no-print-directory -C /builds/boards term' 
/builds/boards/RIOT/dist/tools/pyterm/pyterm -p "/dev/riot/tty-nucleo-f303re" -b "115200"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2020-12-16 14:46:27,329 # Connect to serial port /dev/riot/tty-nucleo-f303re
Welcome to pyterm!
Type '/exit' to exit.
2020-12-16 14:46:31,568 # main(): This is RIOT! (Version: 2021.01-devel-1601-gde88e2-pr/cpu/stm32_clk_merge_f0f1f3)
2020-12-16 14:46:31,569 # Hello World!
2020-12-16 14:46:31,574 # You are running RIOT on a(n) nucleo-f303re board.
2020-12-16 14:46:31,576 # This board features a(n) stm32 MCU.

Issues/PRs references

Tick another item in #14975

@aabadie aabadie added Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports labels Dec 16, 2020
@benpicco benpicco added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Dec 16, 2020
@benpicco benpicco merged commit 7d8f801 into RIOT-OS:master Dec 20, 2020
@aabadie aabadie deleted the pr/cpu/stm32_clk_merge_f0f1f3 branch November 17, 2021 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants