From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31527 invoked by alias); 11 Apr 2012 18:38:45 -0000 Received: (qmail 31368 invoked by uid 22791); 11 Apr 2012 18:38:43 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,LIBERO,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-we0-f177.google.com (HELO mail-we0-f177.google.com) (74.125.82.177) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Apr 2012 18:38:30 +0000 Received: by werp11 with SMTP id p11so915437wer.36 for ; Wed, 11 Apr 2012 11:38:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.180.104.230 with SMTP id gh6mr18436935wib.22.1334169509078; Wed, 11 Apr 2012 11:38:29 -0700 (PDT) Received: by 10.223.79.147 with HTTP; Wed, 11 Apr 2012 11:38:29 -0700 (PDT) In-Reply-To: References: <4F859142.9060303@gmail.com> Date: Wed, 11 Apr 2012 18:38:00 -0000 Message-ID: From: Fabrizio Carrai To: ecos-discuss@ecos.sourceware.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] POSIX layer and pthread:Unable to make the application X-SW-Source: 2012-04/txt/msg00010.txt.bz2 Hi, also this seems a problem on the eCos library configuration generated with the configtool. I used the configuration I suggested in a previous post (and that you adopted!) and I'm able to compile your example. Some warnings, but no errors. The inclusion tree is the following: "pthread.h" "pkgconf/isoinfra.h" "cyg/posix/pthread.h" The latter include the declarations that you miss. Please, check it. Your "standard_Posix" configuration should be good. Fabrizio Il giorno 11 aprile 2012 16:12, medamine ha scrit= to: > Hi every one, > > I use > Hardware: ST STM3210E EVAL board > Packages: posix > in the section:POSIX threads > > POSIX pthread implementation header Enabled=3DTrue Value=3D0 > POSIX mutex/cond var implementation header Enabled=3DTrue Value=3D0 > > and I got the pthread.h : > > #ifndef CYGONCE_ISO_PTHREAD_H > #define CYGONCE_ISO_PTHREAD_H > /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > // > // pthread.h > // > // POSIX pthread functions > // > //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > /* CONFIGURATION */ > > #include /* 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 > #include > #define NUM_THREADS 5 > > void *PrintHello(void *threadid) > { > long tid; > tid =3D (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=3D0; t printf("In main: creating thread %ld\n", t); > rc =3D 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/inclu= de -Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Woverloaded-virtual -= Wno-write-strings -mcpu=3Dcortex-m3 -mthumb -g -O2 -ffunction-sections -fda= ta-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 =91PrintHello=92: > hello.c:10: warning: implicit declaration of function =91pthread_exit=92 > hello.c: In function =91main=92: > hello.c:15: error: =91pthread_t=92 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 =91;=92 before =91threads=92 > hello.c:20: warning: implicit declaration of function =91pthread_create=92 > hello.c:20: error: =91threads=92 undeclared (first use in this function) > hello.c:23: warning: implicit declaration of function =91exit=92 > hello.c:23: warning: incompatible implicit declaration of built-in functi= on =91exit=92 > make: *** [hello.o] Error 1 > > First view is that the thread functions doesn't exist in the header threa= d.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 > -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss