[ECOS] Stack access violations in eCos

Jonathan Larmour jifl@eCosCentric.com
Thu Mar 20 02:26:00 GMT 2003


Larice Robert wrote:
>>>I know that most gcc compilers places one dimensional char arrays on 4 byte
>>>boundaries. But this is not the case for multidimensional char arrays (and
>>>there are some of these in eCos). Unfortunately my gcc compiler does not
>>>place any char arrays on 4 byte boundaries. I use the arm-elf tool chain:
>>>
>>>gcc version 3.0.2 20010924 (prerelease)
>>>GNU assembler version 2.10.1 (arm-elf) using BFD version 2.10.1
>>>GNU ld version 2.10.1 (with BFD 2.10.1)
>>>
>>>This was the official tool chain at the time I loaded my first version of
>>>eCos from the Red Hat homepage. Could that be a problem?
>>
>>Could be. I've never had problems with 2.9-ecos-99r1. The latest
>>supported compiler is gcc version 3.2.1. Try that. You can get it by
>>using the new ecos-install.tcl script. Pass the -t flag and it will
>>get just the prebuilt binaries.
>>
>>    Andrew
> 
> 
> Dear Andrew Lunn, Jonathan Larmour,
> 
>   would you please PLEASE be so kind to try the experiment in
>     http://sources.redhat.com/ml/ecos-patches/2003-03/msg00086.html
> 
>   it's really short, won't cost much time, the results are
>     really intresting.

Yes, you're absolutely right. However I think the patch needs one little 
improvement: for thread stacks, we should use CYGBLD_ATTRIB_ALIGNED like 
you say (but ATTRIB not ANNOTATE for consistency with other names in 
cyg_type.h).

However this patch deals with more than thread stacks, although that's the 
main bit. It also does e.g. thread objects, in which case we should use a 
different macro, like say:

#define CYGBLD_ATTRIB_ALIGNOFTYPE( _type_ ) \ 
__attribute__((aligned(__alignof__( _type_ ))))

And I certainly know it's a pain, but we'd need ChangeLog entries for 
these, although it's worth using a script to do this, e.g.

for i in `cat filelist` ; do
   CL=`echo $i | sed 's@current/.*@current/ChangeLog@g'`
   sed "s@FILE@${i}@g" < /tmp/myentry > /tmp/myentry.tmp
   cat /tmp/myentry.tmp $CL > $CL.new
   mv $CL.new $CL
done

for some appropriate files "filelist" and "/tmp/myentry", e.g.

2003-03-19  Larice Robert  <larice@vidisys.de>

	* FILE: Add alignments where required.


Finally, don't use a #warning for calmrisc32 just because you aren't sure.

With that, I can apply your patch! And thanks for looking into all this 
and spending the time!

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine


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



More information about the Ecos-discuss mailing list