Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lwip httpd example #269

Closed
wants to merge 9 commits into from

Conversation

peterharperuk
Copy link
Contributor

threadsafe and freertos

Fixes #266

@lurch
Copy link
Contributor

lurch commented Sep 8, 2022

make[2]: fork: Resource temporarily unavailable

Looks like the CI server ran out of processes? ping @liamfraser

EDIT: passing again now - perhaps this was also related to today's server-reboot incident?

@peterharperuk
Copy link
Contributor Author

The sys version of this fails an assert in freertos. Not immediately obvious why

#0 _exit (status=status@entry=1) at /home/peterh/source/pico/pico-sdk/src/rp2_common/pico_runtime/runtime.c:183
#1 0x1000591e in __assert_func (file=file@entry=0x1001bd1c "/home/peterh/source/pico/freertos/FreeRTOS-Kernel/queue.c",
line=line@entry=1537, func=func@entry=0x1001c090 <func.5762> "xQueueSemaphoreTake",
failedexpr=failedexpr@entry=0x1001beb8 "pxQueue->uxItemSize == 0")
at /home/peterh/source/pico/pico-sdk/src/rp2_common/pico_runtime/runtime.c:228
#2 0x100154e2 in xQueueSemaphoreTake (xQueue=xQueue@entry=0x20003280 <ucHeap+7076>, xTicksToWait=,
xTicksToWait@entry=4294967295) at /home/peterh/source/pico/freertos/FreeRTOS-Kernel/queue.c:1542
#3 0x10015664 in xQueueTakeMutexRecursive (xMutex=0x20003280 <ucHeap+7076>, xTicksToWait=xTicksToWait@entry=4294967295)
at /home/peterh/source/pico/freertos/FreeRTOS-Kernel/queue.c:743
#4 0x10010e02 in sys_mutex_lock (mutex=mutex@entry=0x20001374 <mem_mutex>)
at /home/peterh/source/pico/pico-sdk/lib/lwip/contrib/ports/freertos/sys_arch.c:220
#5 0x1000891e in mem_trim (rmem=rmem@entry=0x20022628 <ram_heap+616>, new_size=)
at /home/peterh/source/pico/pico-sdk/lib/lwip/src/core/mem.c:751
#6 0x1000936e in pbuf_realloc (p=, new_len=)
at /home/peterh/source/pico/pico-sdk/lib/lwip/src/core/pbuf.c:444
#7 0x10013b36 in mdns_send_outpacket (msg=msg@entry=0x20003748 <ucHeap+8300>, netif=netif@entry=0x200220cc <cyw43_state+2264>)
at /home/peterh/source/pico/pico-sdk/lib/lwip/src/apps/mdns/mdns_out.c:789
#8 0x100116ce in mdns_send_probe (netif=0x200220cc <cyw43_state+2264>, destination=destination@entry=0x1001b768 )
at /home/peterh/source/pico/pico-sdk/lib/lwip/src/apps/mdns/mdns.c:2273
#9 0x10012464 in mdns_probe_and_announce (arg=0x200220cc <cyw43_state+2264>)
at /home/peterh/source/pico/pico-sdk/lib/lwip/src/apps/mdns/mdns.c:2316
#10 0x1000d182 in sys_check_timeouts () at /home/peterh/source/pico/pico-sdk/lib/lwip/src/core/timeouts.c:390
#11 0x10010b66 in tcpip_timeouts_mbox_fetch (mbox=mbox@entry=0x200016cc <tcpip_mbox>, msg=msg@entry=0x200037ac <ucHeap+8400>)
at /home/peterh/source/pico/pico-sdk/lib/lwip/src/api/tcpip.c:109
#12 0x10010b92 in tcpip_thread (arg=) at /home/peterh/source/pico/pico-sdk/lib/lwip/src/api/tcpip.c:142
#13 0x10014644 in xPortPendSVHandler ()
at /home/peterh/source/pico/freertos/FreeRTOS-Kernel/portable/ThirdParty/GCC/RP2040/port.c:380

pxQueue->uxItemSize is 66

@peterharperuk peterharperuk force-pushed the add_httpd branch 2 times, most recently from 72c5808 to 08e59c6 Compare October 3, 2022 16:28
@peterharperuk
Copy link
Contributor Author

@lurch Yes. Unfortunately that c file is generated by a binary that's built from c code. So the tool has to be built first. It didn't strike me as trivial to build a native binary in the sdk? I could check a windows and linux version in and generate picow_fsdata.c from that I guess? But it seems less fragile to check the source in and require a manual step if the files are changed. Ideally there would be a python version of the tool.

@lurch
Copy link
Contributor

lurch commented Oct 4, 2022

It didn't strike me as trivial to build a native binary in the sdk?

AFAIK the SDK build-process does build pioasm and elf2uf2 as native binaries? But I've no idea if the mechanism used within pico-sdk is also usable by code within pico-examples, so I'll shut up now 😉

But it seems less fragile to check the source in and require a manual step if the files are changed.

Yup.

@peterharperuk
Copy link
Contributor Author

AFAIK the SDK build-process does build pioasm and elf2uf2 as native binaries

Yes - I can vaguely see what it's doing. I might give it a try.

@peterharperuk
Copy link
Contributor Author

Currently failing...

*** PANIC ***
sys_timeout: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty

@peterharperuk
Copy link
Contributor Author

Needs georgerobotics/cyw43-driver#39

@lurch lurch mentioned this pull request Dec 9, 2022
@peterharperuk
Copy link
Contributor Author

Now needs raspberrypi/pico-sdk#1139 :)

@peterharperuk
Copy link
Contributor Author

Updated this to tip of dev. Changed to use CYW43_TASK_STACK_SIZE so now it depends on this raspberrypi/pico-sdk#1177

threadsafe and freertos

Fixes raspberrypi#266
Add modifications needed to the httpd freertos example

Fixes raspberrypi#272
These replace the examples provided by lwip
Stop changing min stack size and use CYW43_TASK_STACK_SIZE instead.
Requires async changes
@peterharperuk
Copy link
Contributor Author

I think this is ready!

@peterharperuk
Copy link
Contributor Author

Fails on Windows

ninja: error: 'pico_w/freertos/httpd/makefsdata/makefsdata.exe', needed by 'pico_w/freertos/httpd/content/picow_fsdata.c', missing and no known rule to make it

@peterharperuk
Copy link
Contributor Author

ah ha - fails on a proper OS as well when using ninja

Fiddle with stuff till it works
Actually it just didn't like the directory creation in the end
@peterharperuk
Copy link
Contributor Author

ninja works on ubuntu now. Still can't get Windows to build a native binary. I think I'll give up on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants