riscv: gdb cannot connect to rtems runnin in qemu

Jan.Sommer at dlr.de Jan.Sommer at dlr.de
Fri Jan 29 14:38:20 UTC 2021



From: Joel Sherrill <joel at rtems.org>
Sent: Friday, January 29, 2021 3:33 PM
To: Sommer, Jan <Jan.Sommer at dlr.de>
Cc: Jiri Gaisler <jiri at gaisler.se>; rtems-users at rtems.org <users at rtems.org>
Subject: Re: riscv: gdb cannot connect to rtems runnin in qemu



On Fri, Jan 29, 2021 at 8:29 AM <Jan.Sommer at dlr.de<mailto:Jan.Sommer at dlr.de>> wrote:
Just tried again with the rv32imac BSP.
With this gdb works.

I was poking at the gdb source and found the code in question in riscv-tdep.c:


  /* In theory a binary compiled for RV32 could run on an RV64 target,
     however, this has not been tested in GDB yet, so for now we require
     that the requested xlen match the targets xlen.  */
  if (abi_features.xlen != features.xlen)
    error (_("bfd requires xlen %d, but target has xlen %d"),
   abi_features.xlen, features.xlen);
  /* We do support running binaries compiled for 32-bit float on targets
     with 64-bit float, so we only complain if the binary requires more
     than the target has available.  */
  if (abi_features.flen > features.flen)
    error (_("bfd requires flen %d, but target has flen %d"),
   abi_features.flen, features.flen);

I'm reading that as the qemu configuration doesn't support the floating point
width required for 64-bit riscv.

In one of my test directories, I had different qemu's for 32-bit and 64-bit
riscv. Do you? Maybe that makes a difference.

Yes, I used the 32 bit version for riscv. I used the following qemu line:
qemu-system-riscv32 -nographic -machine virt -m 2G -nographic -net none -serial mon:stdio -bios /tmp/riscv/ticker.exe -s -S

I also have a
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.

Best regards,

    Jan


--joel

Best regards,

    Jan

> -----Original Message-----
> From: users <users-bounces at rtems.org<mailto:users-bounces at rtems.org>> On Behalf Of Jan.Sommer at dlr.de<mailto:Jan.Sommer at dlr.de>
> Sent: Friday, January 29, 2021 3:10 PM
> To: joel at rtems.org<mailto:joel at rtems.org>; jiri at gaisler.se<mailto:jiri at gaisler.se>
> Cc: users at rtems.org<mailto:users at rtems.org>
> Subject: RE: riscv: gdb cannot connect to rtems runnin in qemu
>
>
>
> > From: Joel Sherrill <joel at rtems.org<mailto:joel at rtems.org>>
> >
> >On Fri, Jan 29, 2021 at 7:20 AM <Jan.Sommer at dlr.de<mailto:Jan.Sommer at dlr.de>> wrote:
> >> Hello
> >>
> >> I just tried to debug a riscv test program running in qemu.
> >> However, gdb could not establish a connection to qemu and produced the
> following error:
> >> /tmp/rtems/riscv❯ riscv-rtems6-gdb ticker.exe GNU gdb (GDB)
> >> 10.1.90.20210125-git [..]
> >>
> >> For help, type "help".
> >> Type "apropos word" to search for commands related to "word"...
> >> Reading symbols from
> /tools/modulesystem/tools/rtems/rtems6/install/bsps/riscv-
> rtems6/grv32imafdc-smp/testsuites/samples/ticker.exe...
> >> (gdb) target remote :1234
> >> Remote debugging using :1234
> >> bfd requires flen 8, but target has flen 4
> >
> > griscv are Jiri's BSPs and should run on sis and be able to be debugged that
> way.
> >
> > He should know if they worked on qemu and he was able to connect gdb.
> >
>
> Sorry for the confusion. Jiri already told me previously that for running on
> qemu I need to use the BSPs without a "g" like rv32imafdc.
> That's what I did for my test application. For testing with ticker.exe I chose
> the wrong directory.
> To clarify, I use the rv32imafdc BSP to run on qemu.
> The application runs fine, but debugging it through the qemu gdb-server
> does not work.
> This does also happen with the ticker.exe of the rv32imafdc BSP.
>
> Best regards,
>
>     Jan
>
> > Otherwise, this looks like a potential mismatch of 32 and 64 bit stuff
> > like gdb wasn't built with both 32 and 64 bit riscv support. Which
> > seems odd to me because it lives in the same repo as binutils and
> > should have a comparable build of binutils.
> >
> >
> >> The tools and rtems are built from master a couple of days ago.
> >> I used the following command line for qemu (v. 4.2.0):
> >> qemu-system-riscv32 -nographic -machine virt -m 2G -nographic -net
> >> none -serial mon:stdio -bios /tmp/riscv/ticker.exe -s -S
> >>
> >> Does anyone have a hint if the problem is with qemu, gdb or rtems?
> >> Without gdb the program runs normally in qemu.
> >>
> >> Best regards,
> >>
> >>     Jan
> >>
> >> Deutsches Zentrum für Luft- und Raumfahrt e. V. (DLR) German
> >> Aerospace Center Institute for Software Technology | Software for
> >> Space Systems and Interactive Visualization | Lilienthalplatz 7 |
> >> 38108 Braunschweig | Germany
> >>
> >> Jan Sommer
> >
> > _______________________________________________
> users mailing list
> users at rtems.org<mailto:users at rtems.org>
> http://lists.rtems.org/mailman/listinfo/users
>
> _______________________________________________
> users mailing list
> users at rtems.org<mailto:users at rtems.org>
> http://lists.rtems.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20210129/99d29051/attachment-0001.html>


More information about the users mailing list