-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
esp32/machine_rtc: Add prefix to rtc user mem macro. #5349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Currently on one of my builds I set the user memory size to be zero. RTC.memory() still works but doesn't accept any input and always returns empty, however 8 bytes are still used for the Perhaps if MICROPY_HW_RTC_USER_MEM_MAX is 0, we should also not compile any of the code related to RTC user memory. |
This change looks ok to me.
Yeah, I guess if the user is setting this to 0 they really want the maximum amount of RTC memory for their own use, and so would never use |
I've added optional compilation for when the user memory size is zero, and I have made a couple changes regarding choice of integer sizes and their usage to decrease code & memory footprint. I've tested the functionality with |
Great, looks good (except for comment above).
It's ok, no need, I do this anyway as part of the merge process. |
Direct access to RTC memory is a smaller code footprint. If you're satisfied then I'm happy for this to merge 💯 |
When working with ESP32 C modules, you may want to put symbols/data/code in to RTC memory so that you can write a deepsleep stub, or use the ULP on the ESP32. When doing so, the RTC memory region can sometimes overflow at linker time due to the allocations made within the ESP32 RTC module.
This fix allows modifying the size of that memory region in your board config to decrease the size, by adding
#define MICROPY_HW_RTC_USER_MEM_MAX 512
for example, the RTC module's user memory region would be decreased from 2K to 512 bytes, giving you space for other content outside of MicroPython.This fix both renames the macro to something more suited for configuration use and allows it to be defined outside of the RTC module.