boards: Add qemu_leon3

This board configuration can be used out-of-the-box with SPARC QEMU
distributed with Zephyr SDK v0.11.2.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
This commit is contained in:
Martin Åberg 2020-10-16 21:04:25 +02:00 committed by Andrew Boie
parent bf28bbbcec
commit 34014deb0f
10 changed files with 154 additions and 0 deletions

View file

@ -20,4 +20,5 @@ under :zephyr_file:`doc/templates/board.tmpl`
xtensa/index.rst
posix/index.rst
riscv/index.rst
sparc/index.rst
shields/index.rst

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

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

View file

@ -0,0 +1,8 @@
# Copyright (c) 2019-2020 Cobham Gaisler AB
#
# SPDX-License-Identifier: Apache-2.0
config BOARD_QEMU_LEON3
bool "QEMU LEON3 target"
depends on SOC_LEON3
select QEMU_TARGET

View file

@ -0,0 +1,10 @@
# Copyright (c) 2019-2020 Cobham Gaisler AB
#
# SPDX-License-Identifier: Apache-2.0
if BOARD_QEMU_LEON3
config BOARD
default "qemu_leon3"
endif

View file

@ -0,0 +1,13 @@
# SPDX-License-Identifier: Apache-2.0
set(EMU_PLATFORM qemu)
set(QEMU_binary_suffix sparc)
set(QEMU_CPU_TYPE_${ARCH} leon3)
set(QEMU_FLAGS_${ARCH}
-nographic
-machine leon3_generic
-icount auto
)
board_set_debugger_ifnset(qemu)

View file

@ -0,0 +1,60 @@
.. _qemu_leon3:
LEON3 Emulation (QEMU)
######################
Overview
********
The LEON3 QEMU board configuration is used to emulate the LEON3 processor.
.. figure:: qemu_leon3.png
:width: 600px
:align: center
:alt: Qemu
Qemu (Credit: qemu.org)
Programming and Debugging
*************************
Applications for the ``qemu_leon3`` board configuration can be built and run in
the usual way for emulated boards (see :ref:`build_an_application` and
:ref:`application_run` for more details).
Flashing
========
While this board is emulated and you can't "flash" it, you can 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_leon3
: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 zephyr-v2.4.0-27-g7b37fdd5303b ***
threadA: Hello World from qemu_leon3!
threadB: Hello World from qemu_leon3!
threadA: Hello World from qemu_leon3!
threadB: Hello World from qemu_leon3!
threadA: Hello World from qemu_leon3!
threadB: Hello World from qemu_leon3!
threadA: Hello World from qemu_leon3!
threadB: Hello World from qemu_leon3!
threadA: Hello World from qemu_leon3!
threadB: Hello World from qemu_leon3!
Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
Debugging
=========
Refer to the detailed overview about :ref:`application_debugging`.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2020 Cobham Gaisler AB
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <leon3soc.dtsi>
/ {
chosen {
zephyr,console = &uart0;
zephyr,sram = &ram0;
};
};
&timer0 {
interrupts = <6>;
};
&uart0 {
interrupts = <3>;
status = "okay";
};
&ram0 {
reg = <0x40000000 0x40000000>;
};

View file

@ -0,0 +1,12 @@
identifier: qemu_leon3
name: QEMU Emulation for LEON3
type: qemu
simulation: qemu
arch: sparc
ram: 1048576
flash: 524288
toolchain:
- zephyr
- xtools
testing:
default: true

View file

@ -0,0 +1,11 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_LEON3=y
CONFIG_BOARD_QEMU_LEON3=y
CONFIG_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_SERIAL=y
CONFIG_UART_APBUART=y
CONFIG_UART_CONSOLE=y
CONFIG_LEON_GPTIMER=y
CONFIG_QEMU_ICOUNT_SHIFT=6