This is the mail archive of the ecos-discuss@sourceware.org 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]

stack base pointer not align to 4 bytes


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)
{
    cyg_thread_create(
        IC_PRIORITY,
        IC_Main, 
        0, 
        IC_PROCESS_NAME, 
        g_IC_Stack, 
        IC_STACK_SIZE, 
        &g_pIC_Handle, 
        &g_sIC_ThreadObj);

    cyg_thread_resume(g_pIC_Handle); 

}

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!

BTW:
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


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