Using pico-sdk develop branch, add in support for CYW43-based
WiFi/BT/BLE boards on the RP2350 such as the
SparkFun Thing Plus RP2350 or the Pimoroni Pico Plus 2W.
Fixes#2608
Rolls in dynamic SPI divider #2600
* Support LED digitalWrite on RP2350+CYW
Also move "special GPIO" to 64 since the Pimoroni Pico 2W uses the
RP2350B with 48 GPIOs.
* Enable CYW43_PIN_WL_DYNAMIC in IDE and P.IO
Allows calling `cyw43_set_pins_wl(cyw43_pin_array);` to redefine the
CYW43 hookup in the variant initialization.
* Adds RISC-V compilation option to the IDE and Platform.IO.
* Build RP2350-RISCV libpico, libbearssl
* Fix RP2350 BearSSL library (was copied from RP2040, now built for M33)
* New GCC 14.2 toolchain is required (12.4 RISC-V support is borked)
* Newlib locking fixed prototypes
* Manually force all runtime init code into RP2350 binaries
* Add RISC-V to CI
* Remove RP2350 BOOT2.S files, binaries (not used)
* Clean up minor GCC 14.x warnings
* Add RP2350-RISCV OTA build, link
* Add RISC-V FreeRTOS files (configuration still not running, but builds)
* Add basic documentation
Pull in Raspberry Pi's custom RP2350 ARM and RISC-V ports for FreeRTOS.
Basic tests run, but stress mutex test is failing in unique and interesting
ways.
* Add simplified switching test catching task swap problem
* Freertosrp2350: use FreeRTOS macros in noInterrupts/interrupts when applicable. (#2456)
* Use FreeRTOS macros in noInterrupts/interrupts when applicable.
* Fixed calling taskEXIT_CRITICAL and taskENTER_CRITICAL
---------
Co-authored-by: fietser28 <fietser28@users.noreply.github.com>
* Migrate RP2040-specific bits to separate dirs
* Add chip to boards.txt, isolate RP2040-specifics
* Add RP2350 boot2, bearssl, and libraries
* Platform.IO adjust to new paths
* Add RPIPICO2 JSON for P.IO
* Add RP2350 to Platform.io
* Update Picotool and OpenOCD for all hosts
* Use picotool to generate UF2s
* Build separate libpico blobs serially
Thanks for the review, @aarturo182 !
* Add RP2350 to CI
* Allow Ethernet/WiFi building for RP2350
* Update Adafruit TinyUSB to latest
* Test skip fix
* Make RP2350 Picotool work. update USB ID
* Fix EEPROM/FS flash locations
RP2350 adds a 4K header sector to the UF2, meaning we have 4K less total
flash to work with. Adjust all constants appropriately on the RP2350.
* Adds ilabs board and PSRAM support. (#2342)
* Adds iLabs boards and basic PSRAM support.
* Make PSRAM come up as part of chip init
Uses SparkFun psram.cpp to set timings on clocks which are defined in the
variant file. Prefix things with RP2350_PSRAM_xxx for sanity.
Users don't need to call anything, PSRAM "just appears". Still need to
add in malloc-type allocation.
* Add board SparkFun ProMicro RP2350
Same pinout as the SparkFun ProMicro RP2040 with 8MB PSRAM and RP2350
* Add TLSF library for use w/PSRAM
Fork of upstream to include add'l C++ warning fixes.
* Add pmalloc/pcalloc to use PSRAM memory
free() and realloc() all look at the pointer passed in and jump to the
appropriate handler. Also takes care of stopping IRQs and taking the
malloc mutex to support multicore and FreeRTOS (when that workd)
* Fix BOOTSEL for RP2350
* Add simple rp2040.idleOtherCore test
* Add Generic RP2350 and clean up PSRAM menus
Commercial boards now only have 1 size PSRAM, no need to have menu for them.
* Add Solder Party RP2350 Stamp boards (#2352)
* Add PSRAM heap info helpers, mutex lock mallinfo
* Add RP2350 docs
* FreeRTOS and OTA unsupported warnings for RP2350
FreeRTOS often seems to have interesting corner cases. Add two simple
tests that have been useful while debugging issues found from users or
from FreeRTOS updates.
Since FreeRTOS has real tasks and mutexes with support for priority bumping, actually always try and take a `CoreMutex` instead of seeing if someone else already has it and aborting immediately.
This fix helps ensure things like Serial output in a multi-task system won't get lost.
* Fix FreeRTOS CoreMutex shim to handle ISRs
Automatically check, when in FreeRTOS, if we're in an ISR and
if so call the correct mutex grab.
Thanks to @caveman99 for finding and proposing a solution!
Fixes#1441
* Fix the CoreMutex destructor, too
Update to head of upstream FreeRTOS/SMP branch. Very minor changes.
Remove the custom getreent implementation, use the one that was defined
in the upstream FreeRTOS/smp branch (callback related vs. static vars).
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
Fixes#1402
The global USB mutex is auto-shadowed with a FreeRTOS semaphore while in
FreeRTOS mode. Unfortunately, while the core was using the proper
FreeRTOS semaphore to lock access to the USB port, the actual FreeRTOS
USB task was using the naked Pico SDK mutex, leading to cases where it
could acquire the mutex even though some other FreeRTOS task actually
owned the shadowed mutex.
Properly lock the shadowed Semaphore, not mutex_t, in the FreeRTOS
USB periodic task.
Fixes#795
Replace all CoreMutex and Newlib mutex accesses with FreeRTOS calls
when in FreeRTOS mode. Avoid issues with hange/etc. due to priority
inversion.
No changes to normal operating mode.
Add a FreeRTOS stress test that caught the issue fixed here.
Adds a 12K OTA stub 3rd stage bootloader, which reads new firmware
from the LittleFS filesystem and flashes on reboot.
By storing the OTA commands in a file in flash, it is possible to
recover from a power failure during OTA programming. On power
resume, the OTA block will simply re-program from the beginning.
Support cryptographic signed OTA updates, if desired. Includes
host-side signing logic via openssl.
Add PicoOTA library which encapsulates the file format for
the updater, including CRC32 checking.
Add LEAmDNS support to allow Arduino IDE discovery
Add ArduinoOTA class for IDE uploads
Add MD5Builder class
Add Updater class which supports writing and validating
cryptographically signed binaries from any source (http,
Ethernet, WiFi, Serial, etc.)
Add documentation and readmes.
FreeRTOS SMP was updated to:
a) Move ths SYSTICK handler, which cannot be disabled and can fire
even with IRQs disabled, to RAM
b) Add a flag from the core to the SYSTICK handler to hold off on
any PendSV (task switch) calls while we are doing the idleOtherCore.
The core now sets this flag, _holdPendSV, and adds add'l FreeRTOS SMP
calls to really, really tell the OS we can't, don't, and better not
be swapped out while writing to flash.
Fixes#719
* Add support for the WiFi chip on the Pico W board.
* USB interrupt now no longer hard coded (conflicted with the WiFi IRQ).
* Add in Pico W board to makeboards.py
* Add in GPIO and variant support
* Initialize WiFi in the Variant
* Use manual LWIP, fix size accounting
* Remove the SDK WiFi overrides
* Pulling in work done in the ESP8266 core.
* Make IPAddress support IPv6
* Build LWIP with IPv4 and IPv6 support
* Use proper MAC
* Avoid cyw_warn crash. Make macro to a comment while building
* Add WiFiServer
* Add WiFiUdp
* Move LWIP-specific support files to LWIP_Ethernet
* Add WiFi::ping (ICMP ping)
* Move ICMP echo (ping) to LWIPIntfDev
* Move hostByName to LwipIntfDev
* Add AP mode with simple DHCP server
* Add some examples and basic ESP8266 compat hacks
* Update Adafruit TinyUSB to fix crash
* Set DHCP hostname
* Make Wifi.begin() return CONNECTED with link + IP
* Return connected() on WiFi::begin
* Fix spurious TCP retransmission
* Protect LWIP from reentrancy
The Pico SDK calls "sys_check_timeouts() from inside a periodic interrupt.
This appears unsafe, as the interrupt could happen while already in the
(non-reentrant) LWIP code.
Block the interrupt from calling sys_check_timeouts by using a global flag
manually set via an RAII recursive lock.
Add interrupt protection macros around critical sections inside LWIP via
the standard defines.
These two changes should make LWIP significantly more stable and long
running.
* Support disconnecting and reconnecting WiFi
* Add WiFiServer simple example
* Update documentation
Fixes#666Fixed#665
Instead of wrapping the memory functions in the link stage, rebuild
Newlib and enable retargetable locks. Override the weak definitions
in the libc.a with our own, SDK based ones.
The wrapping utilized before catches app-level memory allocations
but misses allocations inside Newlib libc (like printf/etc.).
Each core needs its own _impure_ptr or else crashes like the one seen
in parallel printf_floats can happen. Enable it in the toolchain
build and implement a simple swapper here.
FreeRTOS SMP doesn't support Newlib's dynamic reent which is needed
to allow save MT support. Minor patch to FreeRTOS and update the
FreeRTOS variant.cpp and setup to support it.
To remove compiler warning the valid core macro was modified to only check
that the core passed in was < # of total cores. Unfortunately there are
parts of the FreeRTOS code where the passed in core # is -1. The upstream
catches this and returns FALSE, but my hacked version returned TRUE. This
caused interesting memory corruption errors and crashes when the
current task block[-1] was updated.
Undo the change and fix the 1 spot where a warning happens instead.
Undo the forced compiler -O0 for port.c, it was only masking the fault.
Use low power WFE when idle.
Set PORT.C to built `-O0` always because it seems to occasinally end
up with interrupts disabled in task code, causing the SYSTICK never to
fire and killing task switching.
No need for dynamic exceptions. We don't move the execbase.
Using all the work from @hfellner and others, add FreeRTOS
SMP support.
Allow idling cores through the FreeRTOS FIFO queue to
allow for file system and EEPROM support.
Make delay a weak function so FreeRTOS can override.
Add cycle count support under FreeRTOS using a PIO SM.
Use a task-based approach for handling the USB periodic work
instead of the IRQ-based one in the main core.
Set 8 prio levels so it fits in 3 bits nicely (0..7).