Skip to content
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 Key Value Storage implementation for EFR32 platform. #4367

Merged
merged 4 commits into from
Jan 27, 2021

Conversation

rgoliver
Copy link

Problem

Add the implementation for the Key Value Storage API on the EFR32 Platform using the pigweed KVS.

Summary of Changes

  • Add support for pigweed logs
  • Update the pigweed repo to support C++14
  • Add the KVS implementation for the EFR32 Platform, this is wrapped in macros so is off by default.
  • Add a new example app which tests and demonstrates the KVS on EFR32.

Rob Oliver added 2 commits January 15, 2021 09:33
Add a small module which connects pigweed logs to CHIP logging.
Adds support for C++14 KVS.
src/platform/EFR32/KeyValueStorage.cpp Outdated Show resolved Hide resolved
examples/persistent-storage/README.md Outdated Show resolved Hide resolved
src/platform/EFR32/KeyValueStorage.cpp Outdated Show resolved Hide resolved
examples/persistent-storage/KeyValueStorageTest.cpp Outdated Show resolved Hide resolved
examples/persistent-storage/KeyValueStorageTest.cpp Outdated Show resolved Hide resolved
examples/persistent-storage/KeyValueStorageTest.h Outdated Show resolved Hide resolved
examples/persistent-storage/efr32/.gn Outdated Show resolved Hide resolved
src/platform/EFR32/KeyValueStorage.cpp Outdated Show resolved Hide resolved
src/platform/EFR32/KeyValueStorage.h Outdated Show resolved Hide resolved
examples/build_overrides/efr32_sdk.gni Outdated Show resolved Hide resolved
examples/build_overrides/efr32_sdk.gni Outdated Show resolved Hide resolved
size_t offset_bytes) const
{
assert(CHIP_KVS_AVAILABLE);
auto status_and_size = mKvs.Get(key, std::span<std::byte>(reinterpret_cast<std::byte *>(value), value_size), offset_bytes);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't std::span C++20 and std::byte C++17?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are provided by pigweed.

src/platform/EFR32/KeyValueStoreManagerImpl.cpp Outdated Show resolved Hide resolved

pw::StatusWithSize Write(Address destination_flash_address, std::span<const std::byte> data) override
{
return pw::StatusWithSize(MscStatusToPwStatus(MSC_WriteWord(reinterpret_cast<uint32_t *>(destination_flash_address),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reinterpret_cast looks like undefined behavior. What if I pass in a span that's not 32 bit aligned?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface is private and only available to the KVS object which is provided the alignment. I'll add some asserts though just in case.

Use the pigweed KVS to implement persitent storage on the EFR32
platform. Only gets included when the application defined the KVS
macros.
@rgoliver rgoliver force-pushed the kvs_efr branch 2 times, most recently from 0af75e6 to 983f045 Compare January 22, 2021 16:40
Add an example app which tests the KVS api.
@mspang mspang merged commit bf60cc2 into project-chip:master Jan 27, 2021
austinh0 pushed a commit to austinh0/connectedhomeip that referenced this pull request Jan 28, 2021
…p#4367)

* Add pigweed logging backend for CHIP

Add a small module which connects pigweed logs to CHIP logging.

* Update pigweed repo

Adds support for C++14 KVS.

* Add KVS implementation for EFR32 platform

Use the pigweed KVS to implement persitent storage on the EFR32
platform. Only gets included when the application defined the KVS
macros.

* Add persistent storage test/example

Add an example app which tests the KVS api.
austinh0 pushed a commit to austinh0/connectedhomeip that referenced this pull request Jan 28, 2021
…p#4367)

* Add pigweed logging backend for CHIP

Add a small module which connects pigweed logs to CHIP logging.

* Update pigweed repo

Adds support for C++14 KVS.

* Add KVS implementation for EFR32 platform

Use the pigweed KVS to implement persitent storage on the EFR32
platform. Only gets included when the application defined the KVS
macros.

* Add persistent storage test/example

Add an example app which tests the KVS api.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants