Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


LWIP_HTTPD_CUSTOM_FILES

Hi

I’m developing a small project on stm32f407 to show logs file written on sdcard using raw lwip. I’ve enabled:

LWIP_HTTPD_CUSTOM_FILES
LWIP_HTTPD_DYNAMIC_FILE_READ

but I’ve some problems to implements these methods:

int fs_open_custom(struct fs_file *file, const char *name);
void fs_close_custom(struct fs_file *file);
int fs_read_custom(struct fs_file *file, char *buffer, int count);

any ideas?

thank you,

Andrea

here is my starting code:

//open custom file
int fs_open_custom(struct fs_file *file, const char *name) {

//open log file
if(strncmp_url(name,”/log_file.txt”,13)>0)
{
file->data = “buffer_open_custom”;
file->len = 1000;
file->index = 0;
file->pextension = NULL;
file->is_custom_file = 1;

//0 if unable to open
return 1;
}
}

//read file and fill “buffer” step by step by “count” bytes amount
int fs_read_custom(struct fs_file *file, char *buffer, int count) {

int read = 0;
if (file->index < file->len)
{
read = 100;
file->is_custom_file = 1;
buffer = “buffer_read_custom”;
}
else
{
//end reached
read = FS_READ_EOF;
}
return read;
}

void fs_close_custom(struct fs_file *file){

//close file
//f_close(&fileOpen);

}

fs_open_custom works ok and the first part of the page is correctly loaded, then fs_read_custom is called 10 times before return FS_READ_EOF but only the first call appends to the buffer “buffer_read_custom” string, next calls append only part of “fsdata_custom.c” file. Any idea about this behavior? This is only a proof of concept example. I just need to test this code works correctly


 

Newest Forum Posts

  1. Монтаж камина с грилем в Москве - установка и барбекю by KpddomErorb, 2025-05-10 18:28
  2. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  9. Build a project in "release" mode by tang, 2025-02-20 10:36
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35

Last-Modified Blogs