diff --git a/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg/lwipopts.h b/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg/lwipopts.h index 901683775..4fde3bbce 100644 --- a/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg/lwipopts.h +++ b/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg/lwipopts.h @@ -51,4 +51,9 @@ #define LWIP_THREAD_PRIORITY (LOWPRIO) #endif +/* HTTPD settings override.*/ +#define LWIP_HTTPD_CUSTOM_FILES 1 +#define LWIP_HTTPD_DYNAMIC_FILE_READ 1 +#define LWIP_HTTPD_DYNAMIC_HEADERS 1 + #endif /* LWIP_HDR_LWIPOPTS_H__ */ diff --git a/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg/stm32f769_discovery/mcuconf.h b/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg/stm32f769_discovery/mcuconf.h index fce0eb57e..b65e61212 100644 --- a/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg/stm32f769_discovery/mcuconf.h +++ b/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg/stm32f769_discovery/mcuconf.h @@ -291,8 +291,8 @@ /* * SDC driver system settings. */ -#define STM32_SDC_USE_SDMMC1 TRUE -#define STM32_SDC_USE_SDMMC2 FALSE +#define STM32_SDC_USE_SDMMC1 FALSE +#define STM32_SDC_USE_SDMMC2 TRUE #define STM32_SDC_SDMMC_UNALIGNED_SUPPORT TRUE #define STM32_SDC_SDMMC_WRITE_TIMEOUT 1000 #define STM32_SDC_SDMMC_READ_TIMEOUT 1000 diff --git a/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg/stm32f769_discovery/portab.h b/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg/stm32f769_discovery/portab.h index 465ff26dc..122baedaf 100644 --- a/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg/stm32f769_discovery/portab.h +++ b/demos/STM32/RT-STM32-LWIP-FATFS-USB/cfg/stm32f769_discovery/portab.h @@ -33,6 +33,8 @@ #define PORTAB_SDU1 SDU2 +#define PORTAB_SDC1 SDCD2 + #define PORTAB_BLINK_LED1 LINE_ARD_D13 /*===========================================================================*/ diff --git a/demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c b/demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c index a95b656d3..3a282e652 100644 --- a/demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c +++ b/demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c @@ -24,10 +24,11 @@ #include "chprintf.h" #include "shell.h" +#include "ff.h" + #include "lwipthread.h" #include "lwip/apps/httpd.h" - -#include "ff.h" +#include "httpd_fatfs.h" #include "portab.h" #include "usbcfg.h" @@ -208,7 +209,7 @@ static void InsertHandler(eventid_t id) { * On insertion SDC initialization and FS mount. */ #if HAL_USE_SDC - if (sdcConnect(&SDCD1)) + if (sdcConnect(&PORTAB_SDC1)) #else if (mmcConnect(&MMCD1)) #endif @@ -217,7 +218,7 @@ static void InsertHandler(eventid_t id) { err = f_mount(&SDC_FS, "/", 1); if (err != FR_OK) { #if HAL_USE_SDC - sdcDisconnect(&SDCD1); + sdcDisconnect(&PORTAB_SDC1); #else mmcDisconnect(&MMCD1); #endif @@ -233,7 +234,7 @@ static void RemoveHandler(eventid_t id) { (void)id; #if HAL_USE_SDC - sdcDisconnect(&SDCD1); + sdcDisconnect(&PORTAB_SDC1); #else mmcDisconnect(&MMCD1); #endif @@ -320,12 +321,12 @@ int main(void) { * Activates the SDC driver 1 using default configuration. */ - sdcStart(&SDCD1, NULL); + sdcStart(&PORTAB_SDC1, NULL); /* * Activates the card insertion monitor. */ - tmr_init(&SDCD1); + tmr_init(&PORTAB_SDC1); #else /* * Initializes the MMC driver to work with SPI3. @@ -348,6 +349,7 @@ int main(void) { /* * Starts the HTTP server. */ + httpd_fatfs_init(); httpd_init(); /* diff --git a/demos/STM32/RT-STM32-LWIP-FATFS-USB/make/stm32f769_discovery.make b/demos/STM32/RT-STM32-LWIP-FATFS-USB/make/stm32f769_discovery.make index 5f11b0c2d..47bcd635f 100644 --- a/demos/STM32/RT-STM32-LWIP-FATFS-USB/make/stm32f769_discovery.make +++ b/demos/STM32/RT-STM32-LWIP-FATFS-USB/make/stm32f769_discovery.make @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -Og -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -116,6 +116,7 @@ include $(CHIBIOS)/os/hal/lib/streams/streams.mk include $(CHIBIOS)/os/various/shell/shell.mk include $(CHIBIOS)/os/various/lwip_bindings/lwip.mk include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk +include $(CHIBIOS)/os/various/httpd_fatfs_bindings/httpd_fatfs.mk # Define linker script file here LDSCRIPT= $(STARTUPLD)/STM32F76xxI.ld @@ -156,7 +157,7 @@ CPPWARN = -Wall -Wextra -Wundef # # List all user C define here, like -D_DEBUG=1 -UDEFS = +UDEFS = -DFATFS_HAL_DEVICE=SDCD2 # Define ASM defines here UADEFS =