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 Malloc inside kernel code.


On Sun, Feb 06, 2005 at 11:42:03PM -0000, Ruchika Singh wrote:
> 
> Hi Everyone:
> 
> I am new to ecos and am involved with a small exercise where in I need to 
> allocate and use some memory from inside the kernel code.

Just a note first. The whole design philosophy of eCos is to not use
dynamic memory in the kernel, driver, hal etc...

> I am using the malloc function call for this purpose and am using the call 
> inside the Cyg_Scheduler_Implementation class's constructor in bitmap.cxx 
> file with following line of code:
> ptr = (int *)malloc(20480)
> where ptr is a class member.
> 
> although the code compiles correctly I get the following error when I link 
> it to my hello world application.
> 
>  /home1/rusingh/ecos/build/install/lib/libtarget.a
> (kernel_bitmap.o):/home1/rusingh/ecos/packages/kernel/current/src/sched/bitma
> p.cxx:91:undefined reference to `malloc(unsigned long)'

Do you have the memalloc package in your eCos configuration?
 
> /home1/rusingh/ecos/build/install/lib/libtarget.a
> kernel_bitmap.o):/home1/rusingh/ecos/packages/kernel/current/src/sched/bitma
>  p.cxx:91:relocation truncated to fit: R_ARM_PC24 malloc(unsigned long)
> collect2: ld returned 1 exit status

This looks strange. It looks like it is trying to make a call to a
symbol which is a long long way away. 

        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]