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.

SYSBIOS: Exiting/Halting SysBios Scheduler

Part Number: SYSBIOS
Other Parts Discussed in Thread: C2000WARE,

Hi all,

With the C2000Ware serial flash kernel example, the sample application jumps to the code load entry point. This is perfectly acceptable, as the application has no scheduler or interrupts. In our application, we want to use a similar method, however we are using TI's SysBios with a variety of SW/HW interrupts and tasks. The question is, how can we safely stop the scheduling/execution of interrupts and tasks so we can execute the code loader?

My current approach is to exit the BIOS, which is done like so:

  1. Constrain the number of SysBios exit tasks to 1 in the app config
  2. Before starting the scheduler, register our exit task with System_atexit((System_AtexitHandler)Exit_Handler)
  3. Start the scheduler with BIOS_start()
  4. When a suitable SCI message is received to initiate code loading, call BIOS_exit(CODE_LOAD), where we provide a sensible status code to indicate that is a 'code load' exit
  5. In our exit handler, check the exit reason. If it is to perform a code load procedure, then branch to the entry point of the code loader
  6. The code loader reprogram the flash and then resets the device

I have attached a simplified version of the exit handler here

void Exit_Handler(int reason)
{
    switch(reason)
    {
        case(BIOS_EXIT_CODE_LOAD):
            Exit_CodeLoad();
            // Will never return to here
            break;
        default:
            break;
    }

    return;    
}

static void Exit_CodeLoad(void){
    // Branch to static code loader entry point
    asm("    MOVL XAR7, #0x81000");
    asm("    LC *XAR7");
    // No return
}

Is this a valid approach? Primarily, I am concerned that this method skips any other exit handling that should happen after the user's registered exit functions. I have implemented this and it appears to work as I want; the scheduler pauses and the code loader runs without failure. I am nonetheless concerned with potential issues. Is there any TI documentation for the XDC/SysBios exit process?

Thanks

  • That seems adequate to me. If you have concerns about lingering interrupts being enabled, you can double check by placing a break point at the start of your loader and check the PIEIER and IER and registers for anything unexpected remaining enabled.

    Whitney