Commit Graph

288 Commits

Author SHA1 Message Date
1552324a64 Add mbedtls_hardware_poll implementation to pico_mbedtls 2023-01-27 11:15:22 -06:00
45d2dc4c95 add missing pico_rand dependency (#1203) 2023-01-27 10:48:20 -06:00
729c7f4326 Tweaks to section-attribute stuff in platform.h (#1202) 2023-01-27 08:05:11 -06:00
fefb6b6d1e Move more code from pico_cyw43_arch to pico_cyw43_driver (#1201)
Basically the integration code (cyw43_config.h and related implementations) are now in the driver.
cyw43_arch now just has
  * async_context creation per CYW43_ARCH_TYPE
  * pre-existing cyw43_arch methods for connect etc.
2023-01-26 16:05:29 -06:00
b70f984f2a Add pico_rand library (#1111)
Add a general purpose random number generator via pico_rand library. which tries to use as much real entropy as possible mixed into a PRNG

Co-authored-by: graham sanderson <graham.sanderson@raspberrypi.com>
2023-01-26 13:25:27 -06:00
67af83f069 Fix compile issue with clock_t conversion (#1200)
We don't enable -Wconversion on the kitchen-sink build. But it's
enabled for some tinyusb examples.
2023-01-26 13:11:42 -06:00
b979395c5e Keep retrying if cyw43_wifi_join fails (#1195)
Currently, if the network can't be found we fail almost immediately.
Also fix error codes.

Fixes #1054
2023-01-26 11:28:04 -06:00
260df95e44 tinyusb: enable workaround for RP2040-E15 (#1137)
This sets the compile-time flag for tinyusb's dcd_rp2040 driver by
default. Applications that won't ever be plugged into a Pi 4 or Pi 400
can optionally disable this.
2023-01-25 17:19:23 -06:00
9a5eae111b fix compiler warning (#1193) 2023-01-25 11:41:45 -06:00
248fc72f96 Remove (legacy) direct inclusion of 'pico/platform.h' and 'pico/config.h' (#1190)
* Remove (legacy) direct inclusion of 'pico/platform.h' which potentially skip config/board setup
* also fix direct use of pico/config.h which predated pico.h being assembly includable
2023-01-24 12:03:48 -06:00
a540ca905a Add new async_context abstraction and refactor cyw43_arch to use it (#1177)
* Extract all poll/threadsafe_background/freertos from cyw43_arch into new abstraction async_context:
* provides support for asynchronous events (timers/IRQ notifications) to be handled in a safe context.
* now guarantees all callbacks happen on a single core.
* is reusable by multiple different libraries (stdio_usb can now be ported to this but hasn't been yet).
* supports multiple independent instances (independent instances will not block each other).
* cyw43_arch libraries cleaned up to use the new abstraction. Note each distinct cyw43_arch type is now a very thin layer that creates the right type of context and adds cyw43_driver and lwip support as appropriate.

Additionally,

* Add new pico_time and hardware_alarm APIs
* Add from_us_since_boot()
* Add alarm_pool_create_with_unused_hardware_alarm()
* Add alarm_pool_add_alarm_at_force_in_context()
* Add hardware_alarm_claim_unused()
* Add hardware_alarm_force_irq()
* Added panic_compact() and some minor comment cleanup; moved FIRST_USER_IRQ define to platform_defs.h
2023-01-24 12:01:24 -06:00
c578422528 Remove PLL postdiv assert. Fixes #1047 (#1189) 2023-01-24 09:10:05 -06:00
177b0303dd SYS funcs and GCC12 fixes (#1186)
* SYS functions and GCC 12 fixes

* Add implementation of _gettimeofday and settimeofday, _times
* Remove some GCC warnings about unimplemented SYS functions (e.g. _open) by making weak implementations that return errors.
* Removed _exit from crt0.S since we have a weak version in runtime.c and we don't want two weak impls since the linker can't pick. If the user omits runtime.c then they'll need to provide _exit or get the error
* Add sys/time.h to arch/cc.h for lwIP as it seems under GCC12 this is not getting included
2023-01-24 09:00:26 -06:00
a66ba7a942 user_irqs should be claimed globally not per core, since vector tabes are shared (#1183) 2023-01-24 08:58:01 -06:00
8b8778c59b compile issue seems to have snuck thru (#1184) 2023-01-20 16:47:23 -06:00
aaf0828250 change clock_gpio_init to take float and add clock_gpio_init_int_frac (#1178) 2023-01-20 15:45:18 -06:00
2e45d8ec65 Update source code to use the correct bit - fixes #993 (#1180) 2023-01-20 09:10:01 -06:00
885bd922cf Ability to set USB device as self powered device (#1105) 2023-01-19 16:49:00 -06:00
35787255af Avoid generating garbage input due to initialization (#1125)
First mapping the GPIO pins to the UART peripheral before enabling the UART peripheral avoids generation of garbage character on the UART's input.
2023-01-19 16:39:19 -06:00
13a171a971 Small doxygen fixes (#1092) 2023-01-19 16:38:14 -06:00
73dcbec837 Improved code format (#1146) 2023-01-19 16:24:26 -06:00
88bc4f974c cleanup header guard names to be consistent (#1179) 2023-01-18 08:40:10 -06:00
419eb739c2 Disable linker warning (#1114)
In arm-gnu-toolchain-12.2 we see this warning, that's not relevant to
pico. Disable it.

warning: blink.elf has a LOAD segment with RWX permissions

Fixes #1029
2023-01-17 16:46:02 -06:00
488bd66eb3 Fix conflicting C++ linkage for pico_lwip panic() (#1167) 2023-01-09 09:49:25 -06:00
0b52603667 Fix build issues with spaces and parentheses (#1136)
Add VERBATIM to add_custom_command

Fixes #1043
2022-12-06 18:45:57 -05:00
56594e75af Allow changing the USB VID, PID, manufacturer, and product via CMake (#1130) 2022-12-03 05:39:01 +00:00
0ef07e5215 Fix the description of stdio_flush() (#1095)
Closes #1094
2022-11-24 09:05:00 -06:00
887c0b8443 IRQ on CYW43_PIN_WL_HOST_WAKE not gpio13 (#1069)
fix bug #1068 where the raw irq handler that was added masked on IO_IRQ_BANK0 (defined as 13) and not the gpio connected to the CYW43 i.e.  CYW43_PIN_WL_HOST_WAKE

Co-authored-by: andrew arm <armdev@openlx.org.uk>
2022-11-24 08:42:25 -06:00
5258ee640b Add new DMA sniffer's API (#887) 2022-11-02 09:25:27 -05:00
e4da37cf0c Fix for cyw43 driver working with SMs other than 0 (#1080) 2022-10-27 16:06:33 -05:00
16ab2b21ba Remove incorrect override for LWIP_PLATFORM_ASSERT (#1064)
* Remove incorrect override for LWIP_PLATFORM_ASSERT

LWIP_PLATFORM_ASSERT macro is used by lwip driver implementations to specify the behavior of the assertions in lwip code.

The previous override of this macro incorrectly assumed that the parameter to the function macro was the condition to check. However this is incorrect. The parameter is actually a message string defining what failed. 

This mistake caused all assertions to be ignored. ( and myself to loose many hours of debugging time )

By removing this, we restore the default behavior specified by lwip which is to use `printf` to log the message.

* I think i prefer to use panic (which doesn't pull in fflush etc)

Co-authored-by: Graham Sanderson <graham.sanderson@gmail.com>
2022-10-21 08:57:21 -05:00
b0294d6bf4 fix build without mbedtls submodule initialized, and fix deoptimized debug build (#1067) 2022-10-17 11:34:10 -05:00
3bd7a829db Some optimizations for the hardware divider (#1033)
* Remove unnecessary wait in pico_divider.

There is no need to wait if there is more than 8 cycles between setup and result readout.
Dividend/divisor readout should be correct without delay. Update comment to reflect that.

* Optimize hw_divider_save_state/hw_divider_restore_state.

Doing multiple pushes to avoid stack usage is faster.
The wait loop in hw_divider_save_state had an incorrect branch in the wait loop.
This didn't matter since the wait wasn't necessary to begin with.

* Remove pointless aligns in hardware_divider.

The regular_func_with_section inserts a new section so if aligning
is desired it should be placed in the macro after section start.

* Save a few bytes in hardware_divider.

Signed and unsigned code can use the same exit code.
Branching to the common code is free since we need the 8 cycle
delay anyway.
2022-10-16 17:40:22 -05:00
587ac803c5 Avoid compound assignment with volatile left operand as described in #1017 (#1018)
also move to use of hw_set_bits where appropriate
2022-10-16 17:24:23 -05:00
719d5e41a2 Add mbedtls to pico-sdk (#894)
* Add mbedtls as a submodule

Checked out on branch mbedtls-2.28

* Add mbedtls to pico-sdk

Link your code to pico_lwip_mbedtls and pico_mbedtls.
See tls_client example in pico-examples

Fixes https://github.com/raspberrypi/pico-sdk/issues/893
2022-10-16 16:41:21 -05:00
8e014e6b5d Make sure OUT_STICKY is not set when setting pins / pindirs (#989) 2022-10-16 16:39:44 -05:00
c4f37b2e44 Lwip build fixes (#1011)
Only build lwip acd.c if it exists (after 2.1.3)
Some mdns files only exist in 2.2.x

Fixes #1009
2022-10-16 16:38:42 -05:00
24bb3627cf PLL REFDIV values > 1 considered by vcocalc.py (#952) 2022-10-05 19:06:26 -05:00
3ed9e2fb1e Avoid initializing full stdio_stack_buffer object with zeros (#992) 2022-09-26 11:49:16 -05:00
98aba25e64 Make __get_current_exception inline (#1016)
not `static` inline, so we keep an implementation around if needed (someone might have called it from assembly)
2022-09-12 15:28:18 -05:00
849cdf8a30 Typo in float_aeabi.S: srqtf => sqrtf (#702) 2022-09-12 13:44:38 -05:00
5e9eb27ac2 Implement whole-buffer write semihosting (#1013)
* Implement whole-buffer write semihosting

Each semihosting call is very slow, so doing it for each character
does not provide an ideal developer experience.

This change allows the entire buffer to be printed out in a single call.
2022-09-12 13:20:30 -05:00
189d377be2 Only include mutex header if necessary (#991) 2022-09-06 11:00:51 -05:00
07e5caf341 Supress -Wunused-parameter when PICO_STDIO_ENABLE_CRLF_SUPPORT is unset (#998) 2022-09-06 10:59:48 -05:00
0041f4b7fd set CYW43_WIFI_NVRAM_INCLUDE_FILE allowing user override 2022-09-01 14:10:06 -05:00
89bce613ae Remove hw_set_bits from pio->irq (#978)
It is not known if this is required. This is done for consistency purposes. Related to #974
2022-08-18 08:14:40 -05:00
830e867211 Fix dma_irqn_acknowledge_channel (#977)
Also dma_channel_acknowledge_irq0 and dma_channel_acknowledge_irq1.
Using hw_set_bits acked every channel because INTS0/1 are WC registers.

Fixes #974.
2022-08-17 14:37:50 -05:00
00780f0de9 Make sure stack is 8 byte aligned in shared IRQ handlers (#971) 2022-08-17 10:25:23 -05:00
80cde7276d Enable/disable connection check made with DTR (#932)
* Enable/disable connection check made with DTR
this gives users the option to disable DTR check.

Co-authored-by: Graham Sanderson <graham.sanderson@gmail.com>
2022-08-10 09:16:44 -05:00
a33a11ea16 Call cyw43_deinit() from cyw43_arch_deinit() to release the DMA channels and power off the WLAN chip (#965) 2022-08-10 07:55:54 -05:00