1:name: VeeR EL2
2$name?="VeeR EL2"
3
4# Set to path of the bootable Tock image to run.
5$elf?=@https://dl.antmicro.com/projects/renode/Veer_EL2_Tock_Kernel.elf-s_3091224-2047782db63254c1553d2c56286785d8da5d085c
6$app?=@https://dl.antmicro.com/projects/renode/Veer_EL2_Tock_Rot13_Demo.tbf-s_20824-1038416452d64a736454d0a8ccb2bf537c37f166
7
8using sysbus
9mach create $name
10machine LoadPlatformDescription @platforms/cpus/tock_veer_el2_sim.repl
11
12macro reset
13"""
14    sysbus LoadELF $elf
15    sysbus LoadBinary $app 0x20300000
16"""
17
18machine CreateVirtualConsole "htif"
19python """
20from Antmicro.Renode.Peripherals.Bus import Access, SysbusAccessWidth
21htif = monitor.Machine["sysbus.htif"]
22bus = monitor.Machine.SystemBus
23
24def handle_char(_, __, ___, value):
25    if(value not in (0x1, 0xFF) and value < 0xFF):
26        htif.DisplayChar(value)
27    else:
28        for x in [ord(c) for c in "\n[[htif: Finished, requested simulation end]]"]:
29            htif.DisplayChar(x)
30        htif.DebugLog("FINISHED")
31        monitor.Machine.Pause()
32
33bus.AddWatchpointHook(0xd0580000, SysbusAccessWidth.DoubleWord, Access.Write, handle_char)
34bus.AddWatchpointHook(0xd0580000, SysbusAccessWidth.Byte, Access.Write, handle_char)
35"""
36# This address above might seem arbitrary, but it's hard-coded into the VeeR_EL2 platform definition in Tock
37# That's the location of htif uart
38
39# Silencing plic logs because the driver in Tock currently is a stub and generates a lot of "unhalted write" messages
40logLevel 3 plic
41
42showAnalyzer htif
43runMacro $reset
44