This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: dynamic allocation of memory during driver initialization?
On Fri, Aug 08, 2003 at 03:56:18PM -0500, Grant Edwards wrote:
> On Fri, Aug 08, 2003 at 10:49:45PM +0200, Andrew Lunn wrote:
>
> > > How should a driver dynamically allocate buffer space during
> > > initialization?
>
> > [...]
>
> > Or you might be able to rearrange the ordering so that malloc
> > is up before the init is performed.
>
> I was thinking about that, but had two worries: First, it would
> require changing the priority of the entire IO system (all of
> the init's would be called later, not just mine) -- I was
> afraid that might break something else.
The malloc stuff is quite independent of the rest of the system, so i
don't think its too risky. They only way i could imagine it being a
problem is if the init code detects some sort of error and wants to
print an error message using the IO subsystem. This is not normal
since diag_printf is normally used and thats hardwired into the HAL.
> Second, I don't know how to do it. ;)
You need to look at the attibutes on the C++ constructors for the
device drivers and the malloc stuff. One of them is the priority and
it used by the linker to put them into order. Sorry i cannot give more
detail, thats about as much is i know.
Andrew
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss