![qemu system arm qemu system arm](https://dz2cdn1.dzone.com/storage/temp/4056640-screenshot-from-2017-01-18-18-42-05.png)
*TxRxUART1 = (unsigned int)(*s) /* Transmit char */ +volatile unsigned int * const TxRxUART0 = UART0_TxRxFIFO0 volatile unsigned int * const TxRxUART1 = UART1_TxRxFIFO0 +#define UART0_TxRxFIFO0 ((unsigned int *) (UART0_BASE + 0x30)) #define UART1_TxRxFIFO0 ((unsigned int *) (UART1_BASE + 0x30)) $(ARMGNU)-as $(ARCH) startup.s -o startup.oĭiff -git a/Hello01/hello01.c b/Hello01/hello01.c The output of the git diff command after modifications were made was: diff -git a/Hello01/Makefile b/Hello01/Makefile The UART0 emulation is working fine for example by using a slightly modified version of this program: /opt/qemu-4.2.0/bin/qemu-system-arm -semihosting -semihosting-config enable=on,target=native -nographic -serial mon:stdio -machine xilinx-zynq-a9 -m 768M -cpu cortex-a9 -kernel hello05.elf You need to initialize the UART prior to attempt outputing any characters. The main differences being 1) the GDB port number is different (so multiple instances can run simultaneously) and 2) Qemu is to be controlled using a telnet connection over a socket, so it can be controlled by the Python script. Note: when run in the fault injection setup, the Qemu invocation is qemu-system-arm -M xilinx-zynq-a9 -cpu cortex-a9 -nographic -kernel $BUILD_DIR/mm.elf -m 512M -gdb tcp::3345 -S -monitor telnet::3347,server,nowait The fault injection setup uses Python, and Qemu is running as a subprocess, so it would be easy to get the output from either one of those sources. If it goes through a TCP socket, that's fine too. If this is done by redirecting to stdout, that's fine. I want to be able to capture the output of messages sent to UART. Base address is 0xe0000000, the same in both places. I looked at the disassembly of the ELF file and verified that the address to which the the UART messages are being written is the same as the Qemu setup expects ( info mtree).
![qemu system arm qemu system arm](https://i.stack.imgur.com/rqxpN.png)
Currently I use GDB to ask for the values of the variables which are supposed to be printed. I am using this for software fault injection. The ELF was compiled using the Xilinx ARM toolchain. The ELF file I am using ( mm.elf) performs a simple matrix multiply operation, and then prints whether it succeeded or failed, and how long it took to run.
![qemu system arm qemu system arm](https://i.ytimg.com/vi/EN_n8pBzBZ8/maxresdefault.jpg)
Here is the command line invocation I have been using: qemu-system-arm -M xilinx-zynq-a9 -cpu cortex-a9 -nographic -kernel $BUILD_DIR/mm.elf -m 512M -s -S How do I get the UART output from a baremetal program run with Qemu? Background