This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Using Malloc inside kernel code.
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Ruchika Singh <rusingh at ecs dot umass dot edu>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Mon, 7 Feb 2005 09:26:28 +0100
- Subject: Re: [ECOS] Using Malloc inside kernel code.
- References: <twig.1107733323.75310@ecs.umass.edu>
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