This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How can I include files in DS80C400

Dear all,

I have seen in the 'Initializing the File System' paragraph of the application note of the DS80C400 (http://www.maxim-ic.com/appnotes.cfm/appnote_number/613) that one can include files into it by including the text of these files in the code data of the program, and then write the file data to the file system on startup. Since I still do not understand how to do that, could anyone please more specify or point me to the answer?

Best regards,

Apichan Kanjanavapastit

Parents
  • Caveat: I don't use this processor and am not particularly familiar with their implementation.

    The example appears to use standard C I/O functions (fopen(), fwrite(), etc) for the file system. So, if you want to do as that line suggests, you hardwire a big chunk of data into your program. In C, it would look something like:

    U8 file1data[] =
    {
    0x41, 0x42, 0x43, 0x44, 0x45
    };

    U16 file1size = 5;

    Here, I've encoded a 5-byte text file that happens to contain "ABCDE". In practice, you'd probably write a little tool that takes a given file, converts it to C syntax, and spits out this kind of structure definition.

    Once you have that, you can write the embedded data to the file with fwrite().

    fwrite (file1data, 1, file1size, myFile);

Reply
  • Caveat: I don't use this processor and am not particularly familiar with their implementation.

    The example appears to use standard C I/O functions (fopen(), fwrite(), etc) for the file system. So, if you want to do as that line suggests, you hardwire a big chunk of data into your program. In C, it would look something like:

    U8 file1data[] =
    {
    0x41, 0x42, 0x43, 0x44, 0x45
    };

    U16 file1size = 5;

    Here, I've encoded a 5-byte text file that happens to contain "ABCDE". In practice, you'd probably write a little tool that takes a given file, converts it to C syntax, and spits out this kind of structure definition.

    Once you have that, you can write the embedded data to the file with fwrite().

    fwrite (file1data, 1, file1size, myFile);

Children
No data