public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: medamine <medamine.ecos@gmail.com>
To: Fabrizio Carrai <f.carrai@libero.it>
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] POSIX layer and pthread:Unable to make the application
Date: Mon, 16 Apr 2012 08:19:00 -0000	[thread overview]
Message-ID: <4F8BD5E2.6040208@gmail.com> (raw)
In-Reply-To: <CAJXPg6Ltvhngjo09ijGy8a60bkemC370joGjeRrmLrg9-LQmnA@mail.gmail.com>

On 04/13/2012 05:45 PM, Fabrizio Carrai wrote:

Thanks a lot Fabrizio, I corrected the error: I miss to add the POSIX 
File IO compatibility layer package to my configuration, So it's clear 
that the files are not generated by the configtool

Ciao
Mohamed Amine
> Please check the value of the "POSIX pthread implementation header"
> (Macro name is CYGBLD_ISO_PTHREAD_IMPL_HEADER). The value should be
> <cyg/posix/pthread.h>
> If so, something went bad in the building: **delete** the target
> _install and _build directory and start a build from scratch.
>
> Ciao
> Fabrizio
>
> Il 12 aprile 2012 10:44, medamine<medamine.ecos@gmail.com>  ha scritto:
>> On 04/11/2012 07:38 PM, Fabrizio Carrai wrote:
>>
>> Hi,
>>
>> The problem is that I dont have the<cyg/fileio/limits.h>  header in my
>> install tree also the<cyg/posix/pthread.h>  header
>> and I don't know why the confgtool did not generate these file when I build
>> the library, Is it a problem of version of the configtool or what??
>>
>>> 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<medamine.ecos@gmail.com>    ha
>>> scritto:
>>>
>>>> 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
>>>>
>>
>> --
>> 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

      reply	other threads:[~2012-04-16  8:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 14:12 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F8BD5E2.6040208@gmail.com \
    --to=medamine.ecos@gmail.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=f.carrai@libero.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).