Skip to content

Commit 92d4a88

Browse files
ksychlaaescolar
authored andcommitted
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 <[email protected]> Signed-off-by: Marek Slowinski <[email protected]> Signed-off-by: Piotr Zierhoffer <[email protected]> Signed-off-by: Mateusz Hołenko <[email protected]>
1 parent dc433dd commit 92d4a88

File tree

9 files changed

+193
-0
lines changed

9 files changed

+193
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2024 Antmicro <www.antmicro.com>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_CORTEX_R8_VIRTUAL
5+
select SOC_CORTEX_R8_VIRTUAL
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2024 Antmicro <www.antmicro.com>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
set(SUPPORTED_EMU_PLATFORMS renode)
5+
set(RENODE_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/support/cortex_r8_virtual.resc)
6+
set(RENODE_UART sysbus.uart0)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
board:
2+
name: cortex_r8_virtual
3+
vendor: renode
4+
socs:
5+
- name: cortex_r8_virtual
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2024 Antmicro <www.antmicro.com>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include <cortex_r8_virt.dtsi>
10+
11+
/ {
12+
model = "Cortex-R8 Virtual target";
13+
compatible = "renode,cortex-r8-virtual";
14+
chosen {
15+
zephyr,sram = &sram0;
16+
zephyr,flash = &flash0;
17+
zephyr,console = &uart0;
18+
zephyr,shell-uart = &uart0;
19+
};
20+
};
21+
22+
&uart0 {
23+
status = "okay";
24+
current-speed = <115200>;
25+
clock-frequency = <99999901>;
26+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
identifier: cortex_r8_virtual
2+
name: Cortex R8 Virtual Board
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
ram: 131072
8+
simulation: renode
9+
simulation_exec: renode
10+
testing:
11+
ignore_tags:
12+
- net
13+
- bluetooth
14+
renode:
15+
uart: sysbus.uart0
16+
resc: boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.resc
17+
supported:
18+
- uart
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) 2024 Antmicro <www.antmicro.com>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
CONFIG_XIP=n
5+
6+
CONFIG_ISR_STACK_SIZE=512
7+
CONFIG_THREAD_STACK_INFO=y
8+
9+
CONFIG_MAX_DOMAIN_PARTITIONS=24
10+
11+
# Enable UART driver
12+
CONFIG_SERIAL=y
13+
14+
# Enable console
15+
CONFIG_CONSOLE=y
16+
CONFIG_UART_CONSOLE=y
17+
18+
# Enable serial port
19+
CONFIG_UART_XLNX_PS=y
20+
21+
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000
22+
CONFIG_ARM_MPU=y
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
.. _cortex_r8_virtual:
2+
3+
Cortex-R8 Virtual
4+
#################
5+
6+
Overview
7+
********
8+
9+
The Cortex-R8 Virtual board is a virtual platform that can be emulated with Renode.
10+
Edit the :zephyr_file:`boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.repl` file to adapt the platform layout to your needs.
11+
12+
Refer to the `Renode documentation <https://renode.readthedocs.io/en/latest/>`_
13+
to learn how to obtain Renode for your host.
14+
15+
Programming and debugging
16+
*************************
17+
18+
Building
19+
========
20+
21+
Applications for the ``cortex_r8_virtual`` board target can be built
22+
using the standard build flow (see :ref:`build_an_application`):
23+
24+
.. zephyr-app-commands::
25+
:board: cortex_r8_virtual
26+
:goals: build
27+
28+
Flashing
29+
========
30+
31+
Your software will run in simulation and you don't need to "flash" the board in a traditional way,
32+
but you can use this configuration to run Zephyr applications
33+
and kernel tests directly in Renode with the use of the ``run`` command.
34+
35+
For example, with the :zephyr:code-sample:`synchronization` sample:
36+
37+
.. zephyr-app-commands::
38+
:zephyr-app: samples/synchronization
39+
:host-os: unix
40+
:board: cortex_r8_virtual
41+
:goals: run
42+
43+
This will build an image with the synchronization sample app, boot it using
44+
Renode, and display the following console output:
45+
46+
.. code-block:: console
47+
48+
*** Booting Zephyr OS build v3.6.0-5689-g2a5c606abfa7 ***
49+
thread_a: Hello World from cpu 0 on cortex_r8_virtual!
50+
thread_b: Hello World from cpu 0 on cortex_r8_virtual!
51+
thread_a: Hello World from cpu 0 on cortex_r8_virtual!
52+
thread_b: Hello World from cpu 0 on cortex_r8_virtual!
53+
54+
Exit Renode by pressing :kbd:`CTRL+C`.
55+
56+
Debugging
57+
=========
58+
59+
Refer to the detailed overview about :ref:`application_debugging`.
60+
61+
Renode can serve as a GDB server. For more information, refer to the
62+
`Renode documentation about GDB debugging <https://renode.readthedocs.io/en/latest/debugging/gdb.html>`_.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cpu: CPU.ARMv7R @ sysbus
2+
cpuType: "cortex-r8"
3+
genericInterruptController: gic
4+
numberOfMPURegions: 24
5+
cpuId: 0
6+
7+
scu: Miscellaneous.ArmSnoopControlUnit @ sysbus 0xae000000
8+
9+
gic: IRQControllers.ARM_GenericInterruptController @ {
10+
sysbus new Bus.BusMultiRegistration { address: 0xf9001000; size: 0x100; region: "cpuInterface" };
11+
sysbus new Bus.BusMultiRegistration { address: 0xf9000000; size: 0x1000; region: "distributor" }
12+
}
13+
[0,1] -> cpu@[0,1]
14+
architectureVersion: IRQControllers.ARM_GenericInterruptControllerVersion.GICv1
15+
supportsTwoSecurityStates: false
16+
17+
privateTimer0: Timers.ARM_PrivateTimer @ {
18+
sysbus new Bus.BusPointRegistration { address: 0xae000600; cpu: cpu }
19+
}
20+
-> gic#0@29
21+
frequency: 667000000
22+
23+
mem: Memory.MappedMemory @ sysbus 0x0
24+
size: 0x8000000
25+
26+
uart0: UART.Cadence_UART @ sysbus 0xff000000
27+
-> gic@21
28+
29+
ttc0: Timers.Cadence_TTC @ sysbus 0xff110000
30+
[0-2] -> gic@[36-38]
31+
frequency: 5000000
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
:name: Cortex-R8-Virtual
2+
:description: This script is prepared to run Zephyr on a virtual Cortex-R8 board.
3+
4+
$name?="Cortex-R8-Virtual"
5+
6+
using sysbus
7+
mach create $name
8+
machine LoadPlatformDescription $ORIGIN/cortex_r8_virtual.repl
9+
10+
11+
showAnalyzer uart0
12+
cpu PerformanceInMips 5
13+
14+
macro reset
15+
"""
16+
sysbus LoadELF $elf
17+
"""
18+
runMacro $reset

0 commit comments

Comments
 (0)