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.

Problems starting SYS/BIOS task after loading with remoteproc

Other Parts Discussed in Thread: SYSBIOS

I'm having problems running a task under SYS/BIOS on a DSP core that I've loaded using the remoteproc mechanism.

Background: I'm using a TCI6614 EVM and SC-MCSDK 2.01.00.01, running the unmodifed u-boot, Linux kernel and filesystem on the ARM processor as supplied with the EVM.  The kernel is booted with TFTP and the filesystem runs over NFS.

I've written a simple test program - basically just an infinite loop that delays for one second using the Timestamp_get64() call, then prints out a log message using System_printf():

void testProg(void)
{
    int i = 0;
    while (1) {
        ... loop for 1 sec by calling Timestamp_get64() ...

        System_printf("Loop number %d\n", i++);
    }
    return 0;
}  

The compiled and linked image is copied to /lib/firmware/dsp-core0.out and loaded onto a DSP core using the usual 'echo "running" >/sys/class/remoteproc/dsp-core0/state'.  It loads without errors.  I check the output using the trace buffer at /debug/remoteproc/dsp-core0/trace0.

Everything works fine if I don't attempt to start SYS/BIOS - i.e. if I put the loop in the main() function.  The image loads onto the DSP and the trace buffer shows a new output line every second.

int main(int argc, char* argv[])
{
    testProg();

However, if I try to run the exact same code loop as a task, by calling Task_create(), followed by BIOS_start(), like this:

int main(int argc, char* argv[])

    Task_Params taskParams;
    Task_Handle taskHandle;
    Error_Block eb;

    System_printf("Launching task...\n");

    Error_init(&eb);

    Task_Params_init(&taskParams);
    taskParams.stackSize = 512;
    taskParams.priority = 15;
    taskHandle = Task_create((Task_funcPtr)testProg, &taskParams, &eb);
    if (taskHandle == NULL)
    {
        System_abort("Main task create failed");
    }
    BIOS_start();
    return 0;

then I get two outcomes: either an exception in the trace buffer:

AMR=0x0
RILC=0x0
ILC=0x0
Exception at 0x0
EFR=0x2 NRP=0x0
Internal exception: IERR=0x1
Instruction fetch exception
ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x00000000, sp = 0x007aefa8.
To see more exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'
xdc.runtime.Error.raise: terminating execution

or else I get just the first System_printf, then nothing else:

Launching task...

It seems to alternate between the two outcomes.  I guess the task is either launching and crashing, or else it's launching and hanging.

Can someone please give me a suggestion about what I could be doing wrong?  I'm guessing that something else needs to be initialised before the BIOS_start() call but I can't find anything in the docs.

Incidentally, the .cfg file for the build is basically the same as for the remoteproc example supplied with the EVM, with a couple of differences: (a) xdc.useModule() calls for BIOS and Timestamp, and (b) the .text section is placed in DDR3 memory with Program.sectMap[".text"] = "DDR3"; since our code will eventually be too large for L2SRAM.

TIA for any help.

Tony