CV-Bowen opened a new pull request, #22477:
URL: https://github.com/apache/nuttx/pull/22477
## Summary
QEMU 9.1 (5a558be93a "hw/arm/mps2-tz.c: fix RX/TX interrupts order")
wires the mps2-tz UART interrupts receive first, as the Arm application
notes list them. #19538 already moved mps2-an521 over; the mps3-an547
configurations still have RX and TX the other way round, so on QEMU 9.1
and later the board prints the NSH banner and hangs before the prompt.
- `boards/mps3-an547: swap the UART0 RX and TX interrupts`: UART0 RX is
external interrupt 33 and TX 34, i.e. 49 and 50 in NuttX numbering, in
every an547 configuration.
- `boards/mps3-an547: swap the gdbstub UART1 RX and TX interrupts`: the
`gdbstub` configuration also uses UART1 for the debugger, RX 35 and TX
36, i.e. 51 and 52.
## Impact
- mps3-an547 boots to the NSH prompt and takes console input on QEMU 9.1
and later, and `gdbstub` can be attached over UART1 again.
- On QEMU older than 9.1 (for example 6.2 from Ubuntu 22.04) the
configurations now hang after the banner instead. That is the same
trade mps2-an521 made in #19538; the QEMU fix was tagged for stable.
- Board configuration only; no code change.
## Testing
Host: Ubuntu 22.04.5 LTS x86_64; arm-none-eabi-gcc 10.3-2021.10;
QEMU 6.2.0 (Ubuntu package) and QEMU 10.2.1.
**`mps3-an547:nsh`**: boot `nuttx.bin`, wait for `nsh> `, type
`uname -a`:
| tree | QEMU 6.2.0 | QEMU 10.2.1 |
|---|---|---|
| master | prompt, input OK | banner, then no prompt |
| this PR | banner, then no prompt | prompt, input OK |
**`mps3-an547:gdbstub`** with `CONFIG_SERIAL_GDBSTUB_AUTO_ATTACH=y` (off
by default, so the stub listens on UART1 from boot), UART1 on a TCP port,
`gdb-multiarch` connects and reads the PC, QEMU 10.2.1:
| UART1 RX/TX | gdb |
|---|---|
| 52/51 (master) | `target remote` times out |
| 51/52 (this PR) | `pc 0x6f5 <exception_direct>` |
Both configurations build with 0 warnings.
No regression in rpmsg: sim:rpserver/rpproxy and qemu-armv8a:rpserver/rpproxy
boot and pass the fixed rpmsg cases (dump, ping, rpmsgfs).
<details><summary>Test scripts (not part of this PR)</summary>
```python
# Boot mps3-an547 nuttx.bin, type a command, report whether the console
# both prints and takes input. usage: run.py <qemu-system-arm> <nuttx.bin>
import sys, pexpect
qemu, img = sys.argv[1:3]
p = pexpect.spawn(qemu, ['-M', 'mps3-an547', '-nographic', '-kernel', img],
encoding='utf-8', codec_errors='replace', timeout=20)
try:
p.expect('nsh> ', timeout=20)
except pexpect.TIMEOUT:
print('NO PROMPT'); p.terminate(force=True); sys.exit(0)
p.sendline('uname -a')
try:
p.expect(r'NuttX \S+ \S+', timeout=10)
print('PROMPT + INPUT OK')
except pexpect.TIMEOUT:
print('PROMPT, NO INPUT')
p.terminate(force=True)
```
```python
# Boot mps3-an547:gdbstub with UART1 on a TCP port, attach gdb through it
# and read the PC. usage: gdb.py <qemu-system-arm> <nuttx.bin> <elf> <port>
import sys, subprocess, pexpect
qemu, img, elf, port = sys.argv[1:5]
p = pexpect.spawn(qemu, ['-M', 'mps3-an547', '-nographic',
'-serial', 'mon:stdio',
'-serial', 'tcp:127.0.0.1:%s,server=on,wait=off' %
port,
'-kernel', img],
encoding='utf-8', codec_errors='replace', timeout=20)
try:
p.expect('nsh> ', timeout=20)
except pexpect.TIMEOUT:
print('NO PROMPT'); p.terminate(force=True); sys.exit(0)
try:
out = subprocess.run(['gdb-multiarch', '-nx', '-batch',
'-ex', 'set remotetimeout 5',
'-ex', 'target remote 127.0.0.1:%s' % port,
'-ex', 'info registers pc', elf],
capture_output=True, text=True, timeout=40)
print([l for l in out.stdout.splitlines() if l.startswith('pc')])
except subprocess.TimeoutExpired:
print('gdb: TIMEOUT')
p.terminate(force=True)
```
</details>
--
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]