Commit graph

1320 commits

Author SHA1 Message Date
William Vinnicombe
a0be7cdab5 Add some doxygen to bitset.h, and tidy up some macros 2026-03-10 13:53:35 +00:00
William Vinnicombe
6e1b122c36 Fix some returns 2026-03-10 13:08:16 +00:00
William Vinnicombe
da91b86c15 Review fixups
Add NUM_IRQ_WORDS define, and make it give correct value

`low_power_sleep_until_pin_state` and dormant equivalent now return 0, so they can return errors if those are added in future
2026-03-10 12:00:22 +00:00
will-v-pi
70f69b9446
Apply suggestions from code review to low_power.c and low_power.h 2026-03-10 10:18:05 +00:00
will-v-pi
0b769cd20a
Apply documentation suggestions from code review to low_power.h
Co-authored-by: Andrew Scheller <lurch@durge.org>
2026-03-10 10:04:21 +00:00
William Vinnicombe
52e8d5b430 Use gmtime_r instead of localtime_r on Clang
Some Clang versions (eg the one currently used by Bazel) don't have the localtime_r function
2026-03-06 17:23:44 +00:00
William Vinnicombe
51cedb0b2c Tidy up some comments 2026-03-06 16:04:04 +00:00
William Vinnicombe
8286086548 Tidy up comments, and add more docs 2026-03-06 16:04:04 +00:00
William Vinnicombe
14eaec2b64 Run clk_sys from ROSC when dormant with DORMANT_CLOCK_SOURCE_LPOSC
Also use measured ROSC freq when going dormant
2026-03-06 16:04:04 +00:00
William Vinnicombe
12d501ce8f Add some docs to low power functions 2026-03-06 16:04:04 +00:00
William Vinnicombe
da9ada5746 Mark rtc_clksrc as rp2040 only in bazel build 2026-03-06 16:04:04 +00:00
William Vinnicombe
988d8169db Add scripts to bazel build
Use new include_linker_script_dir and use_linker_script_file functions to add the linker arguments
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
d8654d953c Make it possible to reference default locations in pico_set_linker_script_var variables
Means that CMake doesn't need to know the default memory addresses for different platforms
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
152c2144cf More de-duplication 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
7dc7007476 Remove pico_ld_constants and use pico_set_linker_script_var 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
1ae7e0b9c8 Add customisable heap location, with pico_set_linker_script_var function 2026-03-06 16:04:04 +00:00
William Vinnicombe
18e65fad16 Separate linker scripts out into include files
Allows for much simpler 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
01a398bd09 Fix hardware_rosc bazel build 2026-03-06 16:04:04 +00:00
William Vinnicombe
22b6c96d40 Fix config check 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
71c3dadd97 Fix powman doc
https://forums.raspberrypi.com/viewtopic.php?t=391783
2026-03-06 16:04:04 +00:00
William Vinnicombe
d6d59d0a48 Use better runtime_init_rp2350_sleep_fix
Use dummy IRQ, rather than a timer
2026-03-06 16:04:04 +00:00
William Vinnicombe
c32de66f23 Add support for sleep, dormant, and powman with tinyusb device and host
Deinit and init tusb as required, and keep clocks on during sleep
2026-03-06 16:04:04 +00:00
William Vinnicombe
d0568c0edd Update xip pinning load map
size of 0 works
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
851dfcb982 Fix infinite loop with no persistent data 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
db151e1302 Add Risc-V crt0 data_cpy skip
Also shrink Arm one, and standardise PICO_NO_FLASH skipped code between them
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
50069f06aa Implement exclusive variable when sleeping
Disables all other interrupts
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