![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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.
Revision 2:5a954ee65b33, committed 2014-08-26
- Comitter:
- embeddedartists
- Date:
- Tue Aug 26 06:44:43 2014 +0000
- Parent:
- 1:bbf987874d5f
- Commit message:
- Aligned with the updates in FATFileSystem (i.e. one more parameter in disk_read/disk_write).
Changed in this revision
diff -r bbf987874d5f -r 5a954ee65b33 EALib.lib --- a/EALib.lib Wed Apr 09 10:34:01 2014 +0000 +++ b/EALib.lib Tue Aug 26 06:44:43 2014 +0000 @@ -1,1 +1,1 @@ -https://mbed.org/users/embeddedartists/code/EALib/#d868b74fd08e +https://mbed.org/users/embeddedartists/code/EALib/#eb9809f2ab86
diff -r bbf987874d5f -r 5a954ee65b33 RAMFileSystem.cpp --- a/RAMFileSystem.cpp Wed Apr 09 10:34:01 2014 +0000 +++ b/RAMFileSystem.cpp Tue Aug 26 06:44:43 2014 +0000 @@ -38,6 +38,26 @@ return 0; } +int RAMFileSystem::disk_nwrite(const uint8_t *buffer, uint64_t sector, uint8_t count) { + debug_if(RAMFS_DBG, "write to sector(s) %llu..%llu\n", sector, sector+count); + if ((sector+count-1) >= disk_sectors()) { + return 1; + } + + memcpy((uint8_t*)(memStart + SECTOR_SIZE*((uint32_t)sector)), buffer, SECTOR_SIZE*count); + return 0; +} + +int RAMFileSystem::disk_nread(uint8_t *buffer, uint64_t sector, uint8_t count) { + debug_if(RAMFS_DBG, "read from sector(s) %llu..%llu\n", sector, sector+count); + if ((sector+count-1) >= disk_sectors()) { + return 1; + } + + memcpy(buffer, (uint8_t*)(memStart + SECTOR_SIZE*((uint32_t)sector)), SECTOR_SIZE*count); + return 0; +} + int RAMFileSystem::disk_status() { debug_if(RAMFS_DBG, "disk status %d\n", status); return status;
diff -r bbf987874d5f -r 5a954ee65b33 RAMFileSystem.h --- a/RAMFileSystem.h Wed Apr 09 10:34:01 2014 +0000 +++ b/RAMFileSystem.h Tue Aug 26 06:44:43 2014 +0000 @@ -41,6 +41,8 @@ virtual uint64_t disk_sectors(); uint64_t disk_size(); + int disk_nread(uint8_t * buffer, uint64_t sector, uint8_t count); + int disk_nwrite(const uint8_t * buffer, uint64_t sector, uint8_t count); protected:
diff -r bbf987874d5f -r 5a954ee65b33 USBDevice.lib --- a/USBDevice.lib Wed Apr 09 10:34:01 2014 +0000 +++ b/USBDevice.lib Tue Aug 26 06:44:43 2014 +0000 @@ -1,1 +1,1 @@ -https://mbed.org/users/mbed_official/code/USBDevice/#5b7d31d9d3f3 +https://mbed.org/users/mbed_official/code/USBDevice/#5bf05f9b3c7b
diff -r bbf987874d5f -r 5a954ee65b33 USBMSD_RAMFS.cpp --- a/USBMSD_RAMFS.cpp Wed Apr 09 10:34:01 2014 +0000 +++ b/USBMSD_RAMFS.cpp Tue Aug 26 06:44:43 2014 +0000 @@ -6,14 +6,14 @@ this->ramfs = ramfs; } -int USBMSD_RAMFS::disk_read(uint8_t * data, uint64_t block) +int USBMSD_RAMFS::disk_read(uint8_t * data, uint64_t block, uint8_t count) { - return ramfs->disk_read(data, block); + return ramfs->disk_nread(data, block, count); } -int USBMSD_RAMFS::disk_write(const uint8_t * data, uint64_t block) +int USBMSD_RAMFS::disk_write(const uint8_t * data, uint64_t block, uint8_t count) { - return ramfs->disk_write(data, block); + return ramfs->disk_nwrite(data, block, count); } int USBMSD_RAMFS::disk_initialize() {
diff -r bbf987874d5f -r 5a954ee65b33 USBMSD_RAMFS.h --- a/USBMSD_RAMFS.h Wed Apr 09 10:34:01 2014 +0000 +++ b/USBMSD_RAMFS.h Tue Aug 26 06:44:43 2014 +0000 @@ -25,22 +25,24 @@ protected: /* - * read a block on a storage chip + * read one or more blocks on a storage chip * * @param data pointer where will be stored read data - * @param block block number + * @param block starting block number + * @param count number of blocks to read * @returns 0 if successful */ - virtual int disk_read(uint8_t * data, uint64_t block); + virtual int disk_read(uint8_t* data, uint64_t block, uint8_t count); /* - * write a block on a storage chip + * write one or more blocks on a storage chip * * @param data data to write - * @param block block number + * @param block starting block number + * @param count number of blocks to write * @returns 0 if successful */ - virtual int disk_write(const uint8_t * data, uint64_t block); + virtual int disk_write(const uint8_t* data, uint64_t block, uint8_t count); /* * Disk initilization
diff -r bbf987874d5f -r 5a954ee65b33 mbed.bld --- a/mbed.bld Wed Apr 09 10:34:01 2014 +0000 +++ b/mbed.bld Tue Aug 26 06:44:43 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/6473597d706e \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013 \ No newline at end of file