waf: boards: change toolchain to a board class attribute

This commit is contained in:
Francisco Ferreira 2016-03-15 17:55:30 +00:00 committed by Lucas De Marchi
parent f8727f7362
commit a8aae048c2
1 changed files with 27 additions and 12 deletions

View File

@ -17,6 +17,9 @@ class BoardMeta(type):
if cls.abstract:
return
if not hasattr(cls, 'toolchain'):
cls.toolchain = 'native'
board_name = getattr(cls, 'name', name)
if board_name in _board_classes:
raise Exception('board named %s already exists' % board_name)
@ -26,6 +29,7 @@ class Board:
abstract = True
def configure(self, cfg):
cfg.env.TOOLCHAIN = self.toolchain
cfg.load('toolchain')
cfg.load('compiler_cxx compiler_c')
@ -198,107 +202,119 @@ class minlure(linux):
class erleboard(linux):
toolchain = 'arm-linux-gnueabihf'
def configure_env(self, cfg, env):
super(erleboard, self).configure_env(cfg, env)
env.TOOLCHAIN = 'arm-linux-gnueabihf'
env.DEFINES.update(
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_ERLEBOARD',
)
class navio(linux):
toolchain = 'arm-linux-gnueabihf'
def configure_env(self, cfg, env):
super(navio, self).configure_env(cfg, env)
env.TOOLCHAIN = 'arm-linux-gnueabihf'
env.DEFINES.update(
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_NAVIO',
)
class navio2(linux):
toolchain = 'arm-linux-gnueabihf'
def configure_env(self, cfg, env):
super(navio2, self).configure_env(cfg, env)
env.TOOLCHAIN = 'arm-linux-gnueabihf'
env.DEFINES.update(
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_NAVIO2',
)
class zynq(linux):
toolchain = 'arm-xilinx-linux-gnueabi'
def configure_env(self, cfg, env):
super(zynq, self).configure_env(cfg, env)
env.TOOLCHAIN = 'arm-xilinx-linux-gnueabi'
env.DEFINES.update(
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_ZYNQ',
)
class bbbmini(linux):
toolchain = 'arm-linux-gnueabihf'
def configure_env(self, cfg, env):
super(bbbmini, self).configure_env(cfg, env)
env.TOOLCHAIN = 'arm-linux-gnueabihf'
env.DEFINES.update(
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_BBBMINI',
)
class pxf(linux):
toolchain = 'arm-linux-gnueabihf'
def configure_env(self, cfg, env):
super(pxf, self).configure_env(cfg, env)
env.TOOLCHAIN = 'arm-linux-gnueabihf'
env.DEFINES.update(
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_PXF',
)
class bebop(linux):
toolchain = 'arm-linux-gnueabihf'
def configure_env(self, cfg, env):
super(bebop, self).configure_env(cfg, env)
env.TOOLCHAIN = 'arm-linux-gnueabihf'
env.DEFINES.update(
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_BEBOP',
)
env.STATIC_LINKING = True
class raspilot(linux):
toolchain = 'arm-linux-gnueabihf'
def configure_env(self, cfg, env):
super(raspilot, self).configure_env(cfg, env)
env.TOOLCHAIN = 'arm-linux-gnueabihf'
env.DEFINES.update(
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_RASPILOT',
)
class erlebrain2(linux):
toolchain = 'arm-linux-gnueabihf'
def configure_env(self, cfg, env):
super(erlebrain2, self).configure_env(cfg, env)
env.TOOLCHAIN = 'arm-linux-gnueabihf'
env.DEFINES.update(
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_ERLEBRAIN2',
)
class bhat(linux):
toolchain = 'arm-linux-gnueabihf'
def configure_env(self, cfg, env):
super(bhat, self).configure_env(cfg, env)
env.TOOLCHAIN = 'arm-linux-gnueabihf'
env.DEFINES.update(
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_BH',
)
class pxfmini(linux):
toolchain = 'arm-linux-gnueabihf'
def configure_env(self, cfg, env):
super(pxfmini, self).configure_env(cfg, env)
env.TOOLCHAIN = 'arm-linux-gnueabihf'
env.DEFINES.update(
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_PXFMINI',
)
class px4(Board):
abstract = True
toolchain = 'arm-none-eabi'
def __init__(self):
self.version = None
@ -314,7 +330,6 @@ class px4(Board):
def configure_env(self, cfg, env):
super(px4, self).configure_env(cfg, env)
env.TOOLCHAIN = 'arm-none-eabi'
env.DEFINES.update(
CONFIG_HAL_BOARD = 'HAL_BOARD_PX4',
HAVE_STD_NULLPTR_T = 0,