This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: elf to binary conversion problem


Andrew Lunn ?????:
The .data segment is your problem. It is much higher in memory, so
objdump is putting 0's in the middle.

You might have a RAM application which you are trying to ROM?  Or your
ROM linker scripts are broken.

Andrew

Thanks, Andrew, for help.
Problem was in linker script.
Data and bss sections were defined
    SECTION_got (flash, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_sram (sram, 0x20000400,  LMA_EQ_VMA)
    SECTION_data (sram, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_bss (sram, ALIGN (0x8), LMA_EQ_VMA)
I've changed it to
    SECTION_got (flash, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_sram (sram, 0x20000400,  FOLLOWING (.got))
    SECTION_data (sram, ALIGN (0x8), FOLLOWING (.sram))
    SECTION_bss (sram, ALIGN (0x8), LMA_EQ_VMA)
But I'm not sure if it is completely correct.
Whole script(20k sram, 128k flash):
// eCos memory layout

#include <pkgconf/hal.h>
#include <cyg/infra/cyg_type.inc>

MEMORY
{
sram : ORIGIN = 0x20000000, LENGTH = 0x00005000-CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE
flash : ORIGIN = 0x08000000, LENGTH = 0x00020000
}


SECTIONS
{
    SECTIONS_BEGIN
    SECTION_rom_vectors (flash, 0x08000000, LMA_EQ_VMA)
    SECTION_RELOCS (flash, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_text (flash, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_fini (flash, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_rodata (flash, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_rodata1 (flash, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_fixup (flash, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_gcc_except_table (flash, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_eh_frame (flash, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_got (flash, ALIGN (0x8), LMA_EQ_VMA)
    SECTION_sram (sram, 0x20000400,  FOLLOWING (.got))
    SECTION_data (sram, ALIGN (0x8), FOLLOWING (.sram))
    SECTION_bss (sram, ALIGN (0x8), LMA_EQ_VMA)
    CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
    SECTIONS_END
}

hal_vsr_table = 0x20000000;
hal_virtual_vector_table = hal_vsr_table + 128*4;
hal_startup_stack = 0x20000000 + 1024*20;

Max

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]