T
Tim Wescott
- Jan 1, 1970
- 0
According to Microchip, the MPLAB 6.6 includes a linker. Assuming thatEd said:Hi all,
Please excuse me if this seems a daft question, but I am writing a
program in ASM using MPLAB. That is going fine, I have no probs here,
but what I would like to know is (and I'm not that experienced in this
kind of thing) is there a way I can simply break my subroutines into
smaller seperate files and call them on request, or something away from
the main program, since its getting pretty big and it could make things
alot neater to have various completed objects to the program seperate
from the core of it.
Any pointers or advice would be great
Thanks,
Ed
it's there on 6.53 you want to assemble and link separately.
Usually your assembly files will be run through the linker to produce
object files. An object file is a strange intermediate step where the
assembly (or C code) has been turned into machine language, but which
can still have a few locations defined by name instead of number. Then
you run the batch of assembly files through the linker, which looks for
all of the names that you've asked for, and links it all up into an
executable file. MPLAB probably links directly to a hex file, but it may
go through a "loader" as well.
You need to tell the assembler what you're planning with assembler
directives. There will be something like ".export" to tell the
assembler that you want to make a symbol available, and ".import" to
tell the assembler to assume that a symbol is available at link time.
Every assembler has a different syntax, so you'll have to look in your
documentation to see what you have to do.
Expect to dink with this a bit -- I'm a paid professional, and whenever
I use a new toolchain I always have to mess with it some before I get
all my i's dotted and t's crossed just exactly the way the tools want
them to be. A batch file to invoke the assembler and linker is helpful,
when you get frustrated with everything assembling every time you build
you'll want to learn how to use make, but do that on another day.