vApplicationGetTimerTaskMemory prototype

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

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:

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.

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

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.

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?

If you look at the documentation for configSUPPORT_STATIC_ALLOCATION at https://www.freertos.org/a00110.html it gives better documentation for that function.

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

My personal preference and coding standards would prefer it.