boards: mips: add Qemu Malta support

The MIPS Malta is an ATX form factor evaluation board made by MIPS
Technologies. Malta board is the most popular platform for MIPS
full-system emulation.

See https://www.linux-mips.org/wiki/MIPS_Malta for details.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
This commit is contained in:
Antony Pavlov 2020-12-01 11:24:45 +03:00 committed by Anas Nashif
parent c2c5727bf8
commit 05b9bde34a
13 changed files with 274 additions and 0 deletions

View file

@ -149,6 +149,7 @@
/boards/arm/ubx_bmd345eval_nrf52840/ @Navin-Sankar @brec-u-blox
/boards/common/ @mbolivar-nordic
/boards/deprecated.cmake @tejlmand
/boards/mips/ @frantony
/boards/nios2/ @nashif
/boards/nios2/altera_max10/ @nashif
/boards/arm/stm32_min_dev/ @sidcha

View file

@ -17,6 +17,7 @@ under :zephyr_file:`doc/templates/board.tmpl`
arm/index.rst
arm64/index.rst
arc/index.rst
mips/index.rst
nios2/index.rst
xtensa/index.rst
posix/index.rst

10
boards/mips/index.rst Normal file
View file

@ -0,0 +1,10 @@
.. _boards-mips:
MIPS Boards
###########
.. toctree::
:maxdepth: 1
:glob:
**/*

View file

@ -0,0 +1,16 @@
#
# Copyright (c) 2020 Antony Pavlov <antonynpavlov@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
#
config BOARD_QEMU_MALTA
bool "QEMU emulation for little endian MIPS Malta"
depends on SOC_QEMU_MALTA
select QEMU_TARGET
config BOARD_QEMU_MALTA_BE
bool "QEMU emulation for big endian MIPS Malta"
depends on SOC_QEMU_MALTA
select QEMU_TARGET
select BIG_ENDIAN

View file

@ -0,0 +1,16 @@
#
# Copyright (c) 2020 Antony Pavlov <antonynpavlov@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
#
if BOARD_QEMU_MALTA || BOARD_QEMU_MALTA_BE
config BUILD_OUTPUT_BIN
default n
config BOARD
default "qemu_malta" if BOARD_QEMU_MALTA
default "qemu_malta_be" if BOARD_QEMU_MALTA_BE
endif # BOARD_QEMU_MALTA || BOARD_QEMU_MALTA_BE

View file

@ -0,0 +1,13 @@
# SPDX-License-Identifier: Apache-2.0
set(SUPPORTED_EMU_PLATFORMS qemu)
set(QEMU_CPU_TYPE_${ARCH} 24Kc)
set(QEMU_FLAGS_${ARCH}
-machine malta
-nographic
-serial null
-serial null
)
board_set_debugger_ifnset(qemu)

View file

@ -0,0 +1,106 @@
.. _qemu_malta:
MIPS Malta Emulation (QEMU)
###########################
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
*************************
Use this configuration to run basic Zephyr applications and kernel tests in the QEMU
emulated environment, for example, with the :ref:`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 :ref:`synchronization_sample` in big-endian mode:
.. zephyr-app-commands::
:zephyr-app: samples/synchronization
:host-os: unix
:board: qemu_malta_be
:goals: run
References
**********
https://www.qemu.org/
https://www.linux-mips.org/wiki/MIPS_Malta

View file

@ -0,0 +1,56 @@
/*
* Copyright (c) 2020 Antony Pavlov <antonynpavlov@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include "skeleton.dtsi"
/ {
model = "Qemu MIPS Malta";
compatible = "qemu,malta";
chosen {
zephyr,sram = &sram0;
zephyr,console = &uart2;
zephyr,shell-uart = &uart2;
};
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu@0 {
device_type = "cpu";
compatible = "mti,mips24Kc";
reg = <0>;
cpu_intc: interrupt-controller {
#interrupt-cells = <1>;
compatible = "mti,cpu-intc";
interrupt-controller;
};
};
};
sram0: memory@80200000 {
device_type = "memory";
compatible = "mmio-sram";
reg = <0x80200000 0x100000>;
};
uart2: serial@bf000900 {
compatible = "ns16550";
reg = <0xbf000900 0x40>;
reg-shift = <3>;
interrupt-parent = <&cpu_intc>;
interrupts = <4>;
/* no matter for emulated port */
clock-frequency = <1843200>;
current-speed = <115200>;
label = "UART_2";
status = "okay";
};
};

View file

@ -0,0 +1,15 @@
identifier: qemu_malta
name: QEMU emulation for MIPS
type: qemu
simulation: qemu
arch: mips
toolchain:
- zephyr
- xtools
ram: 1024
flash: 512
testing:
default: true
ignore_tags:
- net
- bluetooth

View file

@ -0,0 +1,7 @@
/*
* Copyright (c) 2020 Antony Pavlov <antonynpavlov@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "qemu_malta.dts"

View file

@ -0,0 +1,15 @@
identifier: qemu_malta_be
name: QEMU emulation for MIPS
type: qemu
simulation: qemu
arch: mips
toolchain:
- zephyr
- xtools
ram: 1024
flash: 512
testing:
default: true
ignore_tags:
- net
- bluetooth

View file

@ -0,0 +1,9 @@
CONFIG_SOC_QEMU_MALTA=y
CONFIG_BOARD_QEMU_MALTA_BE=y
CONFIG_MIPS_CP0_TIMER=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_NS16550=y
CONFIG_QEMU_ICOUNT=y
CONFIG_QEMU_ICOUNT_SHIFT=3

View file

@ -0,0 +1,9 @@
CONFIG_SOC_QEMU_MALTA=y
CONFIG_BOARD_QEMU_MALTA=y
CONFIG_MIPS_CP0_TIMER=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_NS16550=y
CONFIG_QEMU_ICOUNT=y
CONFIG_QEMU_ICOUNT_SHIFT=3