[ECOS] Re: Wrong declaration of idle_thread_stack
Thu Jan 22 11:31:00 GMT 2004
"Uwe Kindler" <firstname.lastname@example.org> writes:
> Hello Nick,
> >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. Similar to what you have already done for the SP in
> >HAL_THREAD_INIT_CONTEXT(). The only real gotcha here is to make sure
> >hat the aligned base+size is still within the original stack space.
> thank you for your quick reply. In order to avoid mistakes I would like to
> ask you what does CYGARC_ALIGNMENT exactly define.
> For the H8S architecture, compiler and linker I can tell you the following
> The stack pointer have to be even (alignment to a 2 byte boundary)
> >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 for stack pointer alignement CYGARC_ALIGNMENT have to be 2. But then
> stack checking would fail because idle_thread_stack is char and so it is
> aligned to 1 byte boundary. So for stack checking CYGARC_ALIGNMENT should be
> Therefore my question: what exactly does CYGARC_ALIGNMENT define. I
> carefully scanned the h8300-elf-gcc documentation but I did not found any
> global compiler switch for alignment of char arrays but I posted a support
> request to KPIT, the maintainer of the H8 toolchain.
CYGARC_ALIGNMENT is defined by the HAL to specify an alignment that
should work correctly for pointers to most types. The default value is
8, which copes with everything up to long long and double on most
architectures. You could redefine it to 4 or 2 in basetype.h, but I
wouldn't bother, keep the default.
So, just push s_base up to the next CYGARC_ALIGNMENT boundary, and
pull s_base+s_size down to the previous boundary.
Nick Garnett eCos Kernel Architect
http://www.ecoscentric.com The eCos and RedBoot experts
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