Skip to content

Commit 6ffdd59

Browse files
committed
Update Linker command files and NV regions
1 parent b24d57d commit 6ffdd59

12 files changed

+55
-22
lines changed

src/platform/cc13xx_26xx/ThreadStackManagerImpl.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,14 @@ void ThreadStackManagerImpl::GetExtAddress(otExtAddress & aExtAddr)
204204
memcpy(aExtAddr.m8, extAddr->m8, OT_EXT_ADDRESS_SIZE);
205205
}
206206

207+
bool ThreadStackManagerImpl::IsThreadAttached(){
208+
return _IsThreadAttached();
209+
}
210+
211+
bool ThreadStackManagerImpl::IsThreadEnabled(){
212+
return _IsThreadEnabled();
213+
}
214+
207215
} // namespace DeviceLayer
208216
} // namespace chip
209217

src/platform/cc13xx_26xx/cc13x4_26x4/BUILD.gn

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ static_library("cc13x4_26x4") {
4646
"KeyValueStoreManagerImpl.h",
4747
"PlatformManagerImpl.h",
4848
"SystemPlatformConfig.h",
49+
"../DefaultTestEventTriggerDelegate.cpp",
50+
"../DefaultTestEventTriggerDelegate.h"
4951
]
5052

5153
deps = [ "${chip_root}/src/platform/logging:headers" ]
@@ -58,6 +60,7 @@ static_library("cc13x4_26x4") {
5860

5961
public_deps = [
6062
"${chip_root}/src/crypto",
63+
"${chip_root}/src/app:test-event-trigger",
6164
"${chip_root}/src/platform:platform_base",
6265
]
6366

src/platform/cc13xx_26xx/cc13x4_26x4/OTAImageProcessorImpl.cpp

+19-3
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ bool OTAImageProcessorImpl::IsFirstImageRun()
103103

104104
requestor = GetRequestorInstance();
105105

106-
return (requestor->GetTargetVersion() == runningSwVer) &&
107-
(requestor->GetCurrentUpdateState() == chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kApplying);
106+
return (requestor->GetCurrentUpdateState() == chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum::kApplying);
108107
}
109108

110109
/* makes room for the new block if needed */
@@ -167,7 +166,7 @@ static bool writeExtFlashImgPages(NVS_Handle handle, ssize_t offset, MutableByte
167166
}
168167

169168
/* Erase the MCUBoot slot */
170-
#define BOOT_SLOT_SIZE (0x000F6000) /* must match flash_map_backend */
169+
#define BOOT_SLOT_SIZE (0x000F2000) /* must match flash_map_backend */
171170
static bool eraseExtSlot(NVS_Handle handle)
172171
{
173172
int_fast16_t status;
@@ -200,6 +199,22 @@ static bool eraseExtHeader(NVS_Handle handle)
200199

201200
CHIP_ERROR OTAImageProcessorImpl::ConfirmCurrentImage()
202201
{
202+
OTARequestorInterface * requestor = chip::GetRequestorInstance();
203+
if (requestor == nullptr)
204+
{
205+
return CHIP_ERROR_INTERNAL;
206+
}
207+
208+
uint32_t currentVersion;
209+
uint32_t targetVersion = requestor->GetTargetVersion();
210+
ReturnErrorOnFailure(DeviceLayer::ConfigurationMgr().GetSoftwareVersion(currentVersion));
211+
if (currentVersion != targetVersion)
212+
{
213+
ChipLogError(SoftwareUpdate, "Current software version = %" PRIu32 ", expected software version = %" PRIu32, currentVersion,
214+
targetVersion);
215+
return CHIP_ERROR_INCORRECT_STATE;
216+
}
217+
203218
return CHIP_NO_ERROR;
204219
}
205220

@@ -268,6 +283,7 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context)
268283
}
269284

270285
/* reset SoC to kick MCUBoot */
286+
ChipLogProgress(SoftwareUpdate,"Resetting device to kick off MCUBoot");
271287
SysCtrlSystemReset();
272288
}
273289

src/platform/cc13xx_26xx/cc13x4_26x4/ThreadStackManagerImpl.h

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
9595
void _ProcMessage(otInstance * aInstance);
9696
void GetExtAddress(otExtAddress & aExtAddr);
9797
CHIP_ERROR GetBufferInfo(void);
98+
bool IsThreadAttached(void);
99+
bool IsThreadEnabled(void);
98100

