export: Add missing flags to Sw4STM32

Some of the optimization and warning flags, which were supported by the
gnuarmeclipse exporter, were missing from the sw4stm32.
pull/5184/head
Jaakko Heikkilä 2017-09-11 17:48:33 +03:00 committed by adbridge
parent 60b0eccf93
commit 431fac4445
2 changed files with 74 additions and 13 deletions

View File

@ -287,6 +287,46 @@ class Sw4STM32(GNUARMEclipse):
opts['cpp']['preprocess'] = False opts['cpp']['preprocess'] = False
if '-E' in flags_in['cxx_flags']: if '-E' in flags_in['cxx_flags']:
opts['cpp']['preprocess'] = True opts['cpp']['preprocess'] = True
opts['c']['slowflashdata'] = False
if '-mslow-flash-data' in flags_in['c_flags']:
opts['c']['slowflashdata'] = True
opts['cpp']['slowflashdata'] = False
if '-mslow-flash-data' in flags_in['cxx_flags']:
opts['cpp']['slowflashdata'] = True
if opts['common']['optimization.messagelength']:
opts['common']['optimization.other'] += ' -fmessage-length=0'
if opts['common']['optimization.signedchar']:
opts['common']['optimization.other'] += ' -fsigned-char'
if opts['common']['optimization.nocommon']:
opts['common']['optimization.other'] += ' -fno-common'
if opts['common']['optimization.noinlinefunctions']:
opts['common']['optimization.other'] += ' -fno-inline-functions'
if opts['common']['optimization.freestanding']:
opts['common']['optimization.other'] += ' -ffreestanding'
if opts['common']['optimization.nobuiltin']:
opts['common']['optimization.other'] += ' -fno-builtin'
if opts['common']['optimization.spconstant']:
opts['common']['optimization.other'] += ' -fsingle-precision-constant'
if opts['common']['optimization.nomoveloopinvariants']:
opts['common']['optimization.other'] += ' -fno-move-loop-invariants'
if opts['common']['warnings.unused']:
opts['common']['warnings.other'] += ' -Wunused'
if opts['common']['warnings.uninitialized']:
opts['common']['warnings.other'] += ' -Wuninitialized'
if opts['common']['warnings.missingdeclaration']:
opts['common']['warnings.other'] += ' -Wmissing-declarations'
if opts['common']['warnings.pointerarith']:
opts['common']['warnings.other'] += ' -Wpointer-arith'
if opts['common']['warnings.padded']:
opts['common']['warnings.other'] += ' -Wpadded'
if opts['common']['warnings.shadow']:
opts['common']['warnings.other'] += ' -Wshadow'
if opts['common']['warnings.logicalop']:
opts['common']['warnings.other'] += ' -Wlogical-op'
if opts['common']['warnings.agreggatereturn']:
opts['common']['warnings.other'] += ' -Waggregate-return'
if opts['common']['warnings.floatequal']:
opts['common']['warnings.other'] += ' -Wfloat-equal'
opts['ld']['strip'] = False opts['ld']['strip'] = False
if '-s' in flags_in['ld_flags']: if '-s' in flags_in['ld_flags']:
opts['ld']['strip'] = True opts['ld']['strip'] = True
@ -313,8 +353,20 @@ class Sw4STM32(GNUARMEclipse):
item = opts['ld']['flags'][index] item = opts['ld']['flags'][index]
if not item.startswith('-Wl,'): if not item.startswith('-Wl,'):
opts['ld']['flags'][index] = '-Wl,' + item opts['ld']['flags'][index] = '-Wl,' + item
# Strange System Workbench feature: If first parameter in Other flags is a
# define (-D...), Other flags will be replaced by defines and other flags
# are completely ignored. Moving -D parameters to defines.
for compiler in ['c', 'cpp', 'as']:
tmpList = opts[compiler]['other'].split(' ')
otherList = []
for item in tmpList:
if item.startswith('-D'):
opts[compiler]['defines'].append(str(item[2:]))
else:
otherList.append(item)
opts[compiler]['other'] = ' '.join(otherList)
# Assembler options # Assembler options
for as_def in self.as_defines: for as_def in opts['as']['defines']:
if '=' in as_def: if '=' in as_def:
opts['as']['other'] += ' --defsym ' + as_def opts['as']['other'] += ' --defsym ' + as_def
else: else:
@ -369,11 +421,7 @@ class Sw4STM32(GNUARMEclipse):
lib_dirs = [self.filter_dot(s) for s in self.resources.lib_dirs] lib_dirs = [self.filter_dot(s) for s in self.resources.lib_dirs]
preproc_cmd = "" preproc_cmd = basename(self.toolchain.preproc[0]) + " " + " ".join(self.toolchain.preproc[1:])
# Hack for Windows. Build fails if command contains parentheses.
preproc_cmd = '"' + \
self.toolchain.preproc[0] + '"' + " " + \
" ".join(self.toolchain.preproc[1:])
for id in ['debug', 'release']: for id in ['debug', 'release']:
opts = {} opts = {}
@ -418,10 +466,11 @@ class Sw4STM32(GNUARMEclipse):
self.process_options(opts, flags) self.process_options(opts, flags)
self.process_sw_options(opts, flags)
opts['c']['defines'] = self.c_defines opts['c']['defines'] = self.c_defines
opts['cpp']['defines'] = self.cpp_defines opts['cpp']['defines'] = self.cpp_defines
opts['as']['defines'] = self.as_defines
self.process_sw_options(opts, flags)
opts['ld']['library_paths'] = [ opts['ld']['library_paths'] = [
self.filter_dot(s) for s in self.resources.lib_dirs] self.filter_dot(s) for s in self.resources.lib_dirs]

View File

@ -108,8 +108,14 @@
{% if opts['common']['optimization.functionsections'] %} {% if opts['common']['optimization.functionsections'] %}
<option id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.ffunction.{{u.id}}" name="Place the function in their own section (-ffunction-sections)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.ffunction" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.ffunction.{{u.id}}" name="Place the function in their own section (-ffunction-sections)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.ffunction" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %} {% endif %}
{% if opts['c']['other'] != '' or opts['c']['otherwarnings'] != ''%} {% if opts['c']['otheroptimizations'] != '' or opts['common']['optimization.other'] != '' %}
<option id="fr.ac6.managedbuid.gnu.c.compiler.option.misc.other.{{u.id}}" name="Other flags" superClass="fr.ac6.managedbuid.gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="{{opts['c']['other']}} {{opts['c']['otherwarnings']}}" valueType="string"/> <option id="gnu.c.compiler.option.optimization.flags.{{u.id}}" superClass="gnu.c.compiler.option.optimization.flags" useByScannerDiscovery="false" value="{{opts['c']['otheroptimizations']}} {{opts['common']['optimization.other']}}" valueType="string"/>
{% endif %}
{% if opts['c']['other'] != '' or opts['c']['otherwarnings'] != '' or opts['common']['warnings.other'] != '' %}
<option id="fr.ac6.managedbuid.gnu.c.compiler.option.misc.other.{{u.id}}" name="Other flags" superClass="fr.ac6.managedbuid.gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="{{opts['c']['other']}} {{opts['c']['otherwarnings']}} {{opts['common']['warnings.other']}}" valueType="string"/>
{% endif %}
{% if opts['c']['slowflashdata'] %}
<option id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.pcrop.{{u.id}}" name="No data reads in code memory (-mslow-flash-data) " superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.pcrop" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %} {% endif %}
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.{{opts['uid']['tool_c_compiler_input']}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/> <inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.{{opts['uid']['tool_c_compiler_input']}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.{{u.id}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/> <inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.{{u.id}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
@ -191,8 +197,14 @@
{% if opts['common']['optimization.functionsections'] %} {% if opts['common']['optimization.functionsections'] %}
<option id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.ffunction.{{u.id}}" name="Place the function in their own section (-ffunction-sections)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.ffunction" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.ffunction.{{u.id}}" name="Place the function in their own section (-ffunction-sections)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.ffunction" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %} {% endif %}
{% if opts['cpp']['other'] != '' or opts['cpp']['otherwarnings'] != ''%} {% if opts['cpp']['otheroptimizations'] != '' or opts['common']['optimization.other'] != '' %}
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.misc.other.{{u.id}}" name="Other flags" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.misc.other" useByScannerDiscovery="false" value="{{opts['cpp']['other']}} {{opts['cpp']['otherwarnings']}}" valueType="string"/> <option id="gnu.cpp.compiler.option.optimization.flags.{{u.id}}" superClass="gnu.cpp.compiler.option.optimization.flags" useByScannerDiscovery="false" value="{{opts['cpp']['otheroptimizations']}} {{opts['common']['optimization.other']}}" valueType="string"/>
{% endif %}
{% if opts['cpp']['other'] != '' or opts['cpp']['otherwarnings'] != '' or opts['common']['warnings.other'] != '' %}
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.misc.other.{{u.id}}" name="Other flags" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.misc.other" useByScannerDiscovery="false" value="{{opts['cpp']['other']}} {{opts['cpp']['otherwarnings']}} {{opts['common']['warnings.other']}}" valueType="string"/>
{% endif %}
{% if opts['cpp']['slowflashdata'] %}
<option id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.pcrop.{{u.id}}" name="No data reads in code memory (-mslow-flash-data) " superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.pcrop" useByScannerDiscovery="false" value="true" valueType="boolean"/>
{% endif %} {% endif %}
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp.{{opts['uid']['tool_cpp_compiler_input']}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp"/> <inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp.{{opts['uid']['tool_cpp_compiler_input']}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s.{{u.id}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s"/> <inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s.{{u.id}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s"/>
@ -262,7 +274,7 @@
<listOptionValue builtIn="false" value="&quot;{{path}}&quot;"/> <listOptionValue builtIn="false" value="&quot;{{path}}&quot;"/>
{% endfor %} {% endfor %}
</option> </option>
{% if opts['as']['other'] != '' or opts['as']['otherwarnings'] != ''%} {% if opts['as']['other'] != '' or opts['as']['otherwarnings'] != '' %}
<option id="gnu.both.asm.option.flags.{{u.id}}" superClass="gnu.both.asm.option.flags" useByScannerDiscovery="false" value="{{opts['as']['other']}} {{opts['as']['otherwarnings']}}" valueType="string"/> <option id="gnu.both.asm.option.flags.{{u.id}}" superClass="gnu.both.asm.option.flags" useByScannerDiscovery="false" value="{{opts['as']['other']}} {{opts['as']['otherwarnings']}}" valueType="string"/>
{% endif %} {% endif %}
{% for item in opts['as']['otherwarnings'] %} {% for item in opts['as']['otherwarnings'] %}