Example showing how to create a file system on the QSPI flash.

Dependencies:   EALib mbed

The app_qspi_memstick application cannot create a QSPI file system - it can only modify an existing one. This application will create a file system for you. Modify the application by changing DESIRED_SIZE_IN_MB to get the desired size of the file system, compile it, download and run to format the QSPI FLASH.

main.cpp

Committer:
embeddedartists
Date:
2014-08-26
Revision:
2:03417cea6ccc
Parent:
0:52d05cabc12f

File content as of revision 2:03417cea6ccc:


/******************************************************************************
 * Includes
 *****************************************************************************/

#include "mbed.h"

#include "QSPIFileSystem.h"

/******************************************************************************
 * Typedefs and defines
 *****************************************************************************/

#define DESIRED_SIZE_IN_MB  (8)

/******************************************************************************
 * Local variables
 *****************************************************************************/

QSPIFileSystem qspifs("qspi");

/******************************************************************************
 * Local functions
 *****************************************************************************/

/******************************************************************************
 * Main function
 *****************************************************************************/

int main() {

    printf("\nQSPI FS formatter\n");
    printf("Will format QSPI as %d MB file system\n", DESIRED_SIZE_IN_MB);

    int err = qspifs.format(DESIRED_SIZE_IN_MB);  
    if (err == 0) {
        printf("Successfully formatted!\n");
    } else {
        printf("Failed to format. Got error %d\n", err);
    }
}