Skip to content

Commit a57238e

Browse files
committed
[cov,test] Fix owner_block flash layout under coverage mode
Under coverage mode, the ROM_EXT size increases, which can break the flash layout assumptions in certain tests. This change introduces specific constants for production and coverage builds and ensures that owner_block unit tests use the production flash layout even when coverage is enabled. Change-Id: I52e17fe8fe17f2d98456a25a77c19066e2ee0703 Signed-off-by: Yi-Hsuan Deng <[email protected]>
1 parent a06c05c commit a57238e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

sw/device/silicon_creator/lib/base/chip.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@
7070
* Allowed bounds for the `length` field of a ROM_EXT manifest.
7171
*/
7272
#define CHIP_ROM_EXT_SIZE_MIN CHIP_MANIFEST_SIZE
73-
#ifndef OT_COVERAGE_ENABLED
74-
#define CHIP_ROM_EXT_SIZE_MAX 0x10000
73+
#define CHIP_ROM_EXT_SIZE_MAX_PRODUCTION_BUILD 0x10000
74+
#define CHIP_ROM_EXT_SIZE_MAX_COVERAGE_BUILD 0x20000
75+
#ifdef OT_COVERAGE_ENABLED
76+
#define CHIP_ROM_EXT_SIZE_MAX CHIP_ROM_EXT_SIZE_MAX_PRODUCTION_BUILD
7577
#else // OT_COVERAGE_ENABLED
76-
#define CHIP_ROM_EXT_SIZE_MAX 0x20000
78+
#define CHIP_ROM_EXT_SIZE_MAX CHIP_ROM_EXT_SIZE_MAX_COVERAGE_BUILD
7779
#endif // OT_COVERAGE_ENABLED
7880
#define CHIP_ROM_EXT_RESIZABLE_SIZE_MAX \
7981
(CHIP_ROM_EXT_SIZE_MAX + CHIP_BL0_SIZE_MAX)

sw/device/silicon_creator/lib/ownership/owner_block.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
owner_block_t owner_page[2];
2424
owner_page_status_t owner_page_valid[2];
2525

26+
// Force production flash layout for unit test coverage
27+
#if defined(OT_COVERAGE_ENABLED) && !defined(OT_PLATFORM_RV32)
28+
#undef CHIP_ROM_EXT_SIZE_MAX
29+
#define CHIP_ROM_EXT_SIZE_MAX CHIP_ROM_EXT_SIZE_MAX_PRODUCTION_BUILD
30+
#endif // defined(OT_COVERAGE_ENABLED) && !defined(OT_PLATFORM_RV32)
31+
2632
enum {
2733
kFlashBankSize = FLASH_CTRL_PARAM_REG_PAGES_PER_BANK,
2834
kFlashPageSize = FLASH_CTRL_PARAM_BYTES_PER_PAGE,

0 commit comments

Comments
 (0)