mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
waf: allow hwdef.dat to override build optimization
This commit is contained in:
parent
77d4e1f796
commit
3c9646dfef
@ -406,7 +406,6 @@ class chibios(Board):
|
||||
'-Werror=unused-but-set-variable',
|
||||
'-Wno-missing-field-initializers',
|
||||
'-Wno-trigraphs',
|
||||
'-Os',
|
||||
'-fno-strict-aliasing',
|
||||
'-fomit-frame-pointer',
|
||||
'-falign-functions=16',
|
||||
@ -435,7 +434,6 @@ class chibios(Board):
|
||||
bldnode = cfg.bldnode.make_node(self.name)
|
||||
env.BUILDROOT = bldnode.make_node('').abspath()
|
||||
env.LINKFLAGS = cfg.env.CPU_FLAGS + [
|
||||
'-Os',
|
||||
'-fomit-frame-pointer',
|
||||
'-falign-functions=16',
|
||||
'-ffunction-sections',
|
||||
|
@ -233,6 +233,18 @@ def load_env_vars(env):
|
||||
if env.ENABLE_ASSERTS:
|
||||
env.CHIBIOS_BUILD_FLAGS += ' ENABLE_ASSERTS=yes'
|
||||
|
||||
def setup_optimization(env):
|
||||
'''setup optimization flags for build'''
|
||||
if env.DEBUG:
|
||||
OPTIMIZE = "-Og"
|
||||
elif env.OPTIMIZE:
|
||||
OPTIMIZE = env.OPTIMIZE
|
||||
else:
|
||||
OPTIMIZE = "-Os"
|
||||
env.CFLAGS += [ OPTIMIZE ]
|
||||
env.CXXFLAGS += [ OPTIMIZE ]
|
||||
env.CHIBIOS_BUILD_FLAGS += ' USE_COPT=%s' % OPTIMIZE
|
||||
|
||||
def configure(cfg):
|
||||
cfg.find_program('make', var='MAKE')
|
||||
#cfg.objcopy = cfg.find_program('%s-%s'%(cfg.env.TOOLCHAIN,'objcopy'), var='OBJCOPY', mandatory=True)
|
||||
@ -305,6 +317,7 @@ def configure(cfg):
|
||||
load_env_vars(cfg.env)
|
||||
if env.HAL_WITH_UAVCAN:
|
||||
setup_can_build(cfg)
|
||||
setup_optimization(cfg.env)
|
||||
|
||||
def pre_build(bld):
|
||||
'''pre-build hook to change dynamic sources'''
|
||||
|
Loading…
Reference in New Issue
Block a user