Commit graph

889 commits

Author SHA1 Message Date
Benjamin Aigner
67b3c8fc25
Adding a Joystick library, concurrently usable with Keyboard & Mouse (#692)
Co-authored-by: Benjamin Aigner <beni@asterics-foundation.org>
2022-07-21 04:40:04 -07:00
Earle F. Philhower, III
b88ad3d143
Support original Pico with ROM B0 (#693)
The SDK disabled float/double support for some functions by default on the
original B0 ROMs.  Manually re-enable it.

Fixes #689
2022-07-20 12:07:34 -07:00
Maximilian Gerhardt
be9e25785c
Correct PlatformIO build for Pico W, add to CI (#686)
* Add LWIP defines from platform.txt

* Add WiFi example to PIO CI
2022-07-19 08:09:47 -07:00
Earle F. Philhower, III
824070b899 Update version 2022-07-18 20:28:49 -07:00
Earle F. Philhower, III
c3a580ee89
Add WiFiClientSecure and WifiServerSecure (TLS) support, NTP (#683)
* Add TLS (https) support
* Add NTP server
* Clean up include path, add BearSSL headers
* Allow 2 NTP servers, add ESP8266 compat define
* Add MFLN SSL example, free/used/total heap getters
* Enable stack thunking
* Add tested SSL examples
* Add BSSL_validation demo
* Add Client Certificate example
* Add RP2040 helper docs
* Clean up doc errors, missing doc version info
* Add WiFiClientSecure documentation
* Add NTP docs

Fixes #679
2022-07-18 20:24:11 -07:00
Earle F. Philhower, III
53cecae109 Update version 2022-07-17 05:52:01 -07:00
Earle F. Philhower, III
61742c9357
Disable WiFi.begin on plain Pico, add JSON (#682) 2022-07-17 05:51:03 -07:00
Earle F. Philhower, III
fee036604c
Provide dummy CYW43 callbacks when no WiFi used (#681)
Fixes #680
2022-07-16 11:57:27 -07:00
Earle F. Philhower, III
988940b25e Update version 2022-07-15 16:49:36 -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
c025c4a1f8
Fix ::printf/etc. due to mutex size conflict (#677)
When real multicore/lockign support was added to newlib, there was an opaque
field in FILE that was used as a mutex, but was only 4 bytes in size.  The
recursive mutexes on the RP2040 are 8 bytes.  This mismatch caused corruption
of the FILE structure and crashes of the system when ::printf/::puts/etc. were
run.

Adjust the lock field size in FILE to 8 bytes and rebuild the toolchain to
fix.
2022-07-14 09:04:02 -07:00
Earle F. Philhower, III
fb05d96979
Add delay to 2nd core start for Picoprobe (#676)
No idea why, but when a Picoprobe upload and reset is used, the 2nd core
does not start w/o a __wfe() call on the first one before launch.

Fixes #674
Fixes #402
2022-07-14 07:43:27 -07:00
Earle F. Philhower, III
8eb030ed89
Update TinyUSB to 1.13.3 (#672)
Fix errors in WebUSB buffering
Fixes #642
2022-07-08 13:45:01 -07:00
Pontus Oldberg
5be405308e
Add support for new SD/RTC and SubGHz boards (#663) 2022-06-30 10:16:44 -07:00
Earle F. Philhower, III
af0c1c87f5
Automatically update the JSON file in makeboards (#664)
Keep the Arduino Board Manager list up-to-date from makeboards.py
2022-06-29 12:50:42 -07:00
Earle F. Philhower, III
cfaae84813 Update version 2022-06-28 15:07:55 -07:00
Earle F. Philhower, III
da8ab1e9dd
Return # of bytes written by SerialUSB::write (#662)
Before always returned 0 on a ::write.  Now properly return the count
of bytes that were sent to the USB port.

Thanks to Terry Haas for the report.
2022-06-28 13:01:06 -07:00
Maximilian Gerhardt
baf65f510f
Add notes on TinyUSB documentation and quirks (#659)
Fixes #648
2022-06-26 15:26:23 -07:00
Maximilian Gerhardt
13f68fbc64
Make TinyUSB linking work automatically with PIO (#658) 2022-06-26 13:24:55 -07:00
Stefan Staub
3071b3f2dd
Update GPIO docs (digital.rst) (#656) 2022-06-25 10:00:29 -07:00
Earle F. Philhower, III
de069cf8c9 Update version 2022-06-24 11:25:21 -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
d954510c9d
Update to latest pico-sdk develop branch (#653)
Fixes #651
2022-06-24 02:19:24 -07:00
Earle F. Philhower, III
8966a9b094
Actually pass in the PIO key for auto-publishing (#652)
Need to manually list the secrets to export to the environment.
2022-06-23 17:12:21 -07:00
Earle F. Philhower, III
3d9611d020
Update FreeRTOS SMP branch to latest upstream (#649) 2022-06-22 17:18:50 -07:00
Earle F. Philhower, III
78b7f26076
Update README.md 2022-06-20 19:17:52 -07:00
Earle F. Philhower, III
7233c39166
Update to latest pico-sdk, allow lock.c->lock.cpp (#646)
Minor change to keep the core all CPP.  Patch just made it into pico-sdk
develop branch allowing recursive mutexes to be auto_init in C++.
Update and rebuild libpico.a.
2022-06-20 11:14:31 -07:00
Earle F. Philhower, III
0ee072671b Update version 2022-06-20 08:30:24 -07:00
Earle F. Philhower, III
1130007761
Make mutexes init in DATA, not ((counstructor)) (#645)
There was a race condition in making mutexes that were only init in
an __attribute((constructor)) code block.  For example, a global
object might do a `malloc` in its constructor which would depend on
the malloc mutex...which may not yet have been initted.

Make them initted in the .data section, instead, which is guaranteed
good before any global constructors are called.
2022-06-20 08:29:08 -07:00
Earle F. Philhower, III
a0060d9c3a
Add dependency file generation to build (#644)
Fixes #643
2022-06-20 07:50:28 -07:00
Earle F. Philhower, III
66eb0613b0
Major multicore fixes Newlib and FreeRTOS (#640)
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.
2022-06-20 07:35:30 -07:00
Earle F. Philhower, III
af8f544913
Update pio publish to match PIO PR build (#641) 2022-06-19 09:14:08 -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
857f91771f
Update to develop branch of pico-sdk (#636)
The realloc() wrapper was included in the develop branch of pico-sdk, so
use it instead of a local, unreproducible version of the SDK.

Should have no effect on code.
2022-06-17 12:13:01 -07:00
Maximilian Gerhardt
592418d9f3
Minor PIO Docs Fixup (#635)
* Fix link display in PlatformIO Docs, Remove JLink warning

* Remove unfinished sentence
2022-06-17 09:49:51 -07:00
Maximilian Gerhardt
0a23dfeb42
Update PlatformIO board files, add PIO CI (#634)
* Shift arduino attribute higher in JSON file

* Try out PlatformIO CI

* Trigger CI

* Clone recursively, actually use own repo

* Fix YAML

* Build Verbose

* Revert to checkout@v2 version, add TinyUSB to examples

* Try fix TInyUSB example

* Pull repo recursively

* Use v3 after all, correct path to example

* Only do CI on PR
2022-06-17 08:57:18 -07:00
Maximilian Gerhardt
4a94677ee5
Update PlatformIO builder script and docs (#633)
* Update board generation, use renamed function

* Update documentation with new platform integration state

* Remove accidentally pushed file

* Use correct update command

* Use correct highlighting

* Use correct language

* Add section on debugging

* Add docs on filesystem, minor corrections

* Use -iprefix in compilation, but still expose all include paths to IDE

* Add exception and RTTI support, document them

* Fix typo
2022-06-16 18:59:46 -07:00
mnltake
3414b73172
Add analogReadResolution() docs (#631) 2022-06-16 08:16:58 -07:00
Pontus Oldberg
3bcbb24603
Updated helper class for Challenger NB board. (#629) 2022-06-15 09:16:47 -07:00
Ha Thach
26752f6f90
Aadd f_cpu 120, 240 mhz option (#628) 2022-06-15 09:12:43 -07:00
Earle F. Philhower, III
8999ec2c7a Add Platform.IO publish to release process 2022-06-14 13:07:19 -07:00
Earle F. Philhower, III
778cf4cb9e Update version 2022-06-14 12:34:22 -07:00
Earle F. Philhower, III
b6a9e756e4 Remove unneeded and invalid file changes
The makever script sets up the repo properly, so no need to patch things
in the package stage.
2022-06-14 12:32:26 -07:00
Earle F. Philhower, III
285c964c98 Update version 2022-06-14 12:05:48 -07:00
Earle F. Philhower, III
1d6f66f834
Shrink flash and RAM usage even more (#627)
Remove MIDI support from the core's main TinyUSB.  MIDI is still supported
using the Adafruit TinyUSB library, just like before (the core never
did use it).

Compile the Pico-SDK using `-Os`

Remove unneeded warning in UF2 upload

Blink.ino shows a savings of 3.5KB flash and 400 bytes of RAM.

For comparison, with this PR blink.ino reports:
````
Sketch uses 49908 bytes (3%) of program storage space. Maximum is 1568768 bytes.
Global variables use 7024 bytes (2%) of dynamic memory, leaving 255120 bytes for local variables. Maximum is 262144 bytes.
````

As comparison, using the MBED core blink.ino reports:
````
Sketch uses 78882 bytes (0%) of program storage space. Maximum is 16777216 bytes.
Global variables use 42780 bytes (15%) of dynamic memory, leaving 227556 bytes for local variables. Maximum is 270336 bytes.
````

So, with this PR we use **37% less flash** and and **87% less RAM**
for simple sketches.
2022-06-13 11:54:38 -07:00
Earle F. Philhower, III
3fb8cbf39f
Temporary fix for muilticore realloc (#625)
This PR includes a pico-sdk built using the fix in
https://github.com/raspberrypi/pico-sdk/pull/864

To properly fix it requires a new pico-sdk release. but until then I am
building against my own fork of pico-sdk and including the binary.
When 1.3.2 is out (and assuming my PR is approved) I'll update the pico-sdk
link.

Fixes #614
2022-06-12 13:38:02 -07:00
Earle F. Philhower, III
c352105176 Remove IRQ-level malloc from USB setup
Fixes a hang found while debugging #614.  Do all memory allocations and
USB descriptor setup in main code prior to `tusb_init()`.  Avoids potential
deadlock in cases where the app is allocating while the USB port is being
set up.
2022-06-10 22:58:23 -07:00
Earle F. Philhower, III
c4623f4297
Disable Wire slave interrupt on ::end (#621)
Fixes #620
2022-06-10 11:42:04 -07:00
Maximilian Gerhardt
1c85a1ca52
Activate default -Os optimization for Platform.IO (#619) 2022-06-10 09:28:26 -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