I can run the freertos demo example but i want to create my own project. At first I tried to do something by changing only main.c in demo and of course I got an error. How should I start?
Was it the basic windows demo in the main FreeRTOS distribution you started with? What did you change and what issue did you faced? Currently it’s hard to answer your question with anything other than questions.
Actually, I want to demonstrate basic queue between tasks and I do not know how should I start. I don’t know which header files I should use. I would be happy if you help.
Here is my main.c code:
#include “FreeRTOS.h”
#include “task.h”void vTask1(void* pvParameters);
void vTask2(void* pvParameters);int main(void){
xTaskCreate(&vTask1, “Task 1”, 1024, NULL, 1, NULL);
xTaskCreate(&vTask2, “Task 2”, 1024, NULL, 1, NULL);
vTaskStartScheduler();
return 0;
}void vTask1(void* pvParameters){
for (; ; ){
printf(“Task 1\r\n”);
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
void vTask2(void* pvParameters){
for (;; ){
printf(“Task 2\r\n”);
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
And I am getting these errors:
Error (active) E1696 cannot open source file "portmacro.h" Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\portable.h 53
Error (active) E0020 identifier "TickType_t" is undefined Project2 C:\Users\oykum\source\repos\Project2\Project2\main.c 27
Error (active) E0020 identifier "TickType_t" is undefined Project2 C:\Users\oykum\source\repos\Project2\Project2\main.c 36
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\list.h 495
Error (active) E0035 #error directive: "Invalid portBYTE_ALIGNMENT definition" Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\portable.h 69
Error (active) E0020 identifier "StackType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\portable.h 127
Error (active) E0020 identifier "StackType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\portable.h 127
Error (active) E0020 identifier "BaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\portable.h 208
Error (active) E0079 expected a type specifier Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 93
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 93
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 355
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 359
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 794
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 861
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 861
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 862
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 904
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 953
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 963
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1089
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1224
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1426
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1443
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1461
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1477
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1539
Error (active) E0020 identifier "TaskHookFunction_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1590
Error (active) E0020 identifier "TaskHookFunction_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1602
Error (active) E0020 identifier "TaskHookFunction_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1613
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1699
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1808
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 1809
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2068
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2069
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2220
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2221
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2364
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2364
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2368
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2531
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2636
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2638
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2701
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2702
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2767
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2873
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2874
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2902
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2902
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2924
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2958
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2960
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2961
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 2975
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 3002
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 3004
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 3020
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 3037
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 3043
Error (active) E0090 function returning function is not allowed Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 3049
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 3060
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 3065
Error (active) E0020 identifier "UBaseType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 3072
Error (active) E0020 identifier "TickType_t" is undefined Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\task.h 3082
Error C1083 Cannot open include file: 'portmacro.h': No such file or directory Project2 D:\indirilenlerd\FreeRTOSv202212.01\FreeRTOS\Source\include\portable.h 53
The first issue seems to be that you do not have the path to portmacro.h in your compiler’s include path. This should be source/portable/[compiler]/[architecture], depending on the compiler and chip architecture you are using. There are a few links on the website with information on creating a new project. From memory the free to download book also has this info. Would give you links but I’m on my phone.
This is the directory that should be in your include search path - https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/main/portable/MSVC-MingW
Let us know if that fixes your problem.