The purpose of this application is to allow easy manipulation of the QSPI file system from a PC
Dependencies: EALib USBDevice mbed
The purpose of this application is to allow easy manipulation of the QSPI file system from a PC.
The application makes the LPC4088 QuickStart Board appear as a USB Memory Stick when connected to a PC. The PC will see the current content of the QSPI file system plus an image file of the file system that can be downloaded and (at a later time) be used to restore the file system to it's current state.
To use this application:
- Make sure that the QSPI file system has been formatted (using either the app_qspi_format application or one of the erase.* images).
- Download the app_qspifs_memstick application using drag-n-drop and then reset the board
- Optionally start a terminal program to read the status messages from the application
- Connect a USB cable to the micro USB slot on the back of the LPC4088 QuickStart Board, underneath the ethernet connector, and then to the PC
- The PC will install drivers if needed and then the USB Memory Stick will be available as a new drive
- Modify the file system to suit your needs
- With the USB cable still connected, press the button on the LPC4088 QuickStart Board
- The application will now:
- disconnect the USB Memory Stick
- write all changes to the QSPI flash memory
- create a new image file of the updated QSPI file system and store it in the .current/ folder
- connect the USB Memory Stick again
- Continue from step 6. until satisfied
Note 1: The file system that is exposed is a copy (in SDRAM) of the QSPI file system. The reason for this is that the USBMSD class requires a FAT file system.
Note 2: The image files created in step 8.3 above will be a *.fsX file (where the 'X' is the size of the file system in MB so *.fs1 for a 1MByte file system). The *.fsX file extensions are recognized by the HDK and can be used to drag-n-drop to the MBED drive in the same way as the *.bin files are. A *.fsX file will not overwrite the program stored in internal flash.
Diff: RAMFileSystem.h
- Revision:
- 0:bd0d999bb6fb
- Child:
- 2:5a954ee65b33
diff -r 000000000000 -r bd0d999bb6fb RAMFileSystem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RAMFileSystem.h Thu Sep 26 09:21:11 2013 +0000 @@ -0,0 +1,53 @@ +#ifndef RAMFILESYSTEM_H +#define RAMFILESYSTEM_H + +#include "mbed.h" +#include "FATFileSystem.h" +#include "sdram.h" +#include <stdint.h> + +/** Creates a FAT file system in SDRAM + * + * @code + * #include "mbed.h" + * #include "RAMFileSystem.h" + * + * RAMFileSystem ramfs(0xA0000000, 4*1024*1024, "ram"); // 4MB of ram starting at 0xA... + * + * int main() { + * sdram_init(); + * + * FILE *fp = fopen("/ram/myfile.txt", "w"); + * fprintf(fp, "Hello World!\n"); + * fclose(fp); + * } + * @endcode + */ +class RAMFileSystem : public FATFileSystem { +public: + + /** Create the File System in RAM + * + * @param addr Start of memory to use for file system + * @param size Number of bytes to use for file system + * @param name The name used to access the virtual filesystem + */ + RAMFileSystem(uint32_t addr, uint32_t size, const char* name); + virtual int disk_initialize(); + virtual int disk_status(); + virtual int disk_read(uint8_t * buffer, uint64_t sector); + virtual int disk_write(const uint8_t * buffer, uint64_t sector); + virtual int disk_sync(); + virtual uint64_t disk_sectors(); + + uint64_t disk_size(); + +protected: + + uint32_t memStart; + uint32_t memSize; + int status; +}; + +#endif +