[rtems commit] bsp/atsam: Allow to change optimization settings.

Christian Mauderer list at c-mauderer.de
Thu Oct 12 16:36:26 UTC 2017


Am 12.10.2017 um 18:06 schrieb Chris Johns:
> On 12/10/17 12:00 am, Sebastian Huber wrote:
>> Module:    rtems
>> Branch:    master
>> Commit:    16fcd56a42dfdef514350ab6297137e2c863afa1
>> Changeset: http://git.rtems.org/rtems/commit/?id=16fcd56a42dfdef514350ab6297137e2c863afa1
>>
>> Author:    Christian Mauderer <Christian.Mauderer at embedded-brains.de>
>> Date:      Wed Oct 11 15:38:14 2017 +0200
>>
>> bsp/atsam: Allow to change optimization settings.
>>
>> Allow to overwrite the optimization settings during configuration.
>>
>> ---
>>
>>  c/src/lib/libbsp/arm/atsam/make/custom/atsamv.cfg | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/c/src/lib/libbsp/arm/atsam/make/custom/atsamv.cfg b/c/src/lib/libbsp/arm/atsam/make/custom/atsamv.cfg
>> index 06892f9..0a2437f 100644
>> --- a/c/src/lib/libbsp/arm/atsam/make/custom/atsamv.cfg
>> +++ b/c/src/lib/libbsp/arm/atsam/make/custom/atsamv.cfg
>> @@ -4,7 +4,6 @@ RTEMS_CPU = arm
>>  
>>  CPU_CFLAGS = -mthumb -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard
>>  
>> -CFLAGS_OPTIMIZE_V = -O2 -g
>> -CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
>> +CFLAGS_OPTIMIZE_V ?= -O2 -g -ffunction-sections -fdata-sections
> 
> 
> This is a really nice change. Should all the BSP's be changed?
> 
> I see a 104 instances in the code and the change could be scripted.
> 
> Being inconsistent on something that could be consistent across all BSPs is
> confusing to all users.
> 
> Chris
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
> 

Hello Chris,

the change is just similar to some other BSPs (like or1k or realview).

If we want to offer something like that for all BSPs, it might would be
a better idea to split the flags up (what I haven't done here). I think
the -ffunction-sections -fdata-sections is allways necessary? Some BSPs
have some other options too like an additional -fomit-frame-pointer in
rbtx4925 or a -mmultiple in mcp750. So if a user would want to use that
environment variable to change optimization, the value wouldn't be
consistent across BSPs.

A consistent solution could be to split it up like in or1k:

  CFLAGS_OPTIMIZE_V ?= -O0 -g
  CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections

The general optimization could be overwritten with CFLAGS_OPTIMIZE_V and
the BSP-specific parts would be added in the second line.

What do you think?

Kind regards

Christian Mauderer




More information about the devel mailing list