aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32')
-rw-r--r--testhal/STM32/multi/QSPI-MFS/.project5
-rw-r--r--testhal/STM32/multi/QSPI-MFS/Makefile-stm32l476_discovery2
-rw-r--r--testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/halconf.h2
-rw-r--r--testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/portab.c10
-rw-r--r--testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/portab.h4
-rw-r--r--testhal/STM32/multi/QSPI-MFS/main.c45
6 files changed, 38 insertions, 30 deletions
diff --git a/testhal/STM32/multi/QSPI-MFS/.project b/testhal/STM32/multi/QSPI-MFS/.project
index 378900979..f3561b950 100644
--- a/testhal/STM32/multi/QSPI-MFS/.project
+++ b/testhal/STM32/multi/QSPI-MFS/.project
@@ -81,5 +81,10 @@
<type>2</type>
<locationURI>CHIBIOS/os</locationURI>
</link>
+ <link>
+ <name>test</name>
+ <type>2</type>
+ <locationURI>CHIBIOS/test</locationURI>
+ </link>
</linkedResources>
</projectDescription>
diff --git a/testhal/STM32/multi/QSPI-MFS/Makefile-stm32l476_discovery b/testhal/STM32/multi/QSPI-MFS/Makefile-stm32l476_discovery
index b01d07514..ff8483b94 100644
--- a/testhal/STM32/multi/QSPI-MFS/Makefile-stm32l476_discovery
+++ b/testhal/STM32/multi/QSPI-MFS/Makefile-stm32l476_discovery
@@ -102,6 +102,8 @@ include $(CHIBIOS)/os/hal/osal/rt/osal.mk
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional).
+include $(CHIBIOS)/test/lib/test.mk
+include $(CHIBIOS)/test/mfs/mfs_test.mk
include $(CHIBIOS)/os/ex/Micron/m25q.mk
include $(CHIBIOS)/os/hal/lib/complex/mfs/mfs.mk
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
diff --git a/testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/halconf.h b/testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/halconf.h
index 51783ad62..e34c3c4bf 100644
--- a/testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/halconf.h
+++ b/testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/halconf.h
@@ -146,7 +146,7 @@
* @brief Enables the SERIAL subsystem.
*/
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
-#define HAL_USE_SERIAL FALSE
+#define HAL_USE_SERIAL TRUE
#endif
/**
diff --git a/testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/portab.c b/testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/portab.c
index 0918c108c..639e2f97e 100644
--- a/testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/portab.c
+++ b/testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/portab.c
@@ -22,6 +22,8 @@
* @{
*/
+#include "hal.h"
+
#include "portab.h"
/*===========================================================================*/
@@ -48,4 +50,12 @@
/* Module exported functions. */
/*===========================================================================*/
+void portab_setup(void) {
+
+ /*
+ * LED line as output.
+ */
+ palSetLineMode(LINE_LED_GREEN, PAL_MODE_OUTPUT_PUSHPULL);
+}
+
/** @} */
diff --git a/testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/portab.h b/testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/portab.h
index 8e7c1cdcf..2f547774a 100644
--- a/testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/portab.h
+++ b/testhal/STM32/multi/QSPI-MFS/cfg-stm32l476_discovery/portab.h
@@ -37,6 +37,8 @@
#define PORTAB_LINE_BUTTON LINE_JOY_CENTER
#define PORTAB_BUTTON_PRESSED PAL_HIGH
+#define PORTAB_SD1 SD2
+
/*===========================================================================*/
/* Module pre-compile time settings. */
/*===========================================================================*/
@@ -60,7 +62,7 @@
#ifdef __cplusplus
extern "C" {
#endif
-
+ void portab_setup(void);
#ifdef __cplusplus
}
#endif
diff --git a/testhal/STM32/multi/QSPI-MFS/main.c b/testhal/STM32/multi/QSPI-MFS/main.c
index 870153684..638f8d807 100644
--- a/testhal/STM32/multi/QSPI-MFS/main.c
+++ b/testhal/STM32/multi/QSPI-MFS/main.c
@@ -22,6 +22,10 @@
#include "m25q.h"
#include "mfs.h"
+#include "mfs_test_root.h"
+
+#include "portab.h"
+
/* 16MB device, 2 cycles delay after NCS.*/
const QSPIConfig qspicfg1 = {
NULL,
@@ -61,8 +65,6 @@ const M25QConfig m25qcfg1 = {
&qspicfg1
};
-MFSDriver mfs;
-
const MFSConfig mfscfg1 = {
(BaseFlash *)&m25q,
0xFFFFFFFFU,
@@ -81,9 +83,9 @@ static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
while (true) {
- palToggleLine(LINE_LED_GREEN);
+ palToggleLine(PORTAB_LINE_LED1);
chThdSleepMilliseconds(500);
- palToggleLine(LINE_LED_GREEN);
+ palToggleLine(PORTAB_LINE_LED1);
chThdSleepMilliseconds(500);
}
}
@@ -92,7 +94,6 @@ static THD_FUNCTION(Thread1, arg) {
* Application entry point.
*/
int main(void) {
- mfs_error_t err;
/*
* System initializations.
@@ -105,39 +106,27 @@ int main(void) {
chSysInit();
/*
- * LED line as output.
+ * Board-dependent GPIO setup code.
*/
- palSetLineMode(LINE_LED_GREEN, PAL_MODE_OUTPUT_PUSHPULL);
+ portab_setup();
/*
- * Creates the blinker thread.
+ * Starting a serial port for test report output.
*/
- chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO + 1, Thread1, NULL);
-
- /* Initializing and starting M25Q driver.*/
- m25qObjectInit(&m25q);
- m25qStart(&m25q, &m25qcfg1);
-
- /* Mounting the MFS volume defined in the configuration.*/
- mfsObjectInit(&mfs);
- err = mfsStart(&mfs, &mfscfg1);
- err = mfsErase(&mfs);
+ sdStart(&PORTAB_SD1, NULL);
- err = mfsWriteRecord(&mfs, 1, 64, pattern);
- err = mfsWriteRecord(&mfs, 2, 64, pattern);
- err = mfsWriteRecord(&mfs, 1, 128, pattern);
- err = mfsWriteRecord(&mfs, 2, 128, pattern);
-
- err = mfsPerformGarbageCollection(&mfs);
-
- mfsStop(&mfs);
-
- (void)err;
+ /*
+ * Creates the blinker thread.
+ */
+ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
* Normal main() thread activity, in this demo it does nothing.
*/
while (true) {
+ if (palReadLine(PORTAB_LINE_BUTTON) == PORTAB_BUTTON_PRESSED) {
+ test_execute((BaseSequentialStream *)&PORTAB_SD1, &mfs_test_suite);
+ }
chThdSleepMilliseconds(500);
}
return 0;