undefined reference to `vPortCleanUpTCB'

flashpackets
Posts: 8
Joined: Tue Jun 27, 2017 10:39 pm

undefined reference to `vPortCleanUpTCB'

Postby flashpackets » Thu Nov 02, 2017 12:07 am

I've no idea how this got into the code... Everything was working I promise.

esp-idf/components/freertos/./tasks.c:3475: undefined reference to `vPortCleanUpTCB'

Although I've been hopping around between releases. I've abandoned esp-idf-v2.1 in favor of v2.0 as that was the last know working version. Is it possible for the menuconfig files between version out of sync?

Oddly a search within tasks.c has no reference to vPortCleanUpTCB, nor does ./include/task.h

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: undefined reference to `vPortCleanUpTCB'

Postby loboris » Thu Nov 02, 2017 1:25 am

vPortCleanUpTCB is external function, you have to define it in your application.
If you don't use static allocated tasks, disable Enable FreeRTOS static allocation API in FreeRTOS configuration.
config SUPPORT_STATIC_ALLOCATION
bool "Enable FreeRTOS static allocation API"
default n
help
FreeRTOS gives the application writer the ability to instead provide the memory
themselves, allowing the following objects to optionally be created without any
memory being allocated dynamically:

- Tasks
- Software Timers
- Queues
- Event Groups
- Binary Semaphores
- Counting Semaphores
- Recursive Semaphores
- Mutexes

Whether it is preferable to use static or dynamic memory allocation is dependent on
the application, and the preference of the application writer. Both methods have pros
and cons, and both methods can be used within the same RTOS application.

Creating RTOS objects using statically allocated RAM has the benefit of providing the
application writer with more control: RTOS objects can be placed at specific memory locations.
The maximum RAM footprint can be determined at link time, rather than run time.
The application writer does not need to concern themselves with graceful handling of memory allocation failures.
It allows the RTOS to be used in applications that simply don't allow any dynamic memory allocation
(although FreeRTOS includes allocation schemes that can overcome most objections).
config ENABLE_STATIC_TASK_CLEAN_UP_HOOK
bool "Enable static task clean up hook"
depends on SUPPORT_STATIC_ALLOCATION
default n
help
Enable this option to make FreeRTOS call the static task clean up hook when a task is deleted.

Bear in mind that if this option is enabled you will need to implement the following function::

void vPortCleanUpTCB ( void *pxTCB ) {
// place clean up code here
}

Who is online

Users browsing this forum: Majestic-12 [Bot] and 175 guests