From 34014deb0f342db1c3fd1fb84fdf467c60eafdaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C3=85berg?= Date: Fri, 16 Oct 2020 21:04:25 +0200 Subject: [PATCH] boards: Add qemu_leon3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- boards/index.rst | 1 + boards/sparc/index.rst | 10 ++++ boards/sparc/qemu_leon3/Kconfig.board | 8 +++ boards/sparc/qemu_leon3/Kconfig.defconfig | 10 ++++ boards/sparc/qemu_leon3/board.cmake | 13 ++++ boards/sparc/qemu_leon3/doc/index.rst | 60 +++++++++++++++++++ boards/sparc/qemu_leon3/doc/qemu_leon3.png | Bin 0 -> 4896 bytes boards/sparc/qemu_leon3/qemu_leon3.dts | 29 +++++++++ boards/sparc/qemu_leon3/qemu_leon3.yaml | 12 ++++ boards/sparc/qemu_leon3/qemu_leon3_defconfig | 11 ++++ 10 files changed, 154 insertions(+) create mode 100644 boards/sparc/index.rst create mode 100644 boards/sparc/qemu_leon3/Kconfig.board create mode 100644 boards/sparc/qemu_leon3/Kconfig.defconfig create mode 100644 boards/sparc/qemu_leon3/board.cmake create mode 100644 boards/sparc/qemu_leon3/doc/index.rst create mode 100644 boards/sparc/qemu_leon3/doc/qemu_leon3.png create mode 100644 boards/sparc/qemu_leon3/qemu_leon3.dts create mode 100644 boards/sparc/qemu_leon3/qemu_leon3.yaml create mode 100644 boards/sparc/qemu_leon3/qemu_leon3_defconfig diff --git a/boards/index.rst b/boards/index.rst index 9d854f42b6..c1a355f697 100644 --- a/boards/index.rst +++ b/boards/index.rst @@ -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 diff --git a/boards/sparc/index.rst b/boards/sparc/index.rst new file mode 100644 index 0000000000..ef09018364 --- /dev/null +++ b/boards/sparc/index.rst @@ -0,0 +1,10 @@ +.. _boards-sparc: + +SPARC Boards +############ + +.. toctree:: + :maxdepth: 1 + :glob: + + **/* diff --git a/boards/sparc/qemu_leon3/Kconfig.board b/boards/sparc/qemu_leon3/Kconfig.board new file mode 100644 index 0000000000..aa99de11bd --- /dev/null +++ b/boards/sparc/qemu_leon3/Kconfig.board @@ -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 diff --git a/boards/sparc/qemu_leon3/Kconfig.defconfig b/boards/sparc/qemu_leon3/Kconfig.defconfig new file mode 100644 index 0000000000..f76d0bf926 --- /dev/null +++ b/boards/sparc/qemu_leon3/Kconfig.defconfig @@ -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 diff --git a/boards/sparc/qemu_leon3/board.cmake b/boards/sparc/qemu_leon3/board.cmake new file mode 100644 index 0000000000..2b8bbea4be --- /dev/null +++ b/boards/sparc/qemu_leon3/board.cmake @@ -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) diff --git a/boards/sparc/qemu_leon3/doc/index.rst b/boards/sparc/qemu_leon3/doc/index.rst new file mode 100644 index 0000000000..f64b08adce --- /dev/null +++ b/boards/sparc/qemu_leon3/doc/index.rst @@ -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`. diff --git a/boards/sparc/qemu_leon3/doc/qemu_leon3.png b/boards/sparc/qemu_leon3/doc/qemu_leon3.png new file mode 100644 index 0000000000000000000000000000000000000000..9dc06ed20e3aaa96188b7d1a9925df68a25db9dc GIT binary patch literal 4896 zcmbtY_dA?j*BwE`5IscHMDIaDlo-ADUWOrv79~pb5`+*TdJ7}kL>-Yti86!;CLTSa zM;Q!JG8tux@lM|NyPkjG+drIZoxRsud*A0=_b(^S+*I!>@CFb709-ZD*R})zC?d%? z;tC~si?=68yl08lX7x$&CSiJsj1r9+7c2He0+TW zYRN!LOG{5r4+H`!C@4rvOW(S6DA ze7vW-`{T!tMn*=Bjg3V`MdYNYsHl&RkBNy1*h4 z+qSkgcXxO4Jc^2n|5hCZ0WB>pud=cd6BEP3!{g%OuG0dpQvY9l6HHlCQ}e$Q+uq(D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Gvkqzr=Q)u0GvoV-=pl9)CjxCZF$C=1K*wp@L0L-n=+k`6mr$; z{NtDPN;SXIxC;fOwyP_M#d^mJCb|p*x)+I}BUS|AX-TM1P5LyLz(o=Egzi|5L+!zw zu0eV29rT~OmQtnPkXiTJRBiYx?X+%m2jk@WfCxDV(VjPtMD{zp9_+=xTh zu>8};uG5&yGwiPaA?j(lA85XQQiqRXW&gYPh!xyZ%(TS+M#ZSMFpmewWq&IFd;hY3 z+~8(fdUQb|A?oSnrmpf4y|Xh^Cn=ziIE&mlV0-UZC4Bh9ZW^N`uSk7Ra?R?+IT#l6 z7{4FmB{jFY{FC(2Bq)59LD_)#aERtDEr-LAo?4FWUS+(Ni&*Dt*QKFgBON^Cc=tDYn;Brju$o%)U!a&DVyIIpU@jsn2 BlY;;N literal 0 HcmV?d00001 diff --git a/boards/sparc/qemu_leon3/qemu_leon3.dts b/boards/sparc/qemu_leon3/qemu_leon3.dts new file mode 100644 index 0000000000..0d86eb149a --- /dev/null +++ b/boards/sparc/qemu_leon3/qemu_leon3.dts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2020 Cobham Gaisler AB + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include + +/ { + chosen { + zephyr,console = &uart0; + zephyr,sram = &ram0; + }; +}; + +&timer0 { + interrupts = <6>; +}; + +&uart0 { + interrupts = <3>; + status = "okay"; +}; + +&ram0 { + reg = <0x40000000 0x40000000>; +}; diff --git a/boards/sparc/qemu_leon3/qemu_leon3.yaml b/boards/sparc/qemu_leon3/qemu_leon3.yaml new file mode 100644 index 0000000000..3d1b24b6b2 --- /dev/null +++ b/boards/sparc/qemu_leon3/qemu_leon3.yaml @@ -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 diff --git a/boards/sparc/qemu_leon3/qemu_leon3_defconfig b/boards/sparc/qemu_leon3/qemu_leon3_defconfig new file mode 100644 index 0000000000..8c232b7de8 --- /dev/null +++ b/boards/sparc/qemu_leon3/qemu_leon3_defconfig @@ -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