Create ramdisk for FileX access

Hi all,

I already posted a topic on the use of a webserver but I prefer create a new topic for this problem.

I downloaded and imported the demo available at Renesas Project Synergy ™ USBX ™ Mass Storage Class (Host) in e²studio but when I want to go into debug mode I get the message:

Exception occured during launch.

Reason: Program files does not exist.

So I can not test this program or use it.

Actually, I need to go get some files, but these files are slightly larger (a few kb), I would store them directly into the uP without having to use a USB key every time.

So my question is, how to create a ramdisk and how do I store files in the ramdisk please? (Knowing that the files are on my PC initially)
Once stored files, the goal is to go play with FileX.

EDIT: I work on SK-S7G2

  • I think I have managed to create the ramdisk, with this code:

    UCHAR                   ram_disk_memory[1024 * 32];
    UCHAR                   ram_disk_sector_cache[512];
    FX_MEDIA                ram_disk_media;
    extern VOID    _fx_ram_driver(FX_MEDIA *media_ptr);

        status = fx_media_format(&ram_disk_media,
                              _fx_ram_driver,                  /* Driver entry             */
                              ram_disk_memory,                 /* RAM disk memory pointer  */
                              ram_disk_sector_cache,           /* Media buffer pointer     */
                              sizeof(ram_disk_sector_cache),   /* Media buffer size        */
                              (CHAR*)"MY_RAM_DISK",            /* Volume Name              */
                              1,                               /* Number of FATs           */
                              32,                              /* Directory Entries        */
                              0,                               /* Hidden sectors           */
                              256,                             /* Total sectors            */
                              128,                             /* Sector size              */
                              1,                               /* Sectors per cluster      */
                              1,                               /* Heads                    */
                              1);                              /* Sectors per track        */

      /* Open the RAM disk.  */
      status = fx_media_open(&ram_disk_media, (CHAR*)"RAM DISK", _fx_ram_driver, ram_disk_memory, ram_disk_sector_cache, sizeof(ram_disk_sector_cache));

    this test code works:

      int j=0;
      UCHAR my_buffer[128];

      status = fx_media_write(&ram_disk_media, 2, my_buffer);

    if(status == FX_SUCCESS) thread_0_counter=3;

    My counter shows well the value 3, so I suppose that the contents of my_buffer has been written to the ramdisk. I will now check if the good values were stored with this code:

    UCHAR my_read[128]; //to read

    status = fx_media_read(&ram_disk_media,2,my_read);

    if(status == FX_SUCCESS) thread_0_counter=my_read[30];

    My counter shows well the value 31.

    Could you now tell me how to manage files in a Synergy project please ?

    The goal is to store an index.html file, previously created, in the memory of µP order to go read it directly with FileX.

    Should there be a specific section in memory to store these files?

    Thank you in advance

  • In reply to Alex:

    Have you looked at the NET-X Webserver example? I think it uses some kind of RAM or Flash storage for HTML. I don't remember how they are encoded, but they do end up being translated to structures stored in the memory map. The project files were included in the earlier pre v1.0 SSP release packages.

  • In reply to Calvin Grier:

    The USB mass storage DEVICE example has a ramdisk over FileX instance where one can expose this disk over said USB DEVICE to the host. You can also use onboard eMMC for a non-volatile option (instead of the ramdisk which is volatile). We have been able to do that as well.

  • In reply to Calvin Grier:

    Hi Calvin,

    Thank you for your reply, I have already run the demo NetX webserver and everything works correctly.

    I noticed that HTML tags are encoded in the file demo_nx_http_htmlstrings.h, and every line of code are in the format #define titleline "<HEAD><TITLE>NetX HTTP Server</TITLE></HEAD>\r\n"

    My HTML code is already registered in a index.html file, I would read this file directly with FileX instead of having to rewrite all the code in this format. Also my web page contains CSS for the graphics, and I do not think I can incorporate it into the format used in the demo NetX. Any ideas please ?

    Ashwin, thank you I will try the Renesas Synergy™ Project USBX™ Mass Storage Class (Device) demo tomorrow !

  • In reply to Alex:

    Hi Alex,

    The easiest would be for you to incorporate the data for your files into the code as C arrays.

    This utility seems to do the trick:


  • In reply to Andres:

    Hi Andres, nice thank you ! I will try it tomorrow and come here if I have any problems.

  • In reply to Alex:

    In the Files section I posted a tiny program that does the same as bin2header but with an output format that suits better my needs and, maybe, yours (it's a matter of taste).

  • In reply to Laboratori Elecsan:

    I downloaded your software thank you, I keep it if necessary!

    I now have my index.html file includes and sent to the webserver, but only the text elements are displayed on the web page.

    Then, I converted to an image in the same way as the index.html file and I sent it, this time only the image is displayed.

    In fact the problem is that the HTML file uses a CSS file and several image files (png), but once converted, these "calls" no longer work, no graphic element is sent.

    I could convert my images in hexadecimal format and integrate them directly into the HTML code and convert this .html file to integrate with e²studio but CSS graphics would still not taken into account, and optimizing or code changes would be really poor. Do you have any solutions?

    Thank you in advance

  • In reply to Alex:

    How about using an external tool like this:

  • In reply to Ashwin:

    Hi Alex,

    I do not think this should be a problems. Any file would be served the same way,  no matter if it is HTML, CSS or a picture. The server doesn't care about the contents.

    Updating files shouldn't be a problem, as you can have this bin to c array conversion as part of your build process. You should keep the files in their original formats somewhere in your project and edit them there.


  • In reply to Andres:

    Hi All,
    I wanted to know that whether Ram Disk can be made in SDRAM
  • In reply to Surojit:

    Hi Surojit-
    This is a very old thread. I believe it would be best to start a new one.