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.
crc.cpp@0:bd0d999bb6fb, 2013-09-26 (annotated)
- Committer:
- embeddedartists
- Date:
- Thu Sep 26 09:21:11 2013 +0000
- Revision:
- 0:bd0d999bb6fb
First version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:bd0d999bb6fb | 1 | /***************************************************************************** |
embeddedartists | 0:bd0d999bb6fb | 2 | * |
embeddedartists | 0:bd0d999bb6fb | 3 | * Copyright(C) 2011, Embedded Artists AB |
embeddedartists | 0:bd0d999bb6fb | 4 | * All rights reserved. |
embeddedartists | 0:bd0d999bb6fb | 5 | * |
embeddedartists | 0:bd0d999bb6fb | 6 | ****************************************************************************** |
embeddedartists | 0:bd0d999bb6fb | 7 | * Software that is described herein is for illustrative purposes only |
embeddedartists | 0:bd0d999bb6fb | 8 | * which provides customers with programming information regarding the |
embeddedartists | 0:bd0d999bb6fb | 9 | * products. This software is supplied "AS IS" without any warranties. |
embeddedartists | 0:bd0d999bb6fb | 10 | * Embedded Artists AB assumes no responsibility or liability for the |
embeddedartists | 0:bd0d999bb6fb | 11 | * use of the software, conveys no license or title under any patent, |
embeddedartists | 0:bd0d999bb6fb | 12 | * copyright, or mask work right to the product. Embedded Artists AB |
embeddedartists | 0:bd0d999bb6fb | 13 | * reserves the right to make changes in the software without |
embeddedartists | 0:bd0d999bb6fb | 14 | * notification. Embedded Artists AB also make no representation or |
embeddedartists | 0:bd0d999bb6fb | 15 | * warranty that such application will be suitable for the specified |
embeddedartists | 0:bd0d999bb6fb | 16 | * use without further testing or modification. |
embeddedartists | 0:bd0d999bb6fb | 17 | *****************************************************************************/ |
embeddedartists | 0:bd0d999bb6fb | 18 | |
embeddedartists | 0:bd0d999bb6fb | 19 | |
embeddedartists | 0:bd0d999bb6fb | 20 | |
embeddedartists | 0:bd0d999bb6fb | 21 | /****************************************************************************** |
embeddedartists | 0:bd0d999bb6fb | 22 | * Includes |
embeddedartists | 0:bd0d999bb6fb | 23 | *****************************************************************************/ |
embeddedartists | 0:bd0d999bb6fb | 24 | |
embeddedartists | 0:bd0d999bb6fb | 25 | #include "mbed.h" |
embeddedartists | 0:bd0d999bb6fb | 26 | #include "crc.h" |
embeddedartists | 0:bd0d999bb6fb | 27 | |
embeddedartists | 0:bd0d999bb6fb | 28 | |
embeddedartists | 0:bd0d999bb6fb | 29 | /****************************************************************************** |
embeddedartists | 0:bd0d999bb6fb | 30 | * Defines and typedefs |
embeddedartists | 0:bd0d999bb6fb | 31 | *****************************************************************************/ |
embeddedartists | 0:bd0d999bb6fb | 32 | |
embeddedartists | 0:bd0d999bb6fb | 33 | #define NUM_CRC_BUFF_ENTRIES (100) |
embeddedartists | 0:bd0d999bb6fb | 34 | |
embeddedartists | 0:bd0d999bb6fb | 35 | #define CRC32_INIT() do { LPC_CRC->MODE = 0x00000036; LPC_CRC->SEED = 0xffffffff; } while(0) |
embeddedartists | 0:bd0d999bb6fb | 36 | |
embeddedartists | 0:bd0d999bb6fb | 37 | #define CRC32_WRITE8(__val) LPC_CRC->WR_DATA_BYTE.DATA = (uint8_t)(__val) |
embeddedartists | 0:bd0d999bb6fb | 38 | #define CRC32_WRITE16(__val) LPC_CRC->WR_DATA_WORD.DATA = (uint16_t)(__val) |
embeddedartists | 0:bd0d999bb6fb | 39 | #define CRC32_WRITE32(__val) LPC_CRC->WR_DATA_DWORD.DATA = (__val) |
embeddedartists | 0:bd0d999bb6fb | 40 | |
embeddedartists | 0:bd0d999bb6fb | 41 | #define CRC32_SUM() LPC_CRC->SUM |
embeddedartists | 0:bd0d999bb6fb | 42 | |
embeddedartists | 0:bd0d999bb6fb | 43 | /****************************************************************************** |
embeddedartists | 0:bd0d999bb6fb | 44 | * External global variables |
embeddedartists | 0:bd0d999bb6fb | 45 | *****************************************************************************/ |
embeddedartists | 0:bd0d999bb6fb | 46 | |
embeddedartists | 0:bd0d999bb6fb | 47 | /****************************************************************************** |
embeddedartists | 0:bd0d999bb6fb | 48 | * Local variables |
embeddedartists | 0:bd0d999bb6fb | 49 | *****************************************************************************/ |
embeddedartists | 0:bd0d999bb6fb | 50 | |
embeddedartists | 0:bd0d999bb6fb | 51 | static uint32_t crcbuff[NUM_CRC_BUFF_ENTRIES]; |
embeddedartists | 0:bd0d999bb6fb | 52 | |
embeddedartists | 0:bd0d999bb6fb | 53 | /****************************************************************************** |
embeddedartists | 0:bd0d999bb6fb | 54 | * Local Functions |
embeddedartists | 0:bd0d999bb6fb | 55 | *****************************************************************************/ |
embeddedartists | 0:bd0d999bb6fb | 56 | |
embeddedartists | 0:bd0d999bb6fb | 57 | |
embeddedartists | 0:bd0d999bb6fb | 58 | /****************************************************************************** |
embeddedartists | 0:bd0d999bb6fb | 59 | * Public Functions |
embeddedartists | 0:bd0d999bb6fb | 60 | *****************************************************************************/ |
embeddedartists | 0:bd0d999bb6fb | 61 | |
embeddedartists | 0:bd0d999bb6fb | 62 | uint32_t crc_Read(FILE* f) |
embeddedartists | 0:bd0d999bb6fb | 63 | { |
embeddedartists | 0:bd0d999bb6fb | 64 | CRC32_INIT(); |
embeddedartists | 0:bd0d999bb6fb | 65 | fseek(f, 0, SEEK_SET); |
embeddedartists | 0:bd0d999bb6fb | 66 | memset(crcbuff, 0, sizeof(uint32_t)*NUM_CRC_BUFF_ENTRIES); |
embeddedartists | 0:bd0d999bb6fb | 67 | int numRead = fread(crcbuff, sizeof(uint32_t), 100, f); |
embeddedartists | 0:bd0d999bb6fb | 68 | while (numRead > 0) { |
embeddedartists | 0:bd0d999bb6fb | 69 | for (int i = 0; i < numRead; i++) { |
embeddedartists | 0:bd0d999bb6fb | 70 | CRC32_WRITE32(crcbuff[i]); |
embeddedartists | 0:bd0d999bb6fb | 71 | } |
embeddedartists | 0:bd0d999bb6fb | 72 | numRead = fread(crcbuff, sizeof(uint32_t), 100, f); |
embeddedartists | 0:bd0d999bb6fb | 73 | } |
embeddedartists | 0:bd0d999bb6fb | 74 | return CRC32_SUM(); |
embeddedartists | 0:bd0d999bb6fb | 75 | } |
embeddedartists | 0:bd0d999bb6fb | 76 |