Electronic – STM32F4Discovery, an HTTP server and a web page on the SD card

ethernetsdstm32

I have an STM32F4Discovery board, and I have implemented an HTTP server on it using the LwIP v1.41 stack. I also have implemented a microSD card reader with SDIO and FatFs, and USB FS as a mass storage device. All of this is working fine together.

Can I store the webpages on the SD card in binary format instead of using the fsdata.c inside the microcontroller flash? If so, how can I do that? Is there an example?

Best Answer

Yes, you can do it.

For example, when you receive request GET /file.txt HTTP/1.1 you can check if such file exists, open it, sent relevant headers and file contents.

Web server demo from LwIP will require (as stated on http://lwip.wikia.com/wiki/Sample_Web_Server) extensive rewrite, but in custom HTTP server it is possible.