This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit adafe2d1c8432aa36ceed72aa524ef7523d681e0
Author: raiden00pl <[email protected]>
AuthorDate: Mon Oct 19 14:32:50 2026 +0200

    boards/nucleo-f722ze: make the ST-LINK virtual COM port the default console
    
    Define the USART3 (virtual COM port) and USART6 (Arduino) pins
    unconditionally and default the console choice to the virtual COM port,
    so builds that bypass the board Kconfig still get a console.
    
    Signed-off-by: raiden00pl <[email protected]>
    Assisted-by: Claude Code
---
 .../arm/stm32f7/boards/nucleo-f722ze/index.rst     | 24 ++++++++++--------
 boards/arm/stm32f7/nucleo-f722ze/Kconfig           |  2 +-
 .../stm32f7/nucleo-f722ze/configs/can/defconfig    |  1 -
 .../nucleo-f722ze/configs/cansock/defconfig        |  1 -
 .../nucleo-f722ze/configs/composite/defconfig      |  1 -
 .../stm32f7/nucleo-f722ze/configs/nsh/defconfig    |  2 +-
 boards/arm/stm32f7/nucleo-f722ze/include/board.h   | 29 +++++-----------------
 7 files changed, 22 insertions(+), 38 deletions(-)

diff --git a/Documentation/platforms/arm/stm32f7/boards/nucleo-f722ze/index.rst 
b/Documentation/platforms/arm/stm32f7/boards/nucleo-f722ze/index.rst
index f3157a0a0c6..c78417dd60e 100644
--- a/Documentation/platforms/arm/stm32f7/boards/nucleo-f722ze/index.rst
+++ b/Documentation/platforms/arm/stm32f7/boards/nucleo-f722ze/index.rst
@@ -40,14 +40,18 @@ the above mentioned graphic may be helpful in identifying a 
serial port.
 
 There are 5 choices that can be made from the menuconfig::
 
-  CONFIG_NUCLEO_CONSOLE_ARDUINO or CONFIG_NUCLEO_CONSOLE_MORPHO or
-  CONFIG_NUCLEO_CONSOLE_MORPHO_UART4 or CONFIG_NUCLEO_CONSOLE_VIRTUAL or
-  CONFIG_NUCLEO_CONSOLE_NONE
+  CONFIG_NUCLEO_F722ZE_CONSOLE_VIRTUAL (default) or
+  CONFIG_NUCLEO_F722ZE_CONSOLE_ARDUINO or CONFIG_NUCLEO_F722ZE_CONSOLE_MORPHO 
or
+  CONFIG_NUCLEO_F722ZE_CONSOLE_MORPHO_UART4 or 
CONFIG_NUCLEO_F722ZE_CONSOLE_NONE
 
-The CONFIG_NUCLEO_CONSOLE_NONE makes no preset for the console. You should 
still
+The USART3 (virtual COM port) and USART6 (Arduino) pins are always defined
+in board.h, so a configuration that does not use this choice (for example a
+custom board build) only needs to enable the U[S]ART and select the console.
+
+The CONFIG_NUCLEO_F722ZE_CONSOLE_NONE makes no preset for the console. You 
should still
 visit the U[S]ART selection and Device Drivers to disable any U[S]ART 
remaining.
 
-The CONFIG_NUCLEO_CONSOLE_ARDUINO configurations assume that you are using a
+The CONFIG_NUCLEO_F722ZE_CONSOLE_ARDUINO configurations assume that you are 
using a
 standard Arduino RS-232 shield with the serial interface with RX on pin D0 and
 TX on pin D1 from USART6::
 
@@ -59,7 +63,7 @@ TX on pin D1 from USART6::
             D1 TX    USART6_TX PG14
             -- ----- --------- -----
 
-The CONFIG_NUCLEO_CONSOLE_MORPHO configurations uses Serial Port 8 (USART8)
+The CONFIG_NUCLEO_F722ZE_CONSOLE_MORPHO configurations uses Serial Port 8 
(USART8)
 with TX on PE1 and RX on PE0.::
 
             Serial
@@ -67,7 +71,7 @@ with TX on PE1 and RX on PE0.::
             SERIAL_RX         PE_0
             SERIAL_TX         PE_1
 
-The CONFIG_NUCLEO_CONSOLE_MORPHO_UART4 configurations uses Serial Port 4 
(UART4)
+The CONFIG_NUCLEO_F722ZE_CONSOLE_MORPHO_UART4 configurations uses Serial Port 
4 (UART4)
 with TX on PA1 and RX on PA0. Zero Ohm resistor / solder short at
 SB13 must be removed/open. (Disables Ethernet MII clocking.)::
 
@@ -76,7 +80,7 @@ SB13 must be removed/open. (Disables Ethernet MII clocking.)::
             SERIAL_RX         PA_1  CN11 30
             SERIAL_TX         PA_0  CN11 28
 
-The CONFIG_NUCLEO_CONSOLE_VIRTUAL configurations uses Serial Port 3 (USART3)
+The CONFIG_NUCLEO_F722ZE_CONSOLE_VIRTUAL configurations (the default) uses 
Serial Port 3 (USART3)
 with TX on PD8 and RX on PD9.::
 
             Serial
@@ -152,8 +156,8 @@ Flashing RED - In the event of a fatal crash, all other 
LEDs will be
 Serial Consoles
 ===============
 
-USART6 (CONFIG_NUCLEO_CONSOLE_ARDUINO)
---------------------------------------
+USART6 (CONFIG_NUCLEO_F722ZE_CONSOLE_ARDUINO)
+---------------------------------------------
 
     ======= ========== =====
     ARDUINO FUNCTION   GPIO
diff --git a/boards/arm/stm32f7/nucleo-f722ze/Kconfig 
b/boards/arm/stm32f7/nucleo-f722ze/Kconfig
index 884622e3a10..10c0bb96613 100644
--- a/boards/arm/stm32f7/nucleo-f722ze/Kconfig
+++ b/boards/arm/stm32f7/nucleo-f722ze/Kconfig
@@ -7,7 +7,7 @@ if ARCH_BOARD_NUCLEO_F722ZE
 
 choice
        prompt "Select Console wiring."
-       default NUCLEO_F722ZE_CONSOLE_ARDUINO
+       default NUCLEO_F722ZE_CONSOLE_VIRTUAL
        ---help---
                Select where you will connect the console.
 
diff --git a/boards/arm/stm32f7/nucleo-f722ze/configs/can/defconfig 
b/boards/arm/stm32f7/nucleo-f722ze/configs/can/defconfig
index 1cb4871af1a..f02ac68be8e 100644
--- a/boards/arm/stm32f7/nucleo-f722ze/configs/can/defconfig
+++ b/boards/arm/stm32f7/nucleo-f722ze/configs/can/defconfig
@@ -36,7 +36,6 @@ CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_FILEIOSIZE=512
 CONFIG_NSH_READLINE=y
 CONFIG_NUCLEO_F722ZE_CAN1_MAP_D14D15=y
-CONFIG_NUCLEO_F722ZE_CONSOLE_VIRTUAL=y
 CONFIG_PREALLOC_TIMERS=4
 CONFIG_RAM_SIZE=245760
 CONFIG_RAM_START=0x20010000
diff --git a/boards/arm/stm32f7/nucleo-f722ze/configs/cansock/defconfig 
b/boards/arm/stm32f7/nucleo-f722ze/configs/cansock/defconfig
index 59a299a0093..4370ca6524e 100644
--- a/boards/arm/stm32f7/nucleo-f722ze/configs/cansock/defconfig
+++ b/boards/arm/stm32f7/nucleo-f722ze/configs/cansock/defconfig
@@ -48,7 +48,6 @@ CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_FILEIOSIZE=512
 CONFIG_NSH_READLINE=y
 CONFIG_NUCLEO_F722ZE_CAN1_MAP_D14D15=y
-CONFIG_NUCLEO_F722ZE_CONSOLE_VIRTUAL=y
 CONFIG_PREALLOC_TIMERS=4
 CONFIG_RAM_SIZE=245760
 CONFIG_RAM_START=0x20010000
diff --git a/boards/arm/stm32f7/nucleo-f722ze/configs/composite/defconfig 
b/boards/arm/stm32f7/nucleo-f722ze/configs/composite/defconfig
index afbe1d4ab96..5374b57c2f4 100644
--- a/boards/arm/stm32f7/nucleo-f722ze/configs/composite/defconfig
+++ b/boards/arm/stm32f7/nucleo-f722ze/configs/composite/defconfig
@@ -57,7 +57,6 @@ CONFIG_NET_UDP=y
 CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_FILEIOSIZE=512
 CONFIG_NSH_READLINE=y
-CONFIG_NUCLEO_F722ZE_CONSOLE_VIRTUAL=y
 CONFIG_PREALLOC_TIMERS=4
 CONFIG_RAM_SIZE=245760
 CONFIG_RAM_START=0x20010000
diff --git a/boards/arm/stm32f7/nucleo-f722ze/configs/nsh/defconfig 
b/boards/arm/stm32f7/nucleo-f722ze/configs/nsh/defconfig
index e58237f0ec4..cc8261a4be7 100644
--- a/boards/arm/stm32f7/nucleo-f722ze/configs/nsh/defconfig
+++ b/boards/arm/stm32f7/nucleo-f722ze/configs/nsh/defconfig
@@ -49,4 +49,4 @@ CONFIG_STM32_SERIAL_DISABLE_REORDERING=y
 CONFIG_STM32_USART_BREAKS=y
 CONFIG_SYSTEM_NSH=y
 CONFIG_TASK_NAME_SIZE=0
-CONFIG_USART6_SERIAL_CONSOLE=y
+CONFIG_USART3_SERIAL_CONSOLE=y
diff --git a/boards/arm/stm32f7/nucleo-f722ze/include/board.h 
b/boards/arm/stm32f7/nucleo-f722ze/include/board.h
index 7edaa52b8a8..dac3b00cfc1 100644
--- a/boards/arm/stm32f7/nucleo-f722ze/include/board.h
+++ b/boards/arm/stm32f7/nucleo-f722ze/include/board.h
@@ -386,7 +386,10 @@
 #define GPIO_TIM3_CH3OUT (GPIO_TIM3_CH3OUT_2|GPIO_SPEED_50MHz)
 #define GPIO_TIM3_CH4OUT (GPIO_TIM3_CH4OUT_1|GPIO_SPEED_50MHz)
 
-#if defined(CONFIG_NUCLEO_F722ZE_CONSOLE_ARDUINO)
+/* USART3: ST-LINK virtual COM port (PD8 TX, PD9 RX), the default console */
+
+#define GPIO_USART3_RX (GPIO_USART3_RX_3|GPIO_SPEED_100MHz)
+#define GPIO_USART3_TX (GPIO_USART3_TX_3|GPIO_SPEED_100MHz)
 
 /* USART6:
  *
@@ -402,18 +405,8 @@
  *   -- ----- --------- -----
  */
 
-#  define GPIO_USART6_RX (GPIO_USART6_RX_2|GPIO_SPEED_100MHz)
-#  define GPIO_USART6_TX (GPIO_USART6_TX_2|GPIO_SPEED_100MHz)
-#endif
-
-/* USART3:
- * Use  USART3 and the USB virtual COM port
- */
-
-#if defined(CONFIG_NUCLEO_F722ZE_CONSOLE_VIRTUAL)
-#  define GPIO_USART3_RX (GPIO_USART3_RX_3|GPIO_SPEED_100MHz)
-#  define GPIO_USART3_TX (GPIO_USART3_TX_3|GPIO_SPEED_100MHz)
-#endif
+#define GPIO_USART6_RX (GPIO_USART6_RX_2|GPIO_SPEED_100MHz)
+#define GPIO_USART6_TX (GPIO_USART6_TX_2|GPIO_SPEED_100MHz)
 
 #if defined(CONFIG_NUCLEO_F722ZE_CONSOLE_MORPHO_UART4)
 
@@ -434,16 +427,6 @@
 #  define GPIO_UART4_RX (GPIO_UART4_RX_1|GPIO_SPEED_100MHz)
 #  define GPIO_UART4_TX (GPIO_UART4_TX_1|GPIO_SPEED_100MHz)
 
-/* USART3 seems to be forced selected by the Nucleo-F746ZG kconfig - bug */
-
-#  define GPIO_USART3_RX (GPIO_USART3_RX_1|GPIO_SPEED_100MHz)
-#  define GPIO_USART3_TX (GPIO_USART3_TX_1|GPIO_SPEED_100MHz)
-
-/* USART6 seems to be forced selected by the Nucleo-F722E kconfig - bug */
-
-#  define GPIO_USART6_RX (GPIO_USART6_RX_2|GPIO_SPEED_100MHz)
-#  define GPIO_USART6_TX (GPIO_USART6_TX_2|GPIO_SPEED_100MHz)
-
 #endif
 
 /* USART8:

Reply via email to