Persistent pstate improvements #3192
No reviewers
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk!3192
Loading…
Reference in a new issue
No description provided.
Delete branch "powman-fixups"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This now determines the persistent pstate at link time and uses that in
low_power_persistent_pstate_get, rather than calculating it at runtime (it cannot be done at compile time, because it depends on the size and location of the persistent data section).I've kept the option for runtime calculation by setting
PICO_LOW_POWER_PERSISTENT_PSTATE_STATIC=0(e.g. custom linker scripts that don't provide the new__persistent_data_pstate__), with the logic copied from the linker script to avoid differing logic in the two places. Also added tests to make sure they give the same value.Add
pstate_bitset_to/from_uint32for use with scratch registers and with__persistent_data_pstate__, rather thanpowman_power_statedirectlyAlso add
pstate_resume_func_commonfor commonpstate_resume_funcstuff in tests, rather than duplicating it everywhereSorry, dumb questions... what's the advantage of doing this at link time rather than runtime? Is PICO_LOW_POWER_PERSISTENT_PSTATE_STATIC a good name. I guess PICO_LOW_POWER_PERSISTENT_PSTATE_RUN_TIME=1 would be more obvious to me (to get back the old behaviour?)
It saves about 100 bytes of code, and about half that in CPU cycles
Yeah, the variable name probably needs improvement -
PICO_LOW_POWER_PERSISTENT_PSTATE_RUN_TIMEis probably better@ -5,0 +28,4 @@ASSERT(__persistent_data_end__ - __persistent_data_start__ <= SRAM_STRIPED_END - SRAM_BASE, "Persistent data is too large")/* Assert end is in striped sram */ASSERT(__persistent_data_end__ <= SRAM_STRIPED_END, "Persistent data ends outside striped sram")Is <= right?
@ -704,0 +702,4 @@/* start in sram0, so OR that in */__persistent_data_pstate__ |= ((uint32_t)__persistent_data_start__ >= SRAM_BASE && (uint32_t)__persistent_data_start__ < SRAM4_BASE) ? POWMAN_POWER_DOMAIN_SRAM_BANK0_BITS : 0;ditto
@ -5,0 +28,4 @@ASSERT(__persistent_data_end__ - __persistent_data_start__ <= SRAM_STRIPED_END - SRAM_BASE, "Persistent data is too large")/* Assert end is in striped sram */ASSERT(__persistent_data_end__ <= SRAM_STRIPED_END, "Persistent data ends outside striped sram")Yes, for the end checks, as the end address is set to the next address you can place data
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.