Skip to main content
Jessy J
Associate III
May 27, 2018
Question

how to g

  • May 27, 2018
  • 25 replies
  • 3647 views

..

    This topic has been closed for replies.

    25 replies

    john doe
    Senior III
    May 27, 2018
    Posted on May 27, 2018 at 12:09

    You need to build and run makefsdata, which is in Middlewares/Third_Party/LwIP/src/apps/httpd/makefsdata

    http://lwip.wikia.com/wiki/Sample_Web_Server

     
    Jessy J
    Jessy JAuthor
    Associate III
    May 27, 2018
    Posted on May 27, 2018 at 12:13

    Hello 

    Thank you for your reply 

    iddlewares/Third_Party/LwIP/src/apps/httpd/ there is not makefsdata file ,, i found fs and fsdata.h that is it 

    How to get the makefsdata and how it is related to fsdata.c please ? 

    john doe
    Senior III
    May 27, 2018
    Posted on May 27, 2018 at 12:16

    try the top of the repository, sorry

    STM32Cube/Repository/STM32Cube_FW_F4_V1.21.0/Middlewares/Third_Party/LwIP/src/apps/httpd/makefsdata

    makefsdata is a c program that generates fsdata.c [or fsdata_custom.c, if you so choose]

    Jessy J
    Jessy JAuthor
    Associate III
    May 27, 2018
    Posted on May 27, 2018 at 12:19

    I got the makefsdata file 

    Shall I import it in the projet? sorry but I did not understand how to use makefsdata to get the fsdata.c ?

    john doe
    Senior III
    May 27, 2018
    Posted on May 27, 2018 at 12:26

    makefsdata is a stand-alone utility.  I suggest browsing the LwIP documentation

    http://lwip.wikia.com/wiki/LwIP_Wiki

     
    Jessy J
    Jessy JAuthor
    Associate III
    May 27, 2018
    Posted on May 27, 2018 at 12:28

    Yes I am using LWIP in my project and I have activated from cubMX and I have all the files needed abotu lwip  but I did not still understand how to use them to get the fsdata.c file please ??

    Tesla DeLorean
    Guru
    May 27, 2018
    Posted on May 27, 2018 at 13:13

    You have either got to compile makefsdata.c for your host PC, or download a precompiled .EXE, and have it enumerate and process the directory/file structure you want the server to access. It creates a 'File System' where no storage media or subsystem exists.

    I'm sure there are FAQ, tutorials and videos about this if you're remotely interested in learning how to use the tools.

    An example use case can be found in the software trees

    \STM32Cube_FW_F4_V1.21.0\Projects\STM324xG_EVAL\Applications\LwIP\LwIP_IAP\Src\fsdata.c

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Jessy J
    Jessy JAuthor
    Associate III
    May 27, 2018
    Posted on May 27, 2018 at 13:16

    I got the makefsdata.c from a project but I did not how to compile it for my host PC please ?? or how to download a precompiled ?EXE ?? it is not clear sorry can You help me more please ?? 

    Tesla DeLorean
    Guru
    May 27, 2018
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Jessy J
    Jessy JAuthor
    Associate III
    May 27, 2018
    Posted on May 27, 2018 at 13:44

    Can you explain to me more please ?? 

    I am debutant in this

    :(

    Thank you in advance for your help 

    Jessy J
    Jessy JAuthor
    Associate III
    May 28, 2018
    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

    john doe
    Senior III
    May 28, 2018
    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

    Jessy J
    Jessy JAuthor
    Associate III
    May 28, 2018
    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
    Pavel A.
    May 28, 2018
    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
    Jessy JAuthor
    Associate III
    May 28, 2018
    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

    Pavel A.
    May 28, 2018
    Posted on May 28, 2018 at 14:23

    Try this:

    struct fs_file file;

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

    -- pa