views:

89

answers:

1

Hello,

my elf-file is about 1MByte with all debug symbols. As I try to create a binary file with "powerpc-eabi-objcopy -O binary out.elf out.bin" the out.bin is 1GByte huge.

The build script looks like this

STARTUP(vectors.o)
ENTRY(__exception_reset)
INPUT(extras.o)

GROUP( libtarget.a libgcc.a libsupc++.a )
MEMORY
{
rom : ORIGIN = 0x00020000, LENGTH = 0x001E0000
ram(WA) : ORIGIN = 0x20000000, LENGTH = 0x00100000
iram(WA) : ORIGIN = 0x40000000, LENGTH = 80*1024
flash : ORIGIN = 0x28080000, LENGTH = 0x00780000
}
SECTIONS
{
__reserved_vectors = 0x00020000;
.bam : { . = .; KEEP(*(.bam)) } > rom
.vectors ALIGN (0x4) : { . = .; KEEP(*(.vectors)) } > rom
.text ALIGN (0x4) : { _stext = .; *(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init) } > rom _etext = .; PROVIDE (etext = .);
.rel.dyn : { *(.rel.init) *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) *(.rel.fini) *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) *(.rel.data.rel.ro*) *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) *(.rel.ctors) *(.rel.dtors) *(.rel.got) *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) *(.rel.sbss .rel.sbss.*  .rel.gnu.linkonce.sb.*) *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } > rom .rela.dyn : { *(.rela.init) *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) *(.rela.fini) *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) *(.rela.ctors) *(.rela.dtors) *(.rela.got) *(.rela.got1) *(.rela.got2) *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } > rom .rel.plt : { *(.rel.plt) } > rom .rela.plt : { *(.rela.plt) } > rom
.fini ALIGN (0x8) : { . = .; *(.fini) } > rom
.rodata1 ALIGN (0x8) : { . = .; *(.rodata1*) } > rom
.rodata ALIGN (0x4) : { . = .; *(.rodata*) *(.gnu.linkonce.r.*) } > rom
.fixup ALIGN (0x4) : { __FIXUP_START__ = ABSOLUTE(.); *(.fixup) __FIXUP_END__ = ABSOLUTE(.);} > rom
.gcc_except_table ALIGN (0x1) : { __EXCEPT_START__ = ABSOLUTE(.); *(.gcc_except_table) *(.gcc_except_table.*) __EXCEPT_END__ = ABSOLUTE(.); } > rom
.eh_frame ALIGN (0x4) : { *(.eh_frame_hdr) . = .; __EH_FRAME_BEGIN__ = .; KEEP(*(.eh_frame)) __FRAME_END__ = .; . = . + 8; } > rom = 0
. = 0x00120000;
.romdata ALIGN(0x4) :
{
*(.romdata)
} > rom
.last_section ALIGN(0x4) :
{
    *(.last_section)
} > rom
. = 0x20000000;
__reserved_vsr_table = ALIGN (0x10);
. = __reserved_vsr_table + 0x200;
__reserved_virtual_table = ALIGN (0x10);
. = __reserved_virtual_table + 0x100;
.data ALIGN (0x10) : AT ((LOADADDR (.eh_frame) + SIZEOF (.eh_frame) + 8 - 1) & ~ (8 - 1)) { __ram_data_start = ABSOLUTE(.); *(.data*) *(.gnu.linkonce.d.*) __GOT1_START__ = ABSOLUTE(.); *(.got1) __GOT1_END__ = ABSOLUTE(.); . = ALIGN(8); __CTOR_LIST__ = ABSOLUTE(.); KEEP(*(SORT(.ctors*))) __CTOR_END__ = ABSOLUTE(.); __DTOR_LIST__ = ABSOLUTE(.); KEEP(*(SORT(.dtors*))) __DTOR_END__ = ABSOLUTE(.); . = ALIGN(8); KEEP(*( SORT (.ecos.table.*))) ; . = ALIGN(4); *( .2ram.*) ; __GOT2_START__ = ABSOLUTE(.); *(.got2) __GOT2_END__ = ABSOLUTE(.); __GOT_START = ABSOLUTE(.); _SDA_BASE_ = ABSOLUTE(.); *(.got.plt) *(.got) __GOT_END__ = ABSOLUTE(.); *(.dynamic) *(.eh_frame) __SDATA_START__ = ABSOLUTE(.); *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) __SDATA2_START__ = ABSOLUTE(.); *(.sdata2*) } > ram __rom_data_start = LOADADDR(.data); __ram_data_end = .; PROVIDE(__ram_data_end = .); _edata = .; PROVIDE (edata = .);
.sbss ALIGN (0x4) : { __sbss_start = ABSOLUTE (.); __SBSS_START__ = ABSOLUTE(.); *(.sbss.*) __SBSS_END__ = ABSOLUTE(.); __SBSSx_START__ = ABSOLUTE(.); *(.sbss*) __SBSSx_END__ = ABSOLUTE(.); *(.gnu.linkonce.sb.*) *(.scommon*) __sbss_end = ABSOLUTE (.); } > ram
.bss ALIGN (0x10) : { __bss_start = ABSOLUTE (.); . = .; *(.dynbss*) *(.bss*) *(.gnu.linkonce.b.*) *(COMMON) __bss_end = ABSOLUTE (.); } > ram
__heap1 = ALIGN(0x8);
. = 0x40000000;
.flexray ALIGN(0x8) :
{
*(.flexray)
} > iram
.devdata_sync_bridge :
{
*(.devdata_sync_bridge)
} > iram
.devdata ALIGN(0x4) :
{
*(.devdata)
} > iram
INTERN_SRAM_BASE ALIGN(0x4) :
{
*(INTERN_SRAM_BASE)
} > iram
. = ALIGN(4); _end = .; PROVIDE (end = .);
}
hal_vsr_table = (__reserved_vsr_table);
hal_virtual_vector_table = (__reserved_virtual_table);

Any ideas about the problem?

Thanks,

Friedrich

A: 

It's doing exactly what you're telling it to:

iram(WA) : ORIGIN = 0x40000000, LENGTH = 80*1024

That suggests the output file will end up being 1073823744 bytes.

Presumably what you really want is a copy of just the "rom" section.

tc.