[PATCH rtems-tools v3] tester/rtemstoolkit: add renode implementation

Muhammad Sulthan Mazaya msulthanmazaya at gmail.com
Wed Aug 2 10:08:35 UTC 2023


Add licensing for renode files and change the renode_scripts/ folder to
renode/

---
 .../testing/bsps/kendrytek210-renode.ini      |  38 ++++++++
 tester/rtems/testing/bsps/leon3-renode.ini    |  37 ++++++++
 tester/rtems/testing/renode.cfg               |  64 +++++++++++++
 tester/rtems/testing/renode/kendrytek210.resc |  86 ++++++++++++++++++
 tester/rtems/testing/renode/leon3-prom.bin    | Bin 0 -> 529 bytes
 tester/rtems/testing/renode/leon3.resc        |  80 ++++++++++++++++
 6 files changed, 305 insertions(+)
 create mode 100644 tester/rtems/testing/bsps/kendrytek210-renode.ini
 create mode 100644 tester/rtems/testing/bsps/leon3-renode.ini
 create mode 100644 tester/rtems/testing/renode.cfg
 create mode 100644 tester/rtems/testing/renode/kendrytek210.resc
 create mode 100755 tester/rtems/testing/renode/leon3-prom.bin
 create mode 100644 tester/rtems/testing/renode/leon3.resc

