diff --git a/Makefile.dep b/Makefile.dep index d636d64468..912a209eaf 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -2,6 +2,11 @@ -include $(APPDIR)/Makefile.board.dep -include $(APPDIR)/Makefile.$(TOOLCHAIN).dep +# select default stdio provider if no other is selected +ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE))) + USEMODULE += stdio_default +endif + # include board dependencies -include $(BOARDDIR)/Makefile.dep diff --git a/boards/common/esp32s3/stdio_esp32s3_default.dep.mk b/boards/common/esp32s3/stdio_esp32s3_default.dep.mk new file mode 100644 index 0000000000..0fad20764b --- /dev/null +++ b/boards/common/esp32s3/stdio_esp32s3_default.dep.mk @@ -0,0 +1,19 @@ +ifneq (,$(filter stdio_default,$(USEMODULE))) + ifneq (,$(filter usbus,$(USEMODULE))) + USEMODULE += stdio_cdc_acm + FEATURES_REQUIRED += highlevel_stdio + else ifneq (,$(filter tinyusb_device,$(USEMODULE))) + USEMODULE += stdio_tinyusb_cdc_acm + FEATURES_REQUIRED += highlevel_stdio + else + # Use stdio_usb_serial_jtag if no other stdio is requested explicitly + # and neither USBUS nor tinyusb_device are used + USEMODULE += stdio_usb_serial_jtag + endif + # Even if only stdio_usb_serial_jtag is enabled, usb_board_reset is enabled + # since there should be a CDC ACM interface in any case. This is necessary, + # for example, to reset the board if stdio_cdc_acm or stdio_tinyusb_cdc_acm + # was previously used. + USEMODULE += usb_board_reset + include $(RIOTMAKE)/tools/usb_board_reset.mk +endif diff --git a/boards/common/makefiles/stdio_cdc_acm.dep.mk b/boards/common/makefiles/stdio_cdc_acm.dep.mk index 1bbdcdf911..4800823512 100644 --- a/boards/common/makefiles/stdio_cdc_acm.dep.mk +++ b/boards/common/makefiles/stdio_cdc_acm.dep.mk @@ -1,4 +1,4 @@ -ifeq (,$(filter-out stdio_cdc_acm,$(filter stdio_% slipdev_stdio,$(USEMODULE)))) +ifneq (,$(filter stdio_default,$(USEMODULE))) ifneq (,$(filter tinyusb_device,$(USEMODULE))$(filter tinyusb,$(USEPKG))) # Use stdio_tinyusb_cdc_acm only if no other stdio is requested explicitly # and tinyusb_device is used for any other reason diff --git a/boards/common/makefiles/stdio_tinyusb_cdc_acm.dep.mk b/boards/common/makefiles/stdio_tinyusb_cdc_acm.dep.mk index 8aae180b72..1254cd5955 100644 --- a/boards/common/makefiles/stdio_tinyusb_cdc_acm.dep.mk +++ b/boards/common/makefiles/stdio_tinyusb_cdc_acm.dep.mk @@ -1,4 +1,4 @@ -ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE))) +ifneq (,$(filter stdio_default,$(USEMODULE))) # Use stdio_tinyusb_cdc_acm only if no other stdio is requested explicitly. # and usbus is used for any other reason ifneq (,$(filter usbus,$(USEMODULE))) diff --git a/boards/esp32c3-wemos-mini/Makefile.dep b/boards/esp32c3-wemos-mini/Makefile.dep index 2b25c2a442..b2909c3d65 100644 --- a/boards/esp32c3-wemos-mini/Makefile.dep +++ b/boards/esp32c3-wemos-mini/Makefile.dep @@ -1,4 +1,4 @@ -ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE))) +ifneq (,$(filter stdio_default,$(USEMODULE))) USEMODULE += stdio_usb_serial_jtag endif diff --git a/boards/esp32s3-box/Makefile.dep b/boards/esp32s3-box/Makefile.dep index 1c09d058f4..3e5cbc162a 100644 --- a/boards/esp32s3-box/Makefile.dep +++ b/boards/esp32s3-box/Makefile.dep @@ -1,15 +1,3 @@ -ifeq (,$(filter stdio_% slipdev_stdio usbus usbus% tinyusb_device,$(USEMODULE))) - # Use stdio_usb_serial_jtag if no other stdio is requested explicitly - # and neither USBUS nor tinyusb_device are used - USEMODULE += stdio_usb_serial_jtag - # Even if only stdio_usb_serial_jtag is enabled, usb_board_reset is enabled - # since there should be a CDC ACM interface in any case. This is necessary, - # for example, to reset the board if stdio_cdc_acm or stdio_tinyusb_cdc_acm - # was previously used. - USEMODULE += usb_board_reset - # include $(RIOTMAKE)/tools/usb_board_reset.mk -endif - ifneq (,$(filter disp_dev,$(USEMODULE))) USEMODULE += ili9341 endif @@ -18,5 +6,5 @@ ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += saul_gpio endif +include $(RIOTBOARD)/common/esp32s3/stdio_esp32s3_default.dep.mk include $(RIOTBOARD)/common/esp32s3/Makefile.dep -include $(RIOTBOARD)/common/makefiles/stdio_cdc_acm.dep.mk diff --git a/boards/esp32s3-pros3/Makefile.dep b/boards/esp32s3-pros3/Makefile.dep index 4159038b8d..14a46b0147 100644 --- a/boards/esp32s3-pros3/Makefile.dep +++ b/boards/esp32s3-pros3/Makefile.dep @@ -1,18 +1,6 @@ -ifeq (,$(filter stdio_% slipdev_stdio usbus usbus% tinyusb_device,$(USEMODULE))) - # Use stdio_usb_serial_jtag if no other stdio is requested explicitly - # and neither USBUS nor tinyusb_device are used - USEMODULE += stdio_usb_serial_jtag - # Even if only stdio_usb_serial_jtag is enabled, usb_board_reset is enabled - # since there should be a CDC ACM interface in any case. This is necessary, - # for example, to reset the board if stdio_cdc_acm or stdio_tinyusb_cdc_acm - # was previously used. - USEMODULE += usb_board_reset - include $(RIOTMAKE)/tools/usb_board_reset.mk -endif - ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += saul_gpio endif +include $(RIOTBOARD)/common/esp32s3/stdio_esp32s3_default.dep.mk include $(RIOTBOARD)/common/esp32s3/Makefile.dep -include $(RIOTBOARD)/common/makefiles/stdio_cdc_acm.dep.mk diff --git a/boards/esp32s3-usb-otg/Makefile.dep b/boards/esp32s3-usb-otg/Makefile.dep index 88ec8eaa8b..c8b90d8ebb 100644 --- a/boards/esp32s3-usb-otg/Makefile.dep +++ b/boards/esp32s3-usb-otg/Makefile.dep @@ -1,17 +1,5 @@ -ifeq (,$(filter stdio_% slipdev_stdio usbus usbus% tinyusb_device,$(USEMODULE))) - # Use stdio_usb_serial_jtag if no other stdio is requested explicitly - # and neither USBUS nor tinyusb_device are used - USEMODULE += stdio_usb_serial_jtag - # Even if only stdio_usb_serial_jtag is enabled, usb_board_reset is enabled - # since there should be a CDC ACM interface in any case. This is necessary, - # for example, to reset the board if stdio_cdc_acm or stdio_tinyusb_cdc_acm - # was previously used. - USEMODULE += usb_board_reset - include $(RIOTMAKE)/tools/usb_board_reset.mk -endif - +include $(RIOTBOARD)/common/esp32s3/stdio_esp32s3_default.dep.mk include $(RIOTBOARD)/common/esp32s3/Makefile.dep -include $(RIOTBOARD)/common/makefiles/stdio_cdc_acm.dep.mk # default to using fatfs on SD card ifneq (,$(filter vfs_default,$(USEMODULE))) diff --git a/boards/esp32s3-wt32-sc01-plus/Makefile.dep b/boards/esp32s3-wt32-sc01-plus/Makefile.dep index 0128b651b3..127742cdb0 100644 --- a/boards/esp32s3-wt32-sc01-plus/Makefile.dep +++ b/boards/esp32s3-wt32-sc01-plus/Makefile.dep @@ -1,17 +1,5 @@ -ifeq (,$(filter stdio_% slipdev_stdio usbus usbus% tinyusb_device,$(USEMODULE))) - # Use stdio_usb_serial_jtag if no other stdio is requested explicitly - # and neither USBUS nor tinyusb_device are used - USEMODULE += stdio_usb_serial_jtag - # Even if only stdio_usb_serial_jtag is enabled, usb_board_reset is enabled - # since there should be a CDC ACM interface in any case. This is necessary, - # for example, to reset the board if stdio_cdc_acm or stdio_tinyusb_cdc_acm - # was previously used. - USEMODULE += usb_board_reset - # include $(RIOTMAKE)/tools/usb_board_reset.mk -endif - +include $(RIOTBOARD)/common/esp32s3/stdio_esp32s3_default.dep.mk include $(RIOTBOARD)/common/esp32s3/Makefile.dep -include $(RIOTBOARD)/common/makefiles/stdio_cdc_acm.dep.mk # default to using fatfs on SD card ifneq (,$(filter vfs_default,$(USEMODULE))) diff --git a/boards/hamilton/Makefile.dep b/boards/hamilton/Makefile.dep index 0c3f1f2795..6f96388ab7 100644 --- a/boards/hamilton/Makefile.dep +++ b/boards/hamilton/Makefile.dep @@ -14,6 +14,6 @@ ifneq (,$(filter saul_default,$(USEMODULE))) endif # Use Segger's RTT unless another stdio_% is already used -ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE))) +ifneq (,$(filter stdio_default,$(USEMODULE))) USEMODULE += stdio_rtt endif diff --git a/boards/hip-badge/Makefile.dep b/boards/hip-badge/Makefile.dep index 840d0a4ca8..94128b55a2 100644 --- a/boards/hip-badge/Makefile.dep +++ b/boards/hip-badge/Makefile.dep @@ -1,4 +1,4 @@ -ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE))) +ifneq (,$(filter stdio_default,$(USEMODULE))) USEMODULE += stdio_usb_serial_jtag endif diff --git a/boards/pinetime/Makefile.dep b/boards/pinetime/Makefile.dep index 331a4cf3e7..b80599f39b 100644 --- a/boards/pinetime/Makefile.dep +++ b/boards/pinetime/Makefile.dep @@ -1,5 +1,5 @@ # Use Segger's RTT unless another stdio_% is already used -ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE))) +ifneq (,$(filter stdio_default,$(USEMODULE))) USEMODULE += stdio_rtt endif diff --git a/boards/ruuvitag/Makefile.dep b/boards/ruuvitag/Makefile.dep index 1944a9ab7a..a06987f43c 100644 --- a/boards/ruuvitag/Makefile.dep +++ b/boards/ruuvitag/Makefile.dep @@ -5,7 +5,7 @@ ifneq (,$(filter saul_default,$(USEMODULE))) endif # Use Segger's RTT unless another stdio_% is already used -ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE))) +ifneq (,$(filter stdio_default,$(USEMODULE))) USEMODULE += stdio_rtt endif diff --git a/boards/thingy52/Makefile.dep b/boards/thingy52/Makefile.dep index a47e07b05e..e997e6e43c 100644 --- a/boards/thingy52/Makefile.dep +++ b/boards/thingy52/Makefile.dep @@ -5,7 +5,7 @@ ifneq (,$(filter saul_default,$(USEMODULE))) endif # Use Segger's RTT unless another stdio_% is already used -ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE))) +ifneq (,$(filter stdio_default,$(USEMODULE))) USEMODULE += stdio_rtt endif diff --git a/cpu/arm7tdmi_gba/Makefile b/cpu/arm7tdmi_gba/Makefile index 47f9d0499b..b528759960 100644 --- a/cpu/arm7tdmi_gba/Makefile +++ b/cpu/arm7tdmi_gba/Makefile @@ -4,7 +4,7 @@ include $(RIOTCPU)/$(CPU)/Makefile.include DIRS = $(RIOTCPU)/arm7_common -ifneq (,$(filter stdio_%,$(USEMODULE))) +ifneq (,$(filter stdio_fb,$(USEMODULE))) DIRS += stdio_fb endif diff --git a/cpu/arm7tdmi_gba/Makefile.dep b/cpu/arm7tdmi_gba/Makefile.dep index 51481f9a83..f6fa0acdf7 100644 --- a/cpu/arm7tdmi_gba/Makefile.dep +++ b/cpu/arm7tdmi_gba/Makefile.dep @@ -1,6 +1,6 @@ USEMODULE += arm7_common -ifeq (,$(filter stdio_%,$(USEMODULE))) +ifneq (,$(filter stdio_default,$(USEMODULE))) USEMODULE += stdio_fb endif diff --git a/cpu/native/Makefile.dep b/cpu/native/Makefile.dep index a41f94b2d5..cd33b6ea55 100644 --- a/cpu/native/Makefile.dep +++ b/cpu/native/Makefile.dep @@ -13,7 +13,7 @@ else endif endif -ifeq (,$(filter stdio_%,$(USEMODULE))) +ifneq (,$(filter stdio_default,$(USEMODULE))) USEMODULE += stdio_native endif diff --git a/examples/networking/misc/telnet_server/Makefile b/examples/networking/misc/telnet_server/Makefile index 24cae7524c..e4d53c3cfb 100644 --- a/examples/networking/misc/telnet_server/Makefile +++ b/examples/networking/misc/telnet_server/Makefile @@ -34,6 +34,9 @@ USEMODULE += ps # Include the telnet server USEMODULE += stdio_telnet +# select a 2nd stdio method +USEMODULE += stdio_default + # Enable faster re-connects CFLAGS += -DCONFIG_GNRC_TCP_EXPERIMENTAL_DYN_MSL_EN=1 diff --git a/examples/networking/misc/telnet_server/main.c b/examples/networking/misc/telnet_server/main.c index aed0a26fb3..9e36799b9b 100644 --- a/examples/networking/misc/telnet_server/main.c +++ b/examples/networking/misc/telnet_server/main.c @@ -79,7 +79,6 @@ int main(void) /* start shell */ printf("All up, awaiting connection on port %u\n", CONFIG_TELNET_PORT); - puts("Local shell disabled"); char line_buf[SHELL_DEFAULT_BUFSIZE]; shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 2cebdfe864..9505365486 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -488,6 +488,13 @@ PSEUDOMODULES += soft_uart_modecfg PSEUDOMODULES += stdin PSEUDOMODULES += stdio_available PSEUDOMODULES += stdio_cdc_acm +## @defgroup sys_stdio_default Default STDIO provider +## @ingroup sys_stdio +## @{ +## This module selects the default STDIO method of a given board. +## It will be enabled by default if no other stdio method is selected. +PSEUDOMODULES += stdio_default +## @} PSEUDOMODULES += stdio_dispatch PSEUDOMODULES += stdio_ethos PSEUDOMODULES += stdio_nimble_debug diff --git a/makefiles/stdio.inc.mk b/makefiles/stdio.inc.mk index 9c29cf5037..df0221ddd0 100644 --- a/makefiles/stdio.inc.mk +++ b/makefiles/stdio.inc.mk @@ -33,7 +33,7 @@ ifneq (,$(filter stdin,$(USEMODULE))) USEMODULE += isrpipe endif -ifneq (1, $(words $(filter $(STDIO_MODULES),$(USEMODULE)))) +ifneq (1, $(words $(sort $(filter $(STDIO_MODULES),$(USEMODULE))))) USEMODULE += stdio_dispatch endif