Add pico_low_power library#2852
Conversation
Allows for much simpler custom linker scripts
…ript_var variables Means that CMake doesn't need to know the default memory addresses for different platforms
…l files easier Restructured so that it includes the platform-specific files before common ones, so common ones can be overridden
Use new include_linker_script_dir and use_linker_script_file functions to add the linker arguments
Breaking change for Bazel builds using different binary types, instead of setting PICO_DEFAULT_LINKER_SCRIPT to eg `//src/rp2_common/pico_crt0:no_flash_linker_script` it is now `//src/rp2_common/pico_standard_link:no_flash_linker_script`
Treat rp2040 layout (boot2 instead of embedded blocks) as the outlier
|
|
||
| static inline generic_bitset_t *bitset_write_word(generic_bitset_t *bitset, uint word_num, uint32_t value) { | ||
| check_bitset(bitset); | ||
| if (word_num < bitset_word_size(bitset)) { |
There was a problem hiding this comment.
Should this raise an error if word_num >= bitset_word_size(bitset) ?
There was a problem hiding this comment.
This is a question for @kilograham, but given that the other functions don't throw any errors when you attempt to pass a value that is outside the range and just return 0/do nothing, I think this one should also not throw an error?
Add low_power_xx_for_ms functions, which handle starting AON timer if necessary Add low_power_set_external_clock_source function to avoid the need to have src_hz and gpio_pin in the arguments passed to low_power_dormant_until_aon_timer, and for RP2040 you just need to call low_power_set_external_clock_source beforehand (no-op on RP2350) Add DORMANT_CLOCK_SOURCE_DEFAULT and DORMANT_CLOCK_HZ_DEFAULT, so you don't need `#if PICO_RP2040` in user code
|
Latest commit changes the signature for I think this is cleaner than having unused Also adds |
|
Are you happy this is correct now? I can retest if you are. |
Also increase powman_set_power_state timeout when waiting for POWMAN_STATE_WAITING_BITS, as it was sometimes timing out
This writes the calibrated frequency for the LPOSC to improve the accuracy, and switches it back to the default XOSC when waking up
It is unreliable, see RP2040-E10
Yes, I think I'm happy it's ready for retesting now |
peterharperuk
left a comment
There was a problem hiding this comment.
Seems good now. Some examples here if anyone wants them https://github.com/peterharperuk/pico-examples/tree/low_power_examples
Also use low_power_start_aon_timer_at_time_ms in low power tests
…placed between bss and heap Default section_persistent_data.incl now goes into RAM, and you need to override the file to put it at a specific address, to ensure HEAP_LOC is always set correctly in that case
Use external_sleep_timer to check sleeps are actually 2s, and use that instead of rtc_clksrc
The aon_timer test had an infinite while loop
Passes --no-clear arg when not clearing, rather than --clear when clearing, as older picotool doesn't have a --clear flag This will break the build of low_power_test_timers_encrypted unless you use the xip-sram branch of picotool
This adds a pico_low_power library, which allows going to sleep, dormant, and powman pstates.
Also adds bitsets and hardware_rosc, to support the low power stuff.
Includes a possible fix for #2420 to get the bazel rp2040 clang build working
Also requires raspberrypi/picotool#298 when putting persistent data in XIP SRAM
See low_power.h for documentation