This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM6442: AM6442-EVM R5FSS0 cores fail boot on OSPI multi-partitioned boot

Part Number: AM6442

Hello, I am currently running into an issue with ospi multi-partitioned booting. My application is utilizing all the cores and these are the files I am flashing with the correct offsets:
r5fss0-0.mcelf.hs_fs 
r5fss0-1.mcelf.hs_fs
r5fss1-0.mcelf.hs_fs
r5fss1-1.mcelf.hs_fs
m4.mcelf.hs_fs
a53ss0-0.mcelf.hs_fs
a53ss0-1.mcelf.hs_fs
 

All the cores in my application are self initializing during boot. I modified the example 'sbl_opsi_multi_partition' to include the a53ss0-1, set the correct offset according to my cores applications' sizes and changed the code for how R5FSS0-0 cores are loaded and booted.

The original setup has them in this manner: 

        if(SystemP_SUCCESS == status)
        {
            status = App_bootLoadSelfCpu( CONFIG_BOOTLOADER_FLASH_R5FSS0_0, CSL_CORE_ID_R5FSS0_0 );
        }
        if(SystemP_SUCCESS == status)
        {
            status = App_bootLoadSelfCpu( CONFIG_BOOTLOADER_FLASH_R5FSS0_1, CSL_CORE_ID_R5FSS0_1 );
        }



I changed it to be in this manner:

 
      if(SystemP_SUCCESS == status)
        {
            status = App_bootCpu( CONFIG_BOOTLOADER_FLASH_R5FSS0_0, CSL_CORE_ID_R5FSS0_0 );
        }
        if(SystemP_SUCCESS == status)
        {
            status = App_bootCpu( CONFIG_BOOTLOADER_FLASH_R5FSS0_1, CSL_CORE_ID_R5FSS0_1 );
        }

The reason is that I need the applications on those cores to be running and the App_BootCpu() function is responsible to load and run CPUs. Although, the function is designed for those "not in self CPU cluster" while the original function being called on them,
App_bootLoadSelfCpu(), is made for "load but DONT run CPU in self CPU cluster, i.e R5FSS0-0". 

From this I have these questions:
1. The error is cleary stemming from running the wrong function on the R5FSS0 cores, but why does App_bootCpu() can not work with them? 
2. What is the signifance "self CPU cluster, i.e R5FSS0-0" in this context?
3. How to correctly have R5FSS0 cores loaded in and then booted? or does the App_bootLoadSelfCpu() already handle that?


App_bootLoadSelfCpu():
/* load but DONT run CPU in self CPU cluster, i.e R5FSS0-0 */
int32_t App_bootLoadSelfCpu(uint32_t bootDrvInstanceId, uint32_t cpuId)
{
    int32_t status = SystemP_FAILURE;
    Bootloader_BootImageInfo bootImageInfo;
    Bootloader_Handle bootHandle;
    Bootloader_Params bootParams;
    Bootloader_Config *bootConfig;

    Bootloader_Params_init(&bootParams);
    Bootloader_BootImageInfo_init(&bootImageInfo);

    bootHandle = Bootloader_open(bootDrvInstanceId, &bootParams);
    bootConfig = (Bootloader_Config *)bootHandle;
    bootConfig->scratchMemPtr = gAppimage;
    if(bootHandle != NULL)
    {
        status = Bootloader_parseMultiCoreAppImage(bootHandle, &bootImageInfo);
        if(status == SystemP_SUCCESS)
        {
            bootImageInfo.cpuInfo[cpuId].clkHz = Bootloader_socCpuGetClkDefault(cpuId);
            status = Bootloader_loadSelfCpu( bootHandle, &bootImageInfo.cpuInfo[cpuId], FALSE);
        }
        Bootloader_close(bootHandle);
    }
    return status;
}


