mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-11 13:54:16 -04:00
Update example cmake project path (#851)
* fix build on 64 bit platform * moving sample cmake project to a separate root level dir * moving sample cmake project to a separate root level dir * updating paths for the sample cmake project * rename example folder * use configKERNEL_PROVIDED_STATIC_MEMORY * update comments * update comments * rename folder to examples * fix formatting
This commit is contained in:
parent
fc7aca7ff2
commit
a8650b99a3
6 changed files with 30 additions and 35 deletions
28
examples/cmake_example/CMakeLists.txt
Normal file
28
examples/cmake_example/CMakeLists.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(example)
|
||||
|
||||
set(FREERTOS_KERNEL_PATH "../../")
|
||||
|
||||
# Add the freertos_config for FreeRTOS-Kernel
|
||||
add_library(freertos_config INTERFACE)
|
||||
|
||||
target_include_directories(freertos_config
|
||||
INTERFACE
|
||||
../sample_configuration
|
||||
)
|
||||
|
||||
# Select the heap port. values between 1-4 will pick a heap.
|
||||
set(FREERTOS_HEAP "4" CACHE STRING "" FORCE)
|
||||
|
||||
# Select the native compile PORT
|
||||
set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE)
|
||||
|
||||
# Adding the FreeRTOS-Kernel subdirectory
|
||||
add_subdirectory(${FREERTOS_KERNEL_PATH} FreeRTOS-Kernel)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
main.c
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} freertos_kernel freertos_config)
|
87
examples/cmake_example/main.c
Normal file
87
examples/cmake_example/main.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* 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 is a simple main that will start the FreeRTOS-Kernel and run a periodic task
|
||||
* that only delays if compiled with the template port, this project will do nothing.
|
||||
* For more information on getting started please look here:
|
||||
* https://freertos.org/FreeRTOS-quick-start-guide.html
|
||||
*/
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
#include <queue.h>
|
||||
#include <timers.h>
|
||||
#include <semphr.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static StaticTask_t exampleTaskTCB;
|
||||
static StackType_t exampleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||
|
||||
void exampleTask( void * parameters )
|
||||
{
|
||||
/* Unused parameters. */
|
||||
( void ) parameters;
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
/* Example Task Code */
|
||||
vTaskDelay( 100 ); /* delay 100 ticks */
|
||||
}
|
||||
}
|
||||
|
||||
void main( void )
|
||||
{
|
||||
printf( "Example FreeRTOS Project\n" );
|
||||
|
||||
xTaskCreateStatic( exampleTask,
|
||||
"example",
|
||||
configMINIMAL_STACK_SIZE,
|
||||
NULL,
|
||||
configMAX_PRIORITIES - 1,
|
||||
exampleTaskStack,
|
||||
&exampleTaskTCB );
|
||||
|
||||
/* Start the scheduler. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
/* Should not reach here. */
|
||||
}
|
||||
}
|
||||
|
||||
void vApplicationStackOverflowHook( TaskHandle_t xTask,
|
||||
char * pcTaskName )
|
||||
{
|
||||
/* Check pcTaskName for the name of the offending task,
|
||||
* or pxCurrentTCB if pcTaskName has itself been corrupted. */
|
||||
( void ) xTask;
|
||||
( void ) pcTaskName;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue