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

Daniel Hellstrom daniel at gaisler.com
Tue Sep 5 11:11:20 UTC 2023


Hi Gedare,

> I was hoping that
> you might be able to provide a 2-BSD or a GPLv2+linker exception
> license for this file.
I've tried to look into this, but unfortunately at this time I can not 
provide prom.S under a different license. If that would change I will 
let you know. Sounds like a really interesting GSoC project.

/Daniel


On 2023-08-18 16:25, Gedare Bloom wrote:
> Daniel / Gaisler:
>
> On Sun, Aug 6, 2023 at 11:05 PM Muhammad Sulthan Mazaya
> <msulthanmazaya at gmail.com>  wrote:
>> Add gpl to the prom binary file name + include the leon3 prom assembly
>> source with licensing commented
>>
>> ---
>>   .../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 ++++++++++++++++++
> [...]
>> 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 @@
>> +/*
>> + * Fromhttps://github.com/TUT-ASI/leon3-grlib-gpl-mirror/blob/master/software/leon3/prom.S
>> + *
>> + * GPL license, version unknown
>> + */
>> +
> We have a GSoC student working this summer on integration of the
> renode simulator. For running leon3, they found this mirrored version
> of the GRLIB GPL release, and lifted the file ./software/leon3/prom.S.
> I have pointed them to the appropriate location of your releases at
> https://www.gaisler.com/index.php/downloads/leongrlib  however since it
> is just this one file with some runtime boot code, I was hoping that
> you might be able to provide a 2-BSD or a GPLv2+linker exception
> license for this file.
>
> At the moment it is not such a problem because the file is only linked
> for generating a boot img for testing on a simulator. But we would
> prefer if we can keep the license compatible for user adoption.
>
>> +/* 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 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..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 (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-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 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/20230905/4fc9c726/attachment.htm>


More information about the devel mailing list