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

Chris Johns chrisj at rtems.org
Mon Jun 26 21:46:15 UTC 2023


Hi Muhammad,

The patch looks good, thanks.

Are the 3 posted patches the same version?

Chris

On 26/6/2023 2:17 pm, Muhammad Sulthan Mazaya wrote:
> Patch for the implementation of renode on rtems-test. Currently, renode
> installation has not been implemented in rsb. Thus, for testing, you can
> install renode by referring to the documentation link below.
> 
> Downloads for debian, fedora, arch, macOS, and windows:
> https://renode.io/#downloads
> 
> Alternatively, you can access Renode's GitHub releases:
> https://github.com/renode/renode/releases/tag/v1.13.3
> 
> You can also build it from source:
> https://renode.readthedocs.io/en/latest/advanced/building_from_sources.html#building-from-source
> 
> This patch consists of changes to test kendrytek210 using renode. To
> test it, you can build the kendrytek210 test suite as instructed in the
> rtems-docs (Alan's patch here: https://lists.rtems.org/pipermail/devel/2023-April/074838.html).
> Then, use the following command to run the test suite.
> 
> rtems-test --rtems-bsp=kendrytek210-renode [test-suite-path]
> 
> ---
>  .../testing/bsps/kendrytek210-renode.ini      | 38 +++++++++++
>  tester/rtems/testing/renode.cfg               | 64 +++++++++++++++++++
>  .../testing/renode_scripts/kendrytek210.resc  | 53 +++++++++++++++
>  3 files changed, 155 insertions(+)
>  create mode 100644 tester/rtems/testing/bsps/kendrytek210-renode.ini
>  create mode 100644 tester/rtems/testing/renode.cfg
>  create mode 100644 tester/rtems/testing/renode_scripts/kendrytek210.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/renode.cfg b/tester/rtems/testing/renode.cfg
> new file mode 100644
> index 0000000..49e84a5
> --- /dev/null
> +++ b/tester/rtems/testing/renode.cfg
> @@ -0,0 +1,64 @@
> +#
> +# 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 trim_command sed 's/.*\[output\] //'
> +
> +
> +#
> +# Executable
> +#
> +%execute %{renode_cmd} %{binary_opts} %{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


More information about the devel mailing list