Skip to content

Commit

Permalink
Tools: added QURT build
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed May 18, 2024
1 parent 11b62d7 commit 439819c
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
60 changes: 59 additions & 1 deletion Tools/ardupilotwaf/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def __init__(self):
def configure(self, cfg):
cfg.env.TOOLCHAIN = cfg.options.toolchain or self.toolchain
cfg.env.ROMFS_FILES = []
cfg.load('toolchain')
if hasattr(self,'configure_toolchain'):
self.configure_toolchain(cfg)
else:
cfg.load('toolchain')
cfg.load('cxx_checks')

env = waflib.ConfigSet.ConfigSet()
Expand Down Expand Up @@ -190,6 +193,8 @@ def srcpath(path):
cfg.msg("Configured VSCode Intellisense:", 'no', color='YELLOW')

def cc_version_gte(self, cfg, want_major, want_minor):
if cfg.env.TOOLCHAIN == "custom":
return True
(major, minor, patchlevel) = cfg.env.CC_VERSION
return (int(major) > want_major or
(int(major) == want_major and int(minor) >= want_minor))
Expand Down Expand Up @@ -1618,3 +1623,56 @@ class SITL_x86_64_linux_gnu(SITL_static):

class SITL_arm_linux_gnueabihf(SITL_static):
toolchain = 'arm-linux-gnueabihf'

class QURT(Board):
'''support for QURT based boards'''
toolchain = 'custom'

def __init__(self):
self.with_can = False

def configure_toolchain(self, cfg):
cfg.env.CXX_NAME = 'gcc'
cfg.env.HEXAGON_SDK_DIR = "/opt/hexagon-sdk/4.1.0.4-lite"
cfg.env.CC_VERSION = ('4','1','0')
cfg.env.TOOLCHAIN_DIR = cfg.env.HEXAGON_SDK_DIR + "/tools/HEXAGON_Tools/8.4.05/Tools"
cfg.env.COMPILER_CC = cfg.env.TOOLCHAIN_DIR + "/bin/hexagon-clang"
cfg.env.COMPILER_CXX = cfg.env.TOOLCHAIN_DIR + "/bin/hexagon-clang++"
cfg.env.CXX = ["ccache", cfg.env.COMPILER_CXX]
cfg.env.CXX_TGT_F = ['-c', '-o']
cfg.env.CPPPATH_ST = '-I%s'
cfg.env.DEFINES_ST = '-D%s'


def configure_env(self, cfg, env):
super(QURT, self).configure_env(cfg, env)

env.BOARD_CLASS = "QURT"
env.HEXAGON_LINK = cfg.env.HEXAGON_SDK_DIR + "/tools/HEXAGON_Tools/8.4.05/Tools/bin/hexagon-link"
env.HEAXGON_APP = "libardupilot.so"
env.HEXAGON_LINKFLAGS = f"-march=hexagon -mcpu=hexagonv66 -shared -call_shared -G0 {cfg.env.TOOLCHAIN_DIR}/target/hexagon/lib/v66/G0/pic/initS.o -L{cfg.env.TOOLCHAIN_DIR}/target/hexagon/lib/v66/G0/pic -Bsymbolic {cfg.env.TOOLCHAIN_DIR}/target/hexagon/lib/v66/G0/pic/libgcc.a --wrap=malloc --wrap=calloc --wrap=free --wrap=realloc --wrap=memalign --wrap=__stack_chk_fail -lc -soname={env.HEXAGON_APP} --start-group --whole-archive OBJECT_LIST --end-group --start-group -lgcc --end-group {cfg.env.TOOLCHAIN_DIR}/target/hexagon/lib/v66/G0/pic/finiS.o"
env.INCLUDES += [cfg.env.HEXAGON_SDK_DIR + "/rtos/qurt/computev66/include/qurt"]
env.CXXFLAGS += ["-fPIC", "-MD"]

env.DEFINES.update(
CONFIG_HAL_BOARD = 'HAL_BOARD_QURT',
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_NONE',
AP_SIM_ENABLED = 0,
)

if not cfg.env.DEBUG:
env.CXXFLAGS += [
'-O2',
]

env.AP_LIBRARIES += [
'AP_HAL_QURT',
]

def build(self, bld):
super(QURT, self).build(bld)

def get_name(self):
# get name of class
return self.__class__.__name__

2 changes: 2 additions & 0 deletions Tools/ardupilotwaf/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ def configure(cfg):
_filter_supported_cxx_compilers('g++', 'clang++')

cfg.msg('Using toolchain', cfg.env.TOOLCHAIN)
if cfg.env.TOOLCHAIN == "custom":
return

if cfg.env.TOOLCHAIN == 'native':
cfg.load('compiler_cxx compiler_c')
Expand Down

0 comments on commit 439819c

Please sign in to comment.