From 70375c5b656d635919c09997f43eea25c9db2923 Mon Sep 17 00:00:00 2001 From: Joseph Julicher Date: Fri, 13 Oct 2023 09:43:25 -0700 Subject: [PATCH] re-adding main.c to the minimal example --- minimal_freertos_example/main.c | 100 ++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 minimal_freertos_example/main.c diff --git a/minimal_freertos_example/main.c b/minimal_freertos_example/main.c new file mode 100644 index 00000000000..2d9783bfad4 --- /dev/null +++ b/minimal_freertos_example/main.c @@ -0,0 +1,100 @@ +/* + * FreeRTOS Kernel + * 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 freertos and run a periodic task */ +/* if compiled with the template port, this project will do nothing. */ + +#include +#include +#include +#include +#include + +#include + +static StackType_t exampleTaskStack[configMINIMAL_STACK_SIZE]; +static StaticTask_t exampleTaskTCB; + +void exampleTask(void *parameters) +{ + for (;;) + { + /* Example Task Code */ + vTaskDelay(100); /* delay 100 ticks */ + } +} + +int main(void) +{ + printf("Example FreeRTOS Project\n"); + + xTaskCreateStatic(exampleTask, + "example", + configMINIMAL_STACK_SIZE, + NULL, + configMAX_PRIORITIES - 1, + exampleTaskStack, + &exampleTaskTCB); + + vTaskStartScheduler(); + + /* should never get here. */ + for (;;) + { + } + return 0; +} + +void vApplicationStackOverflowHook(TaskHandle_t xTask, + char *pcTaskName) +{ +} + +void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer, + StackType_t **ppxTimerTaskStackBuffer, + uint32_t *pulTimerTaskStackSize) +{ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[configTIMER_TASK_STACK_DEPTH]; + + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; +} + +void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, + StackType_t **ppxIdleTaskStackBuffer, + uint32_t *pulIdleTaskStackSize) +{ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[configMINIMAL_STACK_SIZE]; + + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; +}