0

I'm making a WebServer using STM32F405, the ethernet chip is W5500 from Wiznet.

Wiznet offers an HTTP WebServer demo. However, they use an sd card for loading web content.

I found that Arduino WebServer can load web content without using SD card, it just needs to add some Arduino code inside the sketch.

So the question is how my device load web content without an SD card.

I'm using IAR btw.

dustin2022
  • 182
  • 2
  • 18

4 Answers4

1

Although your question is a bit low on details, I am guessing you want to serve pages from inside your C code without accessing a file system.

I suggest you have a look at Bitty HTTP (shameless plug). I think it's close to what you are looking for. It serves the pages directly from C code (no file system), can work with non standard sockets, and does not require threads (no operating system needed).

I looked at the W5500 and is doesn't seam to use Berkeley sockets (although you maybe able to add this) so you will need to have something that can work without them. Unfortunately you would need to write the socket to W5500 SPI commands part to make it work.

You can also look at other embedded web servers. libmicrohttpd (which is an embedded web server it's self) has a fair list of other embedded web servers. I don't think you will find anything on there that will fit your needs but it's worth a try.

Paul Hutchinson
  • 1,578
  • 15
  • 21
  • Although the OPs question is rather vague, at least you got your shameless plug in as its a great project, kudos, I +1 this – crowie Oct 25 '21 at 07:22
0

Your question is not providing sufficient information, but what I understand that you are trying to get data from HTTP Server using POST & GET request.

There is a reason of using SD card as web is large enough to load inside an controller/ processor memory. In case of arduino you might seen an example where they are loading data from local server and data content is small enough to load and store the content in SRAM.

If you want to load web content its size must be smaller than the size of your SRAM, else it will create a Memory Overflow interrupt. The best way is to use SD Card and some External Memory Chips.

Vaibhav
  • 198
  • 1
  • 7
0

Insufficient information. If you are talking about this demo it uses the ELM FatFS library, which is portable to any media given a suitable block driver. The STM32F4 flash memory block structure does not really lend itself to use as a filesystem usnless it is read-only, and then you have to create the filesystem structure statically.

Adding SD card support to your STM32 is trivial, and probably simpler - the example uses the SPI interface which is much simpler than SDIO to connect and code. The example is for STM32F103 - there maybe minor differences between that and the STM32F405, but I've coded for both, and it is relatively easy to port.

Clifford
  • 88,407
  • 13
  • 85
  • 165
0

It is possible to serve static content without a local file system at all. The idea is to compile static files into the firmware. There multiple ways to do it, but the general approach is this:

  1. Use a utility that converts a list of static files into a single C source, where each file is represented as a uint8_t array of bytes. Along with the raw bytes, a utility can store file name and a modification time.
  2. That C source file gets compiled together with the rest of the firmware. The
  3. When a HTTP request is made for a certain file, it is possible to scan all "hardcoded" files, find the requested file, and serve its content using a uint8_t byte array.

Example implementation:

  1. Full device dashboard example
  2. File packing utility https://github.com/cesanta/mongoose/blob/master/test/pack.c
  3. Static files converted into a single C source file https://github.com/cesanta/mongoose/blob/master/examples/device-dashboard/packed_fs.c
valenok
  • 827
  • 7
  • 9