Hello,
I am working on the STM F446RE board and I use the arduino framework in Visual Studio Code (c++).
My code looks as following:
#include <STM32FreeRTOS.h>
#include <task.h>
#include "tasktest.h"
void Task_Main(void *pvParameters);
void Task_Main(void *pvParameters)
{
for (;;)
{
TaskTest(); //<-- problem with this function
}
}
void setup()
{
xTaskCreate(Task_Main, (const portCHAR *)"Task_Main", 128, NULL, 2, NULL);
vTaskStartScheduler();
while (1)
;
}
void TaskTest() //<-- function that i want to execute
{
}
So TaskMain should execute the function TaskTest(). If this function in declared in main.cpp, then everything runs fine.
BUT: If I declare the function in tasktest.cpp (linked in tasktest.h), I get an error:
c:/users/../.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/genericSTM32F446RE/src/main.cpp.o: in function Task_Main(void*):
main.cpp:(.text._Z9Task_MainPv+0x2): undefined reference to `TaskTest()'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\genericSTM32F446RE\firmware.elf] Error 1
I tried already different things, but I can’t solve this problem. I cannot imagine, that using FreeRTOS requires me to have all functions of an huge project in main.cpp.
Do you have any ideas?
Thank you!