App_bootCpu():
/* boot, i.e load and run CPUs not in self CPU cluster */
int32_t App_bootCpu(uint32_t bootDrvInstanceId, uint32_t cpuId)
{
    int32_t status = SystemP_FAILURE;
    Bootloader_BootImageInfo bootImageInfo;
    Bootloader_Params bootParams;
    Bootloader_Handle bootHandle;
    Bootloader_Config *bootConfig;

    Bootloader_Params_init(&bootParams);
    Bootloader_BootImageInfo_init(&bootImageInfo);

    bootHandle = Bootloader_open(bootDrvInstanceId, &bootParams);
    bootConfig = (Bootloader_Config *)bootHandle;
    bootConfig->scratchMemPtr = gAppimage;

    if(bootHandle != NULL)
    {
        status = Bootloader_parseMultiCoreAppImage(bootHandle, &bootImageInfo);
        if(status == SystemP_SUCCESS)
        {
            bootImageInfo.cpuInfo[cpuId].clkHz = Bootloader_socCpuGetClkDefault(cpuId);
            status = Bootloader_bootCpu(bootHandle, &bootImageInfo.cpuInfo[cpuId]);
        }
        Bootloader_close(bootHandle);
    }
    return status;
}
  • When I proceed to use App_bootLoadSelfCpu() on R5FSS0 cores instead its able to pause but then freezes at "Bootloader_socCpuResetReleaseSelf();". How can this freeze be resolved? Any help would be greatly appreciated. Below is the code snippet:

    ...
            if(status == SystemP_SUCCESS)
            {
                status = App_bootLoadSelfCpu( CONFIG_BOOTLOADER_FLASH_R5FSS0_0, CSL_CORE_ID_R5FSS0_0 );
                DebugP_log("Load R5F0_0 core and release!!\r\n");
            }
    
            if(status == SystemP_SUCCESS) //WHY MUST DO THIS FOR R5F0_0 cores??? TI TICKET SPEED RUN
            {
                status = App_bootLoadSelfCpu( CONFIG_BOOTLOADER_FLASH_R5FSS0_1, CSL_CORE_ID_R5FSS0_1 );
                DebugP_log("Load R5F0_1 core and release!!\r\n");
            }  
    
    
            if(SystemP_SUCCESS == status)
            {
                /* Enable Dac mode */
                status = OSPI_enableDacMode(gOspiHandle[CONFIG_OSPI0]);
            }
    
            bool check = SystemP_SUCCESS == status;
            DebugP_log("check code is %i \r\n ", check);
            DebugP_log("SystemP_SUCCESS code is %u\r\n", (uint32_t)SystemP_SUCCESS);
            DebugP_log("status code is %u\r\n", (uint32_t)status);
    
            if(SystemP_SUCCESS == status)
            {
                /* Reset self cluster and run both the CPUs */
                status = Bootloader_socCpuResetReleaseSelf();
                DebugP_log("Release self CPU from reset. Status code is" PRIu32 "\r\n", (uint32_t)status);
            }
        }
        DebugP_log("SystemP_SUCCESS code is %u\r\n", (uint32_t)SystemP_SUCCESS);
        DebugP_log("status code is %u\r\n", (uint32_t)status);
        if(status != SystemP_SUCCESS )
        {
            DebugP_log("Some tests have failed!!\r\n");
        } else {
            DebugP_log("All tests passed!!\r\n");
        }

  • Hi,

    What is the signifance "self CPU cluster, i.e R5FSS0-0" in this context?

    Your SBL program runs on R5F0-0 Core (part of R5FSS0 cluster), that is why it is called self CPU cluster, App_bootCpu calls Bootloader_runCpu API which resets a particular CPU to start running the application, you shouldn't reset R5FS0-0 before execution of SBL is complete. In the default SBL flow you can see that Bootloader_socCpuResetReleaseSelf is called at the end to run R5F0-1 and R5F0-0 in that order, so I am still a bit confused about why you need to change the default boot sequence.

  • Hi Meet, thank you for clarifying. It wasn't clear to me that Bootloader_socCpuResetReleaseSelf() would be responsible for allowing the applications on R5F0-1 and R5F0-0 to run after they are loaded with App_bootLoadSelfCpu(). 

    Currently I changed it back and running into a new issue where Bootloader_socCpuResetReleaseSelf() is called but nothing is ever returned and it freezes at that stage. 

    Do you have any guidance on how this issue can be resolved?

  • Currently I changed it back and running into a new issue where Bootloader_socCpuResetReleaseSelf() is called but nothing is ever returned and it freezes at that stage. 

    Bootloader_socCpuResetReleaseSelf resets R5F0-0, I don't think it's stuck anywhere, most likely R5F0-0 has switched to running the application at this point. How are you verifying that there is an issue or a freeze?

    Could you share the boot logs?

  • How are you verifying that there is an issue or a freeze?

    I added Debug log messages within the SBL code which are never reached during the boot. Below is the code:

        status = Board_driversOpen();
        DebugP_assert(status == SystemP_SUCCESS);
    
        status = Sciclient_getVersionCheck(1);
        if(SystemP_SUCCESS == status)
        {
            uint32_t coreVariant = Bootloader_socGetCoreVariant();
            if((coreVariant == BOOTLOADER_DEVICE_VARIANT_QUAD_CORE) || (coreVariant == BOOTLOADER_DEVICE_VARIANT_DUAL_CORE))
            {
                if(status == SystemP_SUCCESS)
                {
                    status = App_bootCpu( CONFIG_BOOTLOADER_FLASH_R5FSS1_0, CSL_CORE_ID_R5FSS1_0 );
                    DebugP_log("Load R5F1_0 core and release!!\r\n");
                }
                if((Bootloader_socIsR5FSSDual(BOOTLOADER_R5FSS1) == TRUE) && (status == SystemP_SUCCESS))
                {
                    status = App_bootCpu( CONFIG_BOOTLOADER_FLASH_R5FSS1_1, CSL_CORE_ID_R5FSS1_1 );
                    DebugP_log("Load R5F1_1 core and release!!\r\n");
                }     
            }
    
            /* Do not run M4 when MCU domain is reset isolated */
            if (!Bootloader_socIsMCUResetIsoEnabled())
            {
                if(SystemP_SUCCESS == status)
                {
                    status = App_bootCpu( CONFIG_BOOTLOADER_FLASH_M4FSS0_0, CSL_CORE_ID_M4FSS0_0 );
                    DebugP_log("Load M4F core and release!!\r\n");
                }
            }
            
            if(SystemP_SUCCESS == status)
            {
                status = App_bootCpu( CONFIG_BOOTLOADER_FLASH_A53SS0_0, CSL_CORE_ID_A53SS0_0 );
                //DebugP_log("Load A53SS0_0 core and release!!\r\n");
            }
    
            if(SystemP_SUCCESS == status)
            {
                status = App_bootCpu( CONFIG_BOOTLOADER_FLASH_A53SS0_1, CSL_CORE_ID_A53SS0_1 );
               // DebugP_log("Load A53SS0_1 core and release!!\r\n");
            }
    
            if(status == SystemP_SUCCESS)
            {   // 
                status = App_bootLoadSelfCpu( CONFIG_BOOTLOADER_FLASH_R5FSS0_0, CSL_CORE_ID_R5FSS0_0 );
               // DebugP_log("Load R5F0_0 core and release!!\r\n");
            }
    
            if(status == SystemP_SUCCESS) 
            {   // 
                status = App_bootLoadSelfCpu( CONFIG_BOOTLOADER_FLASH_R5FSS0_1, CSL_CORE_ID_R5FSS0_1 );
               // DebugP_log("Load R5F0_1 core and release!!\r\n");
            }  
    
    
            if(SystemP_SUCCESS == status)
            {
                /* Enable Dac mode */
                status = OSPI_enableDacMode(gOspiHandle[CONFIG_OSPI0]);
            }
    
            bool check = SystemP_SUCCESS == status;
            DebugP_log("Status code is %i (true if 1) \r\n ", check);
            DebugP_log("SystemP_SUCCESS code is %u\r\n", (uint32_t)SystemP_SUCCESS);
            DebugP_log("status code is %u\r\n", (uint32_t)status);
    
            if(SystemP_SUCCESS == status)
            {
                /* Reset self cluster and run both the CPUs */
                status = Bootloader_socCpuResetReleaseSelf();
                ~~~BELOW MESSAGE IS NEVER PRITNED~~~
                DebugP_log("Release R5FSS0_0/1 CPU from reset. Status code is" PRIu32 "\r\n", (uint32_t)status);
            }
        }
        ~~~BELOW MESSAGES ARE NEVER PRINTED~~~
        DebugP_log("SystemP_SUCCESS code is %u\r\n", (uint32_t)SystemP_SUCCESS);
        DebugP_log("status code is %u\r\n", (uint32_t)status);
        if(status != SystemP_SUCCESS )
        {
            DebugP_log("Some tests have failed!!\r\n");
        } else {
            DebugP_log("All tests passed!!\r\n");
        }

    Could you share the boot logs?

  • Hi,

    As I mentioned in my earlier response, Bootloader_socCpuResetReleaseSelf resets R5F0-0, meaning that any instruction or debug message you put after this point will not be executed, so This is expected.

  • If that's the case, why in the original example do they have this at the end (after Bootloader_socCpuResetReleaseSelf):

    if(status != SystemP_SUCCESS )
        {
            DebugP_log("Some tests have failed!!\r\n");
        }


  • This is due to this if condition: https://github.com/TexasInstruments/mcupsdk-core/blob/next/examples/drivers/boot/sbl_ospi_multi_partition/am64x-evm/r5fss0-0_nortos/main.c#L225

    If there is some issue while booting the application then status will not return SystemP_SUCCESS and Bootloader_socCpuResetReleaseSelf is never executed, so the execution will reach this print statement.

  • Hi Meet, thank you. This clarification has been helpful.