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/stm32f2f4f7: expose clock configuration in kconfig #15632

Merged

Conversation

aabadie
Copy link
Contributor

@aabadie aabadie commented Dec 15, 2020

Contribution description

This PR models the clock configuration of STM32 F2, F4 and F7 to Kconfig.
Normally all specific cases are handled but care must be taken with the boards that have a custom HSE (e.g not 8MHz):

  • F4: f4vi1, msbiot, pyboard, stm32f429i-disco (UART over USB), ublox-c030-u201, weact-f401ce/c and weact-f411ce (UART over USB)
  • F7: stm32f723e-disco (tested), stm32f769i-disco

Testing procedure

  • Ensure that the configured clock is unchanged compared to master and verify that it can be configured using menuconfig target (enable PLL custom configuration, save, build, try other clock sources, etc)

Apply the following patch:

diff --git a/examples/hello-world/main.c b/examples/hello-world/main.c
index f51bf8c0a0..7a1910279c 100644
--- a/examples/hello-world/main.c
+++ b/examples/hello-world/main.c
@@ -20,6 +20,9 @@
  */
 
 #include <stdio.h>
+#include <inttypes.h>
+
+#include "board.h"
 
 int main(void)
 {
@@ -28,5 +31,15 @@ int main(void)
     printf("You are running RIOT on a(n) %s board.\n", RIOT_BOARD);
     printf("This board features a(n) %s MCU.\n", RIOT_MCU);
 
+    printf("Clock coreclock: %" PRIu32 "\n", (uint32_t)CLOCK_CORECLOCK);
+    printf("AHB clock: %" PRIu32 "\n", (uint32_t)CLOCK_AHB);
+    printf("APB1 clock: %" PRIu32 "\n", (uint32_t)CLOCK_APB1);
+#ifdef CLOCK_APB2
+    printf("APB2 clock: %" PRIu32 "\n", (uint32_t)CLOCK_APB2);
+#endif
+#ifdef CLOCK_PLLQ
+    printf("PLLQ clock: %" PRIu32 "\n", (uint32_t)CLOCK_PLLQ);
+#endif
+
     return 0;
 }
nucleo-f410rb
$ BUILD_IN_DOCKER=1 make BOARD=nucleo-f410rb -C examples/hello-world clean menuconfig --no-print-directory 
make: Nothing to be done for 'clean'.
Loaded configuration '/work/riot/RIOT/examples/hello-world/bin/nucleo-f410rb/generated/out.config'
Configuration saved to '/work/riot/RIOT/examples/hello-world/bin/nucleo-f410rb/generated/out.config'
make /work/riot/RIOT/examples/hello-world/bin/nucleo-f410rb/generated/autoconf.h
$ BUILD_IN_DOCKER=1 make BOARD=nucleo-f410rb -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-f410rb'  -w '/data/riotbuild/riotbase/examples/hello-world/' 'riot/riotbuild:latest' make 'BOARD=nucleo-f410rb'    
Building application "hello-world" for "nucleo-f410rb" with MCU "stm32".

"make" -C /data/riotbuild/riotbase/boards/nucleo-f410rb
"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
   9180	    112	   2324	  11616	   2d60	/data/riotbuild/riotbase/examples/hello-world/bin/nucleo-f410rb/hello-world.elf
/work/riot/RIOT/dist/tools/openocd/openocd.sh flash /work/riot/RIOT/examples/hello-world/bin/nucleo-f410rb/hello-world.elf
### Flashing Target ###
Open On-Chip Debugger 0.10.0+dev-01406-gca211373d-dirty (2020-10-26-22:35)
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 2000 kHz
Info : STLINK V2J24M11 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.252880
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f4x.cpu on 0
Info : Listening on port 40465 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f4x.cpu       hla_target little stm32f4x.cpu       reset

Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800079c msp: 0x20000200
Info : device id = 0x10006458
Info : flash size = 128 kbytes
auto erase enabled
wrote 16384 bytes from file /work/riot/RIOT/examples/hello-world/bin/nucleo-f410rb/hello-world.elf in 0.662500s (24.151 KiB/s)

