Skip to content

Commit d7cc14b

Browse files
committed
Added changes for the build errores
1 parent 37c9252 commit d7cc14b

File tree

5 files changed

+43
-49
lines changed

5 files changed

+43
-49
lines changed

examples/platform/silabs/SiWx917/BUILD.gn

+5
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ config("silabs-wifi-config") {
190190
if (rs91x_wpa3_transition) {
191191
defines += [ "WIFI_ENABLE_SECURITY_WPA3_TRANSITION=1" ]
192192
}
193+
194+
195+
if (chip_enable_multi_ota_requestor) {
196+
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_MULTI_OTA_REQUESTOR=1" ]
197+
}
193198
}
194199

195200
source_set("siwx917-common") {

src/platform/silabs/SiWx917/BUILD.gn

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
# limitations under the License.
1414

1515
import("//build_overrides/chip.gni")
16-
1716
import("${chip_root}/src/platform/device.gni")
18-
17+
import("${chip_root}/third_party/silabs/efr32_sdk.gni")
1918
import("${chip_root}/build/chip/buildconfig_header.gni")
2019
import("${chip_root}/src/crypto/crypto.gni")
2120
import("${chip_root}/third_party/silabs/silabs_board.gni")

src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <platform/DiagnosticDataProvider.h>
2323
#include <platform/internal/CHIPDeviceLayerInternal.h>
2424
#include <platform/internal/GenericConfigurationManagerImpl.h>
25-
2625
#include <platform/silabs/multi-ota/OTAMultiImageProcessorImpl.h>
2726

2827
using namespace chip::DeviceLayer;
@@ -31,9 +30,11 @@ using namespace ::chip::DeviceLayer::Internal;
3130
static chip::OTAMultiImageProcessorImpl gImageProcessor;
3231

3332
extern "C" {
33+
#if SL_BTLCTRL_MUX
3434
#include "btl_interface.h"
35+
#endif // SL_BTLCTRL_MUX
3536
#include "em_bus.h" // For CORE_CRITICAL_SECTION
36-
#if SL_WIFI
37+
#ifndef SLI_SI91X_MCU_INTERFACE // required for 917 NCP
3738
#include "spi_multiplex.h"
3839
#endif // SL_WIFI
3940
}
@@ -114,7 +115,9 @@ void OTAMultiImageProcessorImpl::HandlePrepareDownload(intptr_t context)
114115

115116
ChipLogProgress(SoftwareUpdate, "HandlePrepareDownload: started");
116117

118+
#ifndef SLI_SI91X_MCU_INTERFACE // required for 917 NCP
117119
CORE_CRITICAL_SECTION(bootloader_init();)
120+
#endif
118121

119122
imageProcessor->mParams.downloadedBytes = 0;
120123

@@ -422,9 +425,9 @@ void OTAMultiImageProcessorImpl::HandleApply(intptr_t context)
422425

423426
// TODO: check where to put this
424427
// ConfigurationManagerImpl().StoreSoftwareUpdateCompleted();
425-
426-
// This reboots the device
428+
#ifndef SLI_SI91X_MCU_INTERFACE // required for 917 NCP
427429
CORE_CRITICAL_SECTION(bootloader_rebootAndInstall();)
430+
#endif
428431
}
429432

430433
CHIP_ERROR OTAMultiImageProcessorImpl::ReleaseBlock()

src/platform/silabs/multi-ota/SiWx917/OTAFirmwareProcessor.cpp

+22-35
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ uint8_t flag = RPS_HEADER;
4646
namespace chip {
4747

4848
// Define static memebers
49-
uint8_t OTAFirmwareProcessor::mReset = false;
49+
//bool OTAFirmwareProcessor::mReset = false;
5050
uint32_t OTAFirmwareProcessor::mWriteOffset = 0;
5151
uint16_t OTAFirmwareProcessor::writeBufOffset = 0;
5252
uint8_t OTAFirmwareProcessor::writeBuffer[kAlignmentBytes] __attribute__((aligned(4))) = { 0 };
@@ -109,24 +109,18 @@ CHIP_ERROR OTAFirmwareProcessor::ProcessInternal(ByteSpan & block)
109109
// should be set to true in HandleProcessBlock
110110
if (status == SL_STATUS_FW_UPDATE_DONE)
111111
{
112-
mReset = true;
112+
//mReset = true;
113113
}
114114
else
115115
{
116116
ChipLogError(SoftwareUpdate, "ERROR: In HandleProcessBlock sl_si91x_fwup_load() error %ld", status);
117-
imageProcessor->mDownloader->EndDownload(CHIP_ERROR_WRITE_FAILED);
118-
return;
117+
// TODO: add this somewhere
118+
// imageProcessor->mDownloader->EndDownload(CHIP_ERROR_WRITE_FAILED);
119+
// TODO: Replace CHIP_ERROR_CANCELLED with new error statement
120+
return CHIP_ERROR_CANCELLED;
119121
}
120122
}
121123
}
122-
if (err)
123-
{
124-
ChipLogError(SoftwareUpdate, "bootloader_eraseWriteStorage() error: %ld", err);
125-
// TODO: add this somewhere
126-
// imageProcessor->mDownloader->EndDownload(CHIP_ERROR_WRITE_FAILED);
127-
// TODO: Replace CHIP_ERROR_CANCELLED with new error statement
128-
return CHIP_ERROR_CANCELLED;
129-
}
130124
mWriteOffset += kAlignmentBytes;
131125
}
132126
}
@@ -147,25 +141,15 @@ CHIP_ERROR OTAFirmwareProcessor::ProcessDescriptor(ByteSpan & block)
147141

