Part Number: AM2634
Tool/software:
Hi!
Can I boot Core2 directly from Core0 by setting Core2 entry address in Core2's TCM memory without the bootloader and image?
I want to use the Core0 function as the entry address for Core2,my code looks like this:
#include <stdio.h>
#include <string.h>
#include <drivers/ipc_rpmsg.h>
#include <drivers/bootloader.h>
#define LOG_TAG ""
#include "elog.h"
#define IPC_TEST_REMOTE_CORE CSL_CORE_ID_R5FSS1_0
Bootloader_socCoreOpModeConfig socCoreOpMode =
{
.r5fss0_opMode = BOOTLOADER_OPMODE_STANDALONE,
.r5fss1_opMode = BOOTLOADER_OPMODE_STANDALONE
};
volatile uint8_t remote_start_flag = 0x00;
void ipc_remote_core_main()
{
remote_start_flag = 0x01;
while(1)
{
}
}
void exception_handler()
{
remote_start_flag = 0x02;
while(1)
{
}
}
uint32_t tcm_memory_data[] =
{
0xE5FF9018,0xE5FF9018,
0xE5FF9018,0xE5FF9018,
0xE5FF9018,0xE5FF9018,
0xE5FF9018,0xE5FF9018,
/* 向量表 */
(uint32_t)ipc_remote_core_main, // entry
(uint32_t)&exception_handler, // undefined
(uint32_t)&exception_handler, // svc
(uint32_t)&exception_handler, // prefetch
(uint32_t)&exception_handler, // data abort
(uint32_t)&exception_handler, // reserved
(uint32_t)&exception_handler, // irq
(uint32_t)&exception_handler, // fiq
};
void ipc_remote_core_start()
{
uint8_t i = 0;
int32_t status;
Bootloader_Handle gBootloaderHandle;
Bootloader_CpuInfo gBootImageInfo;
gBootImageInfo.cpuId = IPC_TEST_REMOTE_CORE;
gBootImageInfo.clkHz = Bootloader_socCpuGetClkDefault(IPC_TEST_REMOTE_CORE);
status = Bootloader_socCpuSetClock(gBootImageInfo.cpuId, gBootImageInfo.clkHz);
if(status != SystemP_SUCCESS)
{
log_i("Bootloader_socCpuSetClock failed\r\n");
return;
}
status = Bootloader_socCpuPowerOnReset(IPC_TEST_REMOTE_CORE, &socCoreOpMode);
if(status != SystemP_SUCCESS)
{
log_i("Bootloader_socCpuPowerOnReset failed\r\n");
return;
}
uint32_t *tcm_memory_addr = (uint32_t *)0x78400000;
for(i = 0; i < (sizeof(tcm_memory_data) / sizeof(tcm_memory_data[0])); i++)
{
*tcm_memory_addr++ = tcm_memory_data[i];
}
status = Bootloader_runCpu(NULL, &gBootImageInfo);
if(status == SystemP_SUCCESS)
{
log_i("core(%d) start success\r\n", IPC_TEST_REMOTE_CORE);
}
else
{
log_i("core(%d) start failed\r\n", IPC_TEST_REMOTE_CORE);
}
}
I hope that when Core2 is started, ipc_remote_core_main can be executed to change the variable remote_start_flag to 1, which is the basis for judging the success of Core2 startup, but after running, it is found that remote_start_flag is still 0, Core2 startup fails.
Is my idea feasible? How can I modify my code?
Thanks.
