Commit graph

100 commits

Author SHA1 Message Date
William Vinnicombe
da9ada5746 Mark rtc_clksrc as rp2040 only in bazel build 2026-03-06 16:04:04 +00:00
William Vinnicombe
ce69db060a Add simple overlay demo 2026-03-06 16:04:04 +00:00
William Vinnicombe
f3698dd621 Add pico_add_linker_script_override_path to make overriding individual files easier
Restructured so that it includes the platform-specific files before common ones, so common ones can be overridden
2026-03-06 16:04:04 +00:00
William Vinnicombe
26cee32bb5 Make overriding ram locations simpler 2026-03-06 16:04:04 +00:00
William Vinnicombe
3ce0fd81dc Separate out rp2_common and platform-specific linker script sections 2026-03-06 16:04:04 +00:00
William Vinnicombe
79af57e606 Add kitchen sink test of custom linker scripts 2026-03-06 16:04:04 +00:00
William Vinnicombe
ef57fea213 fixups 2026-03-06 16:04:04 +00:00
William Vinnicombe
c96479599d Fix some kitchen sink errors 2026-03-06 16:04:04 +00:00
William Vinnicombe
27d41e67e6 Add bazel build, and some CMake function docs 2026-03-06 16:04:04 +00:00
William Vinnicombe
999d7cc630 Add encrypted sleep test 2026-03-06 16:04:04 +00:00
William Vinnicombe
bcff0549fc Implement low_power_sleep_until_irq
Add to hello_sleep_gpio test using chars_available_callback
2026-03-06 16:04:04 +00:00
William Vinnicombe
69f8242a51 Add USB support and chars_available callback
Also add no_flash test for RP2350
2026-03-06 16:04:04 +00:00
William Vinnicombe
d35381a57b Persistent data now zeroed on non-persisted boot 2026-03-06 16:04:04 +00:00
William Vinnicombe
a90ee5cecb Make persistent_data NOLOAD
This allows sealing, but does mean you have to initialise it (like uninitialised_data)
2026-03-06 16:04:04 +00:00
William Vinnicombe
66c5479c53 Accept NULL pstate as default 2026-03-06 16:04:04 +00:00
William Vinnicombe
faf5025d5b Add runtime init function to unpin xip cache that isn't persistent data 2026-03-06 16:04:04 +00:00
William Vinnicombe
94754f8dbc Redo memory handling
Now only persists __persistent_data, and adds low_power_persistent_pstate_get function to return the pstate that persists all that data

This uses a new pico_ld_constants.ld file, to allow CMake to modify the addresses of persistent data and the heap

This new __persistent_data is only supported with HAS_POWMAN_TIMER, and does not work if your binary is signed
2026-03-06 16:04:04 +00:00
William Vinnicombe
471abd7a7f Tidy up non-RP2040 defines
Use HAS_POWMAN_TIMER instead
2026-03-06 16:03:17 +00:00
William Vinnicombe
42f33036bd Add skips of data_copy in arm crt0 2026-03-06 16:03:17 +00:00
William Vinnicombe
d9cf06ba33 Demonstrate non-exclusive sleep 2026-03-06 16:03:17 +00:00
William Vinnicombe
657f9ed067 Pass low power state through powman reboot, so software knows what wasn't persisted
Also fix riscv
2026-03-06 16:03:17 +00:00
William Vinnicombe
9bf9fffd7c Add support for RP2040 dormant (using external RTC clock) 2026-03-06 16:03:17 +00:00
William Vinnicombe
83d1e65f1e Fix hello_sleep_gpio on RP2040 2026-03-06 16:03:17 +00:00
William Vinnicombe
9423fb5202 Fix pin_state functions on RP2350
Don't seem to work on RP2040
2026-03-06 16:03:17 +00:00
William Vinnicombe
03cd9ef681 Implement pstate functions 2026-03-06 16:03:17 +00:00
William Vinnicombe
eb89a06c64 Make it compile and work with RP2040 and RP2350
Includes AMY-1782 workaround
2026-03-06 16:03:17 +00:00
graham sanderson
b1cc5ace59 transplant sleep2 onto develop 2026-03-06 16:03:17 +00:00
Graham Sanderson
9a4766867d
Add support for hard float on M33 via CMake variable PICO_HARD_FLOAT_ABI=1 (#2822)
Some checks are pending
Bazel presubmit checks / bazel-build-check (macos-latest) (push) Waiting to run
Bazel presubmit checks / bazel-build-check (ubuntu-latest) (push) Waiting to run
Bazel presubmit checks / other-bazel-checks (push) Waiting to run
Check Configs / check-configs (push) Waiting to run
CMake / build (push) Waiting to run
Build on macOS / build (push) Waiting to run
Build on Windows / build (push) Waiting to run
* Enable hard-float ABI support for pico_float and pico_double on m33

Resolves #2783

Signed-off-by: Andy Lin <andylinpersonal@gmail.com>

* Add (non google) LLVM support, and replace calling convention check with #if defined(__ARM_PCS_VFP)

* switch float.h to use static inline method for int2float() etc in VFP mode rather than #define

* float/double test cleanup - particularly:

- splitting out executable for each test type for pico_float/double_test
- removing undefined behavior from custom_float_funcs_test.c, to de-confuse clang
- add test of denormal->int

Note some tests still fail on llvm libc (at least version 19)

* fix some issues with newer llvm_libc/compiler as used by bazel build

* keep check_configs happy

* another bazel issue

* introduce pico_double_pico_dcp for consistency

* fixup debug output based on previous commit

* remove unnecessary build guard from double_conv_m33.S

* allow -1 for neg_denormal->int rounding towards minus infinity

* Update test/pico_float_test/CMakeLists.txt

Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>

* Update test/pico_float_test/CMakeLists.txt

Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>

* - add fma/_fast functions to pico_float_test/pico_double_test
- fix guard for TEST_SATURATION in pico_double_test - GCC doesn't clamp either

* - double functions were only wrapped in pico_double_pico not pico_double_pico_dcp explicitly (i.e. explicitly setting double impl to pico_dcp was not selecting our versions)

* avoid extra stack alignment push (per review comment)

* fix fma return code in VFP mode (register transfer was the wrong way around)

* separate PCS=VFP and non-PCS-VFP versions of fma_fast

* remove saving_func_return (which is just bx lr) and fold the separate pop of lr, into a pop of pc

* better fix for wrapping right libraries

* rename some labels from _entry (which is an internal entry point) to _softfp to be clear that these are the function entry points which work with softfp calling conventions

* Make bazel pico_float build not wrap SCI functions on RISC-V to match CMake build

* Split out FMAF as a selectable wrapped item since we don't want to wrap it for VFP

* fix typos

* fix test

---------

Signed-off-by: Andy Lin <andylinpersonal@gmail.com>
Co-authored-by: Andy Lin <andylinpersonal@gmail.com>
Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>
2026-03-04 10:22:27 -06:00
armandomontanez
6262b49c74
[bazel] Run buildifier on Bazel build files (#2825)
Some checks are pending
Bazel presubmit checks / bazel-build-check (macos-latest) (push) Waiting to run
Bazel presubmit checks / bazel-build-check (ubuntu-latest) (push) Waiting to run
Bazel presubmit checks / other-bazel-checks (push) Waiting to run
Check Configs / check-configs (push) Waiting to run
CMake / build (push) Waiting to run
Build on macOS / build (push) Waiting to run
Build on Windows / build (push) Waiting to run
This is an automated change with the following commands:

$ find . -name "BUILD.bazel" -o -name "*.bzl" \
  -exec buildifier -lint=fix {} \;

* Add missing `load()` statements for things provided by @rules_cc. This
  is required for Bazel >9.
* Sort attributes on build targets.
* Add missing trailing commas where applicable.
2026-03-02 10:24:17 +00:00
Peter Harper
5986b8386c
Set picotest_error_code in PICOTEST_CHECK_AND_ABORT (#2722)
Fixes #2721
2026-01-05 11:30:19 -06:00
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)
Some checks are pending
Bazel presubmit checks / bazel-build-check (macos-latest) (push) Waiting to run
Bazel presubmit checks / bazel-build-check (ubuntu-latest) (push) Waiting to run
Bazel presubmit checks / other-bazel-checks (push) Waiting to run
Check Configs / check-configs (push) Waiting to run
CMake / build (push) Waiting to run
Build on macOS / build (push) Waiting to run
Build on Windows / build (push) Waiting to run
* 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