diff --git a/boards/index.rst b/boards/index.rst index 9d854f42b6a..c1a355f697d 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 00000000000..ef090183645 --- /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 00000000000..aa99de11bdf --- /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 00000000000..f76d0bf9262 --- /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 00000000000..2b8bbea4be7 --- /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 00000000000..f64b08adce7 --- /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 00000000000..9dc06ed20e3 Binary files /dev/null and b/boards/sparc/qemu_leon3/doc/qemu_leon3.png differ diff --git a/boards/sparc/qemu_leon3/qemu_leon3.dts b/boards/sparc/qemu_leon3/qemu_leon3.dts new file mode 100644 index 00000000000..0d86eb149a1 --- /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 00000000000..3d1b24b6b22 --- /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 00000000000..8c232b7de88 --- /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