FreeRTOS / FreeRTOS-Kernel

FreeRTOS kernel files only, submoduled into https://github.com/FreeRTOS/FreeRTOS and various other repos.
https://www.FreeRTOS.org
MIT License
2.76k stars 1.12k forks source link

Add SMP template port and example #900

Closed chinglee-iot closed 11 months ago

chinglee-iot commented 11 months ago

Add SMP template port and example

Description

The SMP template port shares of the same template port for single core. The port macros and implementation differences are separated by compile option configNUMBER_OF_CORES. Sharing the same port template helps user to identify the port differences between single core and SMP. A sample configuration file for SMP with minimal configuration change is also provided. The example project with cmake is updated to consume the template port and sample configuration to provide compilable project.

The configuration added for SMP is listed below

/******************************************************************************/
/* Scheduling behaviour related definitions. **********************************/
/******************************************************************************/

/* Set configNUMBER_OF_CORES to greater than 1 to enable running one instance of
 * FreeRTOS kernel to schedule tasks across multiple identical processor cores. */
#define configNUMBER_OF_CORES    2

/******************************************************************************/
/* Hook and callback function related definitions. ****************************/
/******************************************************************************/

/* Set the following configUSE_* constants to 1 to include the named hook
 * functionality in the build.  Set to 0 to exclude the hook functionality from the
 * build.  The application writer is responsible for providing the hook function
 * for any set to 1.  See https://www.freertos.org/a00016.html */
#define configUSE_PASSIVE_IDLE_HOOK    0

As single core template port, the port is expected to be used for:

Test Steps

To build the example project for SMP template port:

cd examples\cmake_example
cmake -S . -B build -DFREERTOS_SMP_EXAMPLE=1
cd build
make

smp_example should be generated in the build folder.

Checklist:

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

codecov[bot] commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (f8ef5f6) 93.64% compared to head (b8df01c) 93.64%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #900 +/- ## ======================================= Coverage 93.64% 93.64% ======================================= Files 6 6 Lines 3179 3179 Branches 885 885 ======================================= Hits 2977 2977 Misses 95 95 Partials 107 107 ``` | [Flag](https://app.codecov.io/gh/FreeRTOS/FreeRTOS-Kernel/pull/900/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FreeRTOS) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/FreeRTOS/FreeRTOS-Kernel/pull/900/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FreeRTOS) | `93.64% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FreeRTOS#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sonarcloud[bot] commented 11 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication