> If I change the line static char g_IC_Stack[IC_STACK_SIZE]; ----------> > static int g_IC_Stack[IC_STACK_SIZE/4]; everything is OK. > > I think this is my fault, but when I grep the eCos source tree, thera > are many files using stack definition like me( for example: > net/tcpip/current/src/ecos/support.c). And the kernel source > code(Cyg_HardwareThread::attach_stack()) did not adjust the alignment > automaticly. > > My fault or eCos fault? Thanks!
It's not really a 'fault' either way, but if you have it declared as char, it's definitely not guaranteed to be word aligned. I think the examples you point out in eCos are probably bugs, at least on platforms that need aligned access. An alternative means for specifying alignment is to use __attribute__((aligned)), eg. static char g_IC_Stack[IC_STACK_SIZE] __attribute__((aligned(4))); --Chris -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
