I'm trying to add a function pointer at a specified location in flash. I've tried the following code, but I'm getting nothing written to the specified location in flash; it's just empty (all Fs). I've tried the CODE_SECTION option, but that just places the entire function in that memory space, I just need the pointer there.
In main.c:
#pragma DATA_SECTION(normalOperation, "NORMALOP")
void
normalOperation ( void ){
code here
}
In the linker:
MEMORY
{
PAGE 0:
JUMPTBL : origin = 0x338000, length = 0x000064
}
SECTIONS
{
NORMALOP : > JUMPTBL PAGE = 0
}
When I run this, I get the warning of "#824-D pragma DATA_SECTION can only be applied to a file level symbol definition, not "normalOperation" (declared at line 402) main.c" and no pointer in the specified memory section.
What is the correct way to place a function pointer in flash memory?