-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Add support for battery-backed RAM for STM32 deivces #51721
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
Add support for battery-backed RAM for STM32 deivces #51721
Conversation
49b67ec
to
0e88a04
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add inline
to the static functions that do the parsing
0e88a04
to
bed3dad
Compare
51dfea4
to
f0923ed
Compare
Enabled bbram on some STM32 boards. Confirmed that the driver is built without problems. Added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
f0923ed
to
64a28da
Compare
STM32 battery-backed RAM is organized in 4 byte registers. Number of registers can vary between models from 5 to 32 registers. Usually, the registers are part of RTC. On some variants they are part of tamper module. On STM32F1 the registers are in separate module. For now, only backup registers from RTC are supported. Signed-off-by: Patryk Duda <[email protected]>
Add 'bbram' command which is very convenient tool for examining and modyfying BBRAM content. Examples: Write one byte: $ bbram write backup_regs 0x1 0xaa Write many bytes (starting from 0x13): $ bbram write backup_regs 0x13 0xa 0xb 0xc 0xd 0xe 0xf 0xaa 0xab 0xac Read whole BBRAM: $ bbram read backup_regs Read many bytes (4 bytes starting from address 0x14 in this case): $ bbram read backup_regs 0x14 4 Read one byte (from 0x14 address): $ bbram read backup_regs 0x14 Signed-off-by: Patryk Duda <[email protected]>
Among supported devices only STM32F031, STM32F051, STM32F072 and STM32f09x have 5 4-byte battery-backed RTC registers. Signed-off-by: Patryk Duda <[email protected]>
All STM32F2 devices have 20 4-byte battery-backed RTC registers. Signed-off-by: Patryk Duda <[email protected]>
All supported STM32F3 devices have 4-byte battery-backed RTC registers, but they have different number of registers: STM32F303x8 and STM32F334 have 5 registers. STM32F303xc and STM32F303xe have 16 registers. STM32F302x8 has 20 registers. STM32F373 has 32 registers. Signed-off-by: Patryk Duda <[email protected]>
All STM32F4 devices have 20 4-byte battery-backed backup registers in RTC. Signed-off-by: Patryk Duda <[email protected]>
All STM32F7 devices have 32 4-byte battery-backed RTC registers. Signed-off-by: Patryk Duda <[email protected]>
Add BBRAM entry for all STM32H7 microcontrollers except STM32H7A3 and STM32H7B3 which have backup registers in tamper module. Signed-off-by: Patryk Duda <[email protected]>
All STM32L0 devices have 5 4-byte battery-backed RTC registers. Signed-off-by: Patryk Duda <[email protected]>
All STM32L1 devices have 4-byte battery-backed RTC registers, but they have different number of registers: STM32L151Xb-a has 5 registers. STM32L151Xb has 20 registers. STM32L151Xc, STM32L152Xc, STM32L152Xe have 32 registers. Signed-off-by: Patryk Duda <[email protected]>
STM32L4 devices, except STM32L412 STM32L422 STM32L4P5 STM32L4Q5, have 32 4-byte battery-backed RTC backup registers. Other STM32L4 devices have backup registers in tamper module, not used in Zephyr. Signed-off-by: Patryk Duda <[email protected]>
All STM32WB devices have 20 4-byte battery-backed backup registers in RTC. Signed-off-by: Patryk Duda <[email protected]>
This patch enables STM32 RTC BBRAM in DTS on some STM32 boards for testing purposes. Signed-off-by: Patryk Duda <[email protected]>
This patch makes possible to check if STM32 boards compile with BBRAM support enabled. Signed-off-by: Patryk Duda <[email protected]>
64a28da
to
fbb7c6a
Compare
Rebased and fixed merge conflict |
Hi!
These changes introduce BBRAM support for STM32 devices. For now, only backup registers from RTC are supported.
I also implemented bbram shell command which is convenient tool to examine and modify BBRAM contents.
Any remarks and comments are welcome (especially with regard to DTS).
Best regards,
Patryk