Question
typedef for constant pointer to constant data function array
I have a C header file (.h):
typedef uint8_t paraFunction(uint8_t paraVal, uint8_t paraNum);
paraFunction *paraCallTable[256];
And I have a C source file (.c):
paraFunction *paraCallTable[] = { fn1, fn2, ... fn255, fn256 };
However, the array ends up in the data section. I want it to be in code/flash because the function addresses (the array data) are constant. The array is used by functions in other source files.
How do I rewrite these declarations to make it all constant? And where do they need to be (.c or .h)?
I googled and tried a gazillion different ways and I obviously just don't get it.