Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

romFS or read-only RAM/ROM disk

Posted by rasty1 on July 25, 2016

Hi, I'm curious if someone tried (or can suggest any tool or ide) to create an image of RAM/ROM-disk that can be mounted by freeRTOS fs. I'd like to create a disk image with files (for Web server) on my host and statically link it to application code.

Thanks Rasty


romFS or read-only RAM/ROM disk

Posted by rtel on July 25, 2016

FreeRTOS+FAT is a standard FAT file system, so any FAT image should work. However I use a simpler approach whereby I create C structures from the files I want on the disk, then during initialisation just copy those structures onto the disk. You can see this being done in the Win32 demo, where a RAM disk is created then the files from the FreeRTOS-PlusDemoCommonFreeRTOSPlusTCP_DemosincludeDefaultWebPages.h header file are copied onto the RAM disk. The bottom of the header file has the following structure that describes the files being copied.

const xFileToCopy_t xHTTPFilesToCopy[] =
{
	{ "freertos.html", sizeof( pcFreeRTOS_HTML_Data ), pcFreeRTOS_HTML_Data },
	{ "logo.jpg", sizeof( pcLogo_JPG_Data ), pcLogo_JPG_Data },
	{ "ftp.png", sizeof( pcFTP_PNG_Data ), pcFTP_PNG_Data }
};

I use a hex editor (hexedit) to create the structures - you just open the file in the editor, copy it to the clipboard, then save the clipboard as a C structure (which is one of the save options). It is just a byte for byte copy so I'm sure you could create a very simple script to do the same thing and thus have it automated.

Attachments

alternate (1777 bytes)

romFS or read-only RAM/ROM disk

Posted by rasty1 on July 25, 2016

Hi, I see what you do in demo, that is nice, but requires RAM disk and Flash - 2 times more memory. Plus I'm not able to make a small RAM-disk (separate thread). Under linux I'd create a virtual device, copy all files and dd'd it to a file, which can be converted to initilized C-array. Above metioned can be done in script. At run-time I'd just mount file system (RAM-disk) to that array. Unfortunately we work with Windows and I did not discover yet how to do the same.

Attachments

alternate (1046 bytes)

romFS or read-only RAM/ROM disk

Posted by rasty1 on July 30, 2016

Hi I found how to make an image of disk. Is there any example how to mount file system to something like: const char romfs[]={ 0xeb,0x3c,0x90,0x4d,0x53,0x44,0x4f,0x53,0x35,0x2e,0x30,0x00,0x02,0x01,0x06,0x00,0x02,0x00,0x02,0xc3,0x00,0xf8,0x01,0x00,0x3f,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x80,0x00,0x29,0x12..

Thanks Rasty


romFS or read-only RAM/ROM disk

Posted by rtel on July 30, 2016

This is not something I have every attempted to do, but presumably if you have suitable read and write functions, which no doubt would be very similar to the RAM disk read and write functions (which just see the disk as an array of bytes), then you could mount it in a very similar way to the RAM disk.


romFS or read-only RAM/ROM disk

Posted by rasty1 on August 2, 2016

it works. imdisk.exe -a -s 102400 -m a: -p "/fs:fat /q /y" -f romfs.img bin2h.exe -cimage_size romfs < romfs.img > romfs.c

Used RAM disk code without "format", probably need to put NULL into fnWriteBlocks in order to make it truely read-only. Tested 100Kb FAT12.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS