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: Re: Wrong declaration of idle_thread_stack


> In Cyg_HardwareThread::attach_stack() all that would be necessary is to
> adjust s_base and s_size to appropriate boundaries at the beginning of the
> function, using CYGARC_ALIGNMENT.

I couldn't find the idle_thread_stack definition, but I guess the definition
could be changed to be alligned at a 4 byte boundary.
Modifying Cyg_HardwareThread::attach_stack() is not needed, as everyone should
supply a proper stack (this is where the assertions are for).

> For the H8S architecture, compiler and linker I can tell you the following
> things:
> 1. The stack pointer have to be even  (alignment to a 2 byte boundary)

Ok. Seems simple to me, just do a proper declaration of idle_thread_stack with
ALIGN(2)

> 2. From hardware point of view of H8S, every section in different memory
> region should start with even address that means ALIGN(2) (least significant
> bit should be zero).

So ALL variables needs to be alligned? every char? So if I use a char (in say
.bss section) in my program (.text section) is has to be alligned.
And if I use a char from the middle of a array like

char test[10];
 *(char*)(&test[1]) = 5;

I will get an allignment error?

I see two solutions for you:
1) threat every char as an short (does this work?: #define char short     )
2) do not use different memory regions for text, bss, data, heap and stack.

Eric.



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]