verified 9292 bytes in 0.138411s (65.560 KiB/s)

Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
shutdown command invoked
Done flashing
/work/riot/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2020-12-15 11:29:48,652 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2020-12-15 11:29:50,107 # main(): This is RIOT! (Version: 2021.01-devel-1580-g0ee99-pr/boards/stm32f2f4f7_clock_kconfig_only)
2020-12-15 11:29:50,108 # Hello World!
2020-12-15 11:29:50,113 # You are running RIOT on a(n) nucleo-f410rb board.
2020-12-15 11:29:50,114 # This board features a(n) stm32 MCU.
2020-12-15 11:29:50,119 # Clock coreclock: 100000000
2020-12-15 11:29:50,120 # AHB clock: 100000000
2020-12-15 11:29:50,125 # APB1 clock: 50000000
2020-12-15 11:29:50,126 # APB2 clock: 100000000
2020-12-15 11:29:50,126 # PLLQ clock: 50000000
2020-12-15 11:29:51,137 # Exiting Pyterm
stm32f429i-disc1
$ BUILD_IN_DOCKER=1 make BOARD=stm32f429i-disc1 -C examples/hello-world clean menuconfig --no-print-directory 
make: Nothing to be done for 'clean'.
Loaded configuration '/work/riot/RIOT/examples/hello-world/bin/stm32f429i-disc1/generated/out.config'
Configuration saved to '/work/riot/RIOT/examples/hello-world/bin/stm32f429i-disc1/generated/out.config'
make /work/riot/RIOT/examples/hello-world/bin/stm32f429i-disc1/generated/autoconf.h
$ BUILD_IN_DOCKER=1 make BOARD=stm32f429i-disc1 -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=stm32f429i-disc1'  -w '/data/riotbuild/riotbase/examples/hello-world/' 'riot/riotbuild:latest' make 'BOARD=stm32f429i-disc1'    
Building application "hello-world" for "stm32f429i-disc1" with MCU "stm32".

"make" -C /data/riotbuild/riotbase/boards/stm32f429i-disc1
"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
   9104	    112	   2300	  11516	   2cfc	/data/riotbuild/riotbase/examples/hello-world/bin/stm32f429i-disc1/hello-world.elf
/work/riot/RIOT/dist/tools/openocd/openocd.sh flash /work/riot/RIOT/examples/hello-world/bin/stm32f429i-disc1/hello-world.elf
### Flashing Target ###
Open On-Chip Debugger 0.10.0+dev-01406-gca211373d-dirty (2020-10-26-22:35)
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
Info : clock speed 2000 kHz
Info : STLINK V2J25M14 (API v2) VID:PID 0483:374B
Info : Target voltage: 2.847647
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 300ms
Info : starting gdb server for stm32f4x.cpu on 0
Info : Listening on port 40581 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f4x.cpu       hla_target little stm32f4x.cpu       unknown

Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Error: mem2array: Read @ 0xe0042004, w=4, cnt=1, failed
Error executing event examine-end on target stm32f4x.cpu:
/usr/local/bin/../share/openocd/scripts/mem_helper.tcl:6: Error: 
in procedure 'ocd_process_reset' 
in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 288
in procedure 'mmw' called at file "/usr/local/bin/../share/openocd/scripts/target/stm32f4x.cfg", line 79
in procedure 'mrw' called at file "/usr/local/bin/../share/openocd/scripts/mem_helper.tcl", line 36
at file "/usr/local/bin/../share/openocd/scripts/mem_helper.tcl", line 6
Info : Previous state query failed, trying to reconnect
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08000980 msp: 0x20000200
Polling target stm32f4x.cpu failed, trying to reexamine
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : device id = 0x20016419
Info : flash size = 2048 kbytes
Info : Dual Bank 2048 kiB STM32F42x/43x/469/479 found
auto erase enabled
wrote 16384 bytes from file /work/riot/RIOT/examples/hello-world/bin/stm32f429i-disc1/hello-world.elf in 0.654829s (24.434 KiB/s)

