This is the mail archive of the ecos-discuss@sources.redhat.com 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: Using standard malloc()


FYI,

The problem I faced was not due the configuration.

The Doug Lea's malloc implementation which I was using failed to
allocate memory because one of its variable "remainder_size" was
declared "long" which probably should have been "unsigned long" due to
this a condition to check for the top fails always since the address
which it checks was showing a negative.

When it was made "unsigned long" malloc works fine.

Thanks and Regards,
Bala.


On 5/12/05, Balasaravanan P <pbalasaravanan@gmail.com> wrote:
> Hi Andrew,
> 
> Thanks for the reply.
> 
> I am using MIPS 4kc processor.
> I also tried enabling "CYGBLD_ISO_MALLOC_HEADER" but could give correct value.
> 
> I have pasted the ecosconfig export ecm file below.
> 
> =========================================
> 
> cdl_savefile_version 1;
> cdl_savefile_command cdl_savefile_version {};
> cdl_savefile_command cdl_savefile_command {};
> cdl_savefile_command cdl_configuration { description hardware template
> package };
> cdl_savefile_command cdl_package { value_source user_value
> wizard_value inferred_value };
> cdl_savefile_command cdl_component { value_source user_value
> wizard_value inferred_value };
> cdl_savefile_command cdl_option { value_source user_value wizard_value
> inferred_value };
> cdl_savefile_command cdl_interface { value_source user_value
> wizard_value inferred_value };
> 
> cdl_configuration eCos {
>    description "" ;
>    hardware    mips32_4kc ;
>    template    kernel ;
>    package -hardware CYGPKG_HAL_MIPS v2_0 ;
>    package -hardware CYGPKG_HAL_MIPS_MIPS32 v2_0 ;
>    package -hardware CYGPKG_HAL_MIPS v2_0 ;
>    package CYGPKG_HAL v2_0 ;
>    package CYGPKG_IO v2_0 ;
>    package CYGPKG_IO_SERIAL v2_0 ;
>    package CYGPKG_INFRA v2_0 ;
>    package CYGPKG_KERNEL v2_0 ;
>    package CYGPKG_ERROR v2_0 ;
>    package CYGPKG_MEMALLOC v2_0 ;
>    package CYGPKG_ISOINFRA v2_0 ;
> };
> 
> cdl_option CYGFUN_HAL_COMMON_KERNEL_SUPPORT {
>    user_value 1
> };
> 
> cdl_option CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK {
>    user_value 0
> };
> 
> cdl_option CYGHWR_HAL_MIPS_MIPS32_CORE {
>    user_value 4Kc
> };
> 
> cdl_component CYGSEM_KERNEL_SCHED_TIMESLICE {
>    user_value 1
> };
> 
> cdl_component CYGPKG_KERNEL_INSTRUMENT {
>    user_value 0
> };
> 
> cdl_option CYGDBG_KERNEL_INSTRUMENT_SMP {
>    user_value 0
> };
> 
> cdl_component CYGDBG_KERNEL_INSTRUMENT_MSGS {
>    user_value 0
> };
> 
> cdl_option CYGSEM_MEMALLOC_ALLOCATOR_FIXED_THREADAWARE {
>    user_value 0
> };
> 
> cdl_option CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_THREADAWARE {
>    user_value 0
> };
> 
> cdl_option CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_COALESCE {
>    user_value 0
> };
> 
> cdl_option CYGBLD_MEMALLOC_MALLOC_IMPLEMENTATION_HEADER {
>    user_value <cyg/memalloc/dlmalloc.hxx>
> };
> 
> cdl_option CYGIMP_MEMALLOC_MALLOC_VARIABLE_SIMPLE {
>    user_value 0
> };
> 
> cdl_option CYGIMP_MEMALLOC_MALLOC_DLMALLOC {
>    user_value 1
> };
> 
> cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER {
>    inferred_value 1 <cyg/error/codes.h>
> };
> 
> cdl_option CYGBLD_ISO_ERRNO_HEADER {
>    inferred_value 1 <cyg/error/errno.h>
> };
> 
> cdl_option CYGBLD_ISO_RAND_HEADER {
>    user_value 0 0
> };
> 
> cdl_option CYGBLD_ISO_MALLOC_HEADER {
>    user_value 0 0
> };
> 
> cdl_option CYGBLD_ISO_STDLIB_SYSTEM_HEADER {
>    user_value 0 0
> };
> 
> cdl_option CYGBLD_ISO_STRERROR_HEADER {
>    inferred_value 1 <cyg/error/strerror.h>
> };
> 
> 
> Best Regards,
> Bala.
> 
> 
> On 5/12/05, Andrew Lunn <andrew@lunn.ch> wrote:
> > On Wed, May 11, 2005 at 11:34:30AM +0530, Balasaravanan P wrote:
> > > Hi,
> > >
> > > I am writing an abstraction layer for an existing application this
> > > requires me to use malloc to create threads.
> > >
> > > I tried using the standard LIBC malloc which returns NULL. I tried
> > > printing the mallinfo structure and it shows 0 for all its members.
> > >
> > > Is there any other way to use standard malloc or am I missing any
> > > configuration steps.
> >
> > You are missing something somewhere. malloc should work. What is the
> > target and the configuration? Do an ecosconfig export and post the
> > result.
> >
> >        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


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