ARM Technical Support Knowledge Articles

armlink/fromelf: Merging load regions to obtain a single binary output

Applies to: ARM Developer Suite (ADS), RealView Developer Kit (RVDK) for OKI, RealView Developer Kit for XScale (RVXDK), RealView Development Suite (RVDS), Software Development Toolkit (SDT)

When placing code and data using scatter-loading, you might need to place more than one execution region at a fixed address in e.g. ROM or Flash, which must not be moved or copied to another location. To do this with ADS 1.0.1 and SDT, you have to introduce another load region, and place the second execution region in it so that it becomes a 'root' region, like this:

ROM_1 0x0 0x10000
{
ER_1 0x0
{
init.o (+RO, +FIRST)
* (+RO)
}
RAM 0x20000
{
* (+RW, +ZI)
}
}
ROM_2 0x10000 0x10000
{
ER_2 0x10000
{
app.o (+RO)
}
}

Unfortunately, when converting the ELF linker output to a binary format with a fromelf step, fromelf will generate one output file for each load region (in the case above, two files, named ER_1 and ER_2). In ADS 1.0.1 and earlier, there is no direct way to create only one file that contains both load regions. Some workarounds for ADS 1.0.1 and SDT are described in Merging binary images together, BIN2AOF.

This restriction is solved in ADS 1.1 with the introduction of the 'FIXED' attribute for regions within the scatter file. The 'FIXED' attribute forces the load address and execution address of a region to be the same (making it a 'root region'), so that it will not be moved/copied. This is achieved by inserting padding into the output file.

With ADS 1.1 and later, you can change the scatter-loading description above to:

ROM_1 0x0 0x20000
{
ER_1 0x0
{
init.o (+RO, +FIRST)
* (+RO)
}
ER_2 0x10000 FIXED
{
app.o (+RO)
}
RAM 0x20000
{
* (+RW, +ZI)
}
}

Note the use of 'FIXED', so that both ER_1 and ER_2 are root regions, and only one output file is created by fromelf (named ER_1).

In RVCT, as an alternative to using 'FIXED', one of the fromelf options: --bincombined (available in RVCT 4.0), --i32combined or --m32combined can be used.  These options will generate one output file for an image containing multiple load regions, inserting padding as required.

Article last edited on: 2009-04-21 16:12:25

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2008-9 ARM Limited. All rights reserved. External (Open), Non-Confidential