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

Chris Johns chrisj at rtems.org
Sun Jul 30 22:49:22 UTC 2023


On 29/7/2023 12:08 pm, Muhammad Sulthan Mazaya wrote:
> Add leon3 implementation for rtems-test using renode.
> 
> ---
>  .../testing/bsps/kendrytek210-renode.ini      |  38 ++++++++++
>  tester/rtems/testing/bsps/leon3-renode.ini    |  37 ++++++++++
>  tester/rtems/testing/renode.cfg               |  65 ++++++++++++++++++
>  .../testing/renode_scripts/kendrytek210.resc  |  53 ++++++++++++++
>  .../testing/renode_scripts/leon3-prom.bin     | Bin 0 -> 529 bytes
>  .../rtems/testing/renode_scripts/leon3.resc   |  47 +++++++++++++
>  6 files changed, 240 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_scripts/kendrytek210.resc
>  create mode 100755 tester/rtems/testing/renode_scripts/leon3-prom.bin

This file does not look like a script to me. I suggest removing _scripts from
the path, eg:

 tester/rtems/testing/renode/leon3-prom.bin

What is this file and where did it come from? I see no attribution or sources to
make this binary file?

Chris

>  create mode 100644 tester/rtems/testing/renode_scripts/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..95850c5
> --- /dev/null
> +++ b/tester/rtems/testing/bsps/kendrytek210-renode.ini
> @@ -0,0 +1,38 @@
> +#
> +# RTEMS Tools Project (http://www.rtems.org/)
> +# Copyright 2010-2014 Chris Johns (chrisj at rtems.org)
> +# 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..af48043
> --- /dev/null
> +++ b/tester/rtems/testing/bsps/leon3-renode.ini
> @@ -0,0 +1,37 @@
> +#
> +# RTEMS Tools Project (http://www.rtems.org/)
> +# Copyright 2010-2014 Chris Johns (chrisj at rtems.org)
> +# 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..a6b13ec
> --- /dev/null
> +++ b/tester/rtems/testing/renode.cfg
> @@ -0,0 +1,65 @@
> +#
> +# RTEMS Tools Project (http://www.rtems.org/)
> +# Copyright 2010-2014 Chris Johns (chrisj at rtems.org)
> +# 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_scripts"
> +%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_scripts/kendrytek210.resc b/tester/rtems/testing/renode_scripts/kendrytek210.resc
> new file mode 100644
> index 0000000..fe13aa8
> --- /dev/null
> +++ b/tester/rtems/testing/renode_scripts/kendrytek210.resc
> @@ -0,0 +1,53 @@
> +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
> +
> +macro reset
> +"""
> +    sysbus LoadELF $bin 
> +"""
> +runMacro $reset
> diff --git a/tester/rtems/testing/renode_scripts/leon3-prom.bin b/tester/rtems/testing/renode_scripts/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_scripts/leon3.resc b/tester/rtems/testing/renode_scripts/leon3.resc
> new file mode 100644
> index 0000000..37f5f2b
> --- /dev/null
> +++ b/tester/rtems/testing/renode_scripts/leon3.resc
> @@ -0,0 +1,47 @@
> +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
> +"""
> +    sysbus LoadBinary @leon3-prom.bin 0x0
> +    sysbus LoadELF $bin
> +
> +    cpu PC 0
> +"""
> +
> +runMacro $reset


More information about the devel mailing list