<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI Symbol";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.E-MailFormatvorlage18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>From:</b> Joel Sherrill <joel@rtems.org> <br>
<b>Sent:</b> Friday, January 29, 2021 3:33 PM<br>
<b>To:</b> Sommer, Jan <Jan.Sommer@dlr.de><br>
<b>Cc:</b> Jiri Gaisler <jiri@gaisler.se>; rtems-users@rtems.org <users@rtems.org><br>
<b>Subject:</b> Re: riscv: gdb cannot connect to rtems runnin in qemu<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Fri, Jan 29, 2021 at 8:29 AM <<a href="mailto:Jan.Sommer@dlr.de">Jan.Sommer@dlr.de</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">Just tried again with the rv32imac BSP.<br>
With this gdb works.<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">I was poking at the gdb source and found the code in question in riscv-tdep.c:<br>
<br>
<br>
  /* In theory a binary compiled for RV32 could run on an RV64 target,<br>
     however, this has not been tested in GDB yet, so for now we require<br>
     that the requested xlen match the targets xlen.  </span>*/<br>
  if (abi_features.xlen != features.xlen)<br>
    error (_("bfd requires xlen %d, but target has xlen %d"),<br>
   abi_features.xlen, features.xlen);<br>
  /* We do support running binaries compiled for 32-bit float on targets<br>
     with 64-bit float, so we only complain if the binary requires more<br>
     than the target has available.  */<br>
  if (abi_features.flen > features.flen)<br>
    error (_("bfd requires flen %d, but target has flen %d"),<br>
   abi_features.flen, features.flen);<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I'm reading that as the qemu configuration doesn't support the floating point<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">width required for 64-bit riscv.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">In one of my test directories, I had different qemu's for 32-bit and 64-bit <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">riscv. Do you? Maybe that makes a difference.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#4F81BD">Yes, I used the 32 bit version for riscv. I used the following qemu line:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#4F81BD">qemu-system-riscv32 -nographic -machine virt -m 2G -nographic -net none -serial mon:stdio -bios /tmp/riscv/ticker.exe -s -S<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#4F81BD"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#4F81BD">I also have a <o:p>
</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#4F81BD">qemu-system-riscv64, but with this I have failed to get an RTEMS application running (neither the rv32* nor the rv64* based ones) so far.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#4F81BD"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#4F81BD">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#4F81BD"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#4F81BD">    Jan<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal">--joel<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal"><br>
Best regards,<br>
<br>
    Jan<br>
<br>
> -----Original Message-----<br>
> From: users <<a href="mailto:users-bounces@rtems.org" target="_blank">users-bounces@rtems.org</a>> On Behalf Of
<a href="mailto:Jan.Sommer@dlr.de" target="_blank">Jan.Sommer@dlr.de</a><br>
> Sent: Friday, January 29, 2021 3:10 PM<br>
> To: <a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a>; <a href="mailto:jiri@gaisler.se" target="_blank">
jiri@gaisler.se</a><br>
> Cc: <a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br>
> Subject: RE: riscv: gdb cannot connect to rtems runnin in qemu<br>
> <br>
> <br>
> <br>
> > From: Joel Sherrill <<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a>><br>
> ><br>
> >On Fri, Jan 29, 2021 at 7:20 AM <<a href="mailto:Jan.Sommer@dlr.de" target="_blank">Jan.Sommer@dlr.de</a>> wrote:<br>
> >> Hello<br>
> >><br>
> >> I just tried to debug a riscv test program running in qemu.<br>
> >> However, gdb could not establish a connection to qemu and produced the<br>
> following error:<br>
> >> /tmp/rtems/riscv<span style="font-family:"Segoe UI Symbol",sans-serif">❯</span> riscv-rtems6-gdb ticker.exe GNU gdb (GDB)<br>
> >> 10.1.90.20210125-git [..]<br>
> >><br>
> >> For help, type "help".<br>
> >> Type "apropos word" to search for commands related to "word"...<br>
> >> Reading symbols from<br>
> /tools/modulesystem/tools/rtems/rtems6/install/bsps/riscv-<br>
> rtems6/grv32imafdc-smp/testsuites/samples/ticker.exe...<br>
> >> (gdb) target remote :1234<br>
> >> Remote debugging using :1234<br>
> >> bfd requires flen 8, but target has flen 4<br>
> ><br>
> > griscv are Jiri's BSPs and should run on sis and be able to be debugged that<br>
> way.<br>
> ><br>
> > He should know if they worked on qemu and he was able to connect gdb.<br>
> ><br>
> <br>
> Sorry for the confusion. Jiri already told me previously that for running on<br>
> qemu I need to use the BSPs without a "g" like rv32imafdc.<br>
> That's what I did for my test application. For testing with ticker.exe I chose<br>
> the wrong directory.<br>
> To clarify, I use the rv32imafdc BSP to run on qemu.<br>
> The application runs fine, but debugging it through the qemu gdb-server<br>
> does not work.<br>
> This does also happen with the ticker.exe of the rv32imafdc BSP.<br>
> <br>
> Best regards,<br>
> <br>
>     Jan<br>
> <br>
> > Otherwise, this looks like a potential mismatch of 32 and 64 bit stuff<br>
> > like gdb wasn't built with both 32 and 64 bit riscv support. Which<br>
> > seems odd to me because it lives in the same repo as binutils and<br>
> > should have a comparable build of binutils.<br>
> ><br>
> ><br>
> >> The tools and rtems are built from master a couple of days ago.<br>
> >> I used the following command line for qemu (v. 4.2.0):<br>
> >> qemu-system-riscv32 -nographic -machine virt -m 2G -nographic -net<br>
> >> none -serial mon:stdio -bios /tmp/riscv/ticker.exe -s -S<br>
> >><br>
> >> Does anyone have a hint if the problem is with qemu, gdb or rtems?<br>
> >> Without gdb the program runs normally in qemu.<br>
> >><br>
> >> Best regards,<br>
> >><br>
> >>     Jan<br>
> >><br>
> >> Deutsches Zentrum für Luft- und Raumfahrt e. V. (DLR) German<br>
> >> Aerospace Center Institute for Software Technology | Software for<br>
> >> Space Systems and Interactive Visualization | Lilienthalplatz 7 |<br>
> >> 38108 Braunschweig | Germany<br>
> >><br>
> >> Jan Sommer<br>
> ><br>
> > _______________________________________________<br>
> users mailing list<br>
> <a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/users" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br>
> <br>
> _______________________________________________<br>
> users mailing list<br>
> <a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/users" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>