Changes between Version 4 and Version 5 of TBR/UserManual/Floating_Point_Support


Ignore:
Timestamp:
Jul 12, 2009, 5:07:05 AM (10 years ago)
Author:
Kptrs
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • TBR/UserManual/Floating_Point_Support

    v4 v5  
    7171
    7272Throughout the RTEMS kernel, actions are taken to support floating point, if either software or hardware floating point is defined to be available '''at the time of compilation of the RTEMS libraries'''. For example, from {{{threaddispatch.c</code> (edited here for simplification):
    73 
     73{{{
    7474 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
    7575    if ( executing->fp_context != NULL )
     
    8383      _Context_Restore_fp( &executing->fp_context );
    8484 #endif
    85 
     85}}}
    8686If floating point is defined as available, and if the executing task has a floating point context, then that context will be saved and restored in context switches. But where do these definitions of floating point support come from? Read on.
    8787= BSP Support =
    8888
    89 =  =Compiler Support==
     89
     90The definitions controlling floating point support for the RTEMS kernel are found in a CPU-dependent header file in the RTEMS source tree, typically {{{cpukit/score/cpu/<cpu name>/rtems/score/cpu.h</code>.
     91
     92For example, for the {{{sparc</code> CPU:
     93{{{
     94/*
     95 *  Does the CPU have hardware floating point?
     96 *
     97 *  If TRUE, then the FLOATING_POINT task attribute is supported.
     98 *  If FALSE, then the FLOATING_POINT task attribute is ignored.
     99 */
     100
     101#if ( SPARC_HAS_FPU == 1 )
     102#define CPU_HARDWARE_FP     TRUE
     103#else
     104#define CPU_HARDWARE_FP     FALSE
     105#endif
     106#define CPU_SOFTWARE_FP     FALSE
     107}}}
     108
     109For more details about this precompiler definition and others related to floating point specializations, read the comments in any {{{cpu.h</code> file, and (even more informative) the file in the RTEMS source tree {{{doc/porting/taskcontext.t</code>, which gets built into a nice document somewhere if you have TeX, but is readable as-is.
     110
     111Most CPUs are really a CPU family, some members of which have hardware floating point and some do not. Thus, in the example above, the definition of {{{SPARC_HAS_FPU</code> comes from another header file depending on the member of the CPU family:
     112
     113= Compiler Support =