EmbeddedRelated.com
Forums

"section" and "org" capabilities of PIC linkers

Started by 2Penny December 31, 2004
Fellow CAE travelers:

I'm interested in finding out if the MPLAB linker has the
capability of using the "section" and "org" commands.  I've
used "section" with a Borland x86, an HP 68000, and a
WindRiver 68000 type linker.  I've used "org" only with the
HP and Windriver 68000 type linkers.  I liked how they separated
out executable code from data and (with the "org" command)
place the code where I wanted it.  I'm hoping someone here
has some experience with this and can tell me definitively
whether the PIC linker can do the same sort of things or not.

Now I'll just wait for input,

2Penny

Thanks for the first laugh of 2005. Harvard architecture as used in a
PIC uses separate memory for program and data so you can't mix them.
You can still use org if you want to leave holes in your code. The
pedants might point out that there are some odd techniques for storing
data in the program memory if you really want to but you can't put
executable code in the data memory.
Peter

2Penny wrote:
> Fellow CAE travelers: > > I'm interested in finding out if the MPLAB linker has the > capability of using the "section" and "org" commands. I've > used "section" with a Borland x86, an HP 68000, and a > WindRiver 68000 type linker. I've used "org" only with the > HP and Windriver 68000 type linkers. I liked how they separated > out executable code from data and (with the "org" command) > place the code where I wanted it. I'm hoping someone here > has some experience with this and can tell me definitively > whether the PIC linker can do the same sort of things or not. > > Now I'll just wait for input, > > 2Penny >
Since the PICs have separate code and data memory it is a bit more complicated. You can do it with a combination of the assembler and linker. I would suggest going to the Microchip site (www.microchip.com) and getting the documentation for MPASM and MPLINK and reading through them. Particularly the sections in MPASM about relocatable code and in MPLINK about relocation processing.