Whether the LM3S6965 Demo support QEMU I/O input?

I wonder if the LM3S6965 Demo support UART input from emulated UART of QEMU. For example, when I use QEMU to emulate it, whether can I write strings from the terminal of QEMU to the UART of this demo, then the demo use interrupt to receive and display them on the emulated OLED?

Hi @lishihong-1
I think it should be possible to support LM3S6965 UART on QEMU.

qemu-system-arm -M lm3s6965evb -nographic -kernel your_demo.elf

  • -nographic connects QEMU’s UART0 to your terminal stdin/stdout.
  • You type into QEMU terminal → gets sent to UART0 → triggers UART RX interrupt (if enabled in the demo).

You will need to implement the RX interrupt in your demo application.

But I need to use graphic option to see the OLED, I’m not sure if using interrupts to receive QEMU input strings in this case would affect the display.

In the case you mention, you cannot use no-graphic method. When you don’t use
-nographic, QEMU doesn’t redirect UART0 to your terminal. But you can explicitly map the UART0 to a host terminal or socket, like this:

qemu-system-arm -M lm3s6965evb \
  -kernel RTOSDemo.elf \
  -serial mon:stdio \
  -serial null \
  -serial pty

In the above snippet:

  • -serial mon:stdio: For QEMU monitor output (optional).
  • -serial pty: This creates a pseudo-terminal on your host and maps it to UART0.

QEMU will print something like:

char device redirected to /dev/pts/3

Then you can connect to that UART from another terminal using screen

screen /dev/pts/3 115200

That is to say, if I don’t use no-graphic method, I need to map the UART0 to a host terminal, then I can input to the UART0 through pty method, and see output on the OLED through screen method?

Yes, that is what I meant.

However, I just tried it according to your no-graphic method, and I can see the OLED output without screen method, but after the screen is connected, it only displays a terminal with nothing and cannot input.

UART0 is used for standard input/output. But the problem seems -serial mon:stdio connects to UART0 and -serial pty connects to UART2 (or UART1 depending on position).
I will try to reproduce the issue , but you can try SDL setup .

qemu-system-arm \
  -M lm3s6965evb \
  -kernel your_demo.elf \
  -serial stdio \
  -display sdl

-serial stdio attaches UART0 to your terminal.
-display sdl opens an SDL window for OLED graphics.

In this case, I tried your method and use screen /dev/pts/0 115200, then I can input strings in other terminal and output in the QEMU terminal, but I’m not sure whether QEMU’s evaluated display can achieve this effect if I modify the demo to use UART0 receiving input strings and transfer them to OLED. As the picture shown, I just use the original demo and try to use another terminal to input, is it successful?

Yes ,based on the screenshot you provided, the demo is successfully sending input characters into QEMU via UART0, and the demo is receiving them correctly. If you modify the demo so that:

  1. UART RX interrupt pushes received characters into a FreeRTOS queue or buffer.
  2. A task reads from the queue and calls the OLED print functions (OLED_WriteChar(), etc.)

Then the characters can appear on the QEMU OLED.

Another problem is I’m not sure if I can achieve the effect of typing and waiting for a ‘enter’ before sending, rather than typing as soon as I press the keyboard.

A rough approach for your problem you mention would be to store the typed characters in a buffer as the user types. Once the “Enter” key (ASCII '\r' or '\n') is detected, process and send the buffered data via UART. This approach ensures that characters are only transmitted after the user finishes typing and presses “Enter,” instead of being sent immediately after each keystroke.

But I don’t know whether the lm3s6965 support UART interrupt receive and how to configure it. In the demo, I just found the use of UARTCharPut to output string. Besides, in this demo I can’t use Timer, the qemu always output “Timer Period is zero,disabling” but the configuration in FreeRTOSConfig.h and FreeRTOS.h are correct, I don’t know if there are other places to adjust. Another question is when I change the code and compile, I must define vApplicationTickHook function and use it in main function, otherwise the Eclipse will output errors like “undefined reference” in tasks.c. But the other demo like mps2-an385 doesn’t have the question.

@lishihong-1, I cannot answer questions related to QEMU, but if you do not want to define vApplicationTickHook, then in the FreeRTOSConfig.h you are using to build, define configUSE_IDLE_HOOK to 0.