Good day, I want to indicate the beginnning and end of a task through digital outputs. that is the led will blink when the task starts and will blink again when the task has finished. . I have done some reading and i think i could use a macro but i am not sure. Please is there a fuction that can do this or any suggestions about how i can go about it? thank You
If you literally mean it goes high when the task begins execution, and then goes low at the very end of its execution, then I would just place the code at the begining and end of the task function. Ont the other hand, if you mean goes high when the task becomes the currently executing task, and low when some other task is running, then I would use the trace macros to detect what task is being started and raise or lower it based on the new current task being that task or not (likely needed a global with the handle for that task)
What do you mean by ‘start’ and ‘end’ – when the task is created and deleted, or when the task is switched in and starts executing and then switched out and stops executing? In either case, I think you could use the trace macros, but would have to test the pxCurrentTCB variable to see which task was executing at the time the macro executed. https://www.freertos.org/rtos-trace-macros.html
Thank you. I am trying to use the trace macros and i am following the instrction and example on the link you pasted but the “vTasksetApplicationTasktag”, am i supposed to declare it somewhere?
Hi, I could not do this in the Eclipse IDE. The following error appears: undefined reference to ‘vTaskSetApplicationTaskTag ‘. I set configUSEAPPLICATIONTASK_TAG to 1. Any tips ?
I don’t think this has anything to do with the Eclipse IDE. Is this an error in the editor window itself? If so, then ignore it, Eclipse tries to parse the C code and will often get it wrong – only pay attention to the compiler errors. If you compile the task.c file and configUSEAPPLICATIONTASK_TAG is set to 1 then the function will be available as can be seen on line 2784 (at the time of writing) here: https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/tasks.c
Richard, Sorry for the delay. I did not find the file “task.c”. I accessed the contents of the file “libfreertos.a” (in the folder C: Espressif ESP8266RTOSSDK lib “, it had the file “task.o” without the function “vTaskSetApplicationTaskTag ()”. In the directory “C: Espressif ESP8266RTOSSDK third_party frets” I found the file “tasks.c” with the definition of the function “vTaskSetApplicationTaskTag ()”. I put it in the project folder in libraries, left the definition of “tskTCB” and the function “vTaskSetApplicationTaskTag ()” and erased the rest of the file. Now when compiling the following error appears within the function definition of the new tasks.c file: build / appapp.a (tasks.o) 🙁 .bss + 0x0): multiple definition of ‘pxCurrentTCB’ c: / Espressif / ESP8266RTOS_SDK / lib libfreertos.a (tasks.o) :(. bss + 0x4): first defined here The errors appear in the view “console” and “problems”. Which project folder do I put the task.c to compile?
From your description it sounds like (I don’t know, as its not code we are distributing ourselves) that FreeRTOS is built as a library. Therefore, to change the FreeRTOS configuration, you will need to change the files used to build the library – then re-build the library.
Thanks. I’ll check with SDK developer Mikhail Grigorev how to resolve this issue. The source files are in a different folder: “C: Espressif ESP8266RTOSSDK third_party frets”
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.