The startup process for each core in FreeRTOS SMP (Symmetric Multi-Processing)

The steps for understanding the topic are as follows:

  1. Primary Core Startup: The primary or master core is typically the first to start. It begins the initialization process, which includes setting up the operating system and the FreeRTOS kernel.
  2. Task Creation: On the primary core, tasks are created before the scheduler is started. This is where you define and configure the tasks that will run within the system.
  3. Scheduler Activation: The vTaskStartScheduler() function is called on the primary core. This activates the FreeRTOS scheduler, which begins task management and scheduling operations.
  4. Task Distribution: After the scheduler is started with vTaskStartScheduler(), tasks are distributed across the available cores based on their affinity, priority, and the system’s scheduling policies.
  5. Independent Execution: Once the scheduler is active, each core operates independently, managing and executing tasks according to the FreeRTOS scheduling algorithm.

Could you please review whether my understanding is correct? If possible, could you also provide a reference example for me to learn and understand better?Thank you for your correction.

  1. Yes, the primary core is responsible for all initialization before starting the scheduler.
  2. Yes, all initial tasks must be created on the primary core before starting the scheduler. Otherwise, tasks may be created by any task running on any core at any time after the scheduler is started.
  3. Yes, in vTaskStartScheduler(), xPortStartScheduler() is called to start the scheduler on all cores. This port function wakes up secondary core(s), and sets up the scheduler to run on each core.
  4. Each core shares the same task list. This is what makes FreeRTOS SMP symmetric. On each core the scheduler will run the highest-priority, ready task. This may violate some assumptions single-core applications and libraries make about task execution. A low-priority and high-priority task can run simultaneously on two cores if there are no other high-priority tasks ready. Defining configRUN_MULTIPLE_PRIORITIES to 0 will disallow this behavior, preventing data races. But, this prevents cores from being fully utilized if not enough tasks in the highest priority are ready.
  5. The scheduler function for each core runs sequentially, and the scheduler timer tick runs the function on all cores. If a core calls a kernel function that reschedules, it schedules a new task immediately. The scheduler function must be protected against concurrent execution by a port-provided mechanism. The RP2040 uses HW spinlocks to accomplish this.

Example SMP projects & ports and more information can be found here: