/* This function will startup the scheduler. It will select one thread with the highest priority level, then switch to it.  */
void rt_system_scheduler_start(void)
/* This function will startup the scheduler. It will select one thread with the highest priority level, then switch to it.  */
void rt_system_scheduler_start(void)
{
    struct rt_thread *to_thread;
    rt_ubase_t highest_ready_priority;
    to_thread = _scheduler_get_highest_priority_thread(&highest_ready_priority);
    rt_current_thread = to_thread;
    rt_schedule_remove_thread(to_thread);
    to_thread->stat = RT_THREAD_RUNNING;
    rt_hw_context_switch_to((rt_ubase_t)&to_thread->sp);
}