ARM Developer Suite

The ADS toolkit consists of the following major components:
• command-line development tools
• GUI development tools
• utilities
• supporting software.

armlink, the ARM linker, enables you to:
• link a collection of objects and libraries (in either ARM or Thumb code) into an
executable image
• partially link a collection of objects into an object that can be used as input to a
future link step
• specify where the code and data are to be located in memory(I will describe it in detail)
• produce debug and reference information about the linked files.

Objects consist of input sections that contain code, initialized data, or the locations of
memory that must be set to zero. Input sections can be Read-Only (RO), Read-Write
(RW), or Zero-Initialized (ZI). These attributes are used by armlink to group input
sections into bigger building blocks called output sections, regions, and images. Load
regions are equivalent to ELF segments.
Load regions typically exist in the system memory map at reset or after the image is
loaded into the target by a debugger. Before you can execute the image, you might have
to move some of its regions to their execution addresses. The memory map of an image
therefore has two distinct views:
• the load view of the memory when the program and data are first loaded
• the execution view of the memory after code is moved to its normal execution
location.

The complete linker command syntax is:
armlink [-help] [-vsn] [-partial] [-output file] [-elf] [-reloc]
[-ro-base address] [-ropi] [-rw-base address] [-rwpi] [-split] [-scatter file]
[-debug|-nodebug] [-remove (RO/RW/ZI/DBG)|-noremove] [-entry location ]
[-keep section-id] [-first section-id] [-last section-id] [-libpath pathlist]
[-scanlib|-noscanlib] [-locals|-nolocals] [-callgraph] [-info topics] [-map]
[-symbols] [-symdefs file] [-edit file] [-xref] [-xreffrom object(section)]
[-xrefto object(section)] [-errors file] [-list file] [-verbose] [-unmangled
|-mangled] [-match crossmangled] [-via file] [-strict] [-unresolved symbol]
[-MI|-LI|-BI] [input-file-list]

There are all the command line, I will pick up some of them we used to discuss.
others if you want to know try to find the document ,"ADS_linkerguide_A".

The memory map of an image has two distinct views.
There are two way to pass this information to armlink.

Using command-line options:
One region in load view, three contiguous regions in execution view. Use the -ro-base option to create this type of image.
One region in load view, three non-contiguous regions in execution view.Use the -ro-base and -rw-base options to create this type of image.
Two regions in load view, three non-contiguous regions in execution view. Use the -ro-base, -rw-base, and -split options to create this type of image.

Using a scatter-loading description file:


Heap:The portion of computer memory that can be used for creating new variables.

Stack:The portion of memory that is used to record the return address of code that calls a
subroutine. The stack can also be used for parameters and temporary variables.

at the retarget.c:
change the value you used "heap_base"
__value_in_regs struct __initial_stackheap __user_initial_stackheap(
unsigned R0, unsigned SP, unsigned R2, unsigned SL)
{
struct __initial_stackheap config;

config.heap_base = (unsigned int)&bottom_of_heap; // defined in heap.s // placed by scatterfile
config.stack_base = SP;
config.heap_limit = SL;
config.stack_limit = SL;



return config;
}

Comments