This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: dividing the elf object file file in to two binary files
- From: ganesh kr <krganesh01 at gmail dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Wed, 5 Aug 2009 18:36:50 +0530
- Subject: [ECOS] Re: dividing the elf object file file in to two binary files
- References: <73f9997f0907192203h77494e62u58b44ccfc7a738f4@mail.gmail.com>
Hi,
I am using ecos 3.0. I am not able to use malloc(). when I call
malloc very first time in my application, it returns null. I called
mallinfo() just before calling malloc. The values of different members
of the returned structure is as bellow:
struct mallinfo {
int arena = 00000000
int ordblks = 00000000
int smblks; = 00000000
int hblks; = 82630000
int hblkhd; = 01356353
int usmblks; = C0043602
int fsmblks; = 330150A8
int uordblks; = 51010004
int fordblks; = 00043A80
int keepcost; = 3BC0A800
int maxfree; = 27010004
};
all these numbers seems to be not correct.
My linker directive file is as bellow:
STARTUP(./lib/vectors.o)
ENTRY(reset_vector)
INPUT(./lib/extras.o)
GROUP(./lib/libtarget.a libgcc.a libsupc++.a)
MEMORY {
app_flash0_rsvd1 : ORIGIN = 0x0, LENGTH = 0x200
app_flash0_memory : ORIGIN = 0x200, LENGTH = 127K-0x200
app_flash0_rsvd2 : ORIGIN = 0x1fa00, LENGTH = 0x200
app_flash1_rsvd1 : ORIGIN = 0x08000000, LENGTH = 0
app_flash1_memory : ORIGIN = 0x08000000, LENGTH = 128K
sram_rsvd1 : ORIGIN = 0x04000000, LENGTH = 0
sram_memory : ORIGIN = 0x04000000, LENGTH = 192K
}
SECTIONS
{
.debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : {
*(.debug_pubnames) } .debug_info 0 : { *(.debug_info) } .debug_abbrev
0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : {
*(.debug_macinfo) } .note.arm.ident 0 : { KEEP (*(.note.arm.ident)) }
.rom_vectors 0x0000000 : { __rom_vectors_vma = ABSOLUTE(.); . = .;
KEEP (*(.vectors)) } > app_flash0_rsvd1 __rom_vectors_lma =
LOADADDR(.rom_vectors);
.text ALIGN (0x4) : { _stext = ABSOLUTE(.); PROVIDE (__stext =
ABSOLUTE(.)); *(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init)
*(.glue_7) *(.glue_7t) } > app_flash0_memory _etext = .; PROVIDE
(__etext = .);
.fini ALIGN (0x4) : { . = .; *(.fini) } > app_flash0_memory
.rodata ALIGN (0x4) : { . = .; *(.rodata*) *(.gnu.linkonce.r.*) }
> app_flash0_memory
.rodata1 ALIGN (0x4) : { . = .; *(.rodata1) } > app_flash0_memory
.fixup ALIGN (0x4) : { . = .; *(.fixup) } > app_flash0_memory
.gcc_except_table ALIGN (0x4) : { . = .; *(.gcc_except_table) } >
app_flash0_memory
.fixed_vectors 0x04000000 : { . = .; KEEP (*(.fixed_vectors)) } >
sram_memory
.data ALIGN (0x4) : AT ((LOADADDR (.gcc_except_table) + SIZEOF
(.gcc_except_table) + 4 - 1) & ~ (4 - 1)) { __ram_data_start =
ABSOLUTE (.); *(.data*) *(.data1) *(.gnu.linkonce.d.*) . = ALIGN (4);
KEEP(*( SORT (.ecos.table.*))) ; . = ALIGN (4); __CTOR_LIST__ =
ABSOLUTE (.); KEEP (*(SORT (.ctors*))) __CTOR_END__ = ABSOLUTE (.);
__DTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.dtors*))) __DTOR_END__ =
ABSOLUTE (.); *(.dynamic) *(.sdata*) *(.gnu.linkonce.s.*) . = ALIGN
(4); *(.2ram.*) } > sram_memory __rom_data_start = LOADADDR (.data);
__ram_data_end = .; PROVIDE (__ram_data_end = .); _edata = .; PROVIDE
(edata = .); PROVIDE (__rom_data_end = LOADADDR (.data) +
SIZEOF(.data));
.bss ALIGN (0x4) : { __bss_start = ABSOLUTE(.); *(.scommon)
*(.dynsbss) *(.sbss*) *(.gnu.linkonce.sb.*) *(.dynbss) *(.bss*)
*(.gnu.linkonce.b.*) *(COMMON) __bss_end = ABSOLUTE (.); } >
sram_memory
__heap1 = ALIGN (0x8);
. = ALIGN(4); _end = .; PROVIDE (end = .);
}
Please any one tell me whats the problem.
1. Is dynamic memory allocation dependent on linker directive and
memory layout?
2. What are the steps to be done to use malloc()? Like what are the
options need to choose in ecos config tool to use malloc()?
Please let me know if any more information is needed.
Regards,
Ganesh K R
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss