From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13982 invoked by alias); 5 Aug 2009 13:07:00 -0000 Received: (qmail 13971 invoked by uid 22791); 5 Aug 2009 13:06:59 -0000 X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f202.google.com (HELO mail-pz0-f202.google.com) (209.85.222.202) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 05 Aug 2009 13:06:53 +0000 Received: by pzk40 with SMTP id 40so49863pzk.14 for ; Wed, 05 Aug 2009 06:06:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.114.53.19 with SMTP id b19mr11550269waa.143.1249477611096; Wed, 05 Aug 2009 06:06:51 -0700 (PDT) In-Reply-To: <73f9997f0907192203h77494e62u58b44ccfc7a738f4@mail.gmail.com> References: <73f9997f0907192203h77494e62u58b44ccfc7a738f4@mail.gmail.com> Date: Wed, 05 Aug 2009 13:07:00 -0000 Message-ID: <73f9997f0908050606l6bac5047g6e22325c8cd35a39@mail.gmail.com> From: ganesh kr To: ecos-discuss@ecos.sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Re: dividing the elf object file file in to two binary files X-SW-Source: 2009-08/txt/msg00011.txt.bz2 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