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

Muhammad Sulthan Mazaya msulthanmazaya at gmail.com
Mon Jul 31 01:20:02 UTC 2023


Hi Joel,

Sorry I don't notice this email from you until Chris replied, gmail is
weird on mailing lists.

> This needs updating with you for sure and maybe Alan? Certainly not
> 2014 and Chris. :)

and

> New file no license or copyright. Hmmm.. is there a comment in the
> renode scripts?

Is there a guide on how I should start with this copyright mark?

> Probably in the other thread but do we have a way to reproduce this from
source?

Yes, I got this built from here
https://github.com/antmicro/renode-rtems-leon3/blob/main/build-prom.sh

> Is this from properly licensed source?  Perhelps a comment (if possible)
to note where
> this comes from and instructions to updated it.

I will add an instruction to update it. About the license, I'm not sure,
the build script I got is from antmicro's repository with Apache License (
https://github.com/antmicro/renode-rtems-leon3/blob/main/LICENSE) and it's
the downloads are sourced from Gaisler.

> Same comment on file header if they comments possible.

Sure, thanks for the feedback

On Sat, Jul 29, 2023 at 12:43 PM Joel Sherrill <joel at rtems.org> wrote:

> Generally looks good. We may have to discuss my renode script comments on
> Discord.
>
> It would be nice to have comments and licenses in them but may not be
> possible.
>
> On Fri, Jul 28, 2023 at 9:09 PM Muhammad Sulthan Mazaya <
> msulthanmazaya at gmail.com> 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
>>  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 needs updating with you for sure and maybe Alan? Certainly not
> 2014 and Chris. :)
>
>
>> +#
>> +# 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.
>>
>
> Again
>
>> +#
>> +# 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.
>>
>
> Again.
>
> Hmmm.. not your fault but Gedare has been sweeping to make sure
> it is consistently
> https://docs.rtems.org/branches/master/eng/coding-file-hdr.html
> says it should be :
>
>  Copyright (C) <FIRST YEAR>, <LAST YEAR> <COPYRIGHT HOLDER>
>
> +#
>> +# 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 @@
>>
>
> New file no license or copyright. Hmmm.. is there a comment in the
> renode scripts?
>
>
>> +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
>>
>
> Probably in the other thread but do we have a way to reproduce this from
> source?
>
> Is this from properly licensed source?  Perhelps a comment (if possible)
> to note where
> this comes from and instructions to updated it.
>
>>
>> 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 @@
>>
>
> Same comment on file header if they comments possible.
>
>
>> +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
>> --
>> 2.34.1
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20230731/7df70dce/attachment-0001.htm>


More information about the devel mailing list