aboutsummaryrefslogtreecommitdiffstats
path: root/testhal
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-11-14 10:34:18 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-11-14 10:34:18 +0000
commit172d281e84c6f095ea642e925424104aeec60702 (patch)
treecf230e178e03dbaa6e6a03d15c90589bbab670ae /testhal
parentad0e734267fad9e103c86b42e2b19773c56f83b1 (diff)
downloadChibiOS-172d281e84c6f095ea642e925424104aeec60702.tar.gz
ChibiOS-172d281e84c6f095ea642e925424104aeec60702.tar.bz2
ChibiOS-172d281e84c6f095ea642e925424104aeec60702.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10995 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal')
-rw-r--r--testhal/STM32/multi/QSPI-MFS/Makefile-stm32l476_discovery2
-rw-r--r--testhal/STM32/multi/QSPI-MFS/main.c26
2 files changed, 24 insertions, 4 deletions
diff --git a/testhal/STM32/multi/QSPI-MFS/Makefile-stm32l476_discovery b/testhal/STM32/multi/QSPI-MFS/Makefile-stm32l476_discovery
index 844f08137..b01d07514 100644
--- a/testhal/STM32/multi/QSPI-MFS/Makefile-stm32l476_discovery
+++ b/testhal/STM32/multi/QSPI-MFS/Makefile-stm32l476_discovery
@@ -5,7 +5,7 @@
# Compiler options here.
ifeq ($(USE_OPT),)
- USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
+ USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16
endif
# C specific options here (added to USE_OPT).
diff --git a/testhal/STM32/multi/QSPI-MFS/main.c b/testhal/STM32/multi/QSPI-MFS/main.c
index 623916957..c3c84a30a 100644
--- a/testhal/STM32/multi/QSPI-MFS/main.c
+++ b/testhal/STM32/multi/QSPI-MFS/main.c
@@ -20,6 +20,7 @@
#include "hal.h"
#include "m25q.h"
+#include "mfs.h"
/* 16MB device, 2 cycles delay after NCS.*/
const QSPIConfig qspicfg1 = {
@@ -60,6 +61,17 @@ const M25QConfig m25qcfg1 = {
&qspicfg1
};
+MFSDriver mfs;
+
+const MFSConfig mfscfg1 = {
+ (BaseFlash *)&m25q,
+ 0xFFFFFFFFU,
+ 131072U,
+ 0,
+ 2,
+ 2,
+ 2
+};
/*
* LED blinker thread, times are in milliseconds.
*/
@@ -103,17 +115,24 @@ int main(void) {
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO + 1, Thread1, NULL);
- /*
- * Initializing and starting M25Q driver.
- */
+ /* Initializing and starting M25Q driver.*/
m25qObjectInit(&m25q);
m25qStart(&m25q, &m25qcfg1);
+ /* Mounting the MFS volume defined in the configuration.*/
+ mfsObjectInit(&mfs);
+ mfsStart(&mfs, &mfscfg1);
+ mfsMount(&mfs);
+
/* Reading.*/
err = flashRead(&m25q, 0, 128, buffer);
if (err != FLASH_NO_ERROR)
chSysHalt("read error");
+ mfsUnmount(&mfs);
+ mfsErase(&mfs);
+
+#if 0
/* Erasing the first sector and waiting for completion.*/
(void) flashStartEraseSector(&m25q, 0);
err = flashWaitErase((BaseFlash *)&m25q);
@@ -158,6 +177,7 @@ int main(void) {
err = flashWaitErase((BaseFlash *)&m25q);
if (err != FLASH_NO_ERROR)
chSysHalt("erase error");
+#endif
/*
* Normal main() thread activity, in this demo it does nothing.