User`s manual

3-26 Suite56 DSP Tools User’s Manual Motorola
Exploiting Memory Control Files
Example 3 -11. Assembling Two Relocatable Object Files
> asm56300 -b section_a.asm
> asm56300 -b section_b.asm
The commands in Example 3 -11 create relocatable object files, section_a.cln and
section_b.cln, that can then be linked. For the purpose of this example, we assume
that we want the block of zeroes set up by
section_a.asm to start at location x:$333
and the block of ones set up by section_b.asm to start at x:$555.Weusethememory
control file in Example 3 -12 to place those blocks at the target locations.
Example 3 -12. A Memory Control File: sec.ctl
section section_b
base x:$555
section section_a x:$333
The two files are linked with the command in Example 3 -13. The option -b indicates that
an object file will be created as linker output. The option
-m indicates that a map file
named
out.map will be created as well. (That file is of particular interest to us in this
example.) The option
-r indicates that the linker should consult a memory control file (in
this example, named
sec.ctl) to determine where to place sections in memory on the
target device.
Example 3 -13. Command to Link Memory Control File to Object Files
> dsplnk -b -mout.map -rsec.ctl section_a section_b
You see the contents of the resulting map file in Example 3 -14. When you use memory
control files (as we did in this example), check the resulting map file to determine whether
you achieved the memory mapping that you expected. By consulting the user’s manual of
the target device (in this example, DSP56300), particularly the chapter about memory
mapping, we know that certain parts of X memory are reserved; those parts are marked
UNUSED in the map file. If those reserved portions of memory were in use, then we would
know that our program was mapping memory inappropriately, and we would
consequently search for the source of that bug.