diff options
author | chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> | 2023-12-04 05:49:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-04 05:49:41 +0300 |
commit | c0ce725293bb8cf9b30626a8bba173af33163533 (patch) | |
tree | 4a66439567e82b935be49458423eb839a853f706 /examples | |
parent | f8ef5f605b28c00b5251e8cf7c45b8ac1a54ef86 (diff) |
Add SMP template port and example (#900)
* Add SMP template port and example
* Add readme file for smp configuration
* Update SMP build flow and add CI build
---------
Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/cmake_example/CMakeLists.txt | 17 | ||||
-rw-r--r-- | examples/sample_configuration/smp/FreeRTOSConfig.h | 65 | ||||
-rw-r--r-- | examples/sample_configuration/smp/readme.md | 10 |
3 files changed, 88 insertions, 4 deletions
diff --git a/examples/cmake_example/CMakeLists.txt b/examples/cmake_example/CMakeLists.txt index 85329678d..f8a4e2d63 100644 --- a/examples/cmake_example/CMakeLists.txt +++ b/examples/cmake_example/CMakeLists.txt @@ -7,10 +7,19 @@ set(FREERTOS_KERNEL_PATH "../../") # Add the freertos_config for FreeRTOS-Kernel add_library(freertos_config INTERFACE) -target_include_directories(freertos_config - INTERFACE - ../sample_configuration -) +if (DEFINED FREERTOS_SMP_EXAMPLE AND FREERTOS_SMP_EXAMPLE STREQUAL "1") + message(STATUS "Build FreeRTOS SMP example") + target_include_directories(freertos_config + INTERFACE + "../sample_configuration/smp" + ) +else() + message(STATUS "Build FreeRTOS example") + target_include_directories(freertos_config + INTERFACE + "../sample_configuration" + ) +endif() # Select the heap port. values between 1-4 will pick a heap. set(FREERTOS_HEAP "4" CACHE STRING "" FORCE) diff --git a/examples/sample_configuration/smp/FreeRTOSConfig.h b/examples/sample_configuration/smp/FreeRTOSConfig.h new file mode 100644 index 000000000..f3b68a444 --- /dev/null +++ b/examples/sample_configuration/smp/FreeRTOSConfig.h @@ -0,0 +1,65 @@ +/* + * FreeRTOS Kernel <DEVELOPMENT BRANCH> + * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + */ + +/******************************************************************************* + * This file provides an example FreeRTOSConfig.h header file, inclusive of an + * abbreviated explanation of each configuration item. Online and reference + * documentation provides more information. + * https://www.freertos.org/a00110.html + * + * Constant values enclosed in square brackets ('[' and ']') must be completed + * before this file will build. + * + * Use the FreeRTOSConfig.h supplied with the RTOS port in use rather than this + * generic file, if one is available. + ******************************************************************************/ + +#ifndef __FREERTOS_CONFIG_SMP_H__ +#define __FREERTOS_CONFIG_SMP_H__ + +#include "../FreeRTOSConfig.h" + +/******************************************************************************/ +/* 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 + +#endif /* __FREERTOS_CONFIG_SMP_H__ */ diff --git a/examples/sample_configuration/smp/readme.md b/examples/sample_configuration/smp/readme.md new file mode 100644 index 000000000..8dc02bd56 --- /dev/null +++ b/examples/sample_configuration/smp/readme.md @@ -0,0 +1,10 @@ +# Configuration support for FreeRTOS SMP + +## Overview +The FreeRTOSConfig.h provided in this folder is a sample configuration that will +assist you in preparing the configuration to enable SMP support in the FreeRTOS +Kernel for your application. + +Based on single core sample configuration file, this configuration file is created +with minimal configuration change. More SMP scheduler configurations can be found +in [Symmetric Multiprocessing (SMP) with FreeRTOS](https://freertos.org/symmetric-multiprocessing-introduction.html) |