boards: renode: Add virtual Cortex-R8 board

This commit adds a virtual target using the `cortex_r8_virtual` SoC.
It can be used for testing purposes and a starting point to add new R8
platforms.

Signed-off-by: Krzysztof Sychla <ksychla@antmicro.com>
Signed-off-by: Marek Slowinski <mslowinski@antmicro.com>
Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
Signed-off-by: Mateusz Hołenko <mholenko@antmicro.com>
This commit is contained in:
Krzysztof Sychla 2024-03-27 14:55:54 +01:00 committed by Alberto Escolar
parent dc433dd6bd
commit 92d4a88c7a
9 changed files with 193 additions and 0 deletions

View file

@ -0,0 +1,5 @@
# Copyright (c) 2024 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: Apache-2.0
config BOARD_CORTEX_R8_VIRTUAL
select SOC_CORTEX_R8_VIRTUAL

View file

@ -0,0 +1,6 @@
# Copyright (c) 2024 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: Apache-2.0
set(SUPPORTED_EMU_PLATFORMS renode)
set(RENODE_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/support/cortex_r8_virtual.resc)
set(RENODE_UART sysbus.uart0)

View file

@ -0,0 +1,5 @@
board:
name: cortex_r8_virtual
vendor: renode
socs:
- name: cortex_r8_virtual

View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 Antmicro <www.antmicro.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <cortex_r8_virt.dtsi>
/ {
model = "Cortex-R8 Virtual target";
compatible = "renode,cortex-r8-virtual";
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
};
};
&uart0 {
status = "okay";
current-speed = <115200>;
clock-frequency = <99999901>;
};

View file

@ -0,0 +1,18 @@
identifier: cortex_r8_virtual
name: Cortex R8 Virtual Board
type: mcu
arch: arm
toolchain:
- zephyr
ram: 131072
simulation: renode
simulation_exec: renode
testing:
ignore_tags:
- net
- bluetooth
renode:
uart: sysbus.uart0
resc: boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.resc
supported:
- uart

View file

@ -0,0 +1,22 @@
# Copyright (c) 2024 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: Apache-2.0
CONFIG_XIP=n
CONFIG_ISR_STACK_SIZE=512
CONFIG_THREAD_STACK_INFO=y
CONFIG_MAX_DOMAIN_PARTITIONS=24
# Enable UART driver
CONFIG_SERIAL=y
# Enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# Enable serial port
CONFIG_UART_XLNX_PS=y
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000
CONFIG_ARM_MPU=y

View file

@ -0,0 +1,62 @@
.. _cortex_r8_virtual:
Cortex-R8 Virtual
#################
Overview
********
The Cortex-R8 Virtual board is a virtual platform that can be emulated with Renode.
Edit the :zephyr_file:`boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.repl` file to adapt the platform layout to your needs.
Refer to the `Renode documentation <https://renode.readthedocs.io/en/latest/>`_
to learn how to obtain Renode for your host.
Programming and debugging
*************************
Building
========
Applications for the ``cortex_r8_virtual`` board target can be built
using the standard build flow (see :ref:`build_an_application`):
.. zephyr-app-commands::
:board: cortex_r8_virtual
:goals: build
Flashing
========
Your software will run in simulation and you don't need to "flash" the board in a traditional way,
but you can use this configuration to run Zephyr applications
and kernel tests directly in Renode with the use of the ``run`` command.
For example, with the :zephyr:code-sample:`synchronization` sample:
.. zephyr-app-commands::
:zephyr-app: samples/synchronization
:host-os: unix
:board: cortex_r8_virtual
:goals: run
This will build an image with the synchronization sample app, boot it using
Renode, and display the following console output:
.. code-block:: console
*** Booting Zephyr OS build v3.6.0-5689-g2a5c606abfa7 ***
thread_a: Hello World from cpu 0 on cortex_r8_virtual!
thread_b: Hello World from cpu 0 on cortex_r8_virtual!
thread_a: Hello World from cpu 0 on cortex_r8_virtual!
thread_b: Hello World from cpu 0 on cortex_r8_virtual!
Exit Renode by pressing :kbd:`CTRL+C`.
Debugging
=========
Refer to the detailed overview about :ref:`application_debugging`.
Renode can serve as a GDB server. For more information, refer to the
`Renode documentation about GDB debugging <https://renode.readthedocs.io/en/latest/debugging/gdb.html>`_.

View file

@ -0,0 +1,31 @@
cpu: CPU.ARMv7R @ sysbus
cpuType: "cortex-r8"
genericInterruptController: gic
numberOfMPURegions: 24
cpuId: 0
scu: Miscellaneous.ArmSnoopControlUnit @ sysbus 0xae000000
gic: IRQControllers.ARM_GenericInterruptController @ {
sysbus new Bus.BusMultiRegistration { address: 0xf9001000; size: 0x100; region: "cpuInterface" };
sysbus new Bus.BusMultiRegistration { address: 0xf9000000; size: 0x1000; region: "distributor" }
}
[0,1] -> cpu@[0,1]
architectureVersion: IRQControllers.ARM_GenericInterruptControllerVersion.GICv1
supportsTwoSecurityStates: false
privateTimer0: Timers.ARM_PrivateTimer @ {
sysbus new Bus.BusPointRegistration { address: 0xae000600; cpu: cpu }
}
-> gic#0@29
frequency: 667000000
mem: Memory.MappedMemory @ sysbus 0x0
size: 0x8000000
uart0: UART.Cadence_UART @ sysbus 0xff000000
-> gic@21
ttc0: Timers.Cadence_TTC @ sysbus 0xff110000
[0-2] -> gic@[36-38]
frequency: 5000000

View file

@ -0,0 +1,18 @@
:name: Cortex-R8-Virtual
:description: This script is prepared to run Zephyr on a virtual Cortex-R8 board.
$name?="Cortex-R8-Virtual"
using sysbus
mach create $name
machine LoadPlatformDescription $ORIGIN/cortex_r8_virtual.repl
showAnalyzer uart0
cpu PerformanceInMips 5
macro reset
"""
sysbus LoadELF $elf
"""
runMacro $reset