From 172d281e84c6f095ea642e925424104aeec60702 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 14 Nov 2017 10:34:18 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10995 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../multi/QSPI-MFS/Makefile-stm32l476_discovery | 2 +- testhal/STM32/multi/QSPI-MFS/main.c | 26 +++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'testhal/STM32') 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. -- cgit v1.2.3