public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] POSIX layer and pthread:Unable to make the application
@ 2012-04-11 14:12 medamine
       [not found] ` <CAJXPg6Ja=tT3NR1s-S6skPb2E7ZmLwdSparKm+z4RaYH2xPG=w@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: medamine @ 2012-04-11 14:12 UTC (permalink / raw)
  To: ecos-discuss

Hi every one,

I use
Hardware: ST STM3210E EVAL board
Packages: posix
in the section:POSIX threads

POSIX pthread implementation header Enabled=True Value=0
POSIX mutex/cond var implementation header Enabled=True Value=0

and I got the pthread.h :

#ifndef CYGONCE_ISO_PTHREAD_H
#define CYGONCE_ISO_PTHREAD_H
/*===========================================
//
// pthread.h
//
// POSIX pthread functions
//
//===========================================

/* CONFIGURATION */

#include <pkgconf/isoinfra.h> /* Configuration header */

/* INCLUDES */

#ifdef CYGINT_ISO_PTHREAD_IMPL
# ifdef CYGBLD_ISO_PTHREAD_IMPL_HEADER
# include CYGBLD_ISO_PTHREAD_IMPL_HEADER
# endif
#endif

#ifdef CYGINT_ISO_PTHREAD_MUTEX
# ifdef CYGBLD_ISO_PTHREAD_MUTEX_HEADER
# include CYGBLD_ISO_PTHREAD_MUTEX_HEADER
# endif
#endif

#endif /* CYGONCE_ISO_PTHREAD_H multiple inclusion protection */

/* EOF pthread.h */

After that, i wrote this application using thread

#include <pthread.h>
#include <stdio.h>
#define NUM_THREADS 5

void *PrintHello(void *threadid)
{
long tid;
tid = (long)threadid;
printf("Hello World! It's me, thread #%ld!\n", tid);
pthread_exit(NULL);
}

int main (int argc, char *argv[])
{
pthread_t threads[NUM_THREADS];
int rc;
long t;
for(t=0; t<NUM_THREADS; t++){
printf("In main: creating thread %ld\n", t);
rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
if (rc){
printf("ERROR; return code from pthread_create() is %d\n", rc);
exit(-1);
}
}

/* Last thing that main() should do */
pthread_exit(NULL);
}

but when i build the application withe eCos library, i got these errors

/STM3240G/fork$ make hello
arm-eabi-gcc -c -o hello.o 
-I/home/st/config/standard_Posix_install/include -Wall -Wpointer-arith 
-Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings 
-mcpu=cortex-m3 -mthumb -g -O2 -ffunction-sections -fdata-sections 
-fno-rtti -fno-exceptions hello.c
cc1: warning: command line option "-Woverloaded-virtual" is valid for 
C++/ObjC++ but not for C
cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ 
but not for C
hello.c: In function ‘PrintHello’:
hello.c:10: warning: implicit declaration of function ‘pthread_exit’
hello.c: In function ‘main’:
hello.c:15: error: ‘pthread_t’ undeclared (first use in this function)
hello.c:15: error: (Each undeclared identifier is reported only once
hello.c:15: error: for each function it appears in.)
hello.c:15: error: expected ‘;’ before ‘threads’
hello.c:20: warning: implicit declaration of function ‘pthread_create’
hello.c:20: error: ‘threads’ undeclared (first use in this function)
hello.c:23: warning: implicit declaration of function ‘exit’
hello.c:23: warning: incompatible implicit declaration of built-in 
function ‘exit’
make: *** [hello.o] Error 1

First view is that the thread functions doesn't exist in the header 
thread.h, the configtool generate uncompleted headers,

Please i need your help.

Thanks a lot.



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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-16  8:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 14:12 [ECOS] POSIX layer and pthread:Unable to make the application medamine
     [not found] ` <CAJXPg6Ja=tT3NR1s-S6skPb2E7ZmLwdSparKm+z4RaYH2xPG=w@mail.gmail.com>
2012-04-11 18:38   ` Fabrizio Carrai
2012-04-12  8:44     ` medamine
2012-04-13 16:45       ` Fabrizio Carrai
2012-04-16  8:19         ` medamine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).