Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

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