cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-H745ZI-Q SBSFU adaptation cannot boot CM4 image.

AKhri.1
Associate II

Hello, I am trying to adapt the H753xx SBSFU implementation to the H745xx dual core board.

I have so far configured a second slot by creating a second MPU region of 1KB to protect the header of the second slot, as well as changing the security checks in the function SFU_IMG_InitImageHandling of the sfu_fwimg_common.c file. You can find code snippets below:

      if (!((SlotHeaderAdd[SLOT_ACTIVE_1] >= SFU_PROTECT_MPU_HEADER_START)
            && ((SlotHeaderAdd[SLOT_ACTIVE_1] + SE_FW_HEADER_TOT_LEN) <=
                (SFU_PROTECT_MPU_HEADER_START + mpu_size))))
      {
        TRACE("\r\n= [FWIMG] Header of SLOT_ACTIVE_%d is not under the MPU protection\r\n", i + 1U);
        e_ret_status = SFU_IMG_INIT_FLASH_CONSTRAINTS_ERROR;
      }
 
      // Check second header
      if (!((SlotHeaderAdd[SLOT_ACTIVE_2] >= SFU_PROTECT_MPU_HEADER_2_START)
            && ((SlotHeaderAdd[SLOT_ACTIVE_2] + SE_FW_HEADER_TOT_LEN) <=
                (SFU_PROTECT_MPU_HEADER_2_START + mpu_size))))
      {
        TRACE("\r\n= [FWIMG] Header of SLOT_ACTIVE_%d is not under the MPU protection\r\n", i + 1U);
        e_ret_status = SFU_IMG_INIT_FLASH_CONSTRAINTS_ERROR;
      }

MPU check in sfu_fwimg_common.c

#define SFU_PROTECT_MPU_HEADER_2_RGNV  MPU_REGION_NUMBER8
#define SFU_PROTECT_MPU_HEADER_2_START SLOT_ACTIVE_2_HEADER
#define SFU_PROTECT_MPU_HEADER_2_SIZE  MPU_REGION_SIZE_1KB
#define SFU_PROTECT_MPU_HEADER_2_SREG  0x00U
#define SFU_PROTECT_MPU_HEADER_2_PERM  MPU_REGION_PRIV_RW
#define SFU_PROTECT_MPU_HEADER_2_EXECV MPU_INSTRUCTION_ACCESS_DISABLE
#define SFU_PROTECT_MPU_HEADER_2_TEXV  MPU_TEX_LEVEL0
#define SFU_PROTECT_MPU_HEADER_2_B     MPU_ACCESS_NOT_BUFFERABLE
#define SFU_PROTECT_MPU_HEADER_2_C     MPU_ACCESS_CACHEABLE

Second MPU region in the sfu_low_level_security.h

After introducing these changes, I have tested with a simple LED blinking app running on the CM7, and it has no problems running, the problem is that I need to use both cores, and so as the integration guide stated (AN5056 section 3.3) : "Add in the UserApplication project, the trigger of CM4 boot." I have added the following line to the main of the CM7 project right before the main loop after all the initializations:

  /* USER CODE BEGIN 2 */
  SET_BIT(RCC->GCR, RCC_GCR_BOOT_C2);
  /* USER CODE END 2 */

I then tested by flashing the board with the SBSFU binary + the CM7 project first before sending the CM4 sfb file using teraterm afterwards. The CM7 project seems to work well as the LED started to blink, but the CM4 project seems to not run at all as LD2 is not blinking.

I had wondered if maybe the linker script for the CM4 project is misconfigured somehow, but testing the CM4 project alone with the debugger produces the expected results.

I suspect that the CM4 is booting at the wrong address, but I am unsure of how I can test that. Any insight on how to solve this problem is greatly appreciated.

2 REPLIES 2
VTaya.1
Associate III

Make change in Option byte for M4 to boot individually. Connect debugger and start debugging M4 core.

How to solved?