Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6569

SDK • Re: Pico W noob, tried to modify httpd example, but no linkage - need to generate pico_fsdata.inc

$
0
0
Fumbling around, used this python3 script in the content directory to generate that pico_fsdata.inc file:

Code:

import osdef generate_fsdata(directory, output_file):    with open(output_file, "w") as f:        f.write("// Generated file containing HTML data\n\n")        for root, dirs, files in os.walk(directory):            for file_name in files:                file_path = os.path.join(root, file_name)                with open(file_path, "r") as file:                    data = file.read()                    array_name = file_name.replace(".", "_")                    f.write(f"const char {array_name}[] = {{\n")                    for char in data:                        f.write(f"0x{ord(char):02x}, ")                    f.write("\n};\n\n")if __name__ == "__main__":    generate_fsdata("web", "pico_fsdata.inc")
now new error

Code:

/usr/src/pico-sdk/lib/lwip/src/apps/http/fs.c: In function 'fs_open':/usr/src/pico-sdk/lib/lwip/src/apps/http/fs.c:58:12: error: 'FS_ROOT' undeclared (first use in this function)   58 |   for (f = FS_ROOT; f != NULL; f = f->next) {      |            ^~~~~~~/usr/src/pico-sdk/lib/lwip/src/apps/http/fs.c:58:12: note: each undeclared identifier is reported only once for each function it appears inmake[3]: *** [CMakeFiles/test.dir/build.make:1993: CMakeFiles/test.dir/usr/src/pico-sdk/lib/lwip/src/apps/http/fs.c.o] Error 1make[3]: *** Waiting for unfinished jobs....make[2]: *** [CMakeFiles/Makefile2:1840: CMakeFiles/test.dir/all] Error 2make[1]: *** [CMakeFiles/Makefile2:1847: CMakeFiles/test.dir/rule] Error 2make: *** [Makefile:150: test] Error 2
EDIT: I don't know python, so I don't know what's going on. But the pico-examples httpd example must grab a script from somewhere, but where?
EDIT: I'm braindead, it's in the SDK: https://github.com/raspberrypi/pico-sdk ... lwip/tools
Now to get my stand-alone project to flippin' use it!

Statistics: Posted by breaker — Mon Feb 03, 2025 11:36 pm



Viewing all articles
Browse latest Browse all 6569

Trending Articles