configuring RTEMS target optimization levels

Joel Sherrill joel.sherrill at OARcorp.com
Wed Sep 12 14:30:03 UTC 2012


On 09/12/2012 08:07 AM, Mick Davis wrote:
> I can describe what I do and hope that it answers your question.
>
> In the source tree c/src/lib/libbsp/<cpu>/<bsp>/make/custom/<bsp>.cfg I have
>
> CPU_CFLAGS = -mcpu=arm926ej-s  -g
>
> and
>
> CFLAGS_OPTIMIZE_V = -O3
>
> When the rtems libs are built they're optimised. There's no easy way I
> know of to get non-optimised rtems libs.
>
> I build apps using as a template the rtems makefiles that get installed,
> eg installed as make/Templates/Makefile.leaf .
>
> I use the ordinary 'make' to get an optimised app build, which uses the
> CFLAGS_OPTIMIZE_V flags.
>
> Or I 'make debug' to get a non-optimised build, where CPU_CFLAGS are
> still used but CFLAGS_OPTIMIZE_V are not.
>
> HTH
>
> On 12/09/12 08:35, Hill, Jeff wrote:
>> Hello All,
>>
>> Please forgive a nebie question.
>>
>> Currently I configure the rtems/rtems-bsp target build by
>> manually setting the following variables. Is this the correct way
>> to set the optimization level with the gnu build system; I was
>> unable to find anything in the configure help, but wonder if
>> the default optimization level shouldn't be configured based
>> on the cpu architecture?
>>
>> export CXXFLAGS_FOR_TARGET="-g -O3 -mhw-mul -mhw-div"
>> export CFLAGS_FOR_TARGET="-g -O3 -mhw-mul -mhw-div"
Those -m options should result in the selection of a multilib
variant of the various libraries.   You can see the gcc logic
for library selection and which library is picked by your
particular set of options with these gcc options:

`-print-multi-directory'
      Print the directory name corresponding to the multilib selected by
      any other switches present in the command line.  This directory is
      supposed to exist in `GCC_EXEC_PREFIX'.

`-print-multi-lib'
      Print the mapping from multilib directory names to compiler
      switches that enable them.  The directory name is separated from
      the switches by `;', and each switch starts with an `@' instead of
      the `-', without spaces between multiple switches.  This is
      supposed to ease shell-processing.

>> I know now that the following options are for configuring
>> the application build, and have nothing to do with
>> the gnu rtems/rtems-bsp build.
>>
>> RTEMS_VARIANT=OPTIMIZE
>> #RTEMS_VARIANT=PROFILE
>> #RTEMS_VARIANT=DEBUG
Those are really obsolete. --enable-rtems-debug on the
configure doesn't change the optimization level AFAIR but
does enable run-time debug checks.
>> Furthermore I think I know now that the<BSP>/make/custom/<BSP>.cfg
>> file configures the application build based on the above options, but
>> has no impact whatsoever on the gnu rtems/rtems-bsp build.
gcc should pick the correct librtemscpu.a for your BSP's selection
of -mXXX options.
>> Jeff
>>
>> _______________________________________________
>> rtems-users mailing list
>> rtems-users at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-users
>>


-- 
Joel Sherrill, Ph.D.             Director of Research&   Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
     Support Available             (256) 722-9985





More information about the users mailing list