2025-06-16 4:18 AM - last edited on 2025-06-16 5:22 AM by STTwo-32
I know this matter is dense and niche, so ill try to articulate my process in a digestible manner and add some memes.
I Recently downloaded sbsfu-v2-7-0 (legacy) package.
After some YMODEM bug fixes, i have a working example SBSFU for only one ACTIVE SLOT and single Download SLOT.
STM32CubeExpansion_SBSFU_V2.7.0\Projects\NUCLEO-G474RE\Applications\2_Images
The codebase readme says it supports more Download SLOTS, Great!, this way we could have two different UserApp downloaded, in order to activate more SLOTs : (app_sfu.h)
/* Multi-images configuration :
- Max : 3 Active images and 3 Download area
- Not necessary same configuration between SFU_NB_MAX_ACTIVE_IMAGE and SFU_NB_MAX_DWL_AREA
- Active slot identified with SFU magic (1,2,3) information from header
- Do not forget to add keys for each image in SE_Corebin/Binary folder
- Master slot : image started in priority if valid
- FW image valid all feature authorized from master slot
*/
#define SFU_NB_MAX_ACTIVE_IMAGE 1U /*!< 1 active image managed */
#define SFU_NB_MAX_DWL_AREA 1U /*!< 1 dwl area managed */
#define MASTER_SLOT SLOT_ACTIVE_1 /*!< SLOT_ACTIVE_1 identified as master slot */
#define SFU_NB_MAX_DWL_AREA 2U
/* SE key region protected by MPU isolation */
__ICFEDIT_SE_Key_region_ROM_start__ = __ICFEDIT_SE_CallGate_region_ROM_end__ + 1; /* PCROP protection : Alignment on 512 bytes */
__ICFEDIT_SE_Key_region_ROM_end__ = __ICFEDIT_SE_Key_region_ROM_start__ + 0xFF +0x100; /* PCROP protection : Minimum size is 1024 bytes , javi added extra space for KEY2*/
/* Slots must be aligned on 4096 bytes (0x1000) */
/* Active slot #1 (144 kbytes) */
__ICFEDIT_SLOT_Active_1_start__ = 0x08010000;
__ICFEDIT_SLOT_Active_1_end__ = 0x08033FFF;
__ICFEDIT_SLOT_Active_1_header__ = __ICFEDIT_SLOT_Active_1_start__;
/* SWAP (8 kbytes) */
__ICFEDIT_SWAP_start__ = 0x08034000;
__ICFEDIT_SWAP_end__ = 0x08035FFF;
/* Dwl slot #1 (144 kbytes) */
__ICFEDIT_SLOT_Dwl_1_start__ = 0x08036000;
__ICFEDIT_SLOT_Dwl_1_end__ = 0x08059FFF;
/* Dwl slot #2 (144 kbytes) */
__ICFEDIT_SLOT_Dwl_2_start__ = 0x0805A000;
__ICFEDIT_SLOT_Dwl_2_end__ = 0x0807DFFF;
arm-none-eabi-objcopy -O binary "${BuildArtifactFileBaseName}.elf" "../${BuildArtifactFileBaseName}.bin" && arm-none-eabi-size "${BuildArtifactFileName}" && "../../../2_Images_SECoreBin/STM32CubeIDE/postbuild.sh" "../" "${BuildArtifactFileBaseName}.elf" "../${BuildArtifactFileBaseName}.bin" "2" "1"
2025-06-16 4:22 AM - edited 2025-06-16 4:26 AM
when i compile SECcore & SBSFU for two sets of identicall keys i was expecting duplicated flash memory content, but it seems prepareimage.py modifies nonce.bin each time is called? anyhow, it creates different key.bin for the same keys