about header files used in score

Chris Johns chrisj at rtems.org
Sat Jun 13 22:01:43 UTC 2009


Zhongjie wrote:
> Hi,
> I don't know whether am I wrong, but I don't think it is right to uesd 
> header files like stdlib.h sys/types.h in the score?
> logically, we should not use any c library in the score and bsp.
> could any one tell me why?
>

The C library is part of the C language, for example you need libc 
headers to build gcc as libc is used by the compiler. Looking at the 
list of headers I would say most are after standard type support to 
improve the portability of RTEMS. Having said this we do try to limit 
the scope but sometimes things creep in. If you see something specific 
that concerns you please raise it.

RTEMS needs a working C compiler and supported libc to work. With gcc it 
knows about the RTEMS thread model and so does newlib the C library we 
use with gcc.

Regards
Chris

> here is a list of some of those files, there are more in bsp code.
> rtems/src/ratemonreportstatistics.c:#include <stdlib.h>
> rtems/src/rtemsobjectgetclassinfo.c:#include <stdio.h>
> rtems/include/rtems/rtems/types.h:#include <stdint.h>
> rtems/include/rtems/rtems/object.h:#include <stdint.h>
> rtems/include/rtems/rtems/region.h:#include <stddef.h>
> score/cpu/sh/rtems/score/types.h:#include <stdbool.h>
> score/cpu/sh/rtems/score/types.h:#include <stdint.h>
> score/cpu/c4x/rtems/score/types.h:#include <stdbool.h>
> score/cpu/c4x/rtems/score/types.h:#include <stdint.h>
> score/cpu/arm/rtems/score/types.h:#include <stdbool.h>
> score/cpu/arm/rtems/score/types.h:#include <stdint.h>
> score/cpu/avr/rtems/score/types.h:#include <stdbool.h>
> score/cpu/avr/rtems/score/types.h:#include <stdint.h>
> score/cpu/bfin/rtems/score/types.h:#include <stdbool.h>
> score/cpu/bfin/rtems/score/types.h:#include <stdint.h>
> score/cpu/i386/rtems/score/types.h:#include <stdbool.h>
> score/cpu/i386/rtems/score/types.h:#include <stdint.h>
> score/cpu/m32c/rtems/score/types.h:#include <stdbool.h>
> score/cpu/m32c/rtems/score/types.h:#include <stdint.h>
> score/cpu/m32c/context_init.c:#include <stdint.h>
> score/cpu/m32r/rtems/score/types.h:#include <stdbool.h>
> score/cpu/m32r/rtems/score/types.h:#include <stdint.h>
> score/cpu/m32r/context_init.c:#include <stdint.h>
> score/cpu/m68k/rtems/score/types.h:#include <stdbool.h>
> score/cpu/m68k/rtems/score/types.h:#include <stdint.h>
> score/cpu/lm32/rtems/score/types.h:#include <stdbool.h>
> score/cpu/lm32/rtems/score/types.h:#include <stdint.h>
> score/cpu/mips/rtems/score/types.h:#include <stdbool.h>
> score/cpu/mips/rtems/score/types.h:#include <stdint.h>
> score/cpu/unix/cpu.c:#include <stdio.h>
> score/cpu/unix/cpu.c:#include <stdlib.h>
> score/cpu/unix/cpu.c:#include <unistd.h>
> score/cpu/unix/cpu.c:   * Avoid using the stdio section of the library.
> score/cpu/unix/cpu.c:         *  We avoid using the stdio section of the 
> library.
> score/cpu/unix/rtems/score/types.h:#include <stdbool.h>
> score/cpu/unix/rtems/score/types.h:#include <stdint.h>
> score/cpu/h8300/rtems/score/types.h:#include <stdbool.h>
> score/cpu/h8300/rtems/score/types.h:#include <stdint.h>
> score/cpu/nios2/rtems/score/types.h:#include <stdbool.h>
> score/cpu/nios2/rtems/score/types.h:#include <stdint.h>
> score/cpu/sparc/rtems/score/types.h:#include <stdbool.h>
> score/cpu/sparc/rtems/score/types.h:#include <stdint.h>
> score/cpu/no_cpu/rtems/score/types.h:#include <stdbool.h>
> score/cpu/no_cpu/rtems/score/types.h:#include <stdint.h>
> score/cpu/powerpc/rtems/score/types.h:#include <stdbool.h>
> score/cpu/powerpc/rtems/score/types.h:#include <stdint.h>
> score/cpu/powerpc/rtems/powerpc/registers.h:#include <stdint.h>
> score/src/objectgetnameasstring.c:#include <stdlib.h>
> score/src/objectgetnameasstring.c:#include <stdio.h>
> score/src/timespecdivide.c:#include <stdio.h>
> score/src/objectsetname.c:#include <stdlib.h>
> score/src/objectsetname.c:#include <stdio.h>
> score/src/heapwalk.c:#include <stdlib.h> /* abort */
> score/src/heapwalk.c:#include <stdio.h>
> score/src/ts64divide.c:#include <stdio.h>
> score/include/rtems/score/timespec.h:#include <stdint.h> /* uint32_t */
> score/include/rtems/system.h:#include <stddef.h>
> score/include/rtems/system.h:#include <stdint.h>
> sapi/src/posixapi.c:#include <sys/types.h>
> sapi/src/itronapi.c:#include <sys/types.h>
> sapi/include/confdefs.h:  #include <sys/types.h>
> score/cpu/unix/cpu.c:#include <sys/types.h>
> score/src/ts64lessthan.c:#include <sys/types.h>
> score/src/timespectoticks.c:#include <sys/types.h>
> score/src/timespecdivide.c:#include <sys/types.h>
> score/src/timespecdividebyinteger.c:#include <sys/types.h>
> score/src/ts64getseconds.c:#include <sys/types.h>
> score/src/ts64getnanoseconds.c:#include <sys/types.h>
> score/src/timespecgreaterthan.c:#include <sys/types.h>
> score/src/timespecisvalid.c:#include <sys/types.h>
> score/src/ts64equalto.c:#include <sys/types.h>
> score/src/timespecsubtract.c:#include <sys/types.h>
> score/src/ts64addto.c:#include <sys/types.h>
> score/src/ts64set.c:#include <sys/types.h>
> score/src/timespeclessthan.c:#include <sys/types.h>
> score/src/timespecaddto.c:#include <sys/types.h>
> score/src/ts64toticks.c:#include <sys/types.h>
> score/src/ts64dividebyinteger.c:#include <sys/types.h>
> score/src/ts64subtract.c:#include <sys/types.h>
> score/src/ts64totimespec.c:#include <sys/types.h>
> score/src/ts64divide.c:#include <sys/types.h>
> score/src/ts64greaterthan.c:#include <sys/types.h>
> score/src/ts64settozero.c:#include <sys/types.h>
> 
> BR.
> Zhongjie
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users



More information about the users mailing list