Commit graph

61 commits

Author SHA1 Message Date
wiznet-mason
a7380a5de0
Add support for W6300-EVB-Pico and W6300-EVB-Pico2 boards (#2999) 2025-06-19 11:16:53 -07:00
Earle F. Philhower, III
acf81f426c
Add PIO-based SoftwareSPI enabling SPI on any pins (#2778)
* Add PIO-based SoftwareSPI enabling SPI on any pins

The Raspberry Pi team has a working PIO-based SPI interface.  Wrap it
to work like a hardware SPI interface, allowing SPI on any pin
combination.

Tested reading and writing an SD card using unmodified SD library.

* Add W5500 example

Good for testing, shows non-contiguous pin outs.
2025-01-27 13:59:52 -08:00
Earle F. Philhower, III
452ef17174
Replace ESP8266SdFat w/SdFat 2.3.0, SDIO, ExFAT (#2764)
* Replace ESP8266SdFat w/SdFat 2.3.0, add SDIO and ExFAT support

Remove ESP8266SdFat fork and replaces with upstream SdFat to simplify
maintenance.

This 2.3.0 version adds SDIO support and enables exFAT support.
Also upgraded FAT filename support to 256 chars, identical to  LittleFS.

* Add SDIO support to SD and SDFS, documentation, and examples

* Update SD examples to all support SPI0, SPI1, or SDIO
2025-01-17 15:22:39 -08:00
Earle F. Philhower, III
21a767e7e4
Semihosting part of core, RISC-V support (#2685)
Semihosting is handy for debugging, so allow the core to use `SerialSemi` as the
::printf port.  Add menu item to the IDE to allow selection.

Add RISC-V implementation of semihost call
2024-12-14 09:42:45 -08:00
Earle F. Philhower, III
1725e2109f
Add semihosting support (SerialSemi and SemiFS) (#2670)
Enable ARM-only semihosting mode.  This mode allows applications on the
Pico to write to the OpenOCD console and read and write files on the
host system (i.e. debugging dump information, etc.)

It is not very fast because of the way it uses breakpoints on the Pico
to communicate, but it is useful in cases when you want to get a single
file off of the Pico while debugging.

Note that this **requires** a connected OpenOCD and GDB or else the
semihosting will cause a system panic.
2024-12-04 16:07:46 -08:00
Earle F. Philhower, III
f5c4136b94
Add SimpleMDNS, IGMP, and .local lookup (#2582)
* Enable LWIP IGMP, MDNS internal server
* Enable MDNS lookup from LWIP DNS
* Add SimpleMDNS responder, small code and no malloc
* Ensure we copy out lwipopts in make-libpico

Adds a small wrapper around the LWIP-provided MDNS responder application.
Drop-in replacement in many basic cases for LEAmDNS.

For FreeRTOS it is important to not allocate memory on an LWIP callback.
LEAmDNS needs to do this to create response objects, leading to crashes.

Increase LWIP timers by bumping the LWIP_ARP number (as done before).

Replace ArduinoOTA LEAmDNS with SimpleMDNS and update a
HTTPUpdateServer example.
2024-11-07 10:09:44 -08:00
wiznet-mason
b0e7ad3de2
Add WIZnet W55RP20-EVB-Pico board (#2555) 2024-10-28 18:10:33 -07:00
Earle F. Philhower, III
f6973fc64d
Add RISC-V support, GCC 14 move (#2491)
* 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
2024-09-29 15:10:36 -07:00
Earle F. Philhower, III
66c1f78f7d
Minimize skipped ESPHost CI tests (#2477) 2024-09-18 08:28:05 -07:00
Pontus Oldberg
f6940cc04e
Adds support for ESP Hosted to WiFi/BLE boards and adds a menu item for ESP WiFi selection (#2468)
* Adds a menu item for selecting type of ESP wifi type.

* Updated pin definitions to work with ESP hosted.

* Fixed residual debug modification.

* Added ESPHost support library.

* Removed local cloning of ESPHost and added to excluded from CI

* Updated boards.txt

---------

Co-authored-by: Pontus Oldberg <pontus.oldberg@non.se.com>
2024-09-18 07:16:23 -07:00
Earle F. Philhower, III
a0b3876de4
Add FreeRTOS support for RP2350 (#2406)
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>
2024-09-16 16:56:22 -07:00
Earle F. Philhower, III
cde5fe3de5
Mac BASH update for CI scripts (#2400) 2024-08-31 12:53:00 -07:00
Earle F. Philhower, III
33694a1fcc
Add RP2350 support, new boards (#2337)
* 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
2024-08-25 11:21:46 -07:00
Earle F. Philhower, III
16d9609ac9
Add VFS to enable POSIX file I/O operations (#2333)
* Add VFS to enable POSIX file I/O operations

Enables use of FILE * operations on internal and external storage.  fopen,
fclose, fseek, fprintf, fscanf, etc. supported.

* Add FS/File::stat and support POSIX stat/fstat
2024-08-16 13:37:23 -07:00
Earle F. Philhower, III
f3b8c58157
Remove obsolete TRAVIS CI variables (#2292)
Use GH native ones instead.
2024-07-23 09:48:33 -07:00
Earle F. Philhower, III
9f66e834d4
Split variant build, combine spell + style checks (#2291)
Variant builds were taking longer than the actual individual CI jobs, so
split it up.

Combine the spelling and style checks, they ran very fast and spent more
time in checking out than in running.
2024-07-22 12:46:47 -07:00
Earle F. Philhower, III
553f7604ea
Add ESP32-compatible Ticker library (#2244)
Uses the Pico SDK alarms and repeated-timers to provide for IRQ-level
periodic tasks to be scheduled.
2024-06-24 14:47:46 -07:00
Earle F. Philhower, III
c99614c1f5
Add AsyncUDP and simple NetBIOS name lookup server (#2234)
Thanks to @me-no-dev's code.  Lets Windows look up the PicoW by name
using NBNS and needs much less memory and code than mDNS.

AsyncUDP ported from the old ESP8266 version, only minimal changes.  Will
probably only be valid in IPv4 environments and may not match current
ESP32 AsyncUDP interfaces.
2024-06-17 17:46:53 -07:00
Earle F. Philhower, III
f6d13d2b70
Bluetooth Master HID and musical keyboard example (#2195)
Adds BluetoothHIDMaster and HIDKeyStream which let the PicoW connect to
and use Bluetooth Classic HID devices like keyboards and mice.

An example that lets the PicoW use a BT keyboard as a piano is
included and shows the use of the new classes.
2024-06-04 14:09:28 -07:00
Earle F. Philhower, III
f786583986
Split out BluetoothHCI for shared usage (#2194) 2024-06-03 15:09:55 -07:00
Earle F. Philhower, III
ec5e62e533
Add Bluetooth audio out (A2DP) on the PicoW (#2174)
Adds a library to run classic Bluetooth A2DP source (output) audio from
the PicoW.  Simple example showing operation and callbacks.

Factor out multiple BT lock/unlock and place in the PicoW variant files.
2024-05-26 14:30:40 -07:00
Earle F. Philhower, III
fa58b6987a
CI can use custom defines, add ESPHost/WINC tests (#2142)
If a file called `.ci.defines` is present in a directory, apply those
while building the specified sketch.

* Add an lwip_ESPHost test, like the wired Ethernet ones
* Add WINC1500 test and CI hook
* Remove 1 minor warning in WINC build
2024-05-02 13:37:50 -07:00
Earle F. Philhower, III
074b952314
Add FatFS and FatFSUSB - Wear-Leveled FTL based FAT filesystem for onboard flash (#2028)
* Add FatFS for onboard flash use/sharing of FAT

* Move all to "fatfs" namespace

The FatFS library defines commonly used names like WORD which could conflict
with user code otherwise.

* Restyle

* FTL-based, wear-leveling FatFS with USB export

Allow using FAT filesystem with onboard flash in a safer, wear-leveled
way and to export the onboard flash to the host as a USB drive for easy
data transfer.

* Update documentation

* Fix submodule reference

* Don't spellehcek ChaN FatFS files

* Disable FTL debugging

* More codespell skips

* Move to latest SPIFTL library

* Allow using raw flash instead of FTL

* Remove unneeded static FIL 4k allocation

* Expose FAT FS format configuration options

* Update documentation

* Remove USB partial flash rewrites

* Remove unneeded dups of FatFS sources

Leave the LICENSE.md and README.md to point to upstream.

* Clean up comments
2024-04-19 10:52:02 -07:00
Earle F. Philhower, III
48a52e61ce
Update to SDFat 2.2.2 release (#2079) 2024-04-18 15:05:36 -07:00
Earle F. Philhower, III
972b7f53be
Fix warning in lwip_ESPHost, add to styler (#1998) 2024-02-11 11:51:16 -08:00
Earle F. Philhower, III
f1170e9d54
Fix Apple M1 installation, add to CI (#1975) 2024-01-31 08:45:10 -08:00
Ha Thach
3160fde679
Support native USB as host (#1910)
* add a new usbstack menu to use native usb as host

* update tinyusb library to 2.3.0

* skip Host native example in ci
2023-12-25 11:36:07 -08:00
Earle F. Philhower, III
47111a6eba
Undo BSTstackLib warning (#1758)
Undo #1751
2023-10-08 16:42:08 -07:00
Earle F. Philhower, III
bd6b20dedd
Mark the BTStackLib as unsupported (#1751)
Per https://github.com/bluekitchen/btstack/issues/529#issuecomment-1746293987
Don't run BTstackLib examples in CI
2023-10-04 09:39:01 -07:00
Earle F. Philhower, III
f60b7831c8
Add SPISlave class (#1717)
Allows the Pico to behave as an SPI slave and allows apps to respond
with appropriate data through callbacks.

Fixes #1680
2023-09-17 15:23:03 -07:00
Earle F. Philhower, III
1f3d5011b2
Support wired network interfaces (W5500, W5100, ENC28J60) (#1703)
Enable use of wired Ethernet modules as first-class LWIP citizens.  All
networking classes like MDNS, WebServer, HTTPClient, WiFiClient, and OTA
can use a wired Ethernet adapter just like built-in WiFi.

Two examples updated to show proper use.

Uses the Async Context support built into the Pico SDK.  When running on the
Pico  it will use the CYW43 async instance.

Uses modified wired Ethernet drivers, thanks Nicholas Humfrey!

Note, the classic, non-LWIP integrated `Ethernet` and related libraries
should still work fine (but not be able to use WebServer/HTTPS/etc.)

Fixes #775
2023-09-14 19:04:39 -07:00
Earle F. Philhower, III
01ee673dc2
Protect the HW random generation from FreeRTOS (#1395)
Fixes #1394

The Pico_Rand SDK calls gather bits from the HW ROSC at precise intervals.
If there is jitter in the sleep_until() call then the ROSC bit collection
will always think it's failed to acquire the right bit and retry infintitely.

Avoid by wrapping the HW random number calls and the sleep_until() routine.
Only when in FreeRTOS set a flag to silently make sleep_until() into a
busy wait loop while in a random number generation step.  When not in the
random code, do the normal sleep_until call.
2023-05-01 19:42:21 -07:00
Earle F. Philhower, III
8e8fea4b7d
Add (unsupported) BTstack Arduino library (#1305)
The BTstack driver includes a basic Arduino library as part of the ports
directory.
2023-03-15 13:02:24 -07:00
Earle F. Philhower, III
8dc44b5e0d
Astyle format variants format (#1295) 2023-03-10 13:00:04 -08:00
Earle F. Philhower, III
7aa1c08d17
Use generic HID classes to minimize code duplic'n (#1254)
Move the Joystick, Keyboard, and Mouse into a base class which handles
the operation/input, and a subclass which will implement the reporting
as a HID device via USB, Bluetooth Classic, or Bluetooth Low Energy (BLE).

Reduce copies of library code and makes maintainability much better.
2023-03-03 11:12:09 -08:00
Earle F. Philhower, III
f5a621935d
Add BLE HID libraries and examples (#1240) 2023-03-01 16:29:25 -08:00
Earle F. Philhower, III
d92c1025ba
Update to SDK 1.5, add alpha-level BT support, use Pico-SDK CYW43 infrastructure (#1167)
* Update to Pico-SDK v1.5
* Hook in pico_rand, use ioctl to set ipv6 allmulti
* Move into PicoSDK LWIP mutex, hack timer sizes
* Utilize much of the PicoSDK infrastructure for WiFi
* Add WiFi::begin(ssid, pass, bssid)
* WiFiMulti to use BSSID, make more robust

WiFiMulti will now be more aggressive and try all matching SSIDs, in order
of RSSI, using the BSSID to identify individual APs in a mesh.

Before, if the highest RSSI AP didn't connect, it would fail immediately.
Now, it will go down the list, ordered by RSSI, to attempt to get a link.

* Add Bluetooth support from Pico-SDK
Able to build and run the HID Keyboard Demo from the Arduino IDE, almost
as-is.

Will probably need to make BT configurable.  Enabling BT on a plain WiFi
sketch uses 50KB of flash and 16KB of RAM even if no BT is used.

* Separate picow libs, BT through menus, example

Build normal Pico.a and 4 different options for PicoW IP/BT configuration.
Use IP=>IP/Bluetooth menu to select between options.

* CMakefile rationalization

* Move BT TLV(pairing) out of last 2 flash sectors

The pairing keys for BT are stored at the end of flash by default, but
we use the last sector of flash for EPROM and the penultimate one for
the filesystem.  Overwriting those in BT could cause some real exciting
crashes down the line.

Move the store to an app-build specific address using a dummy const
array to allocate space in the application image itself.

* PicoBluetoothHID with BT Mouse, Joystick, Keyboard

Add simple Bluetooth Classic HID helper function and port the existing
USB HID devices to it.  Port their examples.

* Protect BT key storage from multicore

* Add short-n-sweet Bluetooth documents

* Add Bluetooth Serial port library

* Turn off BT when the BT libraries exit
2023-02-27 20:09:02 -08:00
Earle F. Philhower, III
da26016edf
DMA-based ADC input (microphone, analog sensor) (#1101)
Mimics the I2S/PWMAudio/Stream interface for ease of use.

* Fix non-32b DMA size transfer calculation in ABM
* Rename wasHolding to isHolding in the I2S/PWM
  It is the **current** number of bits left, not the past number.
* Add commented microphone example
* Add docs
2023-01-05 16:00:34 -08:00
Earle F. Philhower, III
d184274324
Fix CI errors when more than one *.a in cache dir (#1049)
Avoids errors shown in logs for certain builds.
2022-12-18 14:43:36 -08:00
Earle F. Philhower, III
fca7fb5e0f
Add USB drive mode to TinyUSB, SingleFileDisk (#1034)
SingleFileDisk allows for exporting a file from the onboard LittleFS
filesystem to a PC through an emulated FAT drive when connected.  The
PC can open and copy the file, as well as delete it, but the PC has no
access to the main onboard LittleFS and no actual on-flash FAT
structures are used.

This is handy for things like data loggers.  They can run connected to
USB power for some time, and then connected to a PC to dowmload the CSV
log recorded.

It's almost 2023, allow LFN (long file names) on the emulated USB disk.

Reduce the disk buffer size to 64 bytes.  The buffer is statically
allocated so it's always present, even in non-USB disk mode, meaning
all apps will pay the RAM price for it.  64 bytes is slower to read
but works and saves ~1/2KB of heap for all apps.
2022-12-09 13:59:23 -08:00
Earle F. Philhower, III
064dd4794f
Minor header/directrory cleanup (#802) 2022-08-27 13:04:57 -07:00
Earle F. Philhower, III
0edba2ee2a
Add WebServer, WebServerSecure, HTTPUpdateServer, HTTPUpdateServerSecure (#791)
* 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
2022-08-23 15:51:32 -07:00
Earle F. Philhower, III
0b390d7dc4
Add HTTPUpdate class to pull updates from HTTP(S) (#789)
* Add HTTPUpdate class to pull updates from HTTP(S)
* Increase GH runners for pulls
WiFi builds and examples are taking some serious time now
* HTTPUpdate tests build on Pico W
2022-08-21 18:24:59 -07:00
Earle F. Philhower, III
0d15723444
Add HTTPClient, ported from the ESP8266 (#784)
Remove the need to have a separate WiFiClient that's destroyed after
the HTTPClient.  Let the object handle its own client, and pass through
any SSL requests.

Also supports the original ::begin methods which need a
WiFiClient(Secure) to be passed in and managed by the app.
2022-08-21 12:49:06 -07:00
Earle F. Philhower, III
da86a8942b
Add OTA update support (#711)
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.
2022-08-12 00:26:51 -07:00
Earle F. Philhower, III
abf2c586c7
Add Pico W WiFi support (#670)
* 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 #666
Fixed #665
2022-07-15 16:47:53 -07:00
Earle F. Philhower, III
8cf8923a18
Update to Adafruit_TinyUSB_Arduino 1.12.0 (#654)
* Update to Adafruit_TinyUSB_Arduino 1.12.0

* DualRole requires add'l libraries, skip in CI
2022-06-24 11:24:31 -07:00
Earle F. Philhower, III
803184c164
Update to latest Adafruit_TinyUSB (#639)
Fixes #582
2022-06-19 08:57:14 -07:00
Earle F. Philhower, III
fdf30febea
Hide get.py download percent when not interactive (#618)
When get.py is run in a script the percent-update printouts shown while
downloading the toolchain end up as 100s to 1000s of lines in log files.

When stdout is not a terminal, avoid printing these percentages and
shrink logfiles significantly. Errors/etc. are still reported as normal.
2022-06-09 18:00:45 -07:00
Earle F. Philhower, III
8054015bff
Clean up misc obsolete references (#584)
Remove pico-extras from makelibpico.sh
Remove refs to SPIFFS in FS.h
Remove travis::: markers
Update Arduino IDE URL
2022-05-18 17:33:16 -07:00