1
0
mirror of https://github.com/raspberrypi/pico-sdk.git synced 2025-09-20 08:02:03 +03:00

70 Commits

Author SHA1 Message Date
Peter Harper
9227cadf84 add pico_status_led (#2501)
Co-authored-by: graham sanderson <graham.sanderson@raspberrypi.com>
2025-07-28 11:56:15 -05:00
Graham Sanderson
4242010f11 Misc cleanup (#2569)
* miscellaneous cleanup:

* cleanup some #ifdefs which were slightly hacky when RP2350 was added; use HAS_ flags in preference to PICO_RP2040/RP2350
* make some dependencies more explicit - i.e. compile if the user doesn't want to include certain libraries
* cleanup some directory A -> directory B relative path names in CMakeLists.txt to be SDK root -> directory B
2025-07-18 09:37:21 -05:00
Graham Sanderson
af518de1c3 add missing libraries to test/kitchen_sink and auto-gen includes (#2567)
* add missing libraries to test/kitchen_sink and auto-gen includes

* bazel fix
2025-07-17 11:32:46 -05:00
Graham Sanderson
d2cdf6c953 add pioasm --version, and print version number in generated files (#2554)
* add pioasm --version, and print version number in generated files

* Hook up pio version string in Bazel build

---------

Co-authored-by: Armando Montanez <amontanez@google.com>
2025-07-15 15:09:36 -05:00
Andrew Scheller
ae332b3522 Ensure each test has a unique name (followup to #2208) (#2443)
mainly by fixing typos!
2025-04-26 12:13:36 -05:00
Peter Harper
f674850f0e Fix DST bug in aon_timer_get_time for rp2040 (#2409)
If you set the timezone, aon_timer_get_time can wrongly apply a
daylight saving time adjustment based on the stack contents. This can
make it appear that time has gone backwards.

Make sure datetime_to_tm initialises tm_isdst to -1.

Fixes #2374
2025-04-11 09:14:26 -07:00
Peter Harper
d47c0c89ce Update mbedtls, lwip and cyw43-driver (#2405)
* Update LwIP to 2.2.1
* Update to mbedtls to 3.6.1
* Update lib/cyw43-driver to 1.1.0
* Support using a more recent version of mbedtls
altcp_tls_mbedtls.c is not compatible with mbedtls 3.x so use a
patched version until this is resolved.
* Make sure MBEDTLS_VERSION_MAJOR is visible to LwIP.
* Test mbedtls in kitchen sink
* Add mbedtls to bazel
2025-04-11 09:14:02 -07:00
Graham Sanderson
0ca463a29f Fix compilation of pico_double_test on llvm 15 - workaround compiler bug (#2258) 2025-02-12 12:46:32 -06:00
Peter Harper
7dfbb3c958 Add a delay after rtc_set_datetime (#2156)
If you call rtc_get_datetime immediately after rtc_set_datetime you get
junk back. According to the datasheet "Writing to the RTC will take
2 clk_rtc clock periods to arrive". So add a delay after calling
rtc_set_datetime in aon_timer_set_time_calendar.

Fixes #2148
2025-02-06 09:24:30 -06:00
Graham Sanderson
e85c3e5515 rationalize pico_float/pico_double libraries (#2208)
* on RP2350 _dcp variant now enables -msoft-float, since if you're using this at all it is likely because you don't want to use the VFP unit at all (to save stack space)
* implement all float_ and double_ conversion functions in all pico_float_pico_ variants and pico_double_pico on RP2040 and RP2350 (many were missing in some combinations)
* provide better granularity of what functions are wrapped in each case

also marked custom_xxx_funcs_test.c as not in bazel build yet
2025-02-04 16:19:17 -06:00
Graham Sanderson
9f95a46e31 fix pico_time_test.c compile on native (#2207) 2025-01-29 09:13:51 -06:00
graham sanderson
f20663cb7f Fix pico_divider_nesting_test.c on RP2350 - was broken due to running faster and hence further on RP2350, breaking a check which was wrong for larger inputs 2025-01-26 13:31:51 -06:00
graham sanderson
a62d17cb42 Add PASSED/FAILED output to cmsis_test.c 2025-01-26 13:30:56 -06:00
Peter Harper
b8dc8c488d Fix ta_wakes_up_on_or_before (#2190)
* Fix ta_wakes_up_on_or_before

Handle target in the past and running for > 2^32 us.

Fixes #2186

* Add test for ta_wakes_up_on_or_before fix
2025-01-20 10:56:23 -06:00
Peter Harper
969f5895aa ta_set_timeout can fail to set an alarm (#2127)
* ta_set_timeout can fail to set an alarm

If alarm_pool_irq_handler takes <1us between handling an alarm and
calling ta_set_timeout then no alarms will be set as it will appear as
if an earlier alarm is already armedi before the target time.

Make sure ta_set_timeout always leaves with an alarm set by checking the
armed status.

Fixes #2118

* ta_disable_irq_handler should unarm its timer
2024-12-06 10:39:04 -06:00
Luke Wren
65d118c342 RISC-V __mulsf3: handle exponent increase due to rounding (#2086) 2024-11-23 13:02:03 -06:00
armandomontanez
338f99ff1c Initial Pico/2 W Bazel support (#2049)
* Initial Pico 2 W Bazel support

Improves compatibility with Pico W and Pico 2 W by fixing issues that
prevented correct linking of wireless libraries.

* Improve correctness and configurability

* Require newer rules_python

* Require rules_python@0.36.0

* Fix missing compatibility expressions

* Minor tweaks

* Minor cleanup

* Update suggested version in Bazel README

* More README tweaks

* Improve Bazel btstack build correctness
2024-11-21 16:58:02 -06:00
Luke Wren
f9eb48bd91 Add XIP cache maintenance API (fixes #2005) (#2013)
* Add XIP cache maintenance API (fixes #2005)

Also add a cache clean to hardware_flash implementations, to avoid
losing pending writes on the subsequent invalidate.

* Fix comment typos, add to docs index, remove unnecessary defaulting of XIP_CACHE assertions on FLASH

* Fix sense of unsigned wrapping test

* update bazel build

---------

Co-authored-by: graham sanderson <graham.sanderson@raspberrypi.com>
2024-11-11 12:09:30 -06:00
Peter Harper
d649c6c77a Add some tests (#1978)
* Test for best_effort_wfe_or_timeout sev issue

best_effort_wfe_or_timeout should not ignore an outstanding sev
See https://github.com/raspberrypi/pico-sdk/issues/1812

* Test for alarm being set in the past issue

See https://github.com/raspberrypi/pico-sdk/issues/1953
2024-11-05 17:27:19 +00:00
armandomontanez
b49d4ec949 Fix Bazel build breakages (#1908)
* Fix Bazel build breakages

* Adds support for new PICO_DEFAULT_UART_BAUD_RATE option.
* Fixes issues related to Picotool and boot_picoboot_headers.
* Adds pico_float RISC-V pieces to the Bazel build (not yet fully
  tested).
* Adds the missing adafruit board header to the Bazel build.

* Exclude hazard3 float test in Bazel validation script

* Restore missing dependency in hardware_boot_lock
2024-09-10 18:44:55 -05:00
Luke Wren
d886df6eb0 Add fast single-precision add/sub/mul for Hazard3 (#1883)
* Add fast single-precision add/sub/mul for Hazard3

* Make test output less noisy. Map -nan to -inf in vector gen. Move random vectors to separate files.

* Re-disable USB stdout for pico_float_test by default...

* Disable pico/float.h exports on RISC-V as these functions aren't implemented

* Add hazard3 instructions to asm_helper. Split hazard3.h to support this.

You can still include hazard3.h to get everything. This just allows you
to pull in less.
2024-08-30 11:36:30 -05:00
Andrew Scheller
7d5d9276a8 Workaround gcc/newlib issue on Ubuntu 24 (#1863) 2024-08-23 10:59:36 -05:00
Graham Sanderson
fab47c8071 Fix Cmsis irq regression (#1821)
* #1817 fix regression with CMSIS interrupt renaming
2024-08-20 08:52:41 -05:00
graham sanderson
efe2103f9b SDK 2.0.0 release 2024-08-08 08:54:38 -05:00
Andrew Fernandes
0996a9e354 Add support for SEGGER RTT STDIO (updated) (#1411) 2024-07-20 20:52:41 -05:00
armandomontanez
6ff3e4fab2 Expand bazel build to include configuration options and broader support. (#1731)
* Add host Bazel build

Updates target_compatible_with across the repo to ensure that wildcard
builds for both host and rp2040 succeed.

* Get unit tests building

* Add Python script to identify build system differences

Uses the build system tags to make it easier to identify differences
between the CMake and Bazel builds.

* Temporarily disable pico divider test

* Support PICO_BARE_METAL in Bazel

* Support PICO_NO_GC_SECTIONS in Bazel

* Support boot2 configuration in Bazel

Adds support for PICO_DEFAULT_BOOT_STAGE2 and
PICO_DEFAULT_BOOT_STAGE2_FILE in the Bazel build.

* Allowlist some CMake-only options

* Support CXX configuration options in Bazel

* Move multiple_choice_flag.bzl

* Support all pico boards

* Support linking multiple stdio implementations

Changes the Bazel build so stdio implementations are no longer mutually
exclusive.

* Add PICO_BOOT_STAGE2_LINK_IMAGE

* Support PICO_CMSIS_PATH in Bazel

* Support PICO_USE_DEFAULT_MAX_PAGE_SIZE in Bazel

* Silence PICO_CMSIS_VENDOR and PICO_CMSIS_DEVICE differences

* Support PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS in Bazel

* Properly support version defines

* Support embedding binary info in Bazel

* Embed build type in binary

* Support different linker scripts in Bazel build

* Finish out missing PICO_BUILD_DEFINE in Bazel build

* Support PICO_NO_TARGET_NAME

* Reorganize initial configuration options in Bazel

Cleans up and reorganizes some of the initial configuration options
added to the Bazel build so everything is consistent.

* Add builds for pioasm and elf2uf2

* Use Python rules from rules_python

* Actually link in output formats in pioasm tool

* Make tools have public visibility

* Add UF2 Bazel aspect

* Add TODOs for pioasm/uf2 helpers

* Fix compile flag typo

* Update Bazel SDK configuration strings to match recent CMake changes

* Fix pico_divider test

* Clean up straggling TODOs

* Clarify pico_stdio_test compatibility

* Initial Bazel Pico W support

* Add new files from develop

* Clean up compatibility expressions in Bazel build

* Clean up rp2 constraint handling in Bazel

* More Bazel docs cleanup

* Format Bazel build files

* Consolidate transitions in the Pico SDK

* Make every _allowlist_function_transition explicit

* More docs cleanup

* Add a few missing defines

* Improve PICO_CONFIG_HEADER correctness in Bazel

* Minor docs clarifications
2024-06-13 09:50:04 -05:00
Andrew Scheller
a6c65b426d Small kitchen-sink fixes (#1707)
- tweak CMakeLists.txt and kitchen_sink.c to be in a more similar order
- add some "missing" headers to kitchen_sink.c
2024-05-19 19:26:30 -05:00
Graham Sanderson
f28bbfd4ec Add new pico_flash library with flash_safe_execute(func) (#1412)
* Add new pico_flash library, with flash_safe_execute(func) method to help with preventing IRQs and other core accessing flash with pico_multicore or FreeRTOS SMP
2023-06-06 11:19:27 -05:00
Graham Sanderson
7f7232541a switch all .S files to unified asm, and use a macro to setup compiler and some other misc changes (#1295)
* switch all .S files to unified asm, and use a new macro `pico_default_asm_setup` to setup compiler to help porting to other compilers. Also some minor tweaks:
* switch some code to use more recent helper methods (e.g. busy_wait_at_least_n_cycles)
* add documentation to host divider header (I had this ages ago and never promoted)
* fixup erroneous docs about 32p32 values in all divider headers
* fix some compiler warnings
* rename recently added `unified_asm` macro to `pico_default_asm`
2023-03-09 17:40:20 -06:00
Graham Sanderson
1ac90374e3 Various small fixes towards building with other compilers (#1285)
* Fix various non-GCC warnings (no effect on GCC)
* Reduce use of typeof since non GCC compilers may not support it
* Introduce PICO_C_COMPILER_IS_GNU, PICO_C_COMPILER_IS_CLANG, PICO_C_COMPILER_IS_IAR to CMake as if (CMAKE_C_COMPILER_ID STREQUAL "xxx") is a bit verbose
* Use "unified_asm" macro for all inline asm (it is "volatile __asm" on GNU with a .syntex unified)
* Use NOLOAD instead of COPY in linker scripts (arguably more correct anyway)
* Use the same style for setting _etext in all 4 linker scripts (to the beginning of .data). Clang aligns .data on a 16 byte boundary. Note ideally we'd
  add a new symbol __data_source, however that would break backwards compatibility with existing user linker scripts
* Use "a" for .stack, .heap sections because clang complains otherwise, and they are explicitly NOLOAD anyway
* Avoid duplicating __sev, __wfe, __wfi which Clang sometimes seems to provide as built-ins
* Add missing kitchen_sink_blocked_ram binary
* Allow build with LLVM Embedded Toolchain Form ARM v 14.0.0 (unsupported atm)
2023-03-01 15:10:18 -06:00
graham sanderson
c8ccefb972 Add Bluetooth support
Co-authored-by: Peter Harper <77111776+peterharperuk@users.noreply.github.com>
2023-02-10 18:27:23 -06:00
Graham Sanderson
18b97fcba0 add new pcio_I2c_slave library (#1205)
* add (slightly modified) pico_i2c_slave library from https://github.com/vmilea/pico_i2c_slave
* introduce VTABLE_FIRST_IRQ constant
2023-02-07 07:47:01 -06:00
Graham Sanderson
cc169ddd68 stdio hardening + new mutex API (#1224)
* * Harden stdio_usb and stdio in general against deadlocks which could otherwise result from doing printfs from within IRQs
* Add a test for the above
* Add mutex_try_enter_block_until API.
* Make best_effort_wfe_or_timeout not use alarms if called from within IRQ
2023-02-06 16:27:39 -06:00
Graham Sanderson
2a9c59925a remove duplicate pico_rand inclusion in kitchen_sink (#1206) 2023-01-27 16:37:47 -06:00
Graham Sanderson
1bd9de95de add pico_rand to kitchen_sink (#1204) 2023-01-27 10:59:59 -06:00
andygpz11
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
Graham Sanderson
605e21ae6f pairing heap free link list gets orphaned when fully depleted (#1120) (#1121)
add some more asserts, and fix test case for debug which was broken by all the assserts slowing it down
2022-12-08 11:14:53 -06:00
Graham Sanderson
b0294d6bf4 fix build without mbedtls submodule initialized, and fix deoptimized debug build (#1067) 2022-10-17 11:34:10 -05:00
Peter Harper
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
graham sanderson
5e9a5e827b Add Pico W and lwIP support 2022-06-30 00:46:13 -05:00
Earle F. Philhower, III
4c49427bf3 Fix auto_init_recursive_mutex definition for C++ (#875)
Co-authored-by: Graham Sanderson <graham.sanderson@gmail.com>
2022-06-20 12:47:46 -05:00
Graham Sanderson
672e48e9e9 Add sem_try_acquire(). Fixes #846 (#856)
Co-authored-by: Geoff Simmons <geoff@uplex.de>
2022-06-08 13:23:36 -05:00
Graham Sanderson
159d552150 Fix bug in irq_remove_shared_handler and add test #823 (#825)
* Fix bug in irq_remove_shared_handler and add test #823

* Add comments to irq_handler_chain.S

Co-authored-by: Luke Wren <wren6991@gmail.com>
2022-05-16 13:44:15 -05:00
Graham Sanderson
04c68c554b cleanup pico_stdlib_test. add actual check for __builtin bitops (#821) 2022-05-10 13:56:48 -05:00
Graham Sanderson
9c616da1e5 fix bug in pico_float_test (#817) 2022-05-10 12:58:55 -05:00
Andrew Scheller
b7e82b638a Fix function-names reported by hardware_pwm_test (#736) 2022-03-22 17:49:17 -05:00
Graham Sanderson
0562089fab fixup __forceinline for cpp code and add kitchen_sink cpp test (#670)
* fix __force_inline for different GCC versions in cpp mode (the affected versions are different from c mode), and build kitchsink.c as a cpp file too for testing
* silly bug in host platform.h
2021-12-08 12:05:49 -06:00
Graham Sanderson
d7358e4ed8 update generated struct headers to fix collision (#641)
* update generated struct headers to fix collision and include all headers in kitchen_sink test
2021-11-01 08:06:34 -05:00
Andrew Scheller
cc1e2e8758 Small typo in kitchen_sink (#642) 2021-10-30 08:29:26 -05:00
Graham Sanderson
83cd1da1ef fix build if TinyUSB not present (#631) 2021-10-25 08:56:25 -05:00