Fixing typo on renode_script/ folder that is changed to be renode/ in v4 --- .../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-gpl.S | 205 ++++++++++++++++++ .../rtems/testing/renode/leon3-prom-gpl.bin | Bin 0 -> 529 bytes tester/rtems/testing/renode/leon3.resc | 82 +++++++ 7 files changed, 512 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 100644 tester/rtems/testing/renode/leon3-prom-gpl.S create mode 100755 tester/rtems/testing/renode/leon3-prom-gpl.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..0cc48ae --- /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 (msulthanmaz...@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/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..4ab013d --- /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 (msulthanmaz...@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/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 (msulthanmaz...@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 (msulthanmaz...@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-gpl.S b/tester/rtems/testing/renode/leon3-prom-gpl.S new file mode 100644 index 0000000..91dc3bc --- /dev/null +++ b/tester/rtems/testing/renode/leon3-prom-gpl.S @@ -0,0 +1,205 @@ +/* + * From https://github.com/TUT-ASI/leon3-grlib-gpl-mirror/blob/master/software/leon3/prom.S + * + * GPL license, version unknown + */ + +/* Template boot-code for LEON3 test benches */ + +#include "prom.h" + +#ifndef STACKSIZE +#define STACKSIZE 0x00020000 +#endif + + + .seg "text" + .proc 0 + .align 4 + .global start +start: + + flush + set 0x10e0, %g1 ! init IU + mov %g1, %psr + mov %g0, %wim + mov %g0, %tbr + mov %g0, %y + mov %g0, %asr16 + nop + set 0x81000f, %g1 + sta %g1, [%g0] 2 + mov %g0, %g2 + nop + nop + nop + nop + nop + or %g2, %g2, %g0 + nop + nop + nop + nop + nop +#ifdef DSUADDR + set DSUADDR, %g2 + st %g0, [%g2] + st %g0, [%g2+0x08] + st %g0, [%g2+0x20] + st %g0, [%g2+0x24] + st %g0, [%g2+0x40] + st %g0, [%g2+0x44] + st %g0, [%g2+0x50] + st %g0, [%g2+0x54] + st %g0, [%g2+0x58] + st %g0, [%g2+0x5C] + st %g0, [%g2+0x54] +#endif + +2: + mov %asr17, %g3 + and %g3, 0x1f, %g3 + mov %g0, %g4 + mov %g0, %g5 + mov %g0, %g6 + mov %g0, %g7 +1: + mov %g0, %l0 + mov %g0, %l1 + mov %g0, %l2 + mov %g0, %l3 + mov %g0, %l4 + mov %g0, %l5 + mov %g0, %l6 + mov %g0, %l7 + mov %g0, %o0 + mov %g0, %o1 + mov %g0, %o2 + mov %g0, %o3 + mov %g0, %o4 + mov %g0, %o5 + mov %g0, %o6 + mov %g0, %o7 + subcc %g3, 1, %g3 + bge 1b + save + + mov 2, %g1 + mov %g1, %wim + set 0x10e0, %g1 ! enable traps + mov %g1, %psr + nop; nop; nop; + + mov %psr, %g1 + srl %g1, 12, %g1 + andcc %g1, 1, %g0 + be 1f + nop + + set _fsrxx, %g3 + ld [%g3], %fsr + ldd [%g3], %f0 + ldd [%g3], %f2 + ldd [%g3], %f4 + ldd [%g3], %f6 + ldd [%g3], %f8 + ldd [%g3], %f10 + ldd [%g3], %f12 + ldd [%g3], %f14 + ldd [%g3], %f16 + ldd [%g3], %f18 + ldd [%g3], %f20 + ldd [%g3], %f22 + ldd [%g3], %f24 + ldd [%g3], %f26 + ldd [%g3], %f28 + ldd [%g3], %f30 + nop + nop + nop + nop + nop + faddd %f0, %f2, %f4 + nop + nop + nop + nop + ba 1f + nop + + +.align 8 +_fsrxx: + .word 0 + .word 0 + +1: + mov %asr17, %g3 + srl %g3, 28, %g3 + andcc %g3, 0x0f, %g3 + bne 1f + nop + +#ifdef L2MCTRLIO + set L2MCTRLIO, %g1 + set MCFG1, %g2 + st %g2, [%g1] + set MCFG2, %g2 + st %g2, [%g1+4] + set MCFG3, %g2 + st %g2, [%g1+8] +#endif +! set IRQCTRL, %g1 +! set 0x0ffff, %g2 +! st %g2, [%g1+0x10] + +#ifdef UARTADDR + set UARTADDR, %g1 + st %g0, [%g1+0xC] + set 3, %g2 + st %g2, [%g1+0x8] +#endif + +#ifdef DDR2CTRLIO + set DDR2CTRLIO, %g1 + set DDR2CFG4, %g2 + st %g2, [%g1+12] +#endif + +#ifdef ASDCFG +#ifndef SDCTRLPNP +#define SDCTRLPNP 0xFFFFF860 +#endif + set SDCTRLPNP, %g1 + ld [%g1], %g2 + srl %g2, 12, %g2 + set 0x01009, %g1 + subcc %g1, %g2, %g0 + bne 1f + + set ASDCFG, %g1 + set DSDCFG, %g2 + st %g2, [%g1] +#endif + + ! %g3 = cpu index +1: set STACKSIZE, %g2 + mov %g0, %g1 +2: subcc %g3, 0, %g0 + be 3f + nop + add %g1, %g2, %g1 + ba 2b + sub %g3, 1, %g3 + + +3: set RAMSTART+ RAMSIZE-32, %fp + sub %fp, %g1, %fp + sub %fp, 96, %sp + + set RAMSTART, %g1 + + jmp %g1 + nop + +.align 32 diff --git a/tester/rtems/testing/renode/leon3-prom-gpl.bin b/tester/rtems/testing/renode/leon3-prom-gpl.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@3Gco0o*blrF<-dG3t@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@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@F8u{jQW9NtmRx3HF9;+C@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..3196775 --- /dev/null +++ b/tester/rtems/testing/renode/leon3.resc @@ -0,0 +1,82 @@ +# +# RTEMS Tools Project (http://www.rtems.org/) +# Copyright (C) 2023, 2023 Muhammad Sulthan Mazaya (msulthanmaz...@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-gpl.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 + # The source of the assembly file itself is from Gaisler + # https://github.com/TUT-ASI/leon3-grlib-gpl-mirror/blob/master/software/leon3/prom.S + sysbus LoadBinary @leon3-prom-gpl.bin 0x0 + sysbus LoadELF $bin + + cpu PC 0 +""" + +runMacro $reset -- 2.34.1 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel