diff --git a/.gitignore b/.gitignore index 7d474844..890f1a44 100644 --- a/.gitignore +++ b/.gitignore @@ -492,12 +492,15 @@ tools/unit-tests/nxp_ls1028a_host.c tools/unit-tests/nxp_p1021_host.c tools/unit-tests/nxp_t10xx_fixup_extract.h tools/unit-tests/sama5d3_read_extract.h +tools/unit-tests/samr21_erase_extract.h +tools/unit-tests/samr21_erase_fn_extract.h tools/unit-tests/sdhci_host.c tools/unit-tests/stm32l5_write_extract.h tools/unit-tests/stm32u5_write_extract.h tools/unit-tests/t10xx_qe_firmware_extract.h tools/unit-tests/t2080_fman_extract.h tools/unit-tests/ti_hercules_write_extract.h +tools/unit-tests/update_trigger_scrub_extract.h tools/unit-tests/versal_ext_write_extract.h tools/unit-tests/versal_host.c tools/unit-tests/versal_host.h diff --git a/tools/unit-tests/unit-update-trigger-scrub.c b/tools/unit-tests/unit-update-trigger-scrub.c index e35ec8e9..b69d5585 100644 --- a/tools/unit-tests/unit-update-trigger-scrub.c +++ b/tools/unit-tests/unit-update-trigger-scrub.c @@ -52,13 +52,18 @@ static uint8_t NVM_CACHE[NVM_CACHE_SIZE]; /* The staged sector image: the boot/update trailer sector carrying - * the firmware key/nonce pattern at a fixed offset. */ + * the firmware key/nonce pattern at a fixed offset. Sector-aligned: + * wolfBoot_update_trigger() derives the staged sector by rounding the + * flag address down to a sector boundary, and the sector copy must + * stay inside this array. */ #define KEY_OFF 0x0F00 #define KEY_LEN 64 -static uint8_t g_sector[NVM_CACHE_SIZE]; +static uint8_t g_sector[NVM_CACHE_SIZE] + __attribute__((aligned(WOLFBOOT_SECTOR_SIZE))); /* The update partition flags end at the top of the staged sector, so - * lastSector in wolfBoot_update_trigger() resolves to g_sector. */ + * lastSector in wolfBoot_update_trigger() resolves to the base of + * g_sector (the alignment above makes that true by construction). */ #define PART_UPDATE_ENDFLAGS ((uintptr_t)(g_sector + WOLFBOOT_SECTOR_SIZE)) /* Stubbed flash layer: records calls. */