148142
CHIP_ERROR OTAFirmwareProcessor::ApplyAction()
149143
{
150-
uint32_t err = SL_BOOTLOADER_OK;
151-
if (err != SL_BOOTLOADER_OK)
152-
{
153-
ChipLogError(SoftwareUpdate, "bootloader_verifyImage() error: %ld", err);
154-
// Call the OTARequestor API to reset the state
155-
GetRequestorInstance()->CancelImageUpdate();
156-
157-
return SL_GENERIC_OTA_ERROR;
158-
}
159-
160-
CORE_CRITICAL_SECTION(err = bootloader_setImageToBootload(mSlotId);)
161-
if (err != SL_BOOTLOADER_OK)
162-
{
163-
ChipLogError(SoftwareUpdate, "bootloader_setImageToBootload() error: %ld", err);
164-
// Call the OTARequestor API to reset the state
165-
GetRequestorInstance()->CancelImageUpdate();
166-
return SL_GENERIC_OTA_ERROR;
167-
}
168-
144+
// This reboots the device
145+
// if (mReset)
146+
// {
147+
// ChipLogProgress(SoftwareUpdate, "M4 Firmware update complete");
148+
// // send system reset request to reset the MCU and upgrade the m4 image
149+
// ChipLogProgress(SoftwareUpdate, "SoC Soft Reset initiated!");
150+
// // Reboots the device
151+
// sl_si91x_soc_soft_reset();
152+
// }
169153
return CHIP_NO_ERROR;
170154
}
171155

@@ -189,19 +173,22 @@ CHIP_ERROR OTAFirmwareProcessor::FinalizeAction()
189173
{
190174
if (status == SL_STATUS_FW_UPDATE_DONE)
191175
{
192-
mReset = true;
176+
// mReset = true;
193177
}
194178
else
195179
{
196180
ChipLogError(SoftwareUpdate, "ERROR: In HandleFinalize for last chunk sl_si91x_fwup_load() error %ld", status);
197-
imageProcessor->mDownloader->EndDownload(CHIP_ERROR_WRITE_FAILED);
198-
return;
181+
182+
// TODO: add this somewhere
183+
// imageProcessor->mDownloader->EndDownload(CHIP_ERROR_WRITE_FAILED);
184+
// TODO: Replace CHIP_ERROR_CANCELLED with new error statement
185+
return CHIP_ERROR_CANCELLED;
199186
}
200187
}
201188

202189
}
203190

204-
return err ? CHIP_ERROR_WRITE_FAILED : CHIP_NO_ERROR;
191+
return status ? CHIP_ERROR_CANCELLED : CHIP_NO_ERROR;
205192
}
206193

207194
} // namespace chip

src/platform/silabs/multi-ota/SiWx917/OTAFirmwareProcessor.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ class OTAFirmwareProcessor : public OTATlvProcessor
3737
CHIP_ERROR Clear() override;
3838
CHIP_ERROR ApplyAction() override;
3939
CHIP_ERROR FinalizeAction() override;
40-
40+
static constexpr size_t kAlignmentBytes = 64;
41+
static bool mReset = false;
42+
static uint32_t mWriteOffset; // End of last written block
43+
// Bootloader storage API requires the buffer size to be a multiple of 4.
44+
static uint8_t writeBuffer[kAlignmentBytes] __attribute__((aligned(4)));
45+
// Offset indicates how far the write buffer has been filled
46+
static uint16_t writeBufOffset;
4147
private:
4248
CHIP_ERROR ProcessInternal(ByteSpan & block) override;
4349
CHIP_ERROR ProcessDescriptor(ByteSpan & block);
@@ -47,13 +53,7 @@ class OTAFirmwareProcessor : public OTATlvProcessor
4753
#if OTA_ENCRYPTION_ENABLE
4854
uint32_t mUnalignmentNum;
4955
#endif
50-
static constexpr size_t kAlignmentBytes = 64;
51-
static uint32_t mWriteOffset; // End of last written block
52-
static uint8_t mSlotId; // Bootloader storage slot
53-
// Bootloader storage API requires the buffer size to be a multiple of 4.
54-
static uint8_t writeBuffer[kAlignmentBytes] __attribute__((aligned(4)));
55-
// Offset indicates how far the write buffer has been filled
56-
static uint16_t writeBufOffset;
56+
5757
};
5858

5959
} // namespace chip

0 commit comments

Comments
 (0)