This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I am trying to read and write into files on my PC from the DSP Target (C6455) via JTAG using fopen, fread and fwrite function calls. I am able to open a new file on the host PC from the target but the fread and fwrite function calls are failing. They are just returning zeros. I am using DSP BIOS
Here is my code:
void openWriteInfoFile(void)
{
FILE *fp;
Int32 retVal, numCmds, currCmdLen;
fp = fopen("hello.bin", "rb");
retVal = fread(&numCmds, 4, 1, fp);
retVal = fread(&currCmdLen, 4, 1, fp);
fclose(fp);
}
I have even added 0x10000 bytes of heap in my DDR. It works some times but fails most of the time.
Thanks,
Vish
I built the attached project that was able to successfully create a hello.bin file and then to read that hello.bin file. Please give it a try to see if the exact same thing will work for you that worked for me. I will have to caution you that I was not able to get a DSK6455 so I ran this on a DM642 which is what I had at my fingertips. But the project rebuilt for your platform should still be a working example.
I seem to recall that the fclose() might not "take" until the program has run to completion. Hopefully it does not require CCS to close, too, but it did not require that for me. I did run past the end of main() each time, though.
I would recommend first stepping through the openReadInfoFile() function to see if it can read my hello.bin correctly.
Then change the comments in main() to make it write and change the init values in openWriteInfoFile() so it will put new values into the hello.bin file.
Then change the comments in main() back to run the read function.
Please let us know how this works out for you.