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.

DSP多核引导启动

Other Parts Discussed in Thread: SYSBIOS

目的是通过启动0和来动态加载从核,但是从核启动不成功,大佬帮我看看是怎么回事?

#include <xdc/std.h>
#include <xdc/runtime/System.h>

#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>

#include <stdio.h>
#include <stdlib.h>

#include "Platform_C6678.h"

#define DEVICE_REG32_W(x,y) *(volatile uint32_t *)(x)=(y)
#define DEVICE_REG32_R(x) (*(volatile uint32_t *)(x))
#define HWREG(x) (*((volatile unsigned int *)(x)))

#define CHIP_LEVEL_REG 0x02620000
#define KICK0 (CHIP_LEVEL_REG + 0x0038)
#define KICK1 (CHIP_LEVEL_REG + 0x003C)

/* Magic address RBL is polling */

#define MAGIC_ADDR 0x87fffc

#define BOOT_MAGIC_ADDR(x) (MAGIC_ADDR + (1<<28) + (x<<24))
#define IPCGR(x) (0x02620240 + x*4)

#define NUMBER_OF_CORES 2

#define BOOT_MAGIC_NUMBER 0xBABEFACE

#define BOOT_NUMBER0 0xAAAA5555
#define BOOT_NUMBER1 0x11111111
#define BOOT_NUMBER2 0x22222222
#define BOOT_NUMBER3 0x33333333

#define DDR_ADDR0 0x81000000
#define DDR_ADDR1 0x82000000
#define DDR_ADDR2 0x83000000
#define DDR_ADDR3 0x84000000

#define BOOT_UART_BAUDRATE 115200

void write_boot_magic_number(void)
{

int coreNum=0;
coreNum = platform_get_coreid();
printf("core%d\n",coreNum);

int i=0;
//如果要控制底板的LED1和LED2,把14,15改成4,5
HWREG( 0x02320000 + 0x10 ) &= ~(1 << 14);
HWREG( 0x02320000 + 0x14 ) |= (1 << 14);//点亮LED1

HWREG( 0x02320000 + 0x10 ) &= ~(1 << 15);
HWREG( 0x02320000 + 0x14 ) |= (1 << 15);//点亮LED2

for(;i<0x00FFFFFF;i++)
{

}
HWREG( 0x02320000 + 0x14 ) &= ~(1 << 14);//关闭LED1
HWREG( 0x02320000 + 0x14 ) &= ~(1 << 15);//关闭LED2

}

Void load(UArg arg0, UArg arg1)
{
uint32_t coreNum, core;

coreNum = platform_get_coreid();
if (coreNum == 0)
{
printf("enter core %d\n",coreNum);
//Unlock the chip registers
DEVICE_REG32_W(KICK0, 0x83e70b13);
DEVICE_REG32_W(KICK1, 0x95a4f1e0);

//Writing the entry address to other cores
for (core = 1; core < NUMBER_OF_CORES; core++)
{
DEVICE_REG32_W(BOOT_MAGIC_ADDR(core), (uint32_t)write_boot_magic_number);
Task_sleep(100);
}
for (core = 1; core < NUMBER_OF_CORES; core++)
{
DEVICE_REG32_W(IPCGR(core), 1);
Task_sleep(100);
}

}
else
{
printf("enter core %d\n",coreNum);
write_boot_magic_number();
}
}

void main ()
{
Task_create(load, NULL, NULL);

BIOS_start();
}