hujun260 opened a new pull request, #21680:
URL: https://github.com/apache/nuttx/pull/21680

   # NuttX PR Description
   
   ## Title
   
   arm64: qemu: wait for UART FIFO space
   
   ## Description
   
   This PR fixes early console output on the ARM64 QEMU platform by waiting for
   space in the PL011 UART transmit FIFO before writing the next character.
   
   ## Changes
   
   - Check the PL011 UART Flag Register (`UARTFR`) TX FIFO Full (`TXFF`) bit
     before writing early console data.
   - Wait until the transmit FIFO has available space.
   - Prevent early console characters from being written while the FIFO is full.
   
   ## Motivation
   
   The early console path may write characters faster than the PL011 UART can
   accept them. Checking `TXFF` before each write prevents lost or corrupted 
early
   boot messages during QEMU startup.
   
   ## Runtime Testing
   
   The change was tested with the Vela QEMU ARM64 platform using the
   `qemu-arm64-v8a-ap` configuration.
   
   ### Early boot console log
   
   ```text
   NOTICE:  Booting Trusted Firmware
   NOTICE:  BL1: v2.14.0(debug):fb1381d84
   INFO:    BL1: Loading BL2
   NOTICE:  BL1: Booting BL2
   NOTICE:  BL2: Doing platform setup
   NOTICE:  BL31: Initializing runtime services
   INFO:    NUTTXSPD: BL32 CPU0 entry done
   INFO:    NUTTXSPD: BL32 CPU1 entry done
   INFO:    NUTTXSPD: BL32 CPU2 entry done
   INFO:    NUTTXSPD: BL32 CPU3 entry done
   INFO:    Entry point address = 0x40280000
   NuttX  12.7.2 arm64 ap
   qemu-armv8a-ap>
   ```
   
   ### AP-side `ostest`
   
   ```text
   qemu-armv8a-ap> ostest
   ...
   user_main: smp call test
   cpu_call_test: Call cpu 0, wait
   cpu_call_test: Call cpu 1, wait
   cpu_call_test: Call cpu 2, wait
   cpu_call_test: Call cpu 3, wait
   cpu_call_test: Call multi cpu, wait
   cpu_call_test: Test success
   user_main: Exiting
   ostest_main: Exiting with status 0
   ```
   
   ## Testing Status
   
   - [x ] Compile-tested with the ARM64 QEMU configuration
   - [x] Verified early boot console output on Vela QEMU ARM64
   - [x] AP-side `ostest` completed with status 0
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to