StanOverflow
StanOverflow

Reputation: 567

Microblaze on QEMU not producing serial output

I'm trying to emulate baremetal Microblaze code using QEMU but don't get any output from the "print" function. The microblaze is produced from a xilinx project, this produces a .dts file which is used to make a .dtb for use with QEMU. I'm using Xilinx's fork of QEMU

I run QEMU with the following command

~/.local/bin/qemu-system-microblazeel -M microblaze-fdt -dtb system-top.dtb -m 256 -serial mon:stdio -display none -kernel ./workspace/app_0/Debug/app_0.elf -s -S -nographic

I can connect with gdb, and step through the code, it clearly writes to address 0x40600004 which is the UART TX data FIFO, but still nothing is seen at the QEMU terminal. I even added some debug inside the QEMU xilinx UART model, it was registered but never called when the code ran.

#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"

int main()
{
    init_platform();

    print("Hello World\n\r");

    cleanup_platform();
    return 0;
}

This is the UART node from the .dts file

top_axi_uartlite_0: serial@40600000 {
        clock-frequency = <294999169>;
        clocks = <&clk_bus_0>;
        compatible = "xlnx,axi-uartlite-2.0", "xlnx,xps-uartlite-1.00.a";
        current-speed = <115200>;
        device_type = "serial";
        interrupt-names = "interrupt";
        interrupt-parent = <&top_axi_intc_0>;
        interrupts = <1 0>;
        port-number = <0>;
        reg = <0x40600000 0x10000>;
        xlnx,baudrate = <0x1c200>;
        xlnx,data-bits = <0x8>;
        xlnx,odd-parity = <0x0>;
        xlnx,s-axi-aclk-freq-hz-d = "294.999169";
        xlnx,use-parity = <0x0>;
    };

QEMU monitor shows the following memory space

address-space: memory
  0000000000000000-ffffffffffffffff (prio 0, i/o): system
    0000000000000000-000000000fffffff (prio 0, ram): memory@0

address-space: I/O
  0000000000000000-000000000000ffff (prio 0, i/o): io

address-space: cpu-memory-0
  0000000000000000-000000000fffffff (prio 0, ram): memory@0

Upvotes: 2

Views: 767

Answers (0)

Related Questions