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

[QPG] Added boot reason and reboot count implementation #23949

Merged
merged 6 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions src/platform/qpg/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ CHIP_ERROR ConfigurationManagerImpl::Init()
{
CHIP_ERROR err;
uint32_t rebootCount;
qvResetReason_t qvRebootReason;
BootReasonType bootReason;

// Initialize the generic implementation base class.
err = Internal::GenericConfigurationManagerImpl<QPGConfig>::Init();
Expand All @@ -74,12 +76,38 @@ CHIP_ERROR ConfigurationManagerImpl::Init()
SuccessOrExit(err);
}

if (!QPGConfig::ConfigValueExists(QPGConfig::kCounterKey_BootReason))
qvRebootReason = qvCHIP_GetResetReason();

switch (qvRebootReason)
{
err = StoreBootReason(to_underlying(BootReasonType::kUnspecified));
SuccessOrExit(err);
case qvResetReason_HW_BrownOutDetected: {
bootReason = BootReasonType::kBrownOutReset;
break;
}

case qvResetReason_HW_Watchdog: {
bootReason = BootReasonType::kHardwareWatchdogReset;
break;
}

case qvResetReason_HW_Por: {
bootReason = BootReasonType::kPowerOnReboot;
break;
}

case qvResetReason_SW_Por: {
bootReason = BootReasonType::kSoftwareReset;
break;
}

default:
bootReason = BootReasonType::kUnspecified;
break;
}

err = StoreBootReason(to_underlying(bootReason));
SuccessOrExit(err);

err = CHIP_NO_ERROR;

exit:
Expand Down
3 changes: 2 additions & 1 deletion src/platform/qpg/qpgConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ CHIP_ERROR QPGConfig::ClearConfigValue(Key key)

bool QPGConfig::ConfigValueExists(Key key)
{
return qvCHIP_Nvm_ValueExists(key, NULL);
uint16_t dummy = 0;
return qvCHIP_Nvm_ValueExists(key, &dummy);
}

CHIP_ERROR QPGConfig::FactoryResetConfig(void)
Expand Down
8 changes: 4 additions & 4 deletions third_party/qpg_sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,21 @@ static_library("qpg_bootloader_lib") {

qpg_make_build("qpg_openthread_glue") {
make_sources = [ "${qpg_sdk_root}/Components/Qorvo/Matter" ]
make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_qpg6105_mtd/libOpenThreadQorvoGlue_${qpg_target_ic}_mtd.a" ]
make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_qpg6105_ftd/libOpenThreadQorvoGlue_${qpg_target_ic}_ftd.a" ]
make_args = [
"-f",
rebase_path(qpg_sdk_root, root_build_dir) + "/Libraries/Qorvo/OpenThreadQorvoGlue/Makefile.OpenThreadQorvoGlue_${qpg_target_ic}_mtd",
rebase_path(qpg_sdk_root, root_build_dir) + "/Libraries/Qorvo/OpenThreadQorvoGlue/Makefile.OpenThreadQorvoGlue_${qpg_target_ic}_ftd",
"FREERTOS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) +
"/third_party/freertos/repo",
"MBEDTLS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) +
"/third_party/mbedtls/repo",
"OPENTHREAD_REPO_DIR =" + rebase_path(chip_root, root_build_dir) +
"/third_party/openthread/repo",
"WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) +
"/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_${qpg_target_ic}_mtd",
"/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_${qpg_target_ic}_ftd",
]
}
static_library("qpg_openthread_glue_lib") {
deps = [ "${chip_root}/third_party/qpg_sdk:qpg_openthread_glue" ]
libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_qpg6105_mtd/libOpenThreadQorvoGlue_${qpg_target_ic}_mtd.a" ]
libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_qpg6105_ftd/libOpenThreadQorvoGlue_${qpg_target_ic}_ftd.a" ]
}
2 changes: 1 addition & 1 deletion third_party/qpg_sdk/repo
Submodule repo updated 175 files