# Can't get vApplicationGetTimerTaskMemory to be recognised

**URL:** <https://forums.freertos.org/t/cant-get-vapplicationgettimertaskmemory-to-be-recognised/19208>\
**Category:** Kernel\
**Tags:** debug\
**Created:** [February 19, 2024, 12:24am UTC](https://forums.freertos.org/t/cant-get-vapplicationgettimertaskmemory-to-be-recognised/19208 "2024-02-19T00:24:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rocketmagnet](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rocketmagnet](https://forums.freertos.org/u/Rocketmagnet)\
**Post date:** [February 19, 2024, 12:24am UTC](https://forums.freertos.org/t/cant-get-vapplicationgettimertaskmemory-to-be-recognised/19208/1 "2024-02-19T00:24:36Z")

</div>

I have #defined configSUPPORT\_STATIC\_ALLOCATION as 1, and so I need to define my own versions of vApplicationGetTimerTaskMemory() and vApplicationGetIdleTaskMemory().

Now, if I don’t do that, and try to build, then I get two linker errors, saying that those two functions are undefined. Of course.

If I define those functions, then vApplicationGetIdleTaskMemory() seems to be recognised by the linker, but I still get the error: Undefined reference to ‘vApplicationGetTimerTaskMemory’.

I have carefully checked the function to make sure it matches the prototype found in timers.h. The prototype there is:

```auto
    void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
                                         StackType_t ** ppxTimerTaskStackBuffer,
                                         uint32_t * pulTimerTaskStackSize );

```

My function is:

```auto
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer,
                                     StackType_t **ppxTimerTaskStackBuffer,
                                     uint32_t *puxTimerTaskStackSize )
{
    static StaticTask_t xTimerTaskTCB;
    static StackType_t uxTimerTaskStack[configTIMER_TASK_STACK_DEPTH];
    *ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
    *ppxTimerTaskStackBuffer = uxTimerTaskStack;
    *puxTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
}

```

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![karahulx](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/karahulx/32/4893_2.png) [@karahulx](https://forums.freertos.org/u/karahulx)\
**Post date:** [February 19, 2024, 5:19am UTC](https://forums.freertos.org/t/cant-get-vapplicationgettimertaskmemory-to-be-recognised/19208/2 "2024-02-19T05:19:59Z")

</div>

Hi @Rocketmagnet  
Welcome to the FreeRTOS Community Forums !  
Is `configUSE_TIMERS` defined in your FreeRTOSConfig.h file?  
`configUSE_TIMERS` should also be set to 1 for the timer APIs like ‘vApplicationGetTimerTaskMemory’.

Also you can instead set `configKERNEL_PROVIDED_STATIC_MEMORY` to 1 in the FreeRTOSConfig.h to use the kernel provided default implementations of these callbacks.

---

<div class="post-metadata">

**Author:** ![RAc](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rac/32/1389_2.png) [@RAc](https://forums.freertos.org/u/RAc)\
**Post date:** [February 19, 2024, 5:54am UTC](https://forums.freertos.org/t/cant-get-vapplicationgettimertaskmemory-to-be-recognised/19208/3 "2024-02-19T05:54:31Z")

</div>

could it be that your callbacks are implemented in a cpp file and thus decorated by the compiler? If so, relocate them to a file with the extension .c (easiest solution).

---

<div class="post-metadata">

**Author:** ![Rocketmagnet](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rocketmagnet](https://forums.freertos.org/u/Rocketmagnet)\
**Post date:** [February 19, 2024, 8:44am UTC](https://forums.freertos.org/t/cant-get-vapplicationgettimertaskmemory-to-be-recognised/19208/4 "2024-02-19T08:44:41Z")

</div>

Good call. Yes, I’ll try this. Strange though that vApplicationGetIdleTaskMemory() works but vApplicationGetTimerTaskMemory() doesn’t.

---

<div class="post-metadata">

**Author:** ![Rocketmagnet](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rocketmagnet](https://forums.freertos.org/u/Rocketmagnet)\
**Post date:** [February 19, 2024, 8:49am UTC](https://forums.freertos.org/t/cant-get-vapplicationgettimertaskmemory-to-be-recognised/19208/5 "2024-02-19T08:49:56Z")

</div>

Hmm. Just noticed that I’d #included “task.h” but not “timers.h”.

When I #included “timers.h” the build worked! Strange, you’d think it wouldn’t because of the decoration.

---

<div class="post-metadata">

**Author:** ![RAc](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rac/32/1389_2.png) [@RAc](https://forums.freertos.org/u/RAc)\
**Post date:** [February 19, 2024, 9:29am UTC](https://forums.freertos.org/t/cant-get-vapplicationgettimertaskmemory-to-be-recognised/19208/6 "2024-02-19T09:29:12Z")

</div>

possibly there is an implied

extern “C”

around the prototype which will disable decoration.

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [February 19, 2024, 11:38am UTC](https://forums.freertos.org/t/cant-get-vapplicationgettimertaskmemory-to-be-recognised/19208/7 "2024-02-19T11:38:11Z")

</div>

Yes, the timer file pre-declares the prototype of the function, and that includes the extern “C” part, so if the prototype declaration has been seen, the function will get the right linkage.

---

<div class="post-metadata">

**Author:** ![kstribrn](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/kstribrn/32/2085_2.png) [@kstribrn](https://forums.freertos.org/u/kstribrn)\
**Post date:** [February 27, 2024, 11:10pm UTC](https://forums.freertos.org/t/cant-get-vapplicationgettimertaskmemory-to-be-recognised/19208/8 "2024-02-27T23:10:25Z")

</div>

Thanks for taking the time to report back! It greatly helps other users.
