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 a8a556e2cbbfc80c871375c112a7dd6c3d19053f
Author: raiden00pl <[email protected]>
AuthorDate: Mon Oct 19 14:32:50 2026 +0200

    boards/nucleo-f767zi: 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-f767zi/index.rst     | 24 ++++++++++--------
 boards/arm/stm32f7/nucleo-f767zi/Kconfig           |  2 +-
 .../stm32f7/nucleo-f767zi/configs/evalos/defconfig |  1 -
 .../stm32f7/nucleo-f767zi/configs/netnsh/defconfig |  1 -
 .../stm32f7/nucleo-f767zi/configs/nsh/defconfig    |  1 -
 boards/arm/stm32f7/nucleo-f767zi/include/board.h   | 29 +++++-----------------
 6 files changed, 21 insertions(+), 37 deletions(-)

diff --git a/Documentation/platforms/arm/stm32f7/boards/nucleo-f767zi/index.rst 
b/Documentation/platforms/arm/stm32f7/boards/nucleo-f767zi/index.rst
index dceda9b1660..c2eaea97840 100644
--- a/Documentation/platforms/arm/stm32f7/boards/nucleo-f767zi/index.rst
+++ b/Documentation/platforms/arm/stm32f7/boards/nucleo-f767zi/index.rst
@@ -84,14 +84,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_F767ZI_CONSOLE_VIRTUAL (default) or
+  CONFIG_NUCLEO_F767ZI_CONSOLE_ARDUINO or CONFIG_NUCLEO_F767ZI_CONSOLE_MORPHO 
or
+  CONFIG_NUCLEO_F767ZI_CONSOLE_MORPHO_UART4 or 
CONFIG_NUCLEO_F767ZI_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_F767ZI_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_F767ZI_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::
 
@@ -103,7 +107,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_F767ZI_CONSOLE_MORPHO configurations uses Serial Port 8 
(USART8)
 with TX on PE1 and RX on PE0.::
 
             Serial
@@ -111,7 +115,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_F767ZI_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.)::
 
@@ -120,7 +124,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_F767ZI_CONSOLE_VIRTUAL configurations (the default) uses 
Serial Port 3 (USART3)
 with TX on PD8 and RX on PD9.::
 
             Serial
@@ -196,8 +200,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_F767ZI_CONSOLE_ARDUINO)
+---------------------------------------------
 
     ======= ========== =====
     ARDUINO FUNCTION   GPIO
diff --git a/boards/arm/stm32f7/nucleo-f767zi/Kconfig 
b/boards/arm/stm32f7/nucleo-f767zi/Kconfig
index e01d882951f..ebdd584f689 100644
--- a/boards/arm/stm32f7/nucleo-f767zi/Kconfig
+++ b/boards/arm/stm32f7/nucleo-f767zi/Kconfig
@@ -7,7 +7,7 @@ if ARCH_BOARD_NUCLEO_F767ZI
 
 choice
        prompt "Select Console wiring."
-       default NUCLEO_F767ZI_CONSOLE_ARDUINO
+       default NUCLEO_F767ZI_CONSOLE_VIRTUAL
        ---help---
                Select where you will connect the console.
 
diff --git a/boards/arm/stm32f7/nucleo-f767zi/configs/evalos/defconfig 
b/boards/arm/stm32f7/nucleo-f767zi/configs/evalos/defconfig
index f3247873145..fe6b341c730 100644
--- a/boards/arm/stm32f7/nucleo-f767zi/configs/evalos/defconfig
+++ b/boards/arm/stm32f7/nucleo-f767zi/configs/evalos/defconfig
@@ -38,7 +38,6 @@ CONFIG_MPU60X0_I2C=y
 CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_FILEIOSIZE=512
 CONFIG_NSH_READLINE=y
-CONFIG_NUCLEO_F767ZI_CONSOLE_VIRTUAL=y
 CONFIG_PREALLOC_TIMERS=4
 CONFIG_PRIORITY_INHERITANCE=y
 CONFIG_RAM_SIZE=245760
diff --git a/boards/arm/stm32f7/nucleo-f767zi/configs/netnsh/defconfig 
b/boards/arm/stm32f7/nucleo-f767zi/configs/netnsh/defconfig
index 86b0928034f..62f6ffe82d6 100644
--- a/boards/arm/stm32f7/nucleo-f767zi/configs/netnsh/defconfig
+++ b/boards/arm/stm32f7/nucleo-f767zi/configs/netnsh/defconfig
@@ -50,7 +50,6 @@ CONFIG_NET_UDP_CHECKSUMS=y
 CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_FILEIOSIZE=512
 CONFIG_NSH_READLINE=y
-CONFIG_NUCLEO_F767ZI_CONSOLE_VIRTUAL=y
 CONFIG_PREALLOC_TIMERS=4
 CONFIG_RAM_SIZE=245760
 CONFIG_RAM_START=0x20010000
diff --git a/boards/arm/stm32f7/nucleo-f767zi/configs/nsh/defconfig 
b/boards/arm/stm32f7/nucleo-f767zi/configs/nsh/defconfig
index 0416cf11f7f..288e48ef17c 100644
--- a/boards/arm/stm32f7/nucleo-f767zi/configs/nsh/defconfig
+++ b/boards/arm/stm32f7/nucleo-f767zi/configs/nsh/defconfig
@@ -33,7 +33,6 @@ CONFIG_MM_REGIONS=3
 CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_FILEIOSIZE=512
 CONFIG_NSH_READLINE=y
-CONFIG_NUCLEO_F767ZI_CONSOLE_VIRTUAL=y
 CONFIG_PREALLOC_TIMERS=4
 CONFIG_RAM_SIZE=245760
 CONFIG_RAM_START=0x20010000
diff --git a/boards/arm/stm32f7/nucleo-f767zi/include/board.h 
b/boards/arm/stm32f7/nucleo-f767zi/include/board.h
index 7c0fce6faa1..3de63bb433e 100644
--- a/boards/arm/stm32f7/nucleo-f767zi/include/board.h
+++ b/boards/arm/stm32f7/nucleo-f767zi/include/board.h
@@ -417,7 +417,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_F767ZI_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:
  *
@@ -433,18 +436,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_F767ZI_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_F767ZI_CONSOLE_MORPHO_UART4)
 
@@ -465,16 +458,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