verified 9216 bytes in 0.139554s (64.491 KiB/s)

Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
shutdown command invoked
Done flashing
/work/riot/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2020-12-15 11:32:38,183 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2020-12-15 11:32:54,717 # main(): This is RIOT! (Version: 2021.01-devel-1580-g0ee99-pr/boards/stm32f2f4f7_clock_kconfig_only)
2020-12-15 11:32:54,718 # Hello World!
2020-12-15 11:32:54,723 # You are running RIOT on a(n) stm32f429i-disc1 board.
2020-12-15 11:32:54,724 # This board features a(n) stm32 MCU.
2020-12-15 11:32:54,729 # Clock coreclock: 180000000
2020-12-15 11:32:54,730 # AHB clock: 180000000
2020-12-15 11:32:54,735 # APB1 clock: 45000000
2020-12-15 11:32:54,735 # APB2 clock: 90000000
2020-12-15 11:32:54,735 # PLLQ clock: 45000000
2020-12-15 11:32:56,748 # Exiting Pyterm

also tested HSE/HSI16 sources and all worked as expected.

nucleo-f207zg
$ BUILD_IN_DOCKER=1 RYOT_CI=1 make BOARD=nucleo-f207zg -C examples/hello-world menuconfig --no-print-directory 
Loaded configuration '/work/riot/RIOT/examples/hello-world/bin/nucleo-f207zg/generated/out.config'
Configuration saved to '/work/riot/RIOT/examples/hello-world/bin/nucleo-f207zg/generated/out.config'
make /work/riot/RIOT/examples/hello-world/bin/nucleo-f207zg/generated/autoconf.h
$ BUILD_IN_DOCKER=1 RYOT_CI=1 make BOARD=nucleo-f207zg -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-f207zg'  -w '/data/riotbuild/riotbase/examples/hello-world/' 'riot/riotbuild:latest' make 'BOARD=nucleo-f207zg'    
Building application "hello-world" for "nucleo-f207zg" with MCU "stm32".

[INFO] updating stm32cmsis /data/riotbuild/riotbase/cpu/stm32/include/vendor/cmsis/f2/.pkg-state.git-downloaded
echo 2415e69642f0d0afd256ec93fa4ba1ac010b348e   > /data/riotbuild/riotbase/cpu/stm32/include/vendor/cmsis/f2/.pkg-state.git-downloaded
[INFO] patch stm32cmsis
"make" -C /data/riotbuild/riotbase/boards/nucleo-f207zg
"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
   8952	    112	   2324	  11388	   2c7c	/data/riotbuild/riotbase/examples/hello-world/bin/nucleo-f207zg/hello-world.elf
rsync --chmod=ugo=rwX /work/riot/RIOT/examples/hello-world/bin/nucleo-f207zg/hello-world.elf ci@ci-riot-tribe.saclay.inria.fr:/builds/boards/bin/nucleo-f207zg_flashfile.elf
ssh ci@ci-riot-tribe.saclay.inria.fr 'IMAGE_OFFSET= BOARD=nucleo-f207zg QUIET=1 make --no-print-directory -C /builds/boards flash-only FLASHFILE=/builds/boards/bin/nucleo-f207zg_flashfile.elf'
/builds/boards/RIOT/dist/tools/openocd/openocd.sh flash /builds/boards/bin/nucleo-f207zg_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.249572
Info : stm32f2x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f2x.cpu on 0
Info : Listening on port 37925 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f2x.cpu       hla_target little stm32f2x.cpu       reset

target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080007bc msp: 0x20000200
Info : device id = 0x201f6411
Info : flash size = 1024 kbytes
auto erase enabled
wrote 16384 bytes from file /builds/boards/bin/nucleo-f207zg_flashfile.elf in 0.745645s (21.458 KiB/s)

verified 9064 bytes in 0.116652s (75.880 KiB/s)

