This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: malloc1 test and posix stdio fails
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Brett Delmage <Brett dot Delmage at twobikes dot ottawa dot on dot ca>
- Cc: ECOS mailing list <ecos-discuss at ecos dot sourceware dot org>
- Date: Tue, 16 May 2006 17:48:12 +0200
- Subject: Re: [ECOS] malloc1 test and posix stdio fails
- References: <Pine.LNX.4.61.0605161101590.14238@pannier.canbike.ca>
On Tue, May 16, 2006 at 11:33:35AM -0400, Brett Delmage wrote:
> Posix stdio is not working on my May 9 CVS ARM lpcxxx target. I traced
> this to malloc returning 0.
>
> I started running through the memalloc tests. I am loading them into Flash
> and running them using my JTAG debugger, as I would be with my
> application. i.e. I'm not using the test driver or Redboot.
>
> The following tests passed:
>
> heaptest
> dlmalloc1
> dlmalloc2
> kmemfix1
> kmemvar1
>
> However test malloc1 failed as follows:
>
> INFO:<Starting tests from testcase
>
> /ecos-c/usr/J1156-2/ecos-cvs-may9/ecos/packages/services/memalloc/common/current/test
> s/malloc1.c for C library malloc(), calloc() and free() functions>
>
> FAIL:<Can't determine allocation size to use>
>
> Line: 103, File: /ecos-c/usr/J1156-2/ecos-cvs-may9/ecos/packages/services/
> memalloc/common/current/tests/malloc1.c
>
> EXIT:<done>
> ---------------------------------------
> Which refers to the following code snippet:
>
> int
> main( int argc, char *argv[] )
> {
> int *i;
> char *str, *str2, *str3;
> int j;
> int poolmax;
>
> CYG_TEST_INIT();
>
> CYG_TEST_INFO("Starting tests from testcase " __FILE__ " for C library
> "
> "malloc(), calloc() and free() functions");
>
> poolmax = mallinfo().maxfree;
It would be interesting to see all the return values from
mallinfo(). Could you print them out please.
> memalloc.h:
> This would seem to indicate I have 16K for heap.
>
> #define CYGNUM_MEMALLOC_FALLBACK_MALLOC_POOL_SIZE 16384
> #define CYGNUM_MEMALLOC_FALLBACK_MALLOC_POOL_SIZE_16384
No, this is unlikely to be true. This size is only used when there is
no automatic heap definition. Normally everything between the end of
the bss and top of memory is used as heap.
> ----------------------------------------------------------------
> In case this is useful:
>
> #ifndef CYGONCE_PKGCONF_HEAPS_HXX
> #define CYGONCE_PKGCONF_HEAPS_HXX
> /* <pkgconf/heaps.hxx> */
>
> /* This is a generated file - do not edit! */
>
> #define CYGMEM_HEAP_COUNT 1
> #include <cyg/memalloc/dlmalloc.hxx>
>
> extern Cyg_Mempool_dlmalloc *cygmem_memalloc_heaps[ 2 ];
>
> #endif
And this confirms that an automaticly sized heap is being used.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss