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”)
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)?
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.
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 https://regexr.com/ 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:
[env:swervolf_nexys]
platform = chipsalliance
board = swervolf_nexys
framework = wd-riscv-sdk
And I executed the four commands as you suggested with the following output:
38^done
(gdb)
39^error,msg=“Invalid thread id: 1”
(gdb)
~“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”
…
40^done
(gdb)
41^error,msg=“Invalid thread id: 1”
(gdb)
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
ColourToGrey(ColourImage,GreyImage);
// Initialize Uart
uartInit();
// Print message on the serial output
printfNexys("Created Grey Image");
while(1);
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?
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.