shutdown command invoked
Done flashing
ssh -t ci@ci-riot-tribe.saclay.inria.fr 'BOARD=nucleo-f207zg QUIET=1 make --no-print-directory -C /builds/boards term' 
/builds/boards/RIOT/dist/tools/pyterm/pyterm -p "/dev/riot/tty-nucleo-f207zg" -b "115200"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2020-12-15 11:37:15,409 # Connect to serial port /dev/riot/tty-nucleo-f207zg
Welcome to pyterm!
Type '/exit' to exit.
2020-12-15 11:37:19,342 # main(): This is RIOT! (Version: 2021.01-devel-1580-g0ee99-pr/boards/stm32f2f4f7_clock_kconfig_only)
2020-12-15 11:37:19,343 # Hello World!
2020-12-15 11:37:19,348 # You are running RIOT on a(n) nucleo-f207zg board.
2020-12-15 11:37:19,349 # This board features a(n) stm32 MCU.
2020-12-15 11:37:19,353 # Clock coreclock: 120000000
2020-12-15 11:37:19,354 # AHB clock: 120000000
2020-12-15 11:37:19,360 # APB1 clock: 30000000
2020-12-15 11:37:19,360 # APB2 clock: 60000000
2020-12-15 11:37:19,361 # PLLQ clock: 48000000
2020-12-15 11:37:23,765 # Exiting Pyterm
Connection to ci-riot-tribe.saclay.inria.fr closed.
nucleo-f767zi
$ BUILD_IN_DOCKER=1 RYOT_CI=1 make BOARD=nucleo-f767zi -C examples/hello-world menuconfig --no-print-directory 
Loaded configuration '/work/riot/RIOT/examples/hello-world/bin/nucleo-f767zi/generated/out.config'
Configuration saved to '/work/riot/RIOT/examples/hello-world/bin/nucleo-f767zi/generated/out.config'
make /work/riot/RIOT/examples/hello-world/bin/nucleo-f767zi/generated/autoconf.h
$ BUILD_IN_DOCKER=1 RYOT_CI=1 make BOARD=nucleo-f767zi -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-f767zi'  -w '/data/riotbuild/riotbase/examples/hello-world/' 'riot/riotbuild:latest' make 'BOARD=nucleo-f767zi'    
Building application "hello-world" for "nucleo-f767zi" with MCU "stm32".

"make" -C /data/riotbuild/riotbase/boards/nucleo-f767zi
"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
   9324	    112	   2324	  11760	   2df0	/data/riotbuild/riotbase/examples/hello-world/bin/nucleo-f767zi/hello-world.elf
rsync --chmod=ugo=rwX /work/riot/RIOT/examples/hello-world/bin/nucleo-f767zi/hello-world.elf ci@ci-riot-tribe.saclay.inria.fr:/builds/boards/bin/nucleo-f767zi_flashfile.elf
ssh ci@ci-riot-tribe.saclay.inria.fr 'IMAGE_OFFSET= BOARD=nucleo-f767zi QUIET=1 make --no-print-directory -C /builds/boards flash-only FLASHFILE=/builds/boards/bin/nucleo-f767zi_flashfile.elf'
/builds/boards/RIOT/dist/tools/openocd/openocd.sh flash /builds/boards/bin/nucleo-f767zi_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 2000 kHz
Info : STLINK V2J28M17 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.252528
Info : stm32f7x.cpu: hardware has 8 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f7x.cpu on 0
Info : Listening on port 38807 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f7x.cpu       hla_target little stm32f7x.cpu       reset

Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080008d0 msp: 0x20000200
Info : device id = 0x10006451
Info : flash size = 2048 kbytes
Info : Single Bank 2048 kiB STM32F76x/77x found
auto erase enabled
wrote 32768 bytes from file /builds/boards/bin/nucleo-f767zi_flashfile.elf in 0.787269s (40.647 KiB/s)

verified 9436 bytes in 0.122125s (75.454 KiB/s)

Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
shutdown command invoked
Done flashing
ssh -t ci@ci-riot-tribe.saclay.inria.fr 'BOARD=nucleo-f767zi QUIET=1 make --no-print-directory -C /builds/boards term' 
/builds/boards/RIOT/dist/tools/pyterm/pyterm -p "/dev/riot/tty-nucleo-f767zi" -b "115200"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2020-12-15 11:40:58,926 # Connect to serial port /dev/riot/tty-nucleo-f767zi
Welcome to pyterm!
Type '/exit' to exit.
2020-12-15 11:41:07,312 # 2021.01-devel-15main(): This is RIOT! (Version: 2021.01-devel-1580-g0ee99-pr/boards/stm32f2f4f7_clock_kconfig_only)
2020-12-15 11:41:07,313 # Hello World!
2020-12-15 11:41:07,317 # You are running RIOT on a(n) nucleo-f767zi board.
2020-12-15 11:41:07,320 # This board features a(n) stm32 MCU.
2020-12-15 11:41:07,323 # Clock coreclock: 216000000
2020-12-15 11:41:07,325 # AHB clock: 216000000
2020-12-15 11:41:07,326 # APB1 clock: 54000000
2020-12-15 11:41:07,328 # APB2 clock: 108000000
2020-12-15 11:41:07,330 # PLLQ clock: 48000000
2020-12-15 11:41:09,582 # Exiting Pyterm
Connection to ci-riot-tribe.saclay.inria.fr closed.
stm32f723e-disco
$ BUILD_IN_DOCKER=1 make BOARD=stm32f723e-disco -C examples/hello-world menuconfig --no-print-directory 
Loaded configuration '/work/riot/RIOT/examples/hello-world/bin/stm32f723e-disco/generated/out.config'
No changes to save (for '/work/riot/RIOT/examples/hello-world/bin/stm32f723e-disco/generated/out.config')
make /work/riot/RIOT/examples/hello-world/bin/stm32f723e-disco/generated/autoconf.h
$ BUILD_IN_DOCKER=1 make BOARD=stm32f723e-disco -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=stm32f723e-disco'  -w '/data/riotbuild/riotbase/examples/hello-world/' 'riot/riotbuild:latest' make 'BOARD=stm32f723e-disco'    
Building application "hello-world" for "stm32f723e-disco" with MCU "stm32".

