[fs][dartuino][spifs] Attempt to mount the FS on init.

This commit is contained in:
Gurjant Kalsi
2015-12-16 16:23:45 -08:00
parent 7b453164dd
commit 4cc202589c
2 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
#define SPIFS_MOUNT_POINT "/spifs"
#define SPIFS_NAME "spifs"
#define SPIFS_TARGET_DEVICE "qspi-flash"

View File

@@ -43,6 +43,11 @@
#include <lib/minip.h>
#endif
#if WITH_LIB_FS_SPIFS
#include <lib/fs.h>
#include <target/fsconfig.h>
#endif
extern void target_usb_setup(void);
const sdram_config_t target_sdram_config = {
@@ -136,6 +141,17 @@ void target_init(void)
minip_init(stm32_eth_send_minip_pkt, NULL, ip_addr, ip_mask, ip_gateway);
#endif
#if WITH_LIB_FS_SPIFS
status_t mount_success =
fs_mount(SPIFS_MOUNT_POINT, SPIFS_NAME, SPIFS_TARGET_DEVICE);
if (mount_success != NO_ERROR) {
printf("failed to mount '%s' at path '%s' on '%s'."
" Make sure that device is formatted\n",
SPIFS_NAME, SPIFS_MOUNT_POINT, SPIFS_TARGET_DEVICE);
}
#endif
// start usb
target_usb_setup();
}