cancel
Showing results for 
Search instead for 
Did you mean: 

how to g

Jessy J
Associate II
 
25 REPLIES 25
Posted on May 27, 2018 at 13:23

https://community.st.com/0D50X00009XkY6TSAV

Use Google to find information and tutorials

Microsoft and GNU have PC based C compilers that can take C code and make executables/applications that run natively.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Jessy J
Associate II
Posted on May 28, 2018 at 09:46

KI am using LWIP , STM32F4 and I want to iimplement an http web based on netconn API in the board. 

I activated httpd from CubMX, I downloaded makefsdata.exe from internet and I generated with it the fsdata.c file.. 

In the fs.c generated by CubMX there is error in the fnction fs_open

in the programm of the http I am using I wrote this 

file = fs_open(''/STM32F4xx_files/stm32.jpg'');

In fs.c file  

err_t

fs_open(struct fs_file *file, const char *name)

{

const struct fsdata_file *f;

if ((file == NULL) || (name == NULL)) {

return ERR_ARG;

}

I did not understand the error exactly 

You will find attached the capture of the error and the programm

thank you in advance for your help0690X0000060KxtQAE.png

Jessy J
Associate II
Posted on May 28, 2018 at 10:40

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6uH&d=%2Fa%2F0X0000000bxl%2FXHCgLp.pMwYu9pyFfIGdwnOCqaeGoVkihwQdFeletd0&asPdf=false
Posted on May 28, 2018 at 10:25

If you read the LwIP documentation, you will find that you have to write your own custom fs_open to do what you want to do

Pavel A.
Evangelist III
Posted on May 28, 2018 at 13:37

else if((strncmp(buf, 'GET /STM32F4xx.html', 19) == 0)||(strncmp(buf, 'GET / ', 6) == 0))

{

/* Load STM32F4x7 page */

file = fs_open('/STM32F4xx.html');

netconn_write(conn, (const unsigned char*)(file->data), (size_t)file->len, NETCONN_NOCOPY);

fs_close(file);

}

else

{

/* Load Error page */

file = fs_open(&file,'/404.html');

netconn_write(conn, (const unsigned char*)(file->data), (size_t)file->len, NETCONN_NOCOPY);

fs_close(file);

}

Indeed in this htppd.c usage of fs_open is inconsistent. 

If this code comes from some 'static'  template, need to fix it.

Or, get updated sources from the home site of LwIP project.

-- pa

Jessy J
Associate II
Posted on May 28, 2018 at 13:59

Yes I corrected it like this 

struct netbuf *inbuf;

err_t recv_err;

char* buf;

u16_t buflen;

struct fs_file * file;

....

....

/* Check if request to get ST.gif */

if (strncmp((char const *)buf,'GET /STM32F4xx_files/ST.gif',27)==0)

{

recv_err = fs_open(file,'/STM32F4xx_files/ST.gif');

netconn_write(conn, (const unsigned char*)(file->data), (size_t)file->len, NETCONN_NOCOPY);

fs_close(file);

}

 But i get a warning sayin ' file may be used unitialized in this function .wht does this mean ?? it is declared u nthe begining of the function

Thank you for help

Jessy J
Associate II
Posted on May 28, 2018 at 14:45

I got error sayin Passing argument 1 of 'fs_open' from incompatible pointer type 

Jessy J
Associate II
Posted on May 28, 2018 at 14:46

and info saying '' expected 'struct fs_file*' but argument is of type 'struct fs_file**' 

what does this mean please ? 

Jessy J
Associate II
Posted on May 28, 2018 at 15:01

 so what I wrote is correct ? 

struct fs_file *file;

recv_err = fs_open ( fichier, '/ STM32F4xx_files / ST.gif'); 

but I have the same warning sayin file may be used uninitialized in this function

Like

Show 0 Likes

https://community.st.com/0D70X000006SwhsSAC

https://community.st.com/0D70X000006SwhsSAC

Jessy J
Associate II
Posted on May 28, 2018 at 15:47

I meant file and not fichier 

struct fs_file *file;

recv_err = fs_open ( fichier, '/ STM32F4xx_files / ST.gif'); 

is it correct ?? how can I correct it please !!?