AnsweredAssumed Answered

lwIP web files in spi-flash

Question asked by Programmer5 on May 4, 2016
Dear Experts!
I've tested stsw-stm32026 demo code and that worked perfect.
Next I wrote simple SPI flash driver, and tried to load server files from this flash instead of stm32f107's internal flash.

in httpd.c file,

hs->file = file.data;
hs->left = file.len;

I replaced "file.data;" with spi flash data address and "file.len" with spi flash data length.

While inside send_data() function, 

tcp_write(pcb, hs->file, len, 0);

I replaced apiflags from 0 to 1.

Finally inside this enqueue function

tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len, u8_t flags, u8_t apiflags, u8_t optflags)

I wrote my own MEMCPY function that copies contents from external SPI-Flash to RAM buffer.

And it all works well, I was able to load web pages from external flash to browser.

Problem with above approach is, it only works fine when there are few mini pages. I have to load many pages with size more than 1 Mega Byte, and it is not suitable to copy all of them in RAM when I've already static contents in external flash.

So my question is, how I can keep apiflag to 0 in this function

tcp_write(pcb, hs->file, len, 0);

and can load pages from external flash?

Or simply, what steps should I take to load web pages from external SPI flash instead of internal Flash with keeping apiflags 0.

Thanks

Outcomes