# vApplicationGetTimerTaskMemory prototype

**URL:** <https://forums.freertos.org/t/vapplicationgettimertaskmemory-prototype/9380>\
**Category:** Kernel\
**Created:** [March 30, 2020, 9:52pm UTC](https://forums.freertos.org/t/vapplicationgettimertaskmemory-prototype/9380 "2020-03-30T21:52:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@robert](https://forums.freertos.org/u/robert)\
**Post date:** [March 30, 2020, 9:52pm UTC](https://forums.freertos.org/t/vapplicationgettimertaskmemory-prototype/9380/1 "2020-03-30T21:52:02Z")

</div>

I’m looking for where the prototype for vApplicationGetTimerTaskMemory is declared so that it can be checked for consistency between use and declaration at compile time.

Even a full seach of the download doesn’t seem to find it.

Robert

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [March 30, 2020, 10:27pm UTC](https://forums.freertos.org/t/vapplicationgettimertaskmemory-prototype/9380/2 "2020-03-30T22:27:28Z")

</div>

Currently this should be provided by the application writer to be in scope of the file where the function is implemented. Here are the locations of examples in the download:

 ![FilesContainingPrototype](https://d2v6vdsk2p900z.cloudfront.net/original/1X/65b0e6f0108cd91a3d9f037bc7444800009f0f3e.jpeg)

We recently had a request to add the prototypes into the kernel’s header files - although to date our thinking was that the application should provide the prototypes for any optional functions provided by the application, we may change that going forward.

---

<div class="post-metadata">

**Author:** ![robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@robert](https://forums.freertos.org/u/robert)\
**Post date:** [March 30, 2020, 10:57pm UTC](https://forums.freertos.org/t/vapplicationgettimertaskmemory-prototype/9380/3 "2020-03-30T22:57:57Z")

</div>

Umm, so there is no protection for differences in declaration??

That seems, let’s say, somewhat misguided. Also more than a little surprising that you don’t use C’s own facilities for improving what little type safety it has.

As an example of some of the consequences of doing this I get the following error from static analysis (I don’t have the option of ignoring errors in my code, I can in the FreeRTOS code)

blinky.c 151 Info 765: external  
‘vApplicationGetTimerTaskMemory(StaticTask\_t \*\*, StackType\_t \*\*, uint32\_t  
\*)’ (line 151, file D:\CleanDesignGit\TM4CBuild\blinky.c) could be made  
static [MISRA 2004 Rule 8.10]

And that’s with a correct prototype but only within file scope, imagine the damage an incorrect prototype out of file scope could do.

The hack for this, and make no mistake it is a hack so if you have a cleaner solution please present it, would be to add a header file to FreeRTOS to add the missing prototypes. I really don’t like modifying the distribution since it makes applying updates more difficult but it appears to be what’s required.

Robert

---

<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:** [March 30, 2020, 11:18pm UTC](https://forums.freertos.org/t/vapplicationgettimertaskmemory-prototype/9380/4 "2020-03-30T23:18:58Z")

</div>

Richard, my opinion is like Roberts, if a module requests a callback to be provided by something else, a prototype for that callback should be in header of the requesting module. The requesting module needs to have that prototype anyway to make the call, so it should make that prototype public so the providing code can have its definition checked to see if it is compliant.

---

<div class="post-metadata">

**Author:** ![pblase](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/pblase/32/2015_2.png) [@pblase](https://forums.freertos.org/u/pblase)\
**Post date:** [April 20, 2020, 9:54pm UTC](https://forums.freertos.org/t/vapplicationgettimertaskmemory-prototype/9380/5 "2020-04-20T21:54:01Z")

</div>

Not to mention, there’s no indication of what this function is supposed to actually do.  
Timers.c says:

> /\* If static allocation is supported then the application must provide the  
> following callback function - which enables the application to optionally  
> provide the memory that will be used by the timer task as the task’s stack  
> and TCB. \*/

What if I don’t provide the memory, since it’s optional? How do I indicate that?

---

<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:** [April 20, 2020, 10:49pm UTC](https://forums.freertos.org/t/vapplicationgettimertaskmemory-prototype/9380/6 "2020-04-20T22:49:15Z")

</div>

If you look at the documentation for configSUPPORT\_STATIC\_ALLOCATION at [https://www.freertos.org/a00110.html](https://www.freertos.org/a00110.html) it gives better documentation for that function.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [April 20, 2020, 10:51pm UTC](https://forums.freertos.org/t/vapplicationgettimertaskmemory-prototype/9380/7 "2020-04-20T22:51:51Z")

</div>

If consensus is to move the prototypes to the headers, we can do that.

---

<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:** [April 20, 2020, 11:14pm UTC](https://forums.freertos.org/t/vapplicationgettimertaskmemory-prototype/9380/8 "2020-04-20T23:14:15Z")

</div>

My personal preference and coding standards would prefer it.
