Skip to content
Merged
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
18 changes: 12 additions & 6 deletions targets/CMSIS-OS/ChibiOS/common/targetHAL_ConfigurationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// provided as weak so it can be replaced at target level, if required because of the target implementing the storage with a mechanism other then saving to flash
__nfweak void ConfigurationManager_Initialize()
{
// init g_TargetConfiguration
memset(&g_TargetConfiguration, 0, sizeof(HAL_TARGET_CONFIGURATION));

// enumerate the blocks
ConfigurationManager_EnumerateConfigurationBlocks();
};
Expand Down Expand Up @@ -151,8 +154,9 @@ __nfweak bool ConfigurationManager_StoreConfigurationBlock(void* configurationBl

if(configuration == DeviceConfigurationOption_Network)
{
if( g_TargetConfiguration.NetworkInterfaceConfigs->Count == 0 &&
configurationIndex == 0 )
if( g_TargetConfiguration.NetworkInterfaceConfigs == NULL ||
( g_TargetConfiguration.NetworkInterfaceConfigs->Count == 0 &&
configurationIndex == 0 ))
{
// there is no network config block, we are storing the default one
// THIS IS THE ONLY CONFIG BLOCK THAT'S AUTO-CREATED
Expand Down Expand Up @@ -182,8 +186,9 @@ __nfweak bool ConfigurationManager_StoreConfigurationBlock(void* configurationBl
}
else if(configuration == DeviceConfigurationOption_Wireless80211Network)
{
if( g_TargetConfiguration.Wireless80211Configs->Count == 0 ||
(configurationIndex + 1) > g_TargetConfiguration.Wireless80211Configs->Count)
if( g_TargetConfiguration.Wireless80211Configs == NULL ||
(g_TargetConfiguration.Wireless80211Configs->Count == 0 ||
(configurationIndex + 1) > g_TargetConfiguration.Wireless80211Configs->Count))
{
// there is no room for this block, or there are no blocks stored at all
// failing the operation
Expand All @@ -201,8 +206,9 @@ __nfweak bool ConfigurationManager_StoreConfigurationBlock(void* configurationBl
}
else if(configuration == DeviceConfigurationOption_X509CaRootBundle)
{
if( g_TargetConfiguration.CertificateStore->Count == 0 ||
(configurationIndex + 1) > g_TargetConfiguration.CertificateStore->Count)
if( g_TargetConfiguration.Wireless80211Configs == NULL ||
(g_TargetConfiguration.CertificateStore->Count == 0 ||
(configurationIndex + 1) > g_TargetConfiguration.CertificateStore->Count))
{
// there is no room for this block, or there are no blocks stored at all
// failing the operation
Expand Down