99101
private:
100102
// ===== Methods that implement the ThreadStackManager abstract interface.

src/platform/cc13xx_26xx/cc13x4_26x4/cc13x4_cc26x4_freertos.lds

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ SECTIONS {
212212
/* End of executable code/data, NVS is not part of the OTA image */
213213
PROVIDE (_flash_end_address = .);
214214

215-
/* 5 pages of NV Memory (0x800 each) offset by 1 page for BIM/CCFG */
215+
/* 12 pages of NV Memory (0x800 each) offset by 1 page for BIM/CCFG */
216216
/*.nvs (NOLOAD) : ALIGN(0x2000) { */
217-
.nvs (0xFB800) (NOLOAD) : AT (0xFB800) ALIGN(0x800) {
217+
.nvs (0xF8800) (NOLOAD) : AT (0xF8000) ALIGN(0x800) {
218218
*(.nvs)
219219
} > REGION_TEXT
220220

src/platform/cc13xx_26xx/cc13x4_26x4/cc13x4_cc26x4_freertos_factory_data.lds

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ SECTIONS {
222222
/* End of executable code/data, NVS is not part of the OTA image */
223223
PROVIDE (_flash_end_address = .);
224224

225-
/* 5 pages of NV Memory (0x800 each) offset by 1 page for BIM/CCFG */
225+
/* 12 pages of NV Memory (0x800 each) offset by 1 page for BIM/CCFG */
226226
/*.nvs (NOLOAD) : ALIGN(0x2000) { */
227-
.nvs (0xFB000) (NOLOAD) : AT (0xFB000) ALIGN(0x800) {
227+
.nvs (0xF8800) (NOLOAD) : AT (0xF8800) ALIGN(0x800) {
228228
*(.nvs)
229229
} > REGION_TEXT
230230

src/platform/cc13xx_26xx/cc13x4_26x4/cc13x4_cc26x4_freertos_ota.lds

+7-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ MEMORY
2828
MCUBOOT_HDR (RX) : ORIGIN = 0x00006000, LENGTH = 0x00000080
2929
FLASH (RX) : ORIGIN = 0x00006080, LENGTH = 0x000F8780
3030
/*
31-
* NVS is the last 5 pages of slot, this area is not erased
31+
* NVS is the last 12 pages of slot, this area is not erased
3232
* during OTA. The slot size for the primary and secondary slots
33-
* is therefore 0xF6000 (MCUBoot Header + all the remaining space)
33+
* is therefore 0xF2000 (MCUBoot Header + all the remaining space
34+
* leaves 0xF2800 of space, but the slot size needs to be divisible
35+
* by 4k so the slot size therefore becomes 0xF2000)
3436
*/
35-
/* FLASH_NVS (RX) : ORIGIN = 0x000FC000, LENGTH = 0x00002800 */
37+
/* FLASH_NVS (RX) : ORIGIN = 0x000F8800, LENGTH = 0x00006000 */
3638
FLASH_FACTORY_DATA (R) : ORIGIN = 0x000FE800, LENGTH = 0x900
3739
/*
3840
* Customer Configuration Area and Bootloader Backdoor configuration in
@@ -231,8 +233,8 @@ SECTIONS {
231233
/* End of executable code/data, NVS is not part of the OTA image */
232234
PROVIDE (_flash_end_address = .);
233235

234-
/* 5 pages of NV Memory (0x800 each) at the end of Flash */
235-
.nvs (0xFC000) (NOLOAD) : AT (0xFC000) ALIGN(0x800) {
236+
/* 12 pages of NV Memory (0x800 each) at the end of Flash */
237+
.nvs (0xF8800) (NOLOAD) : AT (0xF8800) ALIGN(0x800) {
236238
*(.nvs)
237239
} > REGION_TEXT
238240

src/platform/cc13xx_26xx/cc13x4_26x4/cc13x4_cc26x4_freertos_ota_factory_data.lds

+7-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ MEMORY
2828
MCUBOOT_HDR (RX) : ORIGIN = 0x00006000, LENGTH = 0x00000080
2929
FLASH (RX) : ORIGIN = 0x00006080, LENGTH = 0x000F8780
3030
/*
31-
* NVS is the last 5 pages of slot, this area is not erased
31+
* NVS is the last 12 pages of slot, this area is not erased
3232
* during OTA. The slot size for the primary and secondary slots
33-
* is therefore 0xF6000 (MCUBoot Header + all the remaining space)
33+
* is therefore 0xF2000 (MCUBoot Header + all the remaining space
34+
* leaves 0xF2800 of space, but the slot size needs to be divisible
35+
* by 4k so the slot size therefore becomes 0xF2000)
3436
*/
35-
/* FLASH_NVS (RX) : ORIGIN = 0x000FC000, LENGTH = 0x00002800 */
37+
/* FLASH_NVS (RX) : ORIGIN = 0x000F8800, LENGTH = 0x00006000 */
3638
FLASH_FACTORY_DATA (R) : ORIGIN = 0x000FE800, LENGTH = 0x900
3739
/*
3840
* Customer Configuration Area and Bootloader Backdoor configuration in
@@ -231,8 +233,8 @@ SECTIONS {
231233
/* End of executable code/data, NVS is not part of the OTA image */
232234
PROVIDE (_flash_end_address = .);
233235

234-
/* 5 pages of NV Memory (0x800 each) at the end of Flash */
235-
.nvs (0xFC000) (NOLOAD) : AT (0xFC000) ALIGN(0x800) {
236+
/* 12 pages of NV Memory (0x800 each) at the end of Flash */
237+
.nvs (0xF8800) (NOLOAD) : AT (0xF8800) ALIGN(0x800) {
236238
*(.nvs)
237239
} > REGION_TEXT
238240

third_party/ti_simplelink_sdk/mcuboot/flash_map_backend.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
#define BOOT_SECONDARY_2_BASE_ADDRESS (BOOT_SECONDARY_1_BASE_ADDRESS + BOOT_SECONDARY_1_SIZE)
7878
#define BOOT_SECONDARY_2_SIZE BOOT_SLOT_2_SIZE
7979
#else
80-
#define BOOT_SLOT_1_SIZE 0x000F6000
80+
#define BOOT_SLOT_1_SIZE 0x000F2000
8181

8282
/* Internal Flash locations */
8383
#define BOOTLOADER_BASE_ADDRESS 0x00000000

third_party/ti_simplelink_sdk/mcuboot/mcuboot_config/mcuboot_config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define MCUBOOT_DOWNGRADE_PREVENTION
2828
#define MCUBOOT_HAVE_LOGGING 1
2929
#define MCUBOOT_IMAGE_NUMBER 1
30-
#define MCUBOOT_MAX_IMG_SECTORS 492
30+
#define MCUBOOT_MAX_IMG_SECTORS 484
3131
#define MCUBOOT_OVERWRITE_ONLY
3232
#define MCUBOOT_SIGN_EC256
3333
#define MCUBOOT_USE_FLASH_AREA_GET_SECTORS

third_party/ti_simplelink_sdk/ti_simplelink_executable.gni

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ template("ti_simplelink_executable") {
176176
"--align",
177177
"4",
178178
"--slot-size",
179-
"0x000F6000", # must match the flash_map_backend definitions
179+
"0x000F2000", # must match the flash_map_backend definitions
180180
"--version",
181181
matter_software_ver_str,
182182
"--pad-header",

third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni

+2-2
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ template("ti_simplelink_sdk") {
347347
configs -= [ "${build_root}/config/compiler:std_default" ]
348348
configs += [ ":${sdk_target_name}_posix_config" ]
349349
sources = [
350+
"${chip_root}/src/platform/cc13xx_26xx/nvocmp.c",
350351
"${ti_simplelink_sdk_root}/source/ti/common/nv/crc.c",
351-
"${ti_simplelink_sdk_root}/source/ti/common/nv/nvocmp.c",
352352
]
353353

354354
public_configs = [ ":${sdk_target_name}_config" ]
@@ -398,7 +398,7 @@ template("ti_simplelink_sdk") {
398398

399399
defines += [
400400
"ONE_BLE_LIB_SIZE_OPTIMIZATION",
401-
"NVOCMP_NVPAGES=5",
401+
"NVOCMP_NVPAGES=12",
402402
"NVOCMP_NWSAMEITEM=1",
403403
"CC13X2P",
404404
"SYSCFG",

0 commit comments

Comments
 (0)