The serial port reset logic was calling `sleep_ms()` which ended up doing
a task switch...while the other core was frozen and everything was supposed
to be locked.
Use `busy_wait_ms()` which is a tight loop to delay in the reset portion.
Fixes#1486
Fixes#1439
Use a real FreeRTOS task, at the highest priority, to idle the other core
while doing flash accesses.
The USB stack seems to have some timing dependent bits which get broken
if FreeRTOS switches out the current task when it's running. Avoid any
issue by disabling preemption on the core for all tud_task calls.
The PendSV handler disable flag can live completely inside the FreeRTOS
variant port, so remove any reference to it in the main core.
Tested using Multicode-FreeRTOS, #1402 and #1441
The USB FIFO interrupts were still being serviced even when the core was
frozen, leading to crashes. Explicitly shut off IRQs on both the victim
and the initiator core when freezing.
Removed the need for hack __holdUpPendSV flag
USB changes caused FreeRTOS to not be able to swap tasks when the Serial port
was connected. Clear the "stop PendSV" flag after checking for reset signal.
Stop the IDE from reporting large "Serial port not fount"-type errors after
every upload by delaying a bit before the uploader exits to give the OS/Pico
time to renegotiate.
Fixes flashing problems on certain Linux distros by checking all possible mount
locations instead of only the first one to be found.
Make 1200bps reset tickle more robust
Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
* Add HTTP-parser lib to support ESP32 WebServer
* Add WebServer from ESP32. Only supports HTTP
* Separate HTTP server from the network server
Instead of managing the WiFiServer/WiFiServerSecure in the same object
as the HTTP handling, split them into separate objects. This lets
HTTP and HTTPS servers work without templates or duplicating code.
The HTTP block just gets a `WiFiClient*` and works with that to only
do HTTP processing, while the upper object handles the appropriate
server and client types.
* Add HTTPS server
* Clean up some THandlerFunction refs
* Refactor into a template-ized WebServer/WebServerSecure
* Add DNSServer examples which need WebServer
* Fix CoreMutex infinite recursion crash
Core could crash while Serial debugging was going on and prints were
happening from LWIP/IRQ land and the main app.
* Add HTTPUpdateServer(Secure)
* Add MIME include, optimize WebServer::send(size,len)
When send()ing a large buffer, the WebServer::send() call would
actually convert that buffer into a String (i.e. duplicate it, and
potential issues with embedded \0s in binary data).
Make a simple override to send(size, len) to allow writing from the
source buffer instead.
* Fix WiFiClient::send(Stream), add FSBrowser example
* initial tinyusb lib port
* add Adafruit_TinyUSB_Arduino as submodules
* add yield() to main loop
* sync with tinyusb lib latest
* add USB manufacturer and product
* fix typo in tinyusb lib
* sync with master
updating implementation
* Rationalize link stage command line
Make the build process less insane.
* clean up delay
* clean up platform and board
* update makeboards.py for generating usbstack menu
* update tinyusb lib to 1.0.0
Add support for Adafruit Feather RP2040 (8MB). Identified with a unique
USB PID so it displays properly once programmed one time. Moved LED to
pin 13 (per the website docs), but have no board to test.
Add over/underclocking menus, applied at boot. Use at your own risk, as
usual.
Add shims to allocate flash space for a filesystem (but not implemented
yet).
Add a "generic" RP2040 board
Add a CoreMutex class which implements a deadlock-safe mutex and reqork
the SerialUSB and SerialUART classes to use it to synchronize output
when in a multicore sketch.
Add smarts to the UF2 uploader to potentially trigger a reboot if the
device passed in is /dev/tty* or COM*. Will cause reboot to USB
bootloader and standard UF2 upload will happen w/o any user
intervention.
Allow the IDE to cause the chip to reboot when the Serial port is active
and the baud is set to 1200 followed by a DTR toggle. The user still
needs to hold the BOOTSEL button to enable the UF2 boot, for now.