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.

把.text放到MSMCSRAM上做多核Boot出现错误



大家好,

我在做C6670的多核SPI Boot。

遇到一个问题:

如果把.text放到每个Core各自的L2SRAM上,多核能正常Boot。

但是,如果把.text放到MSMCSRAM上,4个Core共享这段.text,则只能Core0正常Boot,其他Core无法启动。

*****************************************************************************************************************

测试代码如下,即Core0控制GPIO15闪烁一个LED,Core1控制GPIO14闪烁另一个LED

int main(void)
{
    int i=0;
    char * send_msg;
    int coreId = 0;
    CSL_GpioHandle hGpio;//因为要使用GPIO,则先定义GPIO句柄

	//*****************************************************//
	//EVM多核Boot测试
    MulticoreBoot();
    //*****************************************************//

    //*****************************************************//
	//BBU GPIO test
    coreId = DNUM;
    TSCL = 1;
	hGpio = CSL_GPIO_open (0);
	CSL_GPIO_setPinDirOutput(hGpio, 14);
	CSL_GPIO_setPinDirOutput(hGpio, 15);
	if(coreId == 0)
	{
		CSL_GPIO_setOutputData(hGpio,14);
		CSL_GPIO_setOutputData(hGpio,15);
		while(1)
		{
			cycleDelay(1000000000);
			CSL_GPIO_setOutputData(hGpio,15);
			cycleDelay(1000000000);
			CSL_GPIO_clearOutputData(hGpio,15);
		}
	}
	else if(coreId == 1)
	{
		while(1)
		{
			cycleDelay(100000000);
			CSL_GPIO_setOutputData(hGpio,14);
			cycleDelay(100000000);
			CSL_GPIO_clearOutputData(hGpio,14);
		}
	}
	//*****************************************************//

	while(1);
	return 0;
}

*****************************************************************************************************************

情况1:把.text放到L2SRAM中

Core0工程CMD文件修改为: .text          >  CORE0_L2_SRAM

Core1工程CMD文件修改为: .text          >  CORE1_L2_SRAM

其中MulticoreBoot代码如下

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ti/csl/csl_chip.h>

#define CORE_NUM_6670     4

void MulticoreBoot()
{

    int *pBootMagicAddCore0;
    int *IpcGr0;
    int i;
    int coreId = 0;

    coreId = DNUM;

	if(coreId == 0)
	{
	   /*write Boot Magic add of other cores and send IPC interrupt*/
		*((int *)(0x118FFFFC)) = 0x118008a0;
		*((int *)(0x128FFFFC)) = 0x128008a0;
		*((int *)(0x138FFFFC)) = 0x138008a0;

	   IpcGr0  = (int*)0x02620240;
	   /*warning:when running on no-boot mode,core0~core7 must all be connected to the target*/
	   for(i = 1;i < CORE_NUM_6670;i++)//core0 sent ipc interrupt to
	   {
		  *(IpcGr0+i) = (*(IpcGr0+i)) | 0x00000001;
	   }
	}
}

0x118008a0从Core1工程的MAP文件中得到的_C_int00地址。

*****************************************************************************************************************

情况2:把.text放到MSMCSRAM中

Core0工程CMD文件修改为: .text          >  SHRAM

Core1工程CMD文件修改为: .text          >  SHRAM

其中MulticoreBoot代码修改为如下

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ti/csl/csl_chip.h>

#define CORE_NUM_6670     4

void MulticoreBoot()
{

    int *pBootMagicAddCore0;
    int *IpcGr0;
    int i;
    int coreId = 0;

    coreId = DNUM;

	if(coreId == 0)
	{
	   /*write Boot Magic add of other cores and send IPC interrupt*/
		*((int *)(0x118FFFFC)) = 0x0c0008a0;
		*((int *)(0x128FFFFC)) = 0x0c0008a0;
		*((int *)(0x138FFFFC)) = 0x0c0008a0;

	   IpcGr0  = (int*)0x02620240;
	   /*warning:when running on no-boot mode,core0~core7 must all be connected to the target*/
	   for(i = 1;i < CORE_NUM_6670;i++)//core0 sent ipc interrupt to
	   {
		  *(IpcGr0+i) = (*(IpcGr0+i)) | 0x00000001;
	   }
	}
}

其中0x0c0008a0为Core1工程生成的MAP文件中的_c_int00地址。

***************************************************************************************************************

现象:

情况1时,Core0、Core1都能正常启动;

情况2时,Core0能启动,Core1不能启动。

*****************************************************************************************************************

疑问1:

如果把4个Core的.text(实际上4个Core用一套代码,只是在代码中用DNUM区分功能)放到MSMCSRAM中同一个区域块中,做多核Boot时,要怎样处理才能避免上面的问题?

是不是我的bin文件生成工具有问题?

我的bin生成工具为

bin生成步骤为

hex6x.exe -order L post_Core0.rmd DSP1_Core0.out
hex6x.exe -order L post_Core1.rmd DSP1_Core1.out

bconvert64x.exe -le Core0_post2.b post_Core0.b 
bconvert64x.exe -le Core1_post2.b post_Core1.b 

mergebtbl post_Core0.b post_Core1.b simple.btbl

b2i2c.exe simple.btbl post.i2c.b 
b2ccs.exe post.i2c.b simple.i2c.ccs
qfparse.exe
ccs2bin.exe -swap i2crom.ccs  app.bin

*****************************************************************************************************************

在此,还有另一个疑问:

在hex6x.exe、bconvert64x.exe操作之后得到的post_Core0.b 、post_Core1.b能看到各自的_c_int00地址,但是经过

mergebtbl post_Core0.b post_Core1.b simple.btbl

之后,Core1的_c_int00地址貌似被删除了。

如下图

第114行,开头处应该有Core1的_c_int00地址,但是经过mergebtbl后,被删除了。

而且情况1时,使用了*((int *)(0x118FFFFC)) = 0x118008a0;这句代码去写Core1的Black Magic Address为0x118008a0,即为Core1的_c_int00地址。

但是,在生成的bin文件中,根本搜不到118008a0这一串16进制数。

疑问2:请问,此时Core0怎么知道118008a0这个数,并写到Core1的Black Magic Address上去的呢?

  • 补充一点:

    现在怀疑是由于Core0没有正确给Core1的Black Magic Address写_c_int00导致Core1无法启动。

    为了测试,在MulticoreBoot写了下面这句

    *((int *)(0x118FFFFC)) = 0x12345678;

    但是在生成的.out,以及通过hex6x、bconvert64x.exe等一系列工具生成的文件中,根本搜不到12345678这串数字。

    上面这句代码中的0x12345678应该属于局部变量的初值之类的,是被初始化到什么段中去了?为什么生成的.out、.bin文件中都搜不到12345678这串数?

  • 补充:

    如果我把Core0的.text放到MSMCSRAM中,把Core1的.text放到Core1的L2SRAM上,则Core0和Core1都能正常启动。

    但是,我把Core0的.text放到Core0的L2SRAM上,而把Core1的.text放到MSMCSRAM上,则只有Core0能启动。