Remote connection closed

I executed a C program that converts an RGB image to grescale image.
Then, I wanna obtain the created greyscale image by using this command: dump value GreyImage.dat GreyImage
BUT I got the error info:
dropped ‘gdb’ connection
Remote connection closed
Remote connection closed (from interpreter-exec console “dump value GreyImage.dat GreyImage”)

OS: Mac OS Big Sur
Board: Digilent Nexys A7

Any answer would be appreciated!

Full platformio.ini? Do you first start a debugging session, put a breakpoint after the computation of GreyImage and then issue the GDB dump command (here)?

Yeah, I set while(1); at the end of the main function.
I issued the command: dump value GreyImage.dat GreyImage with the same error info as above.

When the breakpoint is hit, what does info registers and help dump return?

Sorry, I’m a novice, so I didn’t quite understand what does “info registers and help dump return” mean. Could you explain it in more detail? Thanks!

You set a breakpoint at the end of the computation. You start debugging mode (Debug → Start debugging). Debugging starts and at some point later the breakpoint is hit and the processor is stopped. You go into the “Debug Console” where you can enter GDB commands. Just like you tried executing dump value GreyImage.dat GreyImage in that console and got an error, I want you to try the commands info registers and help dump to see if GDB is generally working.

Understood. These two commands returned registers’ value and usage of dump rerspectively.
It seems GDB works.

What does x/10x GreyImage and print GreyImage return?

x/10x GreyImage returned:
0x4a7f8 : 0xbcc09bb6 0xb3a4bfb5 0xacaeb8bf 0xb7b6b3ae

0x4a808 <GreyImage+16>: 0xc2c1b1b8 0xb6b1c1c3 0xcabbbfbe 0xbccabeae

0x4a818 <GreyImage+32>: 0xc2c0b6b4 0xa3bec6bf

print GreyImage returned:
Info : dropped ‘gdb’ connection

Remote connection closed

Remote connection closed (from interpreter-exec console “print GreyImage”)

The same error as above…


Seems like either GDB or the thing answering GDB has a bug and aborts the connection. An issue should be opened about that.

Well if the print and dump command does not work but the examine (x) command does work, the only alternative I see is printing a hex dump of the GreyImage object and re-convert that to binary data. You should know the compile-time constant size of GreyImage (e.g., 1000 bytes), so you can use something like

set logging file /home/<user>/image_dump.txt
set logging on
x/1000bx GreyImage
set logging off

To start logging in a file, examine 1000 bytes in hex form (x/1000bx), which should then get saved in a file.

You can then e.g. use a reverse-hexdump like Hex to file (binary) converter to get the binary data (might need cleanup with using the search regex [0-9a-f]{2} and the list regex 0x$& to get the clean hex bytes).

The full configuration file platformio.ini is as follows:
platform = chipsalliance
board = swervolf_nexys
framework = wd-riscv-sdk

monitor_speed = 115200

#debug_tool = whisper

board_build.bitstream_file = /Users/lee_king/Downloads/RVfpga/src/rvfpga.bit

And I executed the four commands as you suggested with the following output:
39^error,msg=“Invalid thread id: 1”
~“0x4a7f8 :\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\n”
~“0x4a800 <GreyImage+8>:\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\n”
~“0x4a808 <GreyImage+16>:\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\n”
~“0x4a810 <GreyImage+24>:\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\n”
~“0x4a818 <GreyImage+32>:\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\n”
~“0x4a820 <GreyImage+40>:\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\n”
~“0x4a828 <GreyImage+48>:\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\t0x00\n”

41^error,msg=“Invalid thread id: 1”

Something wrong? Hmmm…

Thanks, this issue is now tracked in GDB crashes on "dump" and "print" command · Issue #7 · platformio/platform-chipsalliance · GitHub.

I don’t know about that error, and also the contents of the image are now all 0x00. Are you sure the breakpoint hit properly after the data was computed? Previously it was fine with

Maybe you used the wrong length in the x/ command.

Thanks! I’m sure the breakpoint hit properly after the data was computed:
// Transform Colour Image to Grey Image

// Initialize Uart
// Print message on the serial output
printfNexys("Created Grey Image");


return 0;

The contents of the image are now all 0x00, so the created greyscale image just a black image. Anyway, what correct length in the x/? command should I use? :slightly_smiling_face:

Yes and that can’t be correct, since previously you had non-zero content in there.

You have to know the byte size of the GreyImage object, it’s likely a one or two-dimensional array of bytes defined somewhere in the code, lookup the definition in code and you should see the size of it.

Or if you have serial output available, use printf("sizeof(GreyImage) = %d\n", (int) sizeof(GreyImage)); to print it out.

The command sizeof(GreyImage) returned 16384, so I executed the command: x/16384bx GreyImage.
And the logging values are:
~“0x56818 :\t0xb6\t0x9b\t0xc0\t0xbc\t0xb5\t0xbf\t0xa4\t0xb3\n”
~“0x56820 <GreyImage+8>:\t0xbf\t0xb8\t0xae\t0xac\t0xae\t0xb3\t0xb6\t0xb7\n”
~“0x56828 <GreyImage+16>:\t0xb8\t0xb1\t0xc1\t0xc2\t0xc3\t0xc1\t0xb1\t0xb6\n”
~“0x56830 <GreyImage+24>:\t0xbe\t0xbf\t0xbb\t0xca\t0xae\t0xbe\t0xca\t0xbc\n”
~“0x56838 <GreyImage+32>:\t0xb4\t0xb6\t0xc0\t0xc2\t0xbf\t0xc6\t0xbe\t0xa3\n”
~“0x56840 <GreyImage+40>:\t0xc1\t0xb2\t0xa7\t0xbd\t0xbe\t0xaf\t0xb7\t0xaf\n”
~“0x56848 <GreyImage+48>:\t0xc7\t0xb0\t0xb2\t0xae\t0xaa\t0xb7\t0xa1\t0x94\n”
~“0x56850 <GreyImage+56>:\t0xac\t0xa7\t0xa6\t0x9e\t0x9a\t0xaa\t0xb4\t0xa9\n”
~“0x56858 <GreyImage+64>:\t0xb8\t0xc6\t0xc8\t0xbc\t0xbe\t0xd4\t0xd7\t0xc5\n”
~“0x56860 <GreyImage+72>:\t0xc7\t0xd9\t0xac\t0xb0\t0xa8\t0xb6\t0xb7\t0xab\n”
~“0x56868 <GreyImage+80>:\t0xb1\t0x98\t0xa2\t0x98\t0xb4\t0xc2\t0x98\t0xb7\n”
~“0x56870 <GreyImage+88>:\t0xcc\t0xd1\t0xb3\t0xa2\t0xba\t0xbc\t0xb9\t0xd1\n”

It seems that it works normally.

Yes, looks good. Now you can parse those values out and convert them to a real image.

Can you upload the whole output for GreyImage from the log file as a reference?

The content of the file image_dump.txt is a bit long… I cannot upload .txt files, so should I paste the whole content of this file?

You can use or google drive etc.

Hi, please refer to this

Is this your image?


256 by 64 pixels (to get 16384 bytes), 8 bits per pixel?