Writing a Function at specific memory location of Flash
To put a function in a section with GCC, use a function attribute

extern void foobar (void) __attribute__ ((section ("bar")));


Then, declare a section called bar in your linker script. Eg.

MEMORY
{
  FLASH (rx): ORIGIN=0xDEADBEEF, LENGTH=0x80000000
}

SECTIONS
{
  .bar:
  {
    KEEP(*(.bar))
  } &gt; FLASH
}