"make" -C /data/riotbuild/riotbase/boards/stm32f723e-disco
"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/isrpipe
"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
"make" -C /data/riotbuild/riotbase/sys/tsrb
   text	   data	    bss	    dec	    hex	filename
   9888	    132	   2400	  12420	   3084	/data/riotbuild/riotbase/examples/hello-world/bin/stm32f723e-disco/hello-world.elf
/work/riot/RIOT/dist/tools/openocd/openocd.sh flash /work/riot/RIOT/examples/hello-world/bin/stm32f723e-disco/hello-world.elf
### Flashing Target ###
Open On-Chip Debugger 0.10.0+dev-01406-gca211373d-dirty (2020-10-26-22:35)
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
Info : clock speed 2000 kHz
Info : STLINK V2J28M18 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.233684
Info : stm32f7x.cpu: hardware has 0 breakpoints, 10 watchpoints
Info : starting gdb server for stm32f7x.cpu on 0
Info : Listening on port 39361 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f7x.cpu       hla_target little stm32f7x.cpu       halted

Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800057c msp: 0x20000200
Info : device id = 0x10006452
Info : flash size = 512 kbytes
auto erase enabled
wrote 16384 bytes from file /work/riot/RIOT/examples/hello-world/bin/stm32f723e-disco/hello-world.elf in 0.618411s (25.873 KiB/s)

verified 10020 bytes in 0.069643s (140.505 KiB/s)

Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
shutdown command invoked
Done flashing
/work/riot/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200"  
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2020-12-15 11:46:39,534 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2020-12-15 11:46:48,505 # main(): This is RIOT! (Version: 2021.01-devel-1580-g0ee99-pr/boards/stm32f2f4f7_clock_kconfig_only)
2020-12-15 11:46:48,506 # Hello World!
2020-12-15 11:46:48,512 # You are running RIOT on a(n) stm32f723e-disco board.
2020-12-15 11:46:48,514 # This board features a(n) stm32 MCU.
2020-12-15 11:46:48,517 # Clock coreclock: 216000000
2020-12-15 11:46:48,519 # AHB clock: 216000000
2020-12-15 11:46:48,521 # APB1 clock: 54000000
2020-12-15 11:46:48,523 # APB2 clock: 108000000
2020-12-15 11:46:48,524 # PLLQ clock: 48000000
2020-12-15 11:46:53,025 # Exiting Pyterm

Issues/PRs references

Ticks an item in #14975

@aabadie aabadie added Platform: ARM Platform: This PR/issue effects ARM-based platforms 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 Area: Kconfig Area: Kconfig integration labels Dec 15, 2020
@aabadie aabadie force-pushed the pr/boards/stm32f2f4f7_clock_kconfig_only branch from 0ee99c6 to 70f9700 Compare December 15, 2020 11:00
@aabadie aabadie force-pushed the pr/boards/stm32f2f4f7_clock_kconfig_only branch 2 times, most recently from 9c137b6 to b8e6d75 Compare December 15, 2020 15:23
@aabadie
Copy link
Contributor Author

aabadie commented Dec 18, 2020

@leandrolanzieri are you ok with the latest changes ? @benpicco if possible, can you test this PR on the weact-f4xx boards ?

cpu/stm32/kconfigs/Kconfig.clk Show resolved Hide resolved
cpu/stm32/kconfigs/f4/Kconfig Show resolved Hide resolved
cpu/stm32/kconfigs/Kconfig.clk Show resolved Hide resolved
@aabadie aabadie force-pushed the pr/boards/stm32f2f4f7_clock_kconfig_only branch 2 times, most recently from 979cf83 to 542447d Compare January 4, 2021 16:06
@aabadie
Copy link
Contributor Author

aabadie commented Jan 4, 2021

squashed

@leandrolanzieri leandrolanzieri added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines labels Jan 5, 2021
@leandrolanzieri
Copy link
Contributor

@benpicco if possible, can you test this PR on the weact-f4xx boards ?

@benpicco any chance of quickly testing this?

@aabadie
Copy link
Contributor Author

aabadie commented Jan 5, 2021

@benpicco any chance of quickly testing this (on weact-f411ce) ?

ping!

@benpicco
Copy link
Contributor

benpicco commented Jan 5, 2021

weact-f411ce

2021-01-05 18:08:53,637 # Clock coreclock: 96000000
2021-01-05 18:08:53,637 # AHB clock: 96000000
2021-01-05 18:08:53,637 # APB1 clock: 48000000
2021-01-05 18:08:53,638 # APB2 clock: 96000000
2021-01-05 18:08:53,638 # PLLQ clock: 48000000

after a make BOARD=weact-f411ce menuconfig, saving (no changes) and flashing again I get

2021-01-05 18:12:07,651 # Clock coreclock: 30720000
2021-01-05 18:12:07,652 # AHB clock: 30720000
2021-01-05 18:12:07,652 # APB1 clock: 15360000
2021-01-05 18:12:07,652 # APB2 clock: 30720000
2021-01-05 18:12:07,653 # PLLQ clock: 15360000

@aabadie
Copy link
Contributor Author

aabadie commented Jan 5, 2021

after a make BOARD=weact-f411ce menuconfig, saving (no changes) and flashing again I get

Thanks, so something is wrong...

@aabadie
Copy link
Contributor Author

aabadie commented Jan 5, 2021

I just looked at it and I don't understand the problem. All values seems correctly computed in autoconf.h:

#define CONFIG_CUSTOM_PLL_PARAMS 1
#define CONFIG_CLOCK_PLL_M 25
#define CONFIG_CLOCK_PLL_N 192
#define CONFIG_PLL_P_DIV_2 1
#define CONFIG_CLOCK_PLL_P 2
#define CONFIG_CLOCK_PLL_Q 4

More importantly, if PLLQ was completely wrong, the USB wouldn't work at all since it's used as the 48MHz clock source.

@benpicco
Copy link
Contributor

I found the issue!
The problem was that I included clk_conf.h directly because the required defines were not pulled in through board.h.

Now I'm including periph_conf.h in the modified "hello world" example instead, and with this I get

2021-01-19 20:53:33,524 # Clock coreclock: 96000000
2021-01-19 20:53:33,524 # AHB clock: 96000000
2021-01-19 20:53:33,525 # APB1 clock: 48000000
2021-01-19 20:53:33,525 # APB2 clock: 96000000
2021-01-19 20:53:33,526 # PLLQ clock: 48000000

either way.

@aabadie aabadie force-pushed the pr/boards/stm32f2f4f7_clock_kconfig_only branch from 542447d to 551eb80 Compare January 19, 2021 21:09
@aabadie
Copy link
Contributor Author

aabadie commented Jan 19, 2021

rebased to include the latest pr checks.

@aabadie aabadie merged commit f0606b0 into RIOT-OS:master Jan 20, 2021
@aabadie aabadie deleted the pr/boards/stm32f2f4f7_clock_kconfig_only branch January 20, 2021 08:14
@kaspar030 kaspar030 added this to the Release 2021.04 milestone Apr 23, 2021
@leandrolanzieri leandrolanzieri added the Release notes: added Set on PRs that have been processed into the release notes for the current release. label Apr 28, 2021
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 Area: Kconfig Area: Kconfig integration CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Release notes: added Set on PRs that have been processed into the release notes for the current release. Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants