[ECOS] stack base pointer not align to 4 bytes

Xiaochen Zhou zhouxiaochen@h3c.com
Fri May 23 03:51:00 GMT 2008

Hi, All

I want to add CYGFUN_KERNEL_THREADS_STACK_CHECKING to check stack overflow, but found eCos ASSERT about "ASSERT FAIL: <2>thread.inl[212]void Cyg_HardwareThread::attach_stack() stack base alignment"

I view the map file, 

00133f4c b cli_stack
0013bf4c b cli_thread_h
0013bf50 b cli_thread
0013c044 b ulCmdLen
0013c048 b ioBuf             <----------- the C code is "static uint8 ioBuf;"
0013c049 b g_IC_Stack        <---------- not align to 4 bytes
0013d04c b g_pIC_Handle
0013d050 b g_sIC_ThreadObj

Here is my C file,

#define IC_PROCESS_NAME "Syslog_Deamon"
#define IC_PRIORITY     20
#define IC_STACK_SIZE   4096

static char g_IC_Stack[IC_STACK_SIZE]; 
static cyg_handle_t g_pIC_Handle;
static cyg_thread g_sIC_ThreadObj;
cyg_handle_t g_pIC_MailboxIf;
cyg_mbox g_sIC_Mailbox;

void IC_X_Startup(void)



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!

My platform is ARM9 and arm-elf-gcc version is 3.2.1.

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

More information about the Ecos-discuss mailing list