diff --git a/tester/rtems/testing/bsps/kendrytek210-renode.ini b/tester/rtems/testing/bsps/kendrytek210-renode.ini
new file mode 100644
index 0000000..8f7f673
--- /dev/null
+++ b/tester/rtems/testing/bsps/kendrytek210-renode.ini
@@ -0,0 +1,38 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright (C) 2023, 2023 Muhammad Sulthan Mazaya (msulthanmazaya at gmail.com)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# The Kendrytek210 Renode BSP
+#
+[kendrytek210-renode]
+bsp             = kendrytek210-renode
+arch            = riscv
+tester          = %{_rtscripts}/renode.cfg
+bsp_resc_script = %{_rtscripts}/renode_scripts/kendrytek210.resc
diff --git a/tester/rtems/testing/bsps/leon3-renode.ini b/tester/rtems/testing/bsps/leon3-renode.ini
new file mode 100644
index 0000000..d5f7c17
--- /dev/null
+++ b/tester/rtems/testing/bsps/leon3-renode.ini
@@ -0,0 +1,37 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright (C) 2023, 2023 Muhammad Sulthan Mazaya (msulthanmazaya at gmail.com)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# # 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# The Leon3 Renode BSP
+#
+[leon3-renode]
+bsp             = leon3-renode
+arch            = sparc
+tester          = %{_rtscripts}/renode.cfg
+bsp_resc_script = %{_rtscripts}/renode_scripts/leon3.resc
diff --git a/tester/rtems/testing/renode.cfg b/tester/rtems/testing/renode.cfg
new file mode 100644
index 0000000..c7fee25
--- /dev/null
+++ b/tester/rtems/testing/renode.cfg
@@ -0,0 +1,64 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright (C) 2023, 2023 Muhammad Sulthan Mazaya (msulthanmazaya at gmail.com)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# Renode
+#
+# Use a renode command to run the executable in the renode simulator.
+#
+
+%include %{_configdir}/base.cfg
+%include %{_configdir}/checks.cfg
+
+#
+# Console.
+#
+%define console_telnet
+%include %{_configdir}/console.cfg
+
+#
+# RTEMS version
+#
+%include %{_rtdir}/rtems/version.cfg
+
+
+#
+# Renode executable
+#
+%define renode_cmd renode --hide-monitor
+%define binary_opts -e $bin?=@%{test_executable}
+%define start_opts -e "s @%{bsp_resc_script}"
+%define add_path -e "path add @%{_rttesting}/renode"
+%define trim_command sed 's/.*\[output\] //'
+
+#
+# Executable
+#
+%execute %{renode_cmd} %{binary_opts} %{add_path} %{start_opts} | %{trim_command}
diff --git a/tester/rtems/testing/renode/kendrytek210.resc b/tester/rtems/testing/renode/kendrytek210.resc
new file mode 100644
index 0000000..e214aec
--- /dev/null
+++ b/tester/rtems/testing/renode/kendrytek210.resc
@@ -0,0 +1,86 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright (C) 2023, 2023 Muhammad Sulthan Mazaya (msulthanmazaya at gmail.com)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+using sysbus
+using monitor
+
+mach create "K210"
+
+machine LoadPlatformDescription @platforms/cpus/kendryte_k210.repl
+
+path add @/
+
+showAnalyzer "uartAnalyzer" uart Antmicro.Renode.Analyzers.LoggingUartAnalyzer
+uartAnalyzer TimestampFormat None
+
+set report_repeating_line """
+from Antmicro.Renode.Logging import ConsoleBackend 
+ConsoleBackend.Instance.ReportRepeatingLines = True
+"""
+
+set add_hook """
+def match(line):
+    ok_to_kill_lines = [
+        '*** TEST STATE: USER_INPUT',
+        '*** TEST STATE: BENCHMARK',
+        '*** END OF TEST ',
+        '*** FATAL ***'
+    ]
+    return any(l in line for l in ok_to_kill_lines)
+
+def hook(line):
+    monitor.Parse("q")
+
+Antmicro.Renode.Hooks.UartHooksExtensions.AddLineHook(monitor.Machine["sysbus.uart"], match, hook)
+"""
+
+python $add_hook
+
+python $report_repeating_line 
+
+sysbus Tag <0x50440000 0x10000> "SYSCTL"
+sysbus Tag <0x50440018 0x4> "pll_lock" 0xFFFFFFFF
+sysbus Tag <0x5044000C 0x4> "pll1"
+sysbus Tag <0x50440008 0x4> "pll0"
+sysbus Tag <0x50440020 0x4> "clk_sel0"
+sysbus Tag <0x50440028 0x4> "clk_en_cent"
+sysbus Tag <0x5044002c 0x4> "clk_en_peri"
+
+# enable uart tx
+uart WriteDoubleWord 0x8 0x1
+
+machine StartGdbServer 3333
+
+macro reset
+"""
+    sysbus LoadELF $bin 
+"""
+# runMacro $reset
diff --git a/tester/rtems/testing/renode/leon3-prom.bin b/tester/rtems/testing/renode/leon3-prom.bin
new file mode 100755
index 0000000000000000000000000000000000000000..a42628906b6915c589f6be96fe5de82a940c6529
GIT binary patch
literal 529
zcmYk&F-yZh6bJBsQma+O9uC$)FhikhM;GxB2R}yq7LJ!#(<mZEM2ZwSt%!*D2?}kc
z4h|h01RaFy;NT$Q;2>1uKedqte%#A at 3Gco0o*blrF<-dG3t at Q`z^jr1PRRmTcO>iC
zTMbzff4Mk6N(p6;z9(^cO(Mvc#gPB)(jM)TrZYOH3%aB$x~3bd&;cFN5mo7!YIH(@
zHr8A-`tS_k3&-Z%*61Ed|M=Wmr=mNpLf5ht@^Nm00 at 2%SXIf~_w{S=I)TIY{q-T1e
z9=*~Vz0)Us(Kr3jXs;yR(V5jGPEMhaPGYtnJn{XMi)JARO?FmcCa(Kp$?ZU5yQrs!
zJ54GrZPv$AD}B~Ckj{rrNz}U?M<NX<pLe3P0rwm9 at F8u{jQW9NtmRx3HF9;+C at 8B|
S&~A#~dM!DadpO4bG4%^DAaPm%

literal 0
HcmV?d00001

diff --git a/tester/rtems/testing/renode/leon3.resc b/tester/rtems/testing/renode/leon3.resc
new file mode 100644
index 0000000..3579c73
--- /dev/null
+++ b/tester/rtems/testing/renode/leon3.resc
@@ -0,0 +1,80 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright (C) 2023, 2023 Muhammad Sulthan Mazaya (msulthanmazaya at gmail.com)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+using sysbus
+using monitor
+
+mach create "leon3"
+
+machine LoadPlatformDescription @platforms/boards/leon3.repl
+
+path add @/
+
+showAnalyzer "uartAnalyzer" uart Antmicro.Renode.Analyzers.LoggingUartAnalyzer
+uartAnalyzer TimestampFormat None
+
+set report_repeating_line """
+from Antmicro.Renode.Logging import ConsoleBackend 
+ConsoleBackend.Instance.ReportRepeatingLines = True
+"""
+
+set add_hook """
+def my_match(line):
+    ok_to_kill_lines = [
+        '*** TEST STATE: USER_INPUT',
+        '*** TEST STATE: BENCHMARK',
+        '*** END OF TEST ',
+        '*** FATAL ***'
+    ]
+    return any(l in line for l in ok_to_kill_lines)
+
+def my_hook(line):
+    print line
+    monitor.Parse("q")
+
+Antmicro.Renode.Hooks.UartHooksExtensions.AddLineHook(monitor.Machine["sysbus.uart"], my_match, my_hook)
+"""
+
+python $add_hook
+
+python $report_repeating_line 
+
+macro reset
+"""
+    # The leon3-prom.bin is built using Antmicro's script from their
+    # example of how to use renode to test rtems leon3 using renode-test
+    # https://github.com/antmicro/renode-rtems-leon3/blob/main/build-prom.sh
+    sysbus LoadBinary @leon3-prom.bin 0x0
+    sysbus LoadELF $bin
+
+    cpu PC 0
+"""
+
+runMacro $reset
-- 
2.34.1



More information about the devel mailing list