Request for the Latest Trusted Firmware-M Sample Project

Hi All,

I encountered some issues while setting up a Trusted Firmware-M project using the EK-RA8M1 development board in the FSP 5.1.0 environment. The official resources only provide a sample project for FSP 2.0.3. Could you please let me know if there is a more recent sample available?

Here are some settings I made in the project:

Configuration for tfm_bootloader2

Main stack size (bytes): 0x1000
Heap size (bytes): 0x1000
Flash Layout | FLASH_OTP_NV_COUNTERS_AREA_OFFSET: BSP_FEATURE_FLASH_DATA_FLASH_START
General | Number of Images Per Application: 2 (TrustZone)
General | Data Sharing: Enabled
Flash Layout | TrustZone | Non-Secure Callable Region Size (Bytes): 0x800
Flash Layout | TrustZone | Non-Secure Flash Area Size (Bytes) (TrustZone Non-Secure): 0x80000
Flash Layout | TrustZone | Non-Secure Callable RAM Region Size (Bytes): 0x800
Flash Layout | TrustZone | Non-Secure RAM Region Size (Bytes) (TrustZone Non-Secure): 0xA0000
Flash Layout | TrustZone | Image 2 Header Size (Bytes): 0x400
Flash Layout | Bootloader Flash Area Size (Bytes): 0x18000
Flash Layout | Image 1 Header Size (Bytes): 0x400
Flash Layout | Image 1 Flash Area Size (Bytes): 0x50000
Flash Layout | Scratch Flash Area Size (Bytes): 0x0
Data Sharing | Maximum Measured Boot Record Size (Bytes): 0x64
Data Sharing | Shared Data Size (Bytes): 0x380
Data Sharing | Shared Data Address: 0x22000000

Other configurations are omitted to avoid errors.

void hal_entry(void)
{
    /* TODO: add your own code here */
    bl2_main();
    #if BSP_TZ_SECURE_BUILD
    /* Enter non-secure code */
    R_BSP_NonSecureEnter();
    #endif
}

Configuration for tfm_s

Main stack size (bytes): 0x2000
Heap size (bytes): 0x1000
C Runtime Initialization: Disabled
Flash Layout | FLASH_SECURE_RAM_SIZE: 0x3f800
Flash Layout | FLASH_ITS_AREA_OFFSET: 0x08001000

Other configurations are omitted to avoid errors.

void hal_entry(void)
{
    /* TODO: add your own code here */
    extern uint32_t __stack;
    extern uint64_t __STACK_SEAL;
    __set_CONTROL_SPSEL(1);
    __set_PSP(&__stack);
    __TZ_set_STACKSEAL_S(&__STACK_SEAL);
    tfm_main();

    #if BSP_TZ_SECURE_BUILD
    /* Enter non-secure code */
    R_BSP_NonSecureEnter();
    #endif
}

Configuration for tfm_ns

This is the blinky_thread_entry project.

void blinky_thread_entry(void *pvParameters)
{
    FSP_PARAMETER_NOT_USED(pvParameters);
    tfm_ns_interface_init();
    ...
}

Secure/Non-Secure Boundaries

Set in e2studio: 734, 2, 6, 254, x

Issue Encountered

The code path in tfm_s:

tfm_main -> tfm_core_handler_mode() -> tfm_core_svc_handler() -> tfm_arch_free_msp_and_exc_ret(SPM_BOOT_STACK_BOTTOM, exc_return) -> common_sfn_thread() -> Default_Handler()

In common_sfn_thread(), the line meta = PART_METADATA(); runs, and the value of meta is 0x00.

Thanks.