<div dir="ltr"><div><br></div><div>I'm searching for an answer to a simple question.  My friend Google tried to help but so far Google hasn't given me a good answer.   I'm hoping some savvy DPRG member probably has the wisdom I seek.       </div><div><br></div><div><br></div><br><div>I'm using a microchip processor writing code in C.   The code consists of several C source files which are compiled into object code then linked together.  Something like this simplified example.</div><div><br></div><div>gcc -c   foo.c             <<<  compile C code into object file</div><div>gcc -c   bar.c             <<<  compile C code into object file</div><div><br></div><div>gcc   foo.o  bar.o   -o  foobar.cof     <<<  link all object files together</div><div><br></div><div>The final output is in cof format which is converted to hex format used by the programmer.   There is a map file created by the linker which allows me to see where all the C functions end up in memory, something like this.</div><div><br></div><div>External Symbols in Program Memory (by address):<br><br></div><div>                     .  .  .</div><div>                  0x003b18                  _foo<br>                     .  .  . </div><div>                  0x003e1e                  _bar<br> <br></div><div>  <br></div><div>My question is -   How can I force the linker to put a specific function at a specific location?     Say I want the function bar to start at 0x004000.</div><div><br></div><div>There should be some compiler or linker directives to accomplish that.</div><div><br></div><div>Any help is appreciated.</div><div><br></div><div>-Clay Timmons-</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> <br></div></div>