.. zephyr:board:: qemu_malta

Overview
********

This board configuration will use QEMU to emulate the MIPS Malta platform.

This configuration provides support for an MIPS 4Kc/24Kc CPU cores and these devices:

* CP0 Interrupt Controller
* CP0 Core Timer
* NS16550 UART


.. note::
   This board configuration makes no claims about its suitability for use
   with an actual MIPS Malta hardware system, or any other hardware system.

Hardware
********

Supported Features
==================

The following hardware features are supported:

+----------------+------------+----------------------+
| Interface      | Controller | Driver/Component     |
+================+============+======================+
| CP0 IntC       | on-chip    | interrupt controller |
+----------------+------------+----------------------+
| CP0 Core Timer | on-chip    | system clock         |
+----------------+------------+----------------------+
| NS16550        | FPGA       | serial port          |
| UART           |            |                      |
+----------------+------------+----------------------+

The kernel currently does not support other hardware features on this platform.

Devices
========
System Clock
------------

Qemu CP0 timer uses a clock frequency of 200 MHz,
see target/mips/cp0_timer.c in Qemu source tree for details.

Serial Port
-----------

This board configuration uses a single serial communication channel
with the FPGA UART2.

Programming and Debugging
*************************

.. zephyr:board-supported-runners::

Use this configuration to run basic Zephyr applications and kernel tests in the QEMU
emulated environment, for example, with the :zephyr:code-sample:`synchronization` sample:

.. zephyr-app-commands::
   :zephyr-app: samples/synchronization
   :host-os: unix
   :board: qemu_malta
   :goals: run

This will build an image with the synchronization sample app, boot it using
QEMU, and display the following console output:

.. code-block:: console

        *** Booting Zephyr OS build v2.7.99-1627-g9bea7790d620  ***
        thread_a: Hello World from cpu 0 on qemu_malta!
        thread_b: Hello World from cpu 0 on qemu_malta!
        thread_a: Hello World from cpu 0 on qemu_malta!
        thread_b: Hello World from cpu 0 on qemu_malta!
        thread_a: Hello World from cpu 0 on qemu_malta!
        thread_b: Hello World from cpu 0 on qemu_malta!
        thread_a: Hello World from cpu 0 on qemu_malta!
        thread_b: Hello World from cpu 0 on qemu_malta!
        thread_a: Hello World from cpu 0 on qemu_malta!
        thread_b: Hello World from cpu 0 on qemu_malta!


Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.


Big-Endian
==========

Use this configuration to run :zephyr:code-sample:`synchronization` sample in big-endian mode:

.. zephyr-app-commands::
   :zephyr-app: samples/synchronization
   :host-os: unix
   :board: qemu_malta/qemu_malta/be
   :goals: run


References
**********

https://www.qemu.org/
https://www.linux-mips.org/wiki/MIPS_Malta
