public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] workspace_end_init, workspace_end and flash.c
@ 2007-08-27 23:54 Ben Wu
  2007-08-28 10:55 ` Gary Thomas
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Wu @ 2007-08-27 23:54 UTC (permalink / raw)
  To: ecos-discuss

I've been working to integrate the RedBoot 2.04 Intel IXP42x NPE 
ethernet driver to work with the most recent Ecos code and ran into a 
problem where NPE "workspace" buffers were being overwritten causing the 
boot process to hang.

I've tracked down the problem to the flash code where it allocates it's 
own workspace buffers. Specifically :

 >  workspace_end = (unsigned char )(workspace_end_init - fisdir_size);

In the 2.04 intel fork, the line reads

 >  workspace_end = (unsigned char )(workspace_end - fisdir_size);

why the change? It seems that by doing so the flash init assumes it 
always be called first and assumes any code that needs workspace will 
use the workspace_end pointer rather than the workspace_end_init pointer.

It turns out that the NPE init code is being inserted before the flash 
init code with the same RedBoot_INIT_FIRST priority level. Is there 
anyway to fine tune insertion of initialization routines with a the same 
priority order?


-- 
---------------------------
Ben Wu
Design Engineer
email: bwu@changind.com
phone: (909) 596-7888
CHANG Industry, Inc.
1925 McKinley Ave. Suite F
La Verne, CA 91750

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] workspace_end_init, workspace_end and flash.c
  2007-08-27 23:54 [ECOS] workspace_end_init, workspace_end and flash.c Ben Wu
@ 2007-08-28 10:55 ` Gary Thomas
  2007-08-28 11:02   ` Gary Thomas
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Thomas @ 2007-08-28 10:55 UTC (permalink / raw)
  To: Ben Wu; +Cc: ecos-discuss

Ben Wu wrote:
> I've been working to integrate the RedBoot 2.04 Intel IXP42x NPE
> ethernet driver to work with the most recent Ecos code and ran into a
> problem where NPE "workspace" buffers were being overwritten causing the
> boot process to hang.
> 
> I've tracked down the problem to the flash code where it allocates it's
> own workspace buffers. Specifically :
> 
>>  workspace_end = (unsigned char )(workspace_end_init - fisdir_size);
> 
> In the 2.04 intel fork, the line reads
> 
>>  workspace_end = (unsigned char )(workspace_end - fisdir_size);
> 
> why the change? It seems that by doing so the flash init assumes it
> always be called first and assumes any code that needs workspace will
> use the workspace_end pointer rather than the workspace_end_init pointer.
> 
> It turns out that the NPE init code is being inserted before the flash
> init code with the same RedBoot_INIT_FIRST priority level. Is there
> anyway to fine tune insertion of initialization routines with a the same
> priority order?

You'd have to ask Intel why the change; they don't share their code
with us, nor track our CVS (closely).

If the NPE code is indeed being executed before the FLASH code, then
this change would be required.  The order of routines with the same
priority is based on how the linker fills in the init table - not something
that should ever be counted on :-(

Looking at the code however, I think that the version which uses workspace_end
is more correct and will work no matter what order init functions are called.



-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] workspace_end_init, workspace_end and flash.c
  2007-08-28 10:55 ` Gary Thomas
@ 2007-08-28 11:02   ` Gary Thomas
  0 siblings, 0 replies; 3+ messages in thread
From: Gary Thomas @ 2007-08-28 11:02 UTC (permalink / raw)
  To: ecos-discuss

Gary Thomas wrote:
> Ben Wu wrote:
>> I've been working to integrate the RedBoot 2.04 Intel IXP42x NPE
>> ethernet driver to work with the most recent Ecos code and ran into a
>> problem where NPE "workspace" buffers were being overwritten causing the
>> boot process to hang.
>>
>> I've tracked down the problem to the flash code where it allocates it's
>> own workspace buffers. Specifically :
>>
>>>  workspace_end = (unsigned char )(workspace_end_init - fisdir_size);
>> In the 2.04 intel fork, the line reads
>>
>>>  workspace_end = (unsigned char )(workspace_end - fisdir_size);
>> why the change? It seems that by doing so the flash init assumes it
>> always be called first and assumes any code that needs workspace will
>> use the workspace_end pointer rather than the workspace_end_init pointer.
>>
>> It turns out that the NPE init code is being inserted before the flash
>> init code with the same RedBoot_INIT_FIRST priority level. Is there
>> anyway to fine tune insertion of initialization routines with a the same
>> priority order?
> 
> You'd have to ask Intel why the change; they don't share their code
> with us, nor track our CVS (closely).

Actually, this is a case where it would have been nice for Intel *to* share!
They found something and we only learn about it the hard way...

> 
> If the NPE code is indeed being executed before the FLASH code, then
> this change would be required.  The order of routines with the same
> priority is based on how the linker fills in the init table - not something
> that should ever be counted on :-(
> 
> Looking at the code however, I think that the version which uses workspace_end
> is more correct and will work no matter what order init functions are called.
> 
> 
> 


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-28 11:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-27 23:54 [ECOS] workspace_end_init, workspace_end and flash.c Ben Wu
2007-08-28 10:55 ` Gary Thomas
2007-08-28 11:02   ` Gary Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).