Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

sys/stdio_semihosting: model in Kconfig #19651

Merged
merged 4 commits into from
Jun 19, 2023

Conversation

aabadie
Copy link
Contributor

@aabadie aabadie commented May 23, 2023

Contribution description

This was quite straight-forward.

Testing procedure

  • Green CI
  • tests/sys/stdio_semihosting builds fine and produces the same binary with TEST_KCONFIG=1 and TEST_KCONFIG=0

Issues/PRs references

Ticks one item in #16875

@aabadie aabadie added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label May 23, 2023
@aabadie aabadie requested a review from MrKevinWeiss May 23, 2023 08:53
@github-actions github-actions bot added Area: sys Area: System Area: tests Area: tests and testing framework labels May 23, 2023
@riot-ci
Copy link

riot-ci commented May 23, 2023

Murdock results

✔️ PASSED

d4b35ec boards: fix periph_uart_hw_fc dependency resolution

Success Failures Total Runtime
6934 0 6934 12m:08s

Artifacts

@MrKevinWeiss
Copy link
Contributor

Maybe we wait until #19086 gets in, it should simplify the stdio system a lot more.

@aabadie aabadie force-pushed the pr/sys/stdio_semihosting_kconfig branch from 4ae446e to a6b7f2f Compare June 1, 2023 12:29
@aabadie aabadie added the CI: no fast fail don't abort PR build after first error label Jun 1, 2023
@aabadie aabadie force-pushed the pr/sys/stdio_semihosting_kconfig branch from a6b7f2f to ac4a8c5 Compare June 1, 2023 12:36
@aabadie
Copy link
Contributor Author

aabadie commented Jun 1, 2023

Maybe we wait until #19086 gets in, it should simplify the stdio system a lot more.

Now that #19086 is merged, I rebased this one and think it's ready.

@aabadie
Copy link
Contributor Author

aabadie commented Jun 13, 2023

ping @MrKevinWeiss

Copy link
Contributor

@MrKevinWeiss MrKevinWeiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@MrKevinWeiss
Copy link
Contributor

bors merge

bors bot added a commit that referenced this pull request Jun 13, 2023
19651: sys/stdio_semihosting: model in Kconfig r=MrKevinWeiss a=aabadie



Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
@bors
Copy link
Contributor

bors bot commented Jun 13, 2023

Build failed:

@MrKevinWeiss
Copy link
Contributor

hmmm I will look into it.

@MrKevinWeiss
Copy link
Contributor

Looks like a leftover:

diff --git a/boards/common/weact-f4x1cx/weact-f4x1cx.config b/boards/common/weact-f4x1cx/weact-f4x1cx.config
index d7a295b937..1fdb032431 100644
--- a/boards/common/weact-f4x1cx/weact-f4x1cx.config
+++ b/boards/common/weact-f4x1cx/weact-f4x1cx.config
@@ -1,2 +1 @@
 CONFIG_MODULE_BOOTLOADER_STM32=y
-CONFIG_MODULE_USB_BOARD_RESET=y

@aabadie aabadie force-pushed the pr/sys/stdio_semihosting_kconfig branch from ac4a8c5 to c84f97a Compare June 16, 2023 09:38
@aabadie
Copy link
Contributor Author

aabadie commented Jun 16, 2023

Looks like a leftover:

Thanks, applied!

@github-actions github-actions bot added the Area: boards Area: Board ports label Jun 16, 2023
@MrKevinWeiss
Copy link
Contributor

I found some things locally testing, let me go through them.

@MrKevinWeiss
Copy link
Contributor

Turns out a bit more than I thought:

diff --git a/boards/common/weact-f4x1cx/Kconfig b/boards/common/weact-f4x1cx/Kconfig
index 46fc01fcd7..825127591f 100644
--- a/boards/common/weact-f4x1cx/Kconfig
+++ b/boards/common/weact-f4x1cx/Kconfig
@@ -24,6 +24,8 @@ config BOARD_COMMON_WEACT_F4X1CX
 
     select HAVE_SAUL_GPIO
     select HAVE_MTD_SPI_NOR
+    select MODULE_BOOTLOADER_STM32 if MODULE_STDIO_CDC_ACM
+    select MODULE_USB_BOARD_RESET if KCONFIG_USB && TEST_KCONFIG
 
 config CLOCK_HSE
     default 25000000
diff --git a/boards/common/weact-f4x1cx/Makefile.features b/boards/common/weact-f4x1cx/Makefile.features
index 8778a2e59c..d2d81aba42 100644
--- a/boards/common/weact-f4x1cx/Makefile.features
+++ b/boards/common/weact-f4x1cx/Makefile.features
@@ -12,9 +12,3 @@ FEATURES_PROVIDED += periph_usbdev
 
 # Various other features (if any)
 FEATURES_PROVIDED += highlevel_stdio
-
-# This configuration enables modules that are only available when using Kconfig
-# module modelling
-ifeq (1, $(TEST_KCONFIG))
-  KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/common/weact-f4x1cx/weact-f4x1cx.config
-endif
diff --git a/boards/common/weact-f4x1cx/weact-f4x1cx.config b/boards/common/weact-f4x1cx/weact-f4x1cx.config
deleted file mode 100644
index d7a295b937..0000000000
--- a/boards/common/weact-f4x1cx/weact-f4x1cx.config
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG_MODULE_BOOTLOADER_STM32=y
-CONFIG_MODULE_USB_BOARD_RESET=y
diff --git a/boards/nrf51dk/Kconfig b/boards/nrf51dk/Kconfig
index 6cc36c9b6b..be2b3812bf 100644
--- a/boards/nrf51dk/Kconfig
+++ b/boards/nrf51dk/Kconfig
@@ -20,6 +20,6 @@ config BOARD_NRF51DK
 
     select HAVE_SAUL_GPIO
 
-    select MODULE_PERIPH_UART_HW_FC if TEST_KCONFIG && HAS_PERIPH_UART_HW_FC
+    select MODULE_PERIPH_UART_HW_FC if HAS_PERIPH_UART_HW_FC && MODULE_PERIPH_UART
 
 source "$(RIOTBOARD)/common/nrf51/Kconfig"
diff --git a/boards/nrf51dk/Makefile.dep b/boards/nrf51dk/Makefile.dep
index 7b8cb845b6..48cf92c800 100644
--- a/boards/nrf51dk/Makefile.dep
+++ b/boards/nrf51dk/Makefile.dep
@@ -2,6 +2,8 @@ ifneq (,$(filter saul_default,$(USEMODULE)))
   USEMODULE += saul_gpio
 endif
 
-FEATURES_REQUIRED += periph_uart_hw_fc
+ifneq (,$(filter periph_uart,$(USEMODULE)))
+  FEATURES_REQUIRED += periph_uart_hw_fc
+endif
 
 include $(RIOTBOARD)/common/nrf51/Makefile.dep
diff --git a/boards/nrf51dongle/Kconfig b/boards/nrf51dongle/Kconfig
index 367b8714c0..4c4b61861b 100644
--- a/boards/nrf51dongle/Kconfig
+++ b/boards/nrf51dongle/Kconfig
@@ -15,6 +15,6 @@ config BOARD_NRF51DONGLE
     select HAS_PERIPH_UART
     select HAS_PERIPH_UART_HW_FC
 
-    select MODULE_PERIPH_UART_HW_FC if TEST_KCONFIG && HAS_PERIPH_UART_HW_FC
+    select MODULE_PERIPH_UART_HW_FC if HAS_PERIPH_UART_HW_FC && MODULE_PERIPH_UART
 
 source "$(RIOTBOARD)/common/nrf51/Kconfig"
diff --git a/boards/nrf51dongle/Makefile.dep b/boards/nrf51dongle/Makefile.dep
index 581680658c..8237864e02 100644
--- a/boards/nrf51dongle/Makefile.dep
+++ b/boards/nrf51dongle/Makefile.dep
@@ -1,3 +1,6 @@
-FEATURES_REQUIRED += periph_uart_hw_fc
+
+ifneq (,$(filter periph_uart,$(USEMODULE)))
+  FEATURES_REQUIRED += periph_uart_hw_fc
+endif
 
 include $(RIOTBOARD)/common/nrf51/Makefile.dep
diff --git a/boards/particle-argon/Kconfig b/boards/particle-argon/Kconfig
index 28729ede92..3420c70f8d 100644
--- a/boards/particle-argon/Kconfig
+++ b/boards/particle-argon/Kconfig
@@ -11,6 +11,6 @@ config BOARD_PARTICLE_ARGON
     bool
     default y
     select BOARD_COMMON_PARTICLE_MESH
-    select MODULE_PERIPH_UART_HW_FC if TEST_KCONFIG && HAS_PERIPH_UART_HW_FC && MODULE_PERIPH_UART
+    select MODULE_PERIPH_UART_HW_FC if HAS_PERIPH_UART_HW_FC && MODULE_PERIPH_UART
 
 source "$(RIOTBOARD)/common/particle-mesh/Kconfig"
diff --git a/boards/particle-boron/Kconfig b/boards/particle-boron/Kconfig
index 842061223b..cdd324939f 100644
--- a/boards/particle-boron/Kconfig
+++ b/boards/particle-boron/Kconfig
@@ -11,6 +11,6 @@ config BOARD_PARTICLE_BORON
     bool
     default y
     select BOARD_COMMON_PARTICLE_MESH
-    select MODULE_PERIPH_UART_HW_FC if TEST_KCONFIG && HAS_PERIPH_UART_HW_FC && MODULE_PERIPH_UART
+    select MODULE_PERIPH_UART_HW_FC if HAS_PERIPH_UART_HW_FC && MODULE_PERIPH_UART
 
 source "$(RIOTBOARD)/common/particle-mesh/Kconfig"
diff --git a/boards/stm32f723e-disco/Kconfig b/boards/stm32f723e-disco/Kconfig
index 4621f6a6da..fa9b2e71c6 100644
--- a/boards/stm32f723e-disco/Kconfig
+++ b/boards/stm32f723e-disco/Kconfig
@@ -34,7 +34,7 @@ config BOARD_STM32F723E_DISCO
 
     select HAVE_SAUL_GPIO
     select HAVE_FT5X06
-    select MODULE_PERIPH_UART_HW_FC if TEST_KCONFIG && HAS_PERIPH_UART_HW_FC && MODULE_PERIPH_UART
+    select MODULE_PERIPH_UART_HW_FC if HAS_PERIPH_UART_HW_FC && MODULE_PERIPH_UART
     # Workaround due to stdout only working with stdin enabled
     select MODULE_STDIN if TEST_KCONFIG
 
diff --git a/boards/stm32f723e-disco/Makefile.dep b/boards/stm32f723e-disco/Makefile.dep
index c58bbadcdb..6334b41c7e 100644
--- a/boards/stm32f723e-disco/Makefile.dep
+++ b/boards/stm32f723e-disco/Makefile.dep
@@ -1,5 +1,5 @@
 ifneq (,$(filter periph_uart,$(USEMODULE)))
-  USEMODULE += periph_uart_hw_fc
+  FEATURES_REQUIRED += periph_uart_hw_fc
 endif
 
 ifneq (,$(filter saul_default,$(USEMODULE)))
diff --git a/boards/stm32l496g-disco/Kconfig b/boards/stm32l496g-disco/Kconfig
index 5121c61815..cc5a452ffe 100644
--- a/boards/stm32l496g-disco/Kconfig
+++ b/boards/stm32l496g-disco/Kconfig
@@ -41,7 +41,7 @@ config BOARD_STM32L496G_DISCO
     select HAVE_FT5X06
 
     select MODULE_PERIPH_LPUART if MODULE_PERIPH_UART
-    select MODULE_PERIPH_UART_HW_FC if MODULE_PERIPH_UART && !MODULE_PERIPH_SPI_STMOD
+    select MODULE_PERIPH_UART_HW_FC if MODULE_PERIPH_UART && !MODULE_PERIPH_SPI_STMOD && HAS_PERIPH_UART_HW_FC
 
 source "$(RIOTBOARD)/common/stm32/Kconfig"
 
diff --git a/boards/stm32l496g-disco/Makefile.dep b/boards/stm32l496g-disco/Makefile.dep
index f1d8250e5c..27f8d0c45e 100644
--- a/boards/stm32l496g-disco/Makefile.dep
+++ b/boards/stm32l496g-disco/Makefile.dep
@@ -14,6 +14,6 @@ ifneq (,$(filter periph_uart,$(USEMODULE)))
   USEMODULE += periph_lpuart
   ifeq (,$(filter periph_spi_stmod_plus,$(USEMODULE)))
     # if STMod+ is not used with SPI (default), the UART interface uses HW FC
-    USEMODULE += periph_uart_hw_fc
+    FEATURES_REQUIRED += periph_uart_hw_fc
   endif
 endif
diff --git a/boards/ublox-c030-u201/Kconfig b/boards/ublox-c030-u201/Kconfig
index fc73c1fa7b..2e1fd0ddd7 100644
--- a/boards/ublox-c030-u201/Kconfig
+++ b/boards/ublox-c030-u201/Kconfig
@@ -28,7 +28,7 @@ config BOARD_UBLOX_C030_U201
     select BOARD_HAS_LSE
 
     select HAVE_SAUL_GPIO
-    select MODULE_PERIPH_UART_HW_FC if TEST_KCONFIG && HAS_PERIPH_UART_HW_FC
+    select MODULE_PERIPH_UART_HW_FC if HAS_PERIPH_UART_HW_FC && MODULE_PERIPH_UART
 
 config CLOCK_HSE
     default 12000000
diff --git a/boards/ublox-c030-u201/Makefile.dep b/boards/ublox-c030-u201/Makefile.dep
index 78e64f15ca..5bac246cb4 100644
--- a/boards/ublox-c030-u201/Makefile.dep
+++ b/boards/ublox-c030-u201/Makefile.dep
@@ -1,4 +1,7 @@
-USEMODULE += periph_uart_hw_fc
+ifneq (,$(filter periph_uart,$(USEMODULE)))
+  FEATURES_REQUIRED += periph_uart_hw_fc
+endif
+
 
 ifneq (,$(filter saul_default,$(USEMODULE)))
   USEMODULE += saul_gpio
diff --git a/pkg/tinyusb/cdc_acm_stdio/Kconfig b/pkg/tinyusb/cdc_acm_stdio/Kconfig
index b25cf791e5..91addc0a19 100644
--- a/pkg/tinyusb/cdc_acm_stdio/Kconfig
+++ b/pkg/tinyusb/cdc_acm_stdio/Kconfig
@@ -14,5 +14,6 @@ config MODULE_STDIO_TINYUSB_CDC_ACM
     depends on MODULE_TINYUSB_DEVICE
     depends on MODULE_TINYUSB_CLASS_CDC
     select MODULE_STDIO_AVAILABLE
+    select USE_STDOUT_BUFFERED
 
 endchoice
diff --git a/sys/Kconfig.picolibc b/sys/Kconfig.picolibc
index cabfc3d015..ccb18a9528 100644
--- a/sys/Kconfig.picolibc
+++ b/sys/Kconfig.picolibc
@@ -7,7 +7,7 @@
 
 if MODULE_PICOLIBC
 
-config PICOLIBC_STDOUT_BUFFERED
+config MODULE_PICOLIBC_STDOUT_BUFFERED
     bool "Buffered standard output"
     default USE_STDOUT_BUFFERED
     help
diff --git a/sys/Kconfig.stdio b/sys/Kconfig.stdio
index e29bf20a88..15e5f28597 100644
--- a/sys/Kconfig.stdio
+++ b/sys/Kconfig.stdio
@@ -34,6 +34,7 @@ config MODULE_STDIO_SEMIHOSTING
     depends on HAS_ARCH_ARM || HAS_ARCH_RISCV
     select MODULE_ZTIMER
     select MODULE_ZTIMER_MSEC
+    select USE_STDOUT_BUFFERED
 
 config MODULE_SLIPDEV_STDIO
     bool "SLIP network device"
diff --git a/sys/usb/usbus/cdc/acm/Kconfig b/sys/usb/usbus/cdc/acm/Kconfig
index 524e4b9cb1..897ce2b230 100644
--- a/sys/usb/usbus/cdc/acm/Kconfig
+++ b/sys/usb/usbus/cdc/acm/Kconfig
@@ -61,5 +61,7 @@ config MODULE_STDIO_CDC_ACM
     depends on MODULE_USBUS_CDC_ACM && !MODULE_TINYUSB_DEVICE
     select MODULE_ISRPIPE
     select MODULE_STDIO_AVAILABLE
+    select USE_STDOUT_BUFFERED
+
 
 endchoice

Some make behaviour also changes but I think that it is a fix that should have been done.

@aabadie aabadie force-pushed the pr/sys/stdio_semihosting_kconfig branch from c84f97a to d4b35ec Compare June 17, 2023 13:13
@github-actions github-actions bot added Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Area: USB Area: Universal Serial Bus labels Jun 17, 2023
@aabadie
Copy link
Contributor Author

aabadie commented Jun 17, 2023

Some make behaviour also changes but I think that it is a fix that should have been done.

Applied, thanks!

@MrKevinWeiss
Copy link
Contributor

bors merge

@bors
Copy link
Contributor

bors bot commented Jun 19, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit ef82aa6 into RIOT-OS:master Jun 19, 2023
@aabadie aabadie deleted the pr/sys/stdio_semihosting_kconfig branch June 19, 2023 11:50
@aabadie
Copy link
Contributor Author

aabadie commented Jun 19, 2023

Thanks!

@benpicco benpicco added this to the Release 2023.07 milestone Aug 2, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Area: boards Area: Board ports Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework Area: USB Area: Universal Serial Bus CI: no fast fail don't abort PR build after first error CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants