2015-11-26 10:34:24 -04:00
|
|
|
# encoding: utf-8
|
|
|
|
|
2016-03-01 18:19:22 -04:00
|
|
|
from collections import OrderedDict
|
2021-08-24 06:03:08 -03:00
|
|
|
import re
|
2018-03-01 05:11:29 -04:00
|
|
|
import sys, os
|
2020-08-30 18:45:21 -03:00
|
|
|
import fnmatch
|
2015-11-26 10:34:24 -04:00
|
|
|
|
|
|
|
import waflib
|
2018-09-02 14:04:13 -03:00
|
|
|
from waflib import Utils
|
2016-05-20 15:36:15 -03:00
|
|
|
from waflib.Configure import conf
|
2021-09-17 12:22:16 -03:00
|
|
|
import json
|
2016-02-15 17:26:14 -04:00
|
|
|
_board_classes = {}
|
2018-01-05 02:53:19 -04:00
|
|
|
_board = None
|
2016-02-15 17:26:14 -04:00
|
|
|
|
|
|
|
class BoardMeta(type):
|
|
|
|
def __init__(cls, name, bases, dct):
|
|
|
|
super(BoardMeta, cls).__init__(name, bases, dct)
|
2016-03-11 08:54:30 -04:00
|
|
|
|
|
|
|
if 'abstract' not in cls.__dict__:
|
|
|
|
cls.abstract = False
|
|
|
|
if cls.abstract:
|
|
|
|
return
|
|
|
|
|
2016-03-15 14:55:30 -03:00
|
|
|
if not hasattr(cls, 'toolchain'):
|
|
|
|
cls.toolchain = 'native'
|
|
|
|
|
2016-02-24 15:59:25 -04:00
|
|
|
board_name = getattr(cls, 'name', name)
|
|
|
|
if board_name in _board_classes:
|
|
|
|
raise Exception('board named %s already exists' % board_name)
|
|
|
|
_board_classes[board_name] = cls
|
2016-02-15 17:26:14 -04:00
|
|
|
|
|
|
|
class Board:
|
2016-03-11 09:02:05 -04:00
|
|
|
abstract = True
|
|
|
|
|
2017-04-02 11:56:50 -03:00
|
|
|
def __init__(self):
|
2020-05-31 08:50:44 -03:00
|
|
|
self.with_can = False
|
2017-04-02 11:56:50 -03:00
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
def configure(self, cfg):
|
2019-02-21 10:33:37 -04:00
|
|
|
cfg.env.TOOLCHAIN = cfg.options.toolchain or self.toolchain
|
2018-07-01 20:34:44 -03:00
|
|
|
cfg.env.ROMFS_FILES = []
|
2016-03-15 14:07:37 -03:00
|
|
|
cfg.load('toolchain')
|
2016-05-19 17:00:29 -03:00
|
|
|
cfg.load('cxx_checks')
|
2016-03-15 14:07:37 -03:00
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
env = waflib.ConfigSet.ConfigSet()
|
2021-08-24 05:20:10 -03:00
|
|
|
def srcpath(path):
|
|
|
|
return cfg.srcnode.make_node(path).abspath()
|
|
|
|
env.SRCROOT = srcpath('')
|
2016-02-22 14:26:02 -04:00
|
|
|
self.configure_env(cfg, env)
|
2016-02-15 17:26:14 -04:00
|
|
|
|
2023-06-07 02:57:41 -03:00
|
|
|
# Setup scripting:
|
2021-11-14 21:04:40 -04:00
|
|
|
env.DEFINES.update(
|
2023-06-07 02:57:41 -03:00
|
|
|
LUA_32BITS = 1,
|
2021-11-14 21:04:40 -04:00
|
|
|
)
|
|
|
|
|
2023-06-07 02:57:41 -03:00
|
|
|
env.AP_LIBRARIES += [
|
|
|
|
'AP_Scripting',
|
|
|
|
'AP_Scripting/lua/src',
|
|
|
|
]
|
2019-07-04 02:04:05 -03:00
|
|
|
|
2023-06-07 02:57:41 -03:00
|
|
|
if cfg.options.enable_scripting:
|
2019-06-17 19:25:45 -03:00
|
|
|
env.DEFINES.update(
|
2021-11-15 01:08:36 -04:00
|
|
|
AP_SCRIPTING_ENABLED = 1,
|
2023-06-07 02:57:41 -03:00
|
|
|
)
|
|
|
|
elif cfg.options.disable_scripting:
|
|
|
|
env.DEFINES.update(
|
|
|
|
AP_SCRIPTING_ENABLED = 0,
|
|
|
|
)
|
2019-06-17 19:25:45 -03:00
|
|
|
|
2020-11-05 19:36:51 -04:00
|
|
|
# allow GCS disable for AP_DAL example
|
|
|
|
if cfg.options.no_gcs:
|
2021-08-18 08:42:18 -03:00
|
|
|
env.CXXFLAGS += ['-DHAL_GCS_ENABLED=0']
|
2021-06-14 08:07:27 -03:00
|
|
|
|
2023-03-10 20:44:51 -04:00
|
|
|
# configurations for XRCE-DDS
|
|
|
|
if cfg.options.enable_dds:
|
|
|
|
cfg.recurse('libraries/AP_DDS')
|
|
|
|
env.ENABLE_DDS = True
|
|
|
|
env.AP_LIBRARIES += [
|
|
|
|
'AP_DDS'
|
|
|
|
]
|
|
|
|
env.DEFINES.update(AP_DDS_ENABLED = 1)
|
|
|
|
# check for microxrceddsgen
|
|
|
|
cfg.find_program('microxrceddsgen',mandatory=True)
|
|
|
|
else:
|
|
|
|
env.ENABLE_DDS = False
|
|
|
|
env.DEFINES.update(AP_DDS_ENABLED = 0)
|
|
|
|
|
2021-06-14 08:07:27 -03:00
|
|
|
# setup for supporting onvif cam control
|
|
|
|
if cfg.options.enable_onvif:
|
|
|
|
cfg.recurse('libraries/AP_ONVIF')
|
|
|
|
env.ENABLE_ONVIF = True
|
|
|
|
env.ROMFS_FILES += [('scripts/ONVIF_Camera_Control.lua',
|
|
|
|
'libraries/AP_Scripting/applets/ONVIF_Camera_Control.lua')]
|
|
|
|
env.DEFINES.update(
|
|
|
|
ENABLE_ONVIF=1,
|
|
|
|
SCRIPTING_ENABLE_DEFAULT=1,
|
|
|
|
)
|
|
|
|
env.AP_LIBRARIES += [
|
|
|
|
'AP_ONVIF'
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
env.ENABLE_ONVIF = False
|
|
|
|
env.DEFINES.update(
|
|
|
|
ENABLE_ONVIF=0,
|
|
|
|
)
|
|
|
|
|
2022-08-11 02:34:51 -03:00
|
|
|
# allow enable of OpenDroneID for any board
|
|
|
|
if cfg.options.enable_opendroneid:
|
|
|
|
env.ENABLE_OPENDRONEID = True
|
|
|
|
env.DEFINES.update(
|
|
|
|
AP_OPENDRONEID_ENABLED=1,
|
|
|
|
)
|
|
|
|
cfg.msg("Enabled OpenDroneID", 'yes')
|
|
|
|
else:
|
|
|
|
cfg.msg("Enabled OpenDroneID", 'no', color='YELLOW')
|
|
|
|
|
2022-08-11 05:03:25 -03:00
|
|
|
# allow enable of firmware ID checking for any board
|
|
|
|
if cfg.options.enable_check_firmware:
|
|
|
|
env.CHECK_FIRMWARE_ENABLED = True
|
|
|
|
env.DEFINES.update(
|
|
|
|
AP_CHECK_FIRMWARE_ENABLED=1,
|
|
|
|
)
|
|
|
|
cfg.msg("Enabled firmware ID checking", 'yes')
|
|
|
|
else:
|
|
|
|
cfg.msg("Enabled firmware ID checking", 'no', color='YELLOW')
|
|
|
|
|
2022-10-14 19:43:22 -03:00
|
|
|
if cfg.options.enable_gps_logging:
|
|
|
|
env.DEFINES.update(
|
|
|
|
AP_GPS_DEBUG_LOGGING_ENABLED=1,
|
|
|
|
)
|
|
|
|
cfg.msg("GPS Debug Logging", 'yes')
|
|
|
|
else:
|
|
|
|
cfg.msg("GPS Debug Logging", 'no', color='YELLOW')
|
|
|
|
|
2022-08-22 21:52:19 -03:00
|
|
|
# allow enable of custom controller for any board
|
|
|
|
# enabled on sitl by default
|
|
|
|
if (cfg.options.enable_custom_controller or self.get_name() == "sitl") and not cfg.options.no_gcs:
|
|
|
|
env.ENABLE_CUSTOM_CONTROLLER = True
|
|
|
|
env.DEFINES.update(
|
|
|
|
AP_CUSTOMCONTROL_ENABLED=1,
|
|
|
|
)
|
|
|
|
env.AP_LIBRARIES += [
|
|
|
|
'AC_CustomControl'
|
|
|
|
]
|
|
|
|
cfg.msg("Enabled custom controller", 'yes')
|
|
|
|
else:
|
|
|
|
env.DEFINES.update(
|
|
|
|
AP_CUSTOMCONTROL_ENABLED=0,
|
|
|
|
)
|
|
|
|
cfg.msg("Enabled custom controller", 'no', color='YELLOW')
|
|
|
|
|
2023-12-25 15:46:41 -04:00
|
|
|
if cfg.options.enable_ppp:
|
|
|
|
env.CXXFLAGS += ['-DAP_NETWORKING_BACKEND_PPP=1']
|
|
|
|
|
2023-11-16 15:09:56 -04:00
|
|
|
if cfg.options.disable_networking:
|
|
|
|
env.CXXFLAGS += ['-DAP_NETWORKING_ENABLED=0']
|
2023-11-12 21:35:11 -04:00
|
|
|
|
|
|
|
if cfg.options.enable_networking_tests:
|
|
|
|
env.CXXFLAGS += ['-DAP_NETWORKING_TESTS_ENABLED=1']
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
d = env.get_merged_dict()
|
|
|
|
# Always prepend so that arguments passed in the command line get
|
|
|
|
# the priority.
|
|
|
|
for k, val in d.items():
|
|
|
|
# Dictionaries (like 'DEFINES') are converted to lists to
|
|
|
|
# conform to waf conventions.
|
|
|
|
if isinstance(val, dict):
|
2016-03-01 18:19:22 -04:00
|
|
|
keys = list(val.keys())
|
|
|
|
if not isinstance(val, OrderedDict):
|
|
|
|
keys.sort()
|
|
|
|
val = ['%s=%s' % (vk, val[vk]) for vk in keys]
|
|
|
|
|
2016-03-16 18:56:47 -03:00
|
|
|
if k in cfg.env and isinstance(cfg.env[k], list):
|
2016-02-15 17:26:14 -04:00
|
|
|
cfg.env.prepend_value(k, val)
|
2016-03-01 18:19:22 -04:00
|
|
|
else:
|
|
|
|
cfg.env[k] = val
|
2016-02-15 17:26:14 -04:00
|
|
|
|
2016-05-19 17:00:29 -03:00
|
|
|
cfg.ap_common_checks()
|
2016-04-05 17:09:48 -03:00
|
|
|
|
2016-09-02 23:37:00 -03:00
|
|
|
cfg.env.prepend_value('INCLUDES', [
|
|
|
|
cfg.srcnode.find_dir('libraries/AP_Common/missing').abspath()
|
|
|
|
])
|
2021-09-17 12:22:16 -03:00
|
|
|
if os.path.exists(os.path.join(env.SRCROOT, '.vscode/c_cpp_properties.json')):
|
|
|
|
# change c_cpp_properties.json configure the VSCode Intellisense env
|
|
|
|
c_cpp_properties = json.load(open(os.path.join(env.SRCROOT, '.vscode/c_cpp_properties.json')))
|
|
|
|
for config in c_cpp_properties['configurations']:
|
|
|
|
config['compileCommands'] = "${workspaceFolder}/build/%s/compile_commands.json" % self.get_name()
|
|
|
|
json.dump(c_cpp_properties, open(os.path.join(env.SRCROOT, './.vscode/c_cpp_properties.json'), 'w'), indent=4)
|
|
|
|
cfg.msg("Configured VSCode Intellisense", 'yes')
|
|
|
|
else:
|
|
|
|
cfg.msg("Configured VSCode Intellisense:", 'no', color='YELLOW')
|
2016-09-02 23:37:00 -03:00
|
|
|
|
2020-01-13 23:00:42 -04:00
|
|
|
def cc_version_gte(self, cfg, want_major, want_minor):
|
|
|
|
(major, minor, patchlevel) = cfg.env.CC_VERSION
|
|
|
|
return (int(major) > want_major or
|
|
|
|
(int(major) == want_major and int(minor) >= want_minor))
|
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
2016-02-15 17:26:14 -04:00
|
|
|
# Use a dictionary instead of the convetional list for definitions to
|
|
|
|
# make easy to override them. Convert back to list before consumption.
|
|
|
|
env.DEFINES = {}
|
|
|
|
|
2022-06-26 21:38:38 -03:00
|
|
|
# potentially set extra defines from an environment variable:
|
|
|
|
if cfg.options.define is not None:
|
|
|
|
for (n, v) in [d.split("=") for d in cfg.options.define]:
|
|
|
|
cfg.msg("Defining: %s" % (n, ), v)
|
|
|
|
env.CFLAGS += ['-D%s=%s' % (n, v)]
|
|
|
|
env.CXXFLAGS += ['-D%s=%s' % (n, v)]
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
env.CFLAGS += [
|
|
|
|
'-ffunction-sections',
|
|
|
|
'-fdata-sections',
|
|
|
|
'-fsigned-char',
|
|
|
|
|
|
|
|
'-Wall',
|
|
|
|
'-Wextra',
|
2019-08-30 07:02:13 -03:00
|
|
|
'-Werror=format',
|
2016-02-15 17:26:14 -04:00
|
|
|
'-Wpointer-arith',
|
|
|
|
'-Wcast-align',
|
|
|
|
'-Wno-missing-field-initializers',
|
|
|
|
'-Wno-unused-parameter',
|
|
|
|
'-Wno-redundant-decls',
|
2016-03-28 21:31:35 -03:00
|
|
|
'-Wno-unknown-pragmas',
|
2017-09-05 21:54:53 -03:00
|
|
|
'-Wno-trigraphs',
|
2019-03-19 08:00:29 -03:00
|
|
|
'-Werror=shadow',
|
2018-08-20 00:03:38 -03:00
|
|
|
'-Werror=return-type',
|
2018-08-26 23:18:03 -03:00
|
|
|
'-Werror=unused-result',
|
2019-08-05 01:37:36 -03:00
|
|
|
'-Werror=unused-variable',
|
2018-11-06 20:37:58 -04:00
|
|
|
'-Werror=narrowing',
|
2019-03-18 22:24:00 -03:00
|
|
|
'-Werror=attributes',
|
2019-06-09 06:10:16 -03:00
|
|
|
'-Werror=overflow',
|
2019-06-10 23:39:56 -03:00
|
|
|
'-Werror=parentheses',
|
2019-06-06 22:46:26 -03:00
|
|
|
'-Werror=format-extra-args',
|
2019-08-01 01:34:52 -03:00
|
|
|
'-Werror=ignored-qualifiers',
|
2020-08-17 22:58:36 -03:00
|
|
|
'-Werror=undef',
|
2020-04-23 23:26:54 -03:00
|
|
|
'-DARDUPILOT_BUILD',
|
2016-02-15 17:26:14 -04:00
|
|
|
]
|
|
|
|
|
2018-11-03 18:59:27 -03:00
|
|
|
if cfg.options.scripting_checks:
|
|
|
|
env.DEFINES.update(
|
|
|
|
AP_SCRIPTING_CHECKS = 1,
|
|
|
|
)
|
|
|
|
|
2020-09-14 00:23:24 -03:00
|
|
|
cfg.msg("CXX Compiler", "%s %s" % (cfg.env.COMPILER_CXX, ".".join(cfg.env.CC_VERSION)))
|
|
|
|
|
2021-07-22 19:29:12 -03:00
|
|
|
if cfg.options.assert_cc_version:
|
|
|
|
cfg.msg("Checking compiler", "%s %s" % (cfg.options.assert_cc_version, ".".join(cfg.env.CC_VERSION)))
|
|
|
|
have_version = cfg.env.COMPILER_CXX+"-"+'.'.join(list(cfg.env.CC_VERSION))
|
|
|
|
want_version = cfg.options.assert_cc_version
|
|
|
|
if have_version != want_version:
|
|
|
|
cfg.fatal("cc version mismatch: %s should be %s" % (have_version, want_version))
|
|
|
|
|
2016-03-08 19:43:27 -04:00
|
|
|
if 'clang' in cfg.env.COMPILER_CC:
|
|
|
|
env.CFLAGS += [
|
|
|
|
'-fcolor-diagnostics',
|
|
|
|
'-Wno-gnu-designator',
|
|
|
|
'-Wno-inconsistent-missing-override',
|
|
|
|
'-Wno-mismatched-tags',
|
|
|
|
'-Wno-gnu-variable-sized-type-not-at-end',
|
2019-12-16 22:21:30 -04:00
|
|
|
'-Werror=implicit-fallthrough',
|
2023-06-20 13:17:07 -03:00
|
|
|
'-cl-single-precision-constant',
|
|
|
|
]
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-cl-single-precision-constant',
|
2016-03-08 19:43:27 -04:00
|
|
|
]
|
2019-11-09 09:08:00 -04:00
|
|
|
else:
|
|
|
|
env.CFLAGS += [
|
|
|
|
'-Wno-format-contains-nul',
|
2023-06-20 13:17:07 -03:00
|
|
|
'-fsingle-precision-constant', # force const vals to be float , not double. so 100.0 means 100.0f
|
2019-11-09 09:08:00 -04:00
|
|
|
]
|
2020-01-13 23:00:42 -04:00
|
|
|
if self.cc_version_gte(cfg, 7, 4):
|
2019-12-16 22:21:30 -04:00
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-Werror=implicit-fallthrough',
|
|
|
|
]
|
2023-01-08 20:40:32 -04:00
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-fcheck-new',
|
2023-06-20 13:17:07 -03:00
|
|
|
'-fsingle-precision-constant',
|
2024-02-01 00:15:53 -04:00
|
|
|
'-Wno-psabi',
|
2023-01-08 20:40:32 -04:00
|
|
|
]
|
2016-03-08 19:43:27 -04:00
|
|
|
|
2016-05-06 18:44:12 -03:00
|
|
|
if cfg.env.DEBUG:
|
|
|
|
env.CFLAGS += [
|
|
|
|
'-g',
|
|
|
|
'-O0',
|
|
|
|
]
|
2020-04-29 09:52:01 -03:00
|
|
|
env.DEFINES.update(
|
|
|
|
HAL_DEBUG_BUILD = 1,
|
|
|
|
)
|
2023-05-10 03:07:13 -03:00
|
|
|
elif cfg.options.debug_symbols:
|
2023-04-30 21:54:56 -03:00
|
|
|
env.CFLAGS += [
|
|
|
|
'-g',
|
|
|
|
]
|
2021-05-21 05:51:31 -03:00
|
|
|
if cfg.env.COVERAGE:
|
|
|
|
env.CFLAGS += [
|
|
|
|
'-fprofile-arcs',
|
|
|
|
'-ftest-coverage',
|
|
|
|
]
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-fprofile-arcs',
|
|
|
|
'-ftest-coverage',
|
|
|
|
]
|
|
|
|
env.LINKFLAGS += [
|
|
|
|
'-lgcov',
|
|
|
|
'-coverage',
|
|
|
|
]
|
2022-01-11 10:59:45 -04:00
|
|
|
env.DEFINES.update(
|
|
|
|
HAL_COVERAGE_BUILD = 1,
|
|
|
|
)
|
2016-05-06 18:44:12 -03:00
|
|
|
|
2019-06-18 19:18:54 -03:00
|
|
|
if cfg.options.bootloader:
|
|
|
|
# don't let bootloaders try and pull scripting in
|
|
|
|
cfg.options.disable_scripting = True
|
2022-08-11 01:33:46 -03:00
|
|
|
if cfg.options.signed_fw:
|
|
|
|
env.DEFINES.update(
|
|
|
|
ENABLE_HEAP = 1,
|
|
|
|
)
|
2020-03-16 19:04:28 -03:00
|
|
|
else:
|
|
|
|
env.DEFINES.update(
|
|
|
|
ENABLE_HEAP = 1,
|
|
|
|
)
|
2019-06-18 19:18:54 -03:00
|
|
|
|
2018-09-30 20:04:10 -03:00
|
|
|
if cfg.options.enable_math_check_indexes:
|
|
|
|
env.CXXFLAGS += ['-DMATH_CHECK_INDEXES']
|
|
|
|
|
2022-09-03 01:59:55 -03:00
|
|
|
if cfg.options.private_key:
|
|
|
|
env.PRIVATE_KEY = cfg.options.private_key
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-std=gnu++11',
|
|
|
|
|
|
|
|
'-fdata-sections',
|
|
|
|
'-ffunction-sections',
|
|
|
|
'-fno-exceptions',
|
|
|
|
'-fsigned-char',
|
|
|
|
|
|
|
|
'-Wall',
|
|
|
|
'-Wextra',
|
|
|
|
'-Wpointer-arith',
|
|
|
|
'-Wno-unused-parameter',
|
|
|
|
'-Wno-missing-field-initializers',
|
|
|
|
'-Wno-reorder',
|
|
|
|
'-Wno-redundant-decls',
|
2016-03-28 21:31:35 -03:00
|
|
|
'-Wno-unknown-pragmas',
|
2019-08-27 01:53:51 -03:00
|
|
|
'-Wno-expansion-to-defined',
|
2020-07-07 00:00:31 -03:00
|
|
|
'-Werror=cast-align',
|
2019-03-18 22:24:00 -03:00
|
|
|
'-Werror=attributes',
|
2016-02-15 17:26:14 -04:00
|
|
|
'-Werror=format-security',
|
2019-09-04 23:10:30 -03:00
|
|
|
'-Werror=format-extra-args',
|
2019-02-28 06:53:50 -04:00
|
|
|
'-Werror=enum-compare',
|
2019-08-30 07:02:13 -03:00
|
|
|
'-Werror=format',
|
2016-02-15 17:26:14 -04:00
|
|
|
'-Werror=array-bounds',
|
|
|
|
'-Werror=uninitialized',
|
|
|
|
'-Werror=init-self',
|
2018-11-06 20:37:58 -04:00
|
|
|
'-Werror=narrowing',
|
2018-08-20 00:03:38 -03:00
|
|
|
'-Werror=return-type',
|
2017-04-19 07:10:52 -03:00
|
|
|
'-Werror=switch',
|
2018-06-26 21:50:15 -03:00
|
|
|
'-Werror=sign-compare',
|
2019-04-09 19:37:06 -03:00
|
|
|
'-Werror=type-limits',
|
2020-08-17 22:58:36 -03:00
|
|
|
'-Werror=undef',
|
2018-08-26 23:18:03 -03:00
|
|
|
'-Werror=unused-result',
|
2019-03-19 08:00:29 -03:00
|
|
|
'-Werror=shadow',
|
2020-01-09 06:16:21 -04:00
|
|
|
'-Werror=unused-value',
|
2019-03-25 06:59:12 -03:00
|
|
|
'-Werror=unused-variable',
|
2019-10-16 01:46:21 -03:00
|
|
|
'-Werror=delete-non-virtual-dtor',
|
2016-02-15 17:26:14 -04:00
|
|
|
'-Wfatal-errors',
|
2017-09-05 21:54:53 -03:00
|
|
|
'-Wno-trigraphs',
|
2019-06-10 23:39:56 -03:00
|
|
|
'-Werror=parentheses',
|
2020-04-23 23:26:54 -03:00
|
|
|
'-DARDUPILOT_BUILD',
|
2021-08-22 05:33:17 -03:00
|
|
|
'-Wuninitialized',
|
|
|
|
'-Warray-bounds',
|
2016-02-15 17:26:14 -04:00
|
|
|
]
|
|
|
|
|
2016-03-08 19:43:27 -04:00
|
|
|
if 'clang++' in cfg.env.COMPILER_CXX:
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-fcolor-diagnostics',
|
|
|
|
|
2019-05-01 04:49:27 -03:00
|
|
|
'-Werror=address-of-packed-member',
|
|
|
|
|
2019-02-17 22:16:01 -04:00
|
|
|
'-Werror=inconsistent-missing-override',
|
2019-03-01 05:25:29 -04:00
|
|
|
'-Werror=overloaded-virtual',
|
2019-02-17 22:16:01 -04:00
|
|
|
|
2019-04-03 18:48:18 -03:00
|
|
|
# catch conversion issues:
|
|
|
|
'-Werror=bitfield-enum-conversion',
|
|
|
|
'-Werror=bool-conversion',
|
|
|
|
'-Werror=constant-conversion',
|
|
|
|
'-Werror=enum-conversion',
|
|
|
|
'-Werror=int-conversion',
|
|
|
|
'-Werror=literal-conversion',
|
|
|
|
'-Werror=non-literal-null-conversion',
|
|
|
|
'-Werror=null-conversion',
|
|
|
|
'-Werror=objc-literal-conversion',
|
|
|
|
# '-Werror=shorten-64-to-32', # ARRAY_SIZE() creates this all over the place as the caller typically takes a uint32_t not a size_t
|
|
|
|
'-Werror=string-conversion',
|
|
|
|
# '-Werror=sign-conversion', # can't use as we assign into AP_Int8 from uint8_ts
|
|
|
|
|
2016-03-08 19:43:27 -04:00
|
|
|
'-Wno-gnu-designator',
|
|
|
|
'-Wno-mismatched-tags',
|
|
|
|
'-Wno-gnu-variable-sized-type-not-at-end',
|
2019-12-16 22:21:30 -04:00
|
|
|
'-Werror=implicit-fallthrough',
|
2016-03-08 19:43:27 -04:00
|
|
|
]
|
|
|
|
else:
|
2016-07-18 15:25:36 -03:00
|
|
|
env.CXXFLAGS += [
|
2019-11-09 09:08:00 -04:00
|
|
|
'-Wno-format-contains-nul',
|
2016-03-08 19:43:27 -04:00
|
|
|
'-Werror=unused-but-set-variable'
|
|
|
|
]
|
2020-01-13 23:00:42 -04:00
|
|
|
if self.cc_version_gte(cfg, 5, 2):
|
2018-11-07 07:27:45 -04:00
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-Werror=suggest-override',
|
|
|
|
]
|
2020-01-13 23:00:42 -04:00
|
|
|
if self.cc_version_gte(cfg, 7, 4):
|
2019-12-16 22:21:30 -04:00
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-Werror=implicit-fallthrough',
|
2021-11-23 19:27:06 -04:00
|
|
|
'-Werror=maybe-uninitialized',
|
|
|
|
'-Werror=duplicated-cond',
|
2021-11-24 21:25:00 -04:00
|
|
|
]
|
|
|
|
if self.cc_version_gte(cfg, 8, 4):
|
|
|
|
env.CXXFLAGS += [
|
2021-11-23 19:25:47 -04:00
|
|
|
'-Werror=sizeof-pointer-div',
|
2019-12-16 22:21:30 -04:00
|
|
|
]
|
2016-03-08 19:43:27 -04:00
|
|
|
|
2020-04-23 23:26:54 -03:00
|
|
|
if cfg.options.Werror:
|
|
|
|
errors = ['-Werror',
|
|
|
|
'-Werror=missing-declarations',
|
|
|
|
'-Werror=float-equal',
|
|
|
|
'-Werror=undef',
|
|
|
|
]
|
|
|
|
env.CFLAGS += errors
|
|
|
|
env.CXXFLAGS += errors
|
|
|
|
|
2016-05-06 18:44:12 -03:00
|
|
|
if cfg.env.DEBUG:
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-g',
|
|
|
|
'-O0',
|
|
|
|
]
|
|
|
|
|
2016-06-21 11:26:18 -03:00
|
|
|
if cfg.env.DEST_OS == 'darwin':
|
|
|
|
env.LINKFLAGS += [
|
|
|
|
'-Wl,-dead_strip',
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
env.LINKFLAGS += [
|
2021-06-13 08:54:36 -03:00
|
|
|
'-fno-exceptions',
|
2016-06-21 11:26:18 -03:00
|
|
|
'-Wl,--gc-sections',
|
|
|
|
]
|
|
|
|
|
2023-12-15 17:43:37 -04:00
|
|
|
if self.with_can:
|
|
|
|
# for both AP_Perip and main fw enable deadlines
|
|
|
|
env.DEFINES.update(CANARD_ENABLE_DEADLINE = 1)
|
|
|
|
|
|
|
|
if not cfg.env.AP_PERIPH:
|
|
|
|
env.AP_LIBRARIES += [
|
|
|
|
'AP_DroneCAN',
|
|
|
|
'modules/DroneCAN/libcanard/*.c',
|
|
|
|
]
|
|
|
|
if cfg.options.enable_dronecan_tests:
|
|
|
|
env.DEFINES.update(AP_TEST_DRONECAN_DRIVERS = 1)
|
|
|
|
|
2023-01-05 09:07:00 -04:00
|
|
|
env.DEFINES.update(
|
2023-12-15 17:43:37 -04:00
|
|
|
DRONECAN_CXX_WRAPPERS = 1,
|
|
|
|
USE_USER_HELPERS = 1,
|
|
|
|
CANARD_ALLOCATE_SEM=1
|
2023-01-05 09:07:00 -04:00
|
|
|
)
|
2017-04-02 11:56:50 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
2019-09-22 07:37:36 -03:00
|
|
|
if cfg.options.build_dates:
|
2019-06-13 07:30:21 -03:00
|
|
|
env.build_dates = True
|
|
|
|
|
2016-07-13 00:07:48 -03:00
|
|
|
# We always want to use PRI format macros
|
|
|
|
cfg.define('__STDC_FORMAT_MACROS', 1)
|
|
|
|
|
2023-11-17 02:07:30 -04:00
|
|
|
if cfg.options.enable_ekf2:
|
|
|
|
env.CXXFLAGS += ['-DHAL_NAVEKF2_AVAILABLE=1']
|
2020-04-11 19:25:09 -03:00
|
|
|
|
|
|
|
if cfg.options.disable_ekf3:
|
|
|
|
env.CXXFLAGS += ['-DHAL_NAVEKF3_AVAILABLE=0']
|
2016-02-15 17:26:14 -04:00
|
|
|
|
2021-06-22 02:57:34 -03:00
|
|
|
if cfg.options.postype_single:
|
|
|
|
env.CXXFLAGS += ['-DHAL_WITH_POSTYPE_DOUBLE=0']
|
|
|
|
|
2020-08-31 02:31:14 -03:00
|
|
|
if cfg.options.osd or cfg.options.osd_fonts:
|
2020-08-31 06:16:54 -03:00
|
|
|
env.CXXFLAGS += ['-DOSD_ENABLED=1', '-DHAL_MSP_ENABLED=1']
|
2020-08-31 02:31:14 -03:00
|
|
|
|
|
|
|
if cfg.options.osd_fonts:
|
2020-08-30 18:45:21 -03:00
|
|
|
for f in os.listdir('libraries/AP_OSD/fonts'):
|
|
|
|
if fnmatch.fnmatch(f, "font*bin"):
|
|
|
|
env.ROMFS_FILES += [(f,'libraries/AP_OSD/fonts/'+f)]
|
2021-05-04 08:12:52 -03:00
|
|
|
|
|
|
|
if cfg.options.ekf_double:
|
2021-05-04 08:12:24 -03:00
|
|
|
env.CXXFLAGS += ['-DHAL_WITH_EKF_DOUBLE=1']
|
2021-05-04 08:12:52 -03:00
|
|
|
|
|
|
|
if cfg.options.ekf_single:
|
2021-05-04 08:12:24 -03:00
|
|
|
env.CXXFLAGS += ['-DHAL_WITH_EKF_DOUBLE=0']
|
2021-05-04 08:12:52 -03:00
|
|
|
|
2023-02-15 07:20:52 -04:00
|
|
|
if cfg.options.consistent_builds:
|
|
|
|
# squash all line numbers to be the number 17
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
"-D__AP_LINE__=17",
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
"-D__AP_LINE__=__LINE__",
|
|
|
|
]
|
|
|
|
|
2021-07-31 18:45:36 -03:00
|
|
|
# add files from ROMFS_custom
|
|
|
|
custom_dir = 'ROMFS_custom'
|
|
|
|
if os.path.exists(custom_dir):
|
|
|
|
for root, subdirs, files in os.walk(custom_dir):
|
|
|
|
for f in files:
|
|
|
|
if fnmatch.fnmatch(f,"*~"):
|
|
|
|
# exclude emacs tmp files
|
|
|
|
continue
|
|
|
|
fname = root[len(custom_dir)+1:]+"/"+f
|
2024-02-20 21:57:45 -04:00
|
|
|
if fname.startswith("/"):
|
|
|
|
fname = fname[1:]
|
2021-07-31 18:45:36 -03:00
|
|
|
env.ROMFS_FILES += [(fname,root+"/"+f)]
|
|
|
|
|
2018-03-01 03:26:49 -04:00
|
|
|
def pre_build(self, bld):
|
|
|
|
'''pre-build hook that gets called before dynamic sources'''
|
2018-07-01 20:34:44 -03:00
|
|
|
if bld.env.ROMFS_FILES:
|
|
|
|
self.embed_ROMFS_files(bld)
|
2018-03-01 03:26:49 -04:00
|
|
|
|
2016-02-24 15:18:00 -04:00
|
|
|
def build(self, bld):
|
2016-05-05 19:16:23 -03:00
|
|
|
bld.ap_version_append_str('GIT_VERSION', bld.git_head_hash(short=True))
|
2022-02-01 20:45:19 -04:00
|
|
|
bld.ap_version_append_int('GIT_VERSION_INT', int("0x" + bld.git_head_hash(short=True), base=16))
|
2023-10-18 22:39:01 -03:00
|
|
|
bld.ap_version_append_str('AP_BUILD_ROOT', bld.srcnode.abspath())
|
2018-01-05 02:53:19 -04:00
|
|
|
import time
|
|
|
|
ltime = time.localtime()
|
2019-06-13 07:30:21 -03:00
|
|
|
if bld.env.build_dates:
|
|
|
|
bld.ap_version_append_int('BUILD_DATE_YEAR', ltime.tm_year)
|
|
|
|
bld.ap_version_append_int('BUILD_DATE_MONTH', ltime.tm_mon)
|
|
|
|
bld.ap_version_append_int('BUILD_DATE_DAY', ltime.tm_mday)
|
2016-02-24 15:18:00 -04:00
|
|
|
|
2018-07-01 20:34:44 -03:00
|
|
|
def embed_ROMFS_files(self, ctx):
|
|
|
|
'''embed some files using AP_ROMFS'''
|
|
|
|
import embed
|
|
|
|
header = ctx.bldnode.make_node('ap_romfs_embedded.h').abspath()
|
2019-10-23 06:52:51 -03:00
|
|
|
if not embed.create_embedded_h(header, ctx.env.ROMFS_FILES, ctx.env.ROMFS_UNCOMPRESSED):
|
2018-11-28 06:06:20 -04:00
|
|
|
ctx.fatal("Failed to created ap_romfs_embedded.h")
|
2018-07-01 20:34:44 -03:00
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
Board = BoardMeta('Board', Board.__bases__, dict(Board.__dict__))
|
2015-11-26 10:34:24 -04:00
|
|
|
|
2021-10-27 05:06:42 -03:00
|
|
|
def add_dynamic_boards_chibios():
|
2018-03-01 05:11:29 -04:00
|
|
|
'''add boards based on existance of hwdef.dat in subdirectories for ChibiOS'''
|
|
|
|
dirname, dirlist, filenames = next(os.walk('libraries/AP_HAL_ChibiOS/hwdef'))
|
|
|
|
for d in dirlist:
|
|
|
|
if d in _board_classes.keys():
|
|
|
|
continue
|
|
|
|
hwdef = os.path.join(dirname, d, 'hwdef.dat')
|
|
|
|
if os.path.exists(hwdef):
|
|
|
|
newclass = type(d, (chibios,), {'name': d})
|
|
|
|
|
2021-12-06 00:52:46 -04:00
|
|
|
@conf
|
|
|
|
def get_chibios_board_cls(ctx, name, hwdef):
|
|
|
|
if name in _board_classes.keys():
|
|
|
|
_board_classes[name].hwdef = hwdef
|
|
|
|
return _board_classes[name]
|
|
|
|
newclass = type(name, (chibios,), {'name': name})
|
|
|
|
newclass.hwdef = hwdef
|
|
|
|
return newclass
|
|
|
|
|
2021-10-27 05:06:42 -03:00
|
|
|
def add_dynamic_boards_esp32():
|
|
|
|
'''add boards based on existance of hwdef.dat in subdirectories for ESP32'''
|
|
|
|
dirname, dirlist, filenames = next(os.walk('libraries/AP_HAL_ESP32/hwdef'))
|
|
|
|
for d in dirlist:
|
|
|
|
if d in _board_classes.keys():
|
|
|
|
continue
|
|
|
|
hwdef = os.path.join(dirname, d, 'hwdef.dat')
|
|
|
|
if os.path.exists(hwdef):
|
2023-05-15 13:47:38 -03:00
|
|
|
mcu_esp32s3 = True if (d[0:7] == "esp32s3") else False
|
|
|
|
if mcu_esp32s3:
|
|
|
|
newclass = type(d, (esp32s3,), {'name': d})
|
|
|
|
else:
|
|
|
|
newclass = type(d, (esp32,), {'name': d})
|
2021-10-27 05:06:42 -03:00
|
|
|
|
2015-11-26 12:32:27 -04:00
|
|
|
def get_boards_names():
|
2021-10-27 05:06:42 -03:00
|
|
|
add_dynamic_boards_chibios()
|
|
|
|
add_dynamic_boards_esp32()
|
2018-09-01 21:05:59 -03:00
|
|
|
|
|
|
|
return sorted(list(_board_classes.keys()), key=str.lower)
|
2016-02-15 17:26:14 -04:00
|
|
|
|
2021-01-19 11:54:06 -04:00
|
|
|
def get_ap_periph_boards():
|
|
|
|
'''Add AP_Periph boards based on existance of periph keywork in hwdef.dat or board name'''
|
|
|
|
list_ap = [s for s in list(_board_classes.keys()) if "periph" in s]
|
|
|
|
dirname, dirlist, filenames = next(os.walk('libraries/AP_HAL_ChibiOS/hwdef'))
|
|
|
|
for d in dirlist:
|
|
|
|
if d in list_ap:
|
|
|
|
continue
|
|
|
|
hwdef = os.path.join(dirname, d, 'hwdef.dat')
|
|
|
|
if os.path.exists(hwdef):
|
|
|
|
with open(hwdef, "r") as f:
|
2021-08-24 06:03:08 -03:00
|
|
|
content = f.read()
|
|
|
|
if 'AP_PERIPH' in content:
|
2021-01-19 11:54:06 -04:00
|
|
|
list_ap.append(d)
|
2021-08-24 06:03:08 -03:00
|
|
|
continue
|
|
|
|
# process any include lines:
|
|
|
|
m = re.match(r"include\s+([^\s]*)", content)
|
|
|
|
if m is None:
|
|
|
|
continue
|
|
|
|
include_path = os.path.join(os.path.dirname(hwdef), m.group(1))
|
|
|
|
with open(include_path, "r") as g:
|
|
|
|
content = g.read()
|
|
|
|
if 'AP_PERIPH' in content:
|
|
|
|
list_ap.append(d)
|
|
|
|
continue
|
|
|
|
|
2021-01-19 11:54:06 -04:00
|
|
|
list_ap = list(set(list_ap))
|
|
|
|
return list_ap
|
|
|
|
|
2018-11-20 06:44:41 -04:00
|
|
|
def get_removed_boards():
|
|
|
|
'''list of boards which have been removed'''
|
|
|
|
return sorted(['px4-v1', 'px4-v2', 'px4-v3', 'px4-v4', 'px4-v4pro'])
|
|
|
|
|
2016-05-20 15:36:15 -03:00
|
|
|
@conf
|
|
|
|
def get_board(ctx):
|
2016-03-07 18:05:46 -04:00
|
|
|
global _board
|
|
|
|
if not _board:
|
2016-05-20 15:36:15 -03:00
|
|
|
if not ctx.env.BOARD:
|
|
|
|
ctx.fatal('BOARD environment variable must be set before first call to get_board()')
|
2018-11-20 06:44:41 -04:00
|
|
|
if ctx.env.BOARD in get_removed_boards():
|
2018-11-20 18:05:22 -04:00
|
|
|
ctx.fatal('''
|
2018-11-20 06:44:41 -04:00
|
|
|
The board target %s has been removed from ArduPilot with the removal of NuttX support and HAL_PX4.
|
|
|
|
|
|
|
|
Please use a replacement build as follows:
|
|
|
|
|
|
|
|
px4-v2 Use Pixhawk1 build
|
|
|
|
px4-v3 Use Pixhawk1 or CubeBlack builds
|
|
|
|
px4-v4 Use Pixracer build
|
|
|
|
px4-v4pro Use DrotekP3Pro build
|
|
|
|
''' % ctx.env.BOARD)
|
|
|
|
|
2019-03-03 20:18:15 -04:00
|
|
|
boards = _board_classes.keys()
|
2023-08-31 18:46:25 -03:00
|
|
|
if ctx.env.BOARD not in boards:
|
2021-05-20 21:57:15 -03:00
|
|
|
ctx.fatal("Invalid board '%s': choices are %s" % (ctx.env.BOARD, ', '.join(sorted(boards, key=str.lower))))
|
2016-05-20 15:36:15 -03:00
|
|
|
_board = _board_classes[ctx.env.BOARD]()
|
2016-03-07 18:05:46 -04:00
|
|
|
return _board
|
2015-11-26 10:34:24 -04:00
|
|
|
|
|
|
|
# NOTE: Keeping all the board definitions together so we can easily
|
|
|
|
# identify opportunities to simplify common flags. In the future might
|
|
|
|
# be worthy to keep board definitions in files of their own.
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
class sitl(Board):
|
2020-05-31 08:50:44 -03:00
|
|
|
|
|
|
|
def __init__(self):
|
2023-08-25 22:34:24 -03:00
|
|
|
self.with_can = True
|
2020-05-31 08:50:44 -03:00
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(sitl, self).configure_env(cfg, env)
|
2016-02-15 17:26:14 -04:00
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD = 'HAL_BOARD_SITL',
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_NONE',
|
2018-11-03 18:59:27 -03:00
|
|
|
AP_SCRIPTING_CHECKS = 1, # SITL should always do runtime scripting checks
|
2023-04-14 01:35:51 -03:00
|
|
|
AP_BARO_PROBE_EXTERNAL_I2C_BUSES = 1,
|
2016-02-15 17:26:14 -04:00
|
|
|
)
|
2016-05-06 18:44:12 -03:00
|
|
|
|
2023-12-23 22:53:38 -04:00
|
|
|
env.BOARD_CLASS = "SITL"
|
|
|
|
|
2021-10-26 02:31:22 -03:00
|
|
|
cfg.define('AP_SIM_ENABLED', 1)
|
2021-06-10 22:16:20 -03:00
|
|
|
cfg.define('HAL_WITH_SPI', 1)
|
|
|
|
cfg.define('HAL_WITH_RAMTRON', 1)
|
2022-08-13 00:11:43 -03:00
|
|
|
cfg.define('AP_OPENDRONEID_ENABLED', 1)
|
2022-08-11 01:33:46 -03:00
|
|
|
cfg.define('AP_SIGNED_FIRMWARE', 0)
|
2021-06-10 22:16:20 -03:00
|
|
|
|
2023-04-02 22:20:30 -03:00
|
|
|
cfg.define('AP_NOTIFY_LP5562_BUS', 2)
|
|
|
|
cfg.define('AP_NOTIFY_LP5562_ADDR', 0x30)
|
|
|
|
|
2023-11-17 22:58:37 -04:00
|
|
|
try:
|
|
|
|
env.CXXFLAGS.remove('-DHAL_NAVEKF2_AVAILABLE=0')
|
|
|
|
except ValueError:
|
|
|
|
pass
|
|
|
|
env.CXXFLAGS += ['-DHAL_NAVEKF2_AVAILABLE=1']
|
|
|
|
|
2020-05-31 08:50:44 -03:00
|
|
|
if self.with_can:
|
|
|
|
cfg.define('HAL_NUM_CAN_IFACES', 2)
|
2023-01-05 09:07:00 -04:00
|
|
|
env.DEFINES.update(CANARD_MULTI_IFACE=1,
|
|
|
|
CANARD_IFACE_ALL = 0x3,
|
2023-08-25 22:34:24 -03:00
|
|
|
CANARD_ENABLE_CANFD = 1,
|
|
|
|
CANARD_ENABLE_ASSERTS = 1)
|
|
|
|
if not cfg.options.force_32bit:
|
|
|
|
# needed for cygwin
|
|
|
|
env.CXXFLAGS += [ '-DCANARD_64_BIT=1' ]
|
|
|
|
env.CFLAGS += [ '-DCANARD_64_BIT=1' ]
|
|
|
|
if Utils.unversioned_sys_platform().startswith("linux"):
|
|
|
|
cfg.define('HAL_CAN_WITH_SOCKETCAN', 1)
|
|
|
|
else:
|
|
|
|
cfg.define('HAL_CAN_WITH_SOCKETCAN', 0)
|
2020-05-31 08:50:44 -03:00
|
|
|
|
2018-08-14 23:20:50 -03:00
|
|
|
env.CXXFLAGS += [
|
2023-05-18 21:53:55 -03:00
|
|
|
'-Werror=float-equal',
|
|
|
|
'-Werror=missing-declarations',
|
2018-08-14 23:20:50 -03:00
|
|
|
]
|
|
|
|
|
2023-12-25 17:50:23 -04:00
|
|
|
if not cfg.options.disable_networking and not 'clang' in cfg.env.COMPILER_CC:
|
|
|
|
# lwip doesn't build with clang
|
2023-11-16 15:09:56 -04:00
|
|
|
env.CXXFLAGS += ['-DAP_NETWORKING_ENABLED=1']
|
|
|
|
|
2022-07-10 20:10:05 -03:00
|
|
|
if cfg.options.ubsan or cfg.options.ubsan_abort:
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
"-fsanitize=undefined",
|
|
|
|
"-fsanitize=float-cast-overflow",
|
2022-07-11 00:30:48 -03:00
|
|
|
"-DUBSAN_ENABLED",
|
2022-07-10 20:10:05 -03:00
|
|
|
]
|
|
|
|
env.LINKFLAGS += [
|
|
|
|
"-fsanitize=undefined",
|
|
|
|
"-lubsan",
|
|
|
|
]
|
|
|
|
|
|
|
|
if cfg.options.ubsan_abort:
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
"-fno-sanitize-recover"
|
|
|
|
]
|
|
|
|
|
2016-05-06 18:44:12 -03:00
|
|
|
if not cfg.env.DEBUG:
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-O3',
|
|
|
|
]
|
|
|
|
|
2020-04-14 07:45:40 -03:00
|
|
|
if 'clang++' in cfg.env.COMPILER_CXX and cfg.options.asan:
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-fsanitize=address',
|
|
|
|
'-fno-omit-frame-pointer',
|
|
|
|
]
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
env.LIB += [
|
|
|
|
'm',
|
|
|
|
]
|
2016-05-21 12:11:48 -03:00
|
|
|
|
|
|
|
cfg.check_librt(env)
|
2019-07-23 08:00:43 -03:00
|
|
|
cfg.check_feenableexcept()
|
2016-05-19 17:25:49 -03:00
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
env.LINKFLAGS += ['-pthread',]
|
2020-04-14 07:45:40 -03:00
|
|
|
|
|
|
|
if cfg.env.DEBUG and 'clang++' in cfg.env.COMPILER_CXX and cfg.options.asan:
|
|
|
|
env.LINKFLAGS += ['-fsanitize=address']
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
env.AP_LIBRARIES += [
|
|
|
|
'AP_HAL_SITL',
|
2023-01-12 19:52:09 -04:00
|
|
|
'AP_CSVReader',
|
2016-02-15 17:26:14 -04:00
|
|
|
]
|
|
|
|
|
2023-08-17 17:19:37 -03:00
|
|
|
env.AP_LIBRARIES += [
|
|
|
|
'SITL',
|
|
|
|
]
|
2020-09-12 16:01:07 -03:00
|
|
|
|
2018-07-01 20:34:44 -03:00
|
|
|
if cfg.options.enable_sfml:
|
|
|
|
if not cfg.check_SFML(env):
|
|
|
|
cfg.fatal("Failed to find SFML libraries")
|
2019-05-16 00:41:03 -03:00
|
|
|
|
2020-11-12 17:13:31 -04:00
|
|
|
if cfg.options.enable_sfml_joystick:
|
|
|
|
if not cfg.check_SFML(env):
|
|
|
|
cfg.fatal("Failed to find SFML libraries")
|
|
|
|
env.CXXFLAGS += ['-DSFML_JOYSTICK']
|
|
|
|
|
2019-05-16 00:41:03 -03:00
|
|
|
if cfg.options.sitl_osd:
|
2020-03-11 22:59:41 -03:00
|
|
|
env.CXXFLAGS += ['-DWITH_SITL_OSD','-DOSD_ENABLED=1']
|
2018-07-09 05:02:53 -03:00
|
|
|
for f in os.listdir('libraries/AP_OSD/fonts'):
|
|
|
|
if fnmatch.fnmatch(f, "font*bin"):
|
|
|
|
env.ROMFS_FILES += [(f,'libraries/AP_OSD/fonts/'+f)]
|
2018-07-01 07:10:08 -03:00
|
|
|
|
2020-10-24 22:43:41 -03:00
|
|
|
for f in os.listdir('Tools/autotest/models'):
|
|
|
|
if fnmatch.fnmatch(f, "*.json") or fnmatch.fnmatch(f, "*.parm"):
|
|
|
|
env.ROMFS_FILES += [('models/'+f,'Tools/autotest/models/'+f)]
|
2020-12-30 15:56:04 -04:00
|
|
|
|
|
|
|
# include locations.txt so SITL on windows can lookup by name
|
|
|
|
env.ROMFS_FILES += [('locations.txt','Tools/autotest/locations.txt')]
|
|
|
|
|
2020-03-11 22:59:41 -03:00
|
|
|
# embed any scripts from ROMFS/scripts
|
|
|
|
if os.path.exists('ROMFS/scripts'):
|
|
|
|
for f in os.listdir('ROMFS/scripts'):
|
|
|
|
if fnmatch.fnmatch(f, "*.lua"):
|
|
|
|
env.ROMFS_FILES += [('scripts/'+f,'ROMFS/scripts/'+f)]
|
|
|
|
|
|
|
|
if len(env.ROMFS_FILES) > 0:
|
2024-02-24 08:35:21 -04:00
|
|
|
# Allow lua to load from ROMFS if any lua files are added
|
|
|
|
for file in env.ROMFS_FILES:
|
|
|
|
if file[0].startswith("scripts") and file[0].endswith(".lua"):
|
|
|
|
env.CXXFLAGS += ['-DHAL_HAVE_AP_ROMFS_EMBEDDED_LUA']
|
|
|
|
break
|
2020-03-11 22:59:41 -03:00
|
|
|
env.CXXFLAGS += ['-DHAL_HAVE_AP_ROMFS_EMBEDDED_H']
|
|
|
|
|
2019-05-16 00:41:03 -03:00
|
|
|
if cfg.options.sitl_rgbled:
|
|
|
|
env.CXXFLAGS += ['-DWITH_SITL_RGBLED']
|
|
|
|
|
2019-03-19 23:08:51 -03:00
|
|
|
if cfg.options.enable_sfml_audio:
|
|
|
|
if not cfg.check_SFML_Audio(env):
|
|
|
|
cfg.fatal("Failed to find SFML Audio libraries")
|
|
|
|
env.CXXFLAGS += ['-DWITH_SITL_TONEALARM']
|
|
|
|
|
2018-09-02 14:04:13 -03:00
|
|
|
if cfg.env.DEST_OS == 'cygwin':
|
2016-04-19 01:12:42 -03:00
|
|
|
env.LIB += [
|
|
|
|
'winmm',
|
|
|
|
]
|
|
|
|
|
2018-09-02 14:04:13 -03:00
|
|
|
if Utils.unversioned_sys_platform() == 'cygwin':
|
|
|
|
env.CXXFLAGS += ['-DCYGWIN_BUILD']
|
2018-02-27 23:56:05 -04:00
|
|
|
|
|
|
|
if 'clang++' in cfg.env.COMPILER_CXX:
|
|
|
|
print("Disabling SLP for clang++")
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-fno-slp-vectorize' # compiler bug when trying to use SLP
|
|
|
|
]
|
2020-09-12 16:01:07 -03:00
|
|
|
|
2023-01-07 23:46:36 -04:00
|
|
|
if cfg.options.force_32bit:
|
2021-09-07 16:32:24 -03:00
|
|
|
# 32bit platform flags
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-m32',
|
|
|
|
]
|
|
|
|
env.CFLAGS += [
|
|
|
|
'-m32',
|
|
|
|
]
|
|
|
|
env.LDFLAGS += [
|
|
|
|
'-m32',
|
|
|
|
]
|
|
|
|
|
2023-05-29 21:52:52 -03:00
|
|
|
# whitelist of compilers which we should build with -Werror
|
|
|
|
gcc_whitelist = frozenset([
|
2023-06-02 02:14:02 -03:00
|
|
|
('11','3','0'),
|
2023-11-25 23:26:49 -04:00
|
|
|
('11','4','0'),
|
2023-07-30 22:00:50 -03:00
|
|
|
('12','1','0'),
|
2023-06-02 02:14:02 -03:00
|
|
|
])
|
|
|
|
|
2023-07-30 22:00:50 -03:00
|
|
|
# initialise werr_enabled from defaults:
|
|
|
|
werr_enabled = bool('g++' in cfg.env.COMPILER_CXX and cfg.env.CC_VERSION in gcc_whitelist)
|
2023-05-29 21:52:52 -03:00
|
|
|
|
2023-07-30 22:00:50 -03:00
|
|
|
# now process overrides to that default:
|
|
|
|
if (cfg.options.Werror is not None and
|
|
|
|
cfg.options.Werror == cfg.options.disable_Werror):
|
|
|
|
cfg.fatal("Asked to both enable and disable Werror")
|
|
|
|
|
|
|
|
if cfg.options.Werror is not None:
|
|
|
|
werr_enabled = cfg.options.Werror
|
|
|
|
elif cfg.options.disable_Werror is not None:
|
|
|
|
werr_enabled = not cfg.options.disable_Werror
|
|
|
|
|
|
|
|
if werr_enabled:
|
2023-05-29 22:42:12 -03:00
|
|
|
cfg.msg("Enabling -Werror", "yes")
|
2023-07-30 22:00:50 -03:00
|
|
|
if '-Werror' not in env.CXXFLAGS:
|
|
|
|
env.CXXFLAGS += [ '-Werror' ]
|
|
|
|
else:
|
|
|
|
cfg.msg("Enabling -Werror", "no")
|
|
|
|
if '-Werror' in env.CXXFLAGS:
|
|
|
|
env.CXXFLAGS.remove('-Werror')
|
|
|
|
|
2021-09-17 12:22:16 -03:00
|
|
|
def get_name(self):
|
|
|
|
return self.__class__.__name__
|
|
|
|
|
2021-09-07 16:32:24 -03:00
|
|
|
|
2024-01-11 22:50:43 -04:00
|
|
|
class sitl_periph(sitl):
|
2020-09-12 16:01:07 -03:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
cfg.env.AP_PERIPH = 1
|
2024-01-11 22:50:43 -04:00
|
|
|
super(sitl_periph, self).configure_env(cfg, env)
|
2020-09-12 16:01:07 -03:00
|
|
|
env.DEFINES.update(
|
|
|
|
HAL_BUILD_AP_PERIPH = 1,
|
|
|
|
PERIPH_FW = 1,
|
2024-01-11 22:50:43 -04:00
|
|
|
HAL_RAM_RESERVE_START = 0,
|
|
|
|
|
|
|
|
CANARD_ENABLE_CANFD = 1,
|
|
|
|
CANARD_ENABLE_TAO_OPTION = 1,
|
|
|
|
CANARD_MULTI_IFACE = 1,
|
|
|
|
|
|
|
|
# FIXME: SITL library should not be using AP_AHRS:
|
|
|
|
AP_AHRS_ENABLED = 1,
|
|
|
|
AP_AHRS_BACKEND_DEFAULT_ENABLED = 0,
|
|
|
|
AP_AHRS_DCM_ENABLED = 1, # need a default backend
|
|
|
|
HAL_EXTERNAL_AHRS_ENABLED = 0,
|
|
|
|
|
|
|
|
HAL_MAVLINK_BINDINGS_ENABLED = 1,
|
|
|
|
|
|
|
|
AP_AIRSPEED_AUTOCAL_ENABLE = 0,
|
|
|
|
AP_CAN_SLCAN_ENABLED = 0,
|
|
|
|
AP_ICENGINE_ENABLED = 0,
|
|
|
|
AP_MISSION_ENABLED = 0,
|
|
|
|
AP_RCPROTOCOL_ENABLED = 0,
|
|
|
|
AP_RTC_ENABLED = 0,
|
|
|
|
AP_SCHEDULER_ENABLED = 0,
|
|
|
|
AP_SCRIPTING_ENABLED = 0,
|
|
|
|
AP_STATS_ENABLED = 0,
|
|
|
|
AP_UART_MONITOR_ENABLED = 1,
|
|
|
|
COMPASS_CAL_ENABLED = 0,
|
|
|
|
COMPASS_LEARN_ENABLED = 0,
|
|
|
|
COMPASS_MOT_ENABLED = 0,
|
|
|
|
HAL_CAN_DEFAULT_NODE_ID = 0,
|
|
|
|
HAL_CANMANAGER_ENABLED = 0,
|
|
|
|
HAL_GCS_ENABLED = 0,
|
|
|
|
HAL_GENERATOR_ENABLED = 0,
|
|
|
|
HAL_LOGGING_ENABLED = 0,
|
|
|
|
HAL_LOGGING_MAVLINK_ENABLED = 0,
|
|
|
|
HAL_PROXIMITY_ENABLED = 0,
|
|
|
|
HAL_RALLY_ENABLED = 0,
|
|
|
|
HAL_SUPPORT_RCOUT_SERIAL = 0,
|
|
|
|
AP_TERRAIN_AVAILABLE = 0,
|
2024-02-29 04:35:49 -04:00
|
|
|
AP_CUSTOMROTATIONS_ENABLED = 0,
|
2024-01-11 22:50:43 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
try:
|
|
|
|
env.CXXFLAGS.remove('-DHAL_NAVEKF2_AVAILABLE=1')
|
|
|
|
except ValueError:
|
|
|
|
pass
|
|
|
|
env.CXXFLAGS += ['-DHAL_NAVEKF2_AVAILABLE=0']
|
|
|
|
|
|
|
|
class sitl_periph_universal(sitl_periph):
|
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(sitl_periph_universal, self).configure_env(cfg, env)
|
|
|
|
env.DEFINES.update(
|
|
|
|
CAN_APP_NODE_NAME = '"org.ardupilot.ap_periph_universal"',
|
|
|
|
APJ_BOARD_ID = 100,
|
|
|
|
|
2020-09-12 16:01:07 -03:00
|
|
|
HAL_PERIPH_ENABLE_GPS = 1,
|
2023-08-17 17:19:37 -03:00
|
|
|
HAL_PERIPH_ENABLE_AIRSPEED = 1,
|
|
|
|
HAL_PERIPH_ENABLE_MAG = 1,
|
|
|
|
HAL_PERIPH_ENABLE_BARO = 1,
|
|
|
|
HAL_PERIPH_ENABLE_RANGEFINDER = 1,
|
|
|
|
HAL_PERIPH_ENABLE_BATTERY = 1,
|
|
|
|
HAL_PERIPH_ENABLE_EFI = 1,
|
|
|
|
HAL_PERIPH_ENABLE_RPM = 1,
|
2023-08-19 03:10:55 -03:00
|
|
|
HAL_PERIPH_ENABLE_RC_OUT = 1,
|
2023-09-29 01:12:12 -03:00
|
|
|
HAL_PERIPH_ENABLE_ADSB = 1,
|
2023-12-19 16:41:09 -04:00
|
|
|
HAL_PERIPH_ENABLE_SERIAL_OPTIONS = 1,
|
2023-08-17 17:19:37 -03:00
|
|
|
AP_AIRSPEED_ENABLED = 1,
|
2023-08-19 19:51:04 -03:00
|
|
|
AP_BATTERY_ESC_ENABLED = 1,
|
2023-08-19 03:10:55 -03:00
|
|
|
HAL_PWM_COUNT = 32,
|
2023-08-19 19:51:04 -03:00
|
|
|
HAL_WITH_ESC_TELEM = 1,
|
2024-01-11 22:50:43 -04:00
|
|
|
AP_TERRAIN_AVAILABLE = 1,
|
2020-09-12 16:01:07 -03:00
|
|
|
)
|
2018-09-01 21:05:59 -03:00
|
|
|
|
2024-01-11 22:50:43 -04:00
|
|
|
class sitl_periph_gps(sitl_periph):
|
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
cfg.env.AP_PERIPH = 1
|
|
|
|
super(sitl_periph_gps, self).configure_env(cfg, env)
|
|
|
|
env.DEFINES.update(
|
|
|
|
HAL_BUILD_AP_PERIPH = 1,
|
|
|
|
PERIPH_FW = 1,
|
|
|
|
CAN_APP_NODE_NAME = '"org.ardupilot.ap_periph_gps"',
|
|
|
|
APJ_BOARD_ID = 101,
|
|
|
|
|
|
|
|
HAL_PERIPH_ENABLE_GPS = 1,
|
|
|
|
)
|
2021-10-27 05:06:42 -03:00
|
|
|
|
|
|
|
class esp32(Board):
|
|
|
|
abstract = True
|
|
|
|
toolchain = 'xtensa-esp32-elf'
|
|
|
|
def configure_env(self, cfg, env):
|
2023-12-23 22:53:38 -04:00
|
|
|
env.BOARD_CLASS = "ESP32"
|
|
|
|
|
2021-10-27 05:06:42 -03:00
|
|
|
def expand_path(p):
|
|
|
|
print("USING EXPRESSIF IDF:"+str(env.idf))
|
|
|
|
return cfg.root.find_dir(env.IDF+p).abspath()
|
|
|
|
try:
|
|
|
|
env.IDF = os.environ['IDF_PATH']
|
|
|
|
except:
|
|
|
|
env.IDF = cfg.srcnode.abspath()+"/modules/esp_idf"
|
|
|
|
|
|
|
|
super(esp32, self).configure_env(cfg, env)
|
|
|
|
cfg.load('esp32')
|
|
|
|
env.DEFINES.update(
|
2021-10-26 02:31:22 -03:00
|
|
|
CONFIG_HAL_BOARD = 'HAL_BOARD_ESP32',
|
2021-10-27 05:06:42 -03:00
|
|
|
)
|
|
|
|
|
|
|
|
tt = self.name[5:] #leave off 'esp32' so we just get 'buzz','diy','icarus, etc
|
|
|
|
|
|
|
|
# this makes sure we get the correct subtype
|
|
|
|
env.DEFINES.update(
|
|
|
|
ENABLE_HEAP = 0,
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_ESP32_%s' % tt.upper() ,
|
2023-05-01 20:31:10 -03:00
|
|
|
HAL_HAVE_HARDWARE_DOUBLE = '1',
|
2021-10-27 05:06:42 -03:00
|
|
|
)
|
|
|
|
|
2024-01-06 21:59:50 -04:00
|
|
|
if self.name.endswith("empty"):
|
|
|
|
# for empty targets build as SIM-on-HW
|
|
|
|
env.DEFINES.update(AP_SIM_ENABLED = 1)
|
|
|
|
env.AP_LIBRARIES += [
|
|
|
|
'SITL',
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
env.DEFINES.update(AP_SIM_ENABLED = 0)
|
|
|
|
|
2021-10-27 05:06:42 -03:00
|
|
|
env.AP_LIBRARIES += [
|
|
|
|
'AP_HAL_ESP32',
|
|
|
|
]
|
|
|
|
|
|
|
|
env.CFLAGS += [
|
|
|
|
'-fno-inline-functions',
|
|
|
|
'-mlongcalls',
|
2023-05-01 20:53:22 -03:00
|
|
|
'-fsingle-precision-constant',
|
2021-10-27 05:06:42 -03:00
|
|
|
]
|
|
|
|
env.CFLAGS.remove('-Werror=undef')
|
|
|
|
|
|
|
|
env.CXXFLAGS += ['-mlongcalls',
|
|
|
|
'-Os',
|
|
|
|
'-g',
|
|
|
|
'-ffunction-sections',
|
|
|
|
'-fdata-sections',
|
|
|
|
'-fno-exceptions',
|
|
|
|
'-fno-rtti',
|
|
|
|
'-nostdlib',
|
|
|
|
'-fstrict-volatile-bitfields',
|
|
|
|
'-Wno-sign-compare',
|
|
|
|
'-fno-inline-functions',
|
|
|
|
'-mlongcalls',
|
2023-05-01 20:53:22 -03:00
|
|
|
'-fsingle-precision-constant', # force const vals to be float , not double. so 100.0 means 100.0f
|
2023-05-01 20:53:22 -03:00
|
|
|
'-fno-threadsafe-statics',
|
2021-10-27 05:06:42 -03:00
|
|
|
'-DCYGWIN_BUILD']
|
|
|
|
env.CXXFLAGS.remove('-Werror=undef')
|
|
|
|
env.CXXFLAGS.remove('-Werror=shadow')
|
|
|
|
|
|
|
|
|
|
|
|
env.INCLUDES += [
|
|
|
|
cfg.srcnode.find_dir('libraries/AP_HAL_ESP32/boards').abspath(),
|
|
|
|
]
|
|
|
|
env.AP_PROGRAM_AS_STLIB = True
|
|
|
|
#if cfg.options.enable_profile:
|
|
|
|
# env.CXXFLAGS += ['-pg',
|
|
|
|
# '-DENABLE_PROFILE=1']
|
|
|
|
def pre_build(self, bld):
|
|
|
|
'''pre-build hook that gets called before dynamic sources'''
|
|
|
|
from waflib.Context import load_tool
|
|
|
|
module = load_tool('esp32', [], with_sys_path=True)
|
|
|
|
fun = getattr(module, 'pre_build', None)
|
|
|
|
if fun:
|
|
|
|
fun(bld)
|
|
|
|
super(esp32, self).pre_build(bld)
|
|
|
|
|
|
|
|
|
|
|
|
def build(self, bld):
|
|
|
|
super(esp32, self).build(bld)
|
|
|
|
bld.load('esp32')
|
|
|
|
|
2022-11-27 19:24:50 -04:00
|
|
|
def get_name(self):
|
|
|
|
return self.__class__.__name__
|
|
|
|
|
2023-05-15 13:47:38 -03:00
|
|
|
class esp32s3(esp32):
|
|
|
|
abstract = True
|
|
|
|
toolchain = 'xtensa-esp32s3-elf'
|
2021-10-27 05:06:42 -03:00
|
|
|
|
2018-01-05 02:53:19 -04:00
|
|
|
class chibios(Board):
|
2018-09-01 21:05:59 -03:00
|
|
|
abstract = True
|
2018-01-05 02:53:19 -04:00
|
|
|
toolchain = 'arm-none-eabi'
|
|
|
|
|
|
|
|
def configure_env(self, cfg, env):
|
2021-12-06 00:52:46 -04:00
|
|
|
if hasattr(self, 'hwdef'):
|
|
|
|
cfg.env.HWDEF = self.hwdef
|
2018-01-05 02:53:19 -04:00
|
|
|
super(chibios, self).configure_env(cfg, env)
|
|
|
|
|
2018-05-03 05:01:09 -03:00
|
|
|
cfg.load('chibios')
|
2018-01-12 21:29:11 -04:00
|
|
|
env.BOARD = self.name
|
2023-12-23 22:53:38 -04:00
|
|
|
env.BOARD_CLASS = "ChibiOS"
|
2018-01-12 21:29:11 -04:00
|
|
|
|
2018-01-05 02:53:19 -04:00
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD = 'HAL_BOARD_CHIBIOS',
|
|
|
|
HAVE_STD_NULLPTR_T = 0,
|
2020-03-17 06:06:28 -03:00
|
|
|
USE_LIBC_REALLOC = 0,
|
2018-01-05 02:53:19 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
env.AP_LIBRARIES += [
|
|
|
|
'AP_HAL_ChibiOS',
|
|
|
|
]
|
|
|
|
|
2018-02-05 18:47:23 -04:00
|
|
|
# make board name available for USB IDs
|
|
|
|
env.CHIBIOS_BOARD_NAME = 'HAL_BOARD_NAME="%s"' % self.name
|
2021-10-23 03:19:52 -03:00
|
|
|
env.HAL_MAX_STACK_FRAME_SIZE = 'HAL_MAX_STACK_FRAME_SIZE=%d' % 1300 # set per Wframe-larger-than, ensure its same
|
2018-10-03 22:26:11 -03:00
|
|
|
env.CFLAGS += cfg.env.CPU_FLAGS + [
|
2018-01-05 02:53:19 -04:00
|
|
|
'-Wlogical-op',
|
|
|
|
'-Wframe-larger-than=1300',
|
|
|
|
'-Wno-attributes',
|
|
|
|
'-fno-exceptions',
|
|
|
|
'-Wall',
|
|
|
|
'-Wextra',
|
|
|
|
'-Wno-sign-compare',
|
|
|
|
'-Wfloat-equal',
|
|
|
|
'-Wpointer-arith',
|
|
|
|
'-Wmissing-declarations',
|
|
|
|
'-Wno-unused-parameter',
|
|
|
|
'-Werror=array-bounds',
|
|
|
|
'-Wfatal-errors',
|
|
|
|
'-Werror=uninitialized',
|
|
|
|
'-Werror=init-self',
|
|
|
|
'-Werror=unused-but-set-variable',
|
|
|
|
'-Wno-missing-field-initializers',
|
2018-01-08 01:07:50 -04:00
|
|
|
'-Wno-trigraphs',
|
2018-01-05 02:53:19 -04:00
|
|
|
'-fno-strict-aliasing',
|
|
|
|
'-fomit-frame-pointer',
|
|
|
|
'-falign-functions=16',
|
|
|
|
'-ffunction-sections',
|
|
|
|
'-fdata-sections',
|
|
|
|
'-fno-strength-reduce',
|
|
|
|
'-fno-builtin-printf',
|
|
|
|
'-fno-builtin-fprintf',
|
|
|
|
'-fno-builtin-vprintf',
|
|
|
|
'-fno-builtin-vfprintf',
|
|
|
|
'-fno-builtin-puts',
|
|
|
|
'-mno-thumb-interwork',
|
|
|
|
'-mthumb',
|
2018-05-03 05:01:09 -03:00
|
|
|
'--specs=nano.specs',
|
2021-01-14 16:36:56 -04:00
|
|
|
'--specs=nosys.specs',
|
2019-07-20 11:41:39 -03:00
|
|
|
'-D__USE_CMSIS',
|
2021-03-25 01:00:37 -03:00
|
|
|
'-Werror=deprecated-declarations',
|
|
|
|
'-DNDEBUG=1'
|
2018-10-03 22:26:11 -03:00
|
|
|
]
|
2020-04-23 23:26:54 -03:00
|
|
|
if not cfg.options.Werror:
|
|
|
|
env.CFLAGS += [
|
|
|
|
'-Wno-error=double-promotion',
|
|
|
|
'-Wno-error=missing-declarations',
|
|
|
|
'-Wno-error=float-equal',
|
|
|
|
'-Wno-error=cpp',
|
|
|
|
]
|
|
|
|
|
2018-10-03 22:26:11 -03:00
|
|
|
env.CXXFLAGS += env.CFLAGS + [
|
|
|
|
'-fno-rtti',
|
|
|
|
'-fno-threadsafe-statics',
|
2018-01-05 02:53:19 -04:00
|
|
|
]
|
2019-05-26 22:47:07 -03:00
|
|
|
env.CFLAGS += [
|
|
|
|
'-std=c11'
|
|
|
|
]
|
2018-01-05 02:53:19 -04:00
|
|
|
|
2018-09-02 14:04:13 -03:00
|
|
|
if Utils.unversioned_sys_platform() == 'cygwin':
|
2018-03-02 00:28:47 -04:00
|
|
|
env.CXXFLAGS += ['-DCYGWIN_BUILD']
|
|
|
|
|
2018-01-12 21:29:11 -04:00
|
|
|
bldnode = cfg.bldnode.make_node(self.name)
|
|
|
|
env.BUILDROOT = bldnode.make_node('').abspath()
|
2023-04-13 17:21:46 -03:00
|
|
|
|
2018-08-29 10:01:59 -03:00
|
|
|
env.LINKFLAGS = cfg.env.CPU_FLAGS + [
|
2018-01-05 02:53:19 -04:00
|
|
|
'-fomit-frame-pointer',
|
|
|
|
'-falign-functions=16',
|
|
|
|
'-ffunction-sections',
|
|
|
|
'-fdata-sections',
|
|
|
|
'-u_port_lock',
|
|
|
|
'-u_port_unlock',
|
|
|
|
'-u_exit',
|
|
|
|
'-u_kill',
|
|
|
|
'-u_getpid',
|
|
|
|
'-u_errno',
|
|
|
|
'-uchThdExit',
|
|
|
|
'-fno-common',
|
|
|
|
'-nostartfiles',
|
|
|
|
'-mno-thumb-interwork',
|
|
|
|
'-mthumb',
|
2021-01-14 16:36:56 -04:00
|
|
|
'--specs=nano.specs',
|
|
|
|
'--specs=nosys.specs',
|
2018-03-02 01:27:40 -04:00
|
|
|
'-L%s' % env.BUILDROOT,
|
2018-01-12 21:29:11 -04:00
|
|
|
'-L%s' % cfg.srcnode.make_node('modules/ChibiOS/os/common/startup/ARMCMx/compilers/GCC/ld/').abspath(),
|
|
|
|
'-L%s' % cfg.srcnode.make_node('libraries/AP_HAL_ChibiOS/hwdef/common/').abspath(),
|
2023-04-13 17:21:46 -03:00
|
|
|
'-Wl,-Map,Linker.map,%s--cref,--gc-sections,--no-warn-mismatch,--library-path=/ld,--script=ldscript.ld,--defsym=__process_stack_size__=%s,--defsym=__main_stack_size__=%s' % ("--print-memory-usage," if cfg.env.EXT_FLASH_SIZE_MB > 0 and cfg.env.INT_FLASH_PRIMARY == 0 else "", cfg.env.PROCESS_STACK, cfg.env.MAIN_STACK)
|
2018-01-05 02:53:19 -04:00
|
|
|
]
|
|
|
|
|
2018-05-03 22:23:05 -03:00
|
|
|
if cfg.env.DEBUG:
|
|
|
|
env.CFLAGS += [
|
2018-05-03 05:01:09 -03:00
|
|
|
'-gdwarf-4',
|
|
|
|
'-g3',
|
2018-05-03 22:23:05 -03:00
|
|
|
]
|
|
|
|
env.LINKFLAGS += [
|
2018-05-03 05:01:09 -03:00
|
|
|
'-gdwarf-4',
|
|
|
|
'-g3',
|
2018-05-03 22:23:05 -03:00
|
|
|
]
|
|
|
|
|
2023-04-22 08:05:23 -03:00
|
|
|
if cfg.env.COMPILER_CXX == "g++":
|
|
|
|
if not self.cc_version_gte(cfg, 10, 2):
|
|
|
|
# require at least 10.2 compiler
|
|
|
|
cfg.fatal("ChibiOS build requires g++ version 10.2.1 or later, found %s" % '.'.join(cfg.env.CC_VERSION))
|
|
|
|
|
2018-08-02 02:22:30 -03:00
|
|
|
if cfg.env.ENABLE_ASSERTS:
|
|
|
|
cfg.msg("Enabling ChibiOS asserts", "yes")
|
|
|
|
env.CFLAGS += [ '-DHAL_CHIBIOS_ENABLE_ASSERTS' ]
|
|
|
|
env.CXXFLAGS += [ '-DHAL_CHIBIOS_ENABLE_ASSERTS' ]
|
|
|
|
else:
|
|
|
|
cfg.msg("Enabling ChibiOS asserts", "no")
|
2018-09-01 21:05:59 -03:00
|
|
|
|
2021-06-19 13:20:19 -03:00
|
|
|
|
2022-02-21 23:22:19 -04:00
|
|
|
if cfg.env.SAVE_TEMPS:
|
|
|
|
env.CXXFLAGS += [ '-S', '-save-temps=obj' ]
|
|
|
|
|
2023-07-08 00:06:29 -03:00
|
|
|
if cfg.options.disable_watchdog:
|
2021-06-19 13:20:19 -03:00
|
|
|
cfg.msg("Disabling Watchdog", "yes")
|
|
|
|
env.CFLAGS += [ '-DDISABLE_WATCHDOG' ]
|
|
|
|
env.CXXFLAGS += [ '-DDISABLE_WATCHDOG' ]
|
|
|
|
else:
|
|
|
|
cfg.msg("Disabling Watchdog", "no")
|
|
|
|
|
2020-11-13 01:09:37 -04:00
|
|
|
if cfg.env.ENABLE_MALLOC_GUARD:
|
|
|
|
cfg.msg("Enabling malloc guard", "yes")
|
|
|
|
env.CFLAGS += [ '-DHAL_CHIBIOS_ENABLE_MALLOC_GUARD' ]
|
|
|
|
env.CXXFLAGS += [ '-DHAL_CHIBIOS_ENABLE_MALLOC_GUARD' ]
|
|
|
|
else:
|
|
|
|
cfg.msg("Enabling malloc guard", "no")
|
|
|
|
|
2021-04-15 14:42:13 -03:00
|
|
|
if cfg.env.ENABLE_STATS:
|
|
|
|
cfg.msg("Enabling ChibiOS thread statistics", "yes")
|
|
|
|
env.CFLAGS += [ '-DHAL_ENABLE_THREAD_STATISTICS' ]
|
|
|
|
env.CXXFLAGS += [ '-DHAL_ENABLE_THREAD_STATISTICS' ]
|
|
|
|
else:
|
|
|
|
cfg.msg("Enabling ChibiOS thread statistics", "no")
|
|
|
|
|
2021-10-26 02:31:22 -03:00
|
|
|
if cfg.env.SIM_ENABLED:
|
|
|
|
env.DEFINES.update(
|
|
|
|
AP_SIM_ENABLED = 1,
|
|
|
|
)
|
|
|
|
env.AP_LIBRARIES += [
|
|
|
|
'SITL',
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
env.DEFINES.update(
|
|
|
|
AP_SIM_ENABLED = 0,
|
|
|
|
)
|
|
|
|
|
2018-01-05 02:53:19 -04:00
|
|
|
env.LIB += ['gcc', 'm']
|
2018-02-01 15:12:38 -04:00
|
|
|
|
2018-01-05 02:53:19 -04:00
|
|
|
env.GIT_SUBMODULES += [
|
|
|
|
'ChibiOS',
|
|
|
|
]
|
2018-07-01 21:30:46 -03:00
|
|
|
|
2019-07-20 11:41:39 -03:00
|
|
|
env.INCLUDES += [
|
2023-11-26 18:30:29 -04:00
|
|
|
cfg.srcnode.find_dir('libraries/AP_GyroFFT/CMSIS_5/include').abspath(),
|
2023-12-24 23:40:22 -04:00
|
|
|
cfg.srcnode.find_dir('modules/lwip/src/include/compat/posix').abspath()
|
2019-07-20 11:41:39 -03:00
|
|
|
]
|
|
|
|
|
2020-09-13 23:05:48 -03:00
|
|
|
# whitelist of compilers which we should build with -Werror
|
2023-05-23 13:27:44 -03:00
|
|
|
gcc_whitelist = frozenset([
|
2020-09-13 23:05:48 -03:00
|
|
|
('4','9','3'),
|
|
|
|
('6','3','1'),
|
2020-09-20 20:46:47 -03:00
|
|
|
('9','2','1'),
|
|
|
|
('9','3','1'),
|
2021-07-26 01:38:35 -03:00
|
|
|
('10','2','1'),
|
2023-05-23 13:27:44 -03:00
|
|
|
('11','3','0'),
|
2023-11-25 23:26:49 -04:00
|
|
|
('11','4','0'),
|
2023-05-23 13:27:44 -03:00
|
|
|
])
|
2020-09-13 23:05:48 -03:00
|
|
|
|
2023-01-05 09:07:00 -04:00
|
|
|
if cfg.env.HAL_CANFD_SUPPORTED:
|
|
|
|
env.DEFINES.update(CANARD_ENABLE_CANFD=1)
|
|
|
|
else:
|
|
|
|
env.DEFINES.update(CANARD_ENABLE_TAO_OPTION=1)
|
|
|
|
if not cfg.options.bootloader and cfg.env.HAL_NUM_CAN_IFACES:
|
|
|
|
if int(cfg.env.HAL_NUM_CAN_IFACES) >= 1:
|
|
|
|
env.DEFINES.update(CANARD_IFACE_ALL=(1<<int(cfg.env.HAL_NUM_CAN_IFACES))-1)
|
2020-09-13 23:05:48 -03:00
|
|
|
if cfg.options.Werror or cfg.env.CC_VERSION in gcc_whitelist:
|
|
|
|
cfg.msg("Enabling -Werror", "yes")
|
|
|
|
if '-Werror' not in env.CXXFLAGS:
|
|
|
|
env.CXXFLAGS += [ '-Werror' ]
|
|
|
|
else:
|
|
|
|
cfg.msg("Enabling -Werror", "no")
|
|
|
|
|
2022-08-11 01:33:46 -03:00
|
|
|
if cfg.options.signed_fw:
|
|
|
|
cfg.define('AP_SIGNED_FIRMWARE', 1)
|
|
|
|
env.CFLAGS += [
|
|
|
|
'-DAP_SIGNED_FIRMWARE=1',
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
cfg.define('AP_SIGNED_FIRMWARE', 0)
|
|
|
|
env.CFLAGS += [
|
|
|
|
'-DAP_SIGNED_FIRMWARE=0',
|
|
|
|
]
|
|
|
|
|
2018-07-01 21:30:46 -03:00
|
|
|
try:
|
|
|
|
import intelhex
|
|
|
|
env.HAVE_INTEL_HEX = True
|
|
|
|
cfg.msg("Checking for intelhex module:", 'OK')
|
|
|
|
except Exception:
|
|
|
|
cfg.msg("Checking for intelhex module:", 'disabled', color='YELLOW')
|
|
|
|
env.HAVE_INTEL_HEX = False
|
2018-01-05 02:53:19 -04:00
|
|
|
|
|
|
|
def build(self, bld):
|
|
|
|
super(chibios, self).build(bld)
|
2018-06-12 00:33:42 -03:00
|
|
|
bld.ap_version_append_str('CHIBIOS_GIT_VERSION', bld.git_submodule_head_hash('ChibiOS', short=True))
|
2018-01-05 02:53:19 -04:00
|
|
|
bld.load('chibios')
|
|
|
|
|
2018-03-01 03:26:49 -04:00
|
|
|
def pre_build(self, bld):
|
|
|
|
'''pre-build hook that gets called before dynamic sources'''
|
|
|
|
from waflib.Context import load_tool
|
|
|
|
module = load_tool('chibios', [], with_sys_path=True)
|
|
|
|
fun = getattr(module, 'pre_build', None)
|
|
|
|
if fun:
|
|
|
|
fun(bld)
|
2020-03-12 20:25:10 -03:00
|
|
|
super(chibios, self).pre_build(bld)
|
2018-03-01 03:26:49 -04:00
|
|
|
|
2021-09-17 12:22:16 -03:00
|
|
|
def get_name(self):
|
|
|
|
return self.name
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
class linux(Board):
|
2023-01-07 23:46:36 -04:00
|
|
|
def __init__(self):
|
|
|
|
if self.toolchain == 'native':
|
|
|
|
self.with_can = True
|
|
|
|
else:
|
|
|
|
self.with_can = False
|
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
2023-04-07 03:38:18 -03:00
|
|
|
if cfg.options.board == 'linux':
|
2023-01-07 23:46:36 -04:00
|
|
|
self.with_can = True
|
2016-02-22 14:26:02 -04:00
|
|
|
super(linux, self).configure_env(cfg, env)
|
2016-02-15 17:26:14 -04:00
|
|
|
|
2023-12-23 22:53:38 -04:00
|
|
|
env.BOARD_CLASS = "LINUX"
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD = 'HAL_BOARD_LINUX',
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_NONE',
|
2021-10-26 02:31:22 -03:00
|
|
|
AP_SIM_ENABLED = 0,
|
2016-02-15 17:26:14 -04:00
|
|
|
)
|
2016-05-06 18:44:12 -03:00
|
|
|
|
|
|
|
if not cfg.env.DEBUG:
|
|
|
|
env.CXXFLAGS += [
|
|
|
|
'-O3',
|
|
|
|
]
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
env.LIB += [
|
|
|
|
'm',
|
|
|
|
]
|
2016-05-21 12:11:48 -03:00
|
|
|
|
|
|
|
cfg.check_librt(env)
|
2016-05-21 12:16:11 -03:00
|
|
|
cfg.check_lttng(env)
|
2016-07-12 23:33:10 -03:00
|
|
|
cfg.check_libdl(env)
|
2016-05-21 12:17:56 -03:00
|
|
|
cfg.check_libiio(env)
|
2016-05-19 17:25:49 -03:00
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
env.LINKFLAGS += ['-pthread',]
|
2017-06-05 08:29:18 -03:00
|
|
|
env.AP_LIBRARIES += [
|
2016-02-15 17:26:14 -04:00
|
|
|
'AP_HAL_Linux',
|
|
|
|
]
|
|
|
|
|
2023-01-07 23:46:36 -04:00
|
|
|
if cfg.options.force_32bit:
|
|
|
|
env.DEFINES.update(
|
|
|
|
HAL_FORCE_32BIT = 1,
|
|
|
|
)
|
|
|
|
# 32bit platform flags
|
|
|
|
cfg.env.CXXFLAGS += [
|
|
|
|
'-m32',
|
|
|
|
]
|
|
|
|
cfg.env.CFLAGS += [
|
|
|
|
'-m32',
|
|
|
|
]
|
|
|
|
cfg.env.LDFLAGS += [
|
|
|
|
'-m32',
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
env.DEFINES.update(
|
|
|
|
HAL_FORCE_32BIT = 0,
|
|
|
|
)
|
2023-04-07 03:38:18 -03:00
|
|
|
if self.with_can and cfg.options.board == 'linux':
|
2023-01-07 23:46:36 -04:00
|
|
|
cfg.env.HAL_NUM_CAN_IFACES = 2
|
|
|
|
cfg.define('HAL_NUM_CAN_IFACES', 2)
|
|
|
|
cfg.define('HAL_CANFD_SUPPORTED', 1)
|
|
|
|
cfg.define('CANARD_ENABLE_CANFD', 1)
|
|
|
|
|
|
|
|
if self.with_can:
|
|
|
|
env.DEFINES.update(CANARD_MULTI_IFACE=1,
|
|
|
|
CANARD_IFACE_ALL = 0x3)
|
2018-03-28 02:25:42 -03:00
|
|
|
|
|
|
|
if cfg.options.apstatedir:
|
|
|
|
cfg.define('AP_STATEDIR', cfg.options.apstatedir)
|
|
|
|
|
2022-01-24 22:00:06 -04:00
|
|
|
defaults_file = 'libraries/AP_HAL_Linux/boards/%s/defaults.parm' % self.get_name()
|
|
|
|
if os.path.exists(defaults_file):
|
|
|
|
env.ROMFS_FILES += [('defaults.parm', defaults_file)]
|
|
|
|
env.DEFINES.update(
|
|
|
|
HAL_PARAM_DEFAULTS_PATH='"@ROMFS/defaults.parm"',
|
|
|
|
)
|
|
|
|
if len(env.ROMFS_FILES) > 0:
|
2024-02-24 08:35:21 -04:00
|
|
|
# Allow lua to load from ROMFS if any lua files are added
|
|
|
|
for file in env.ROMFS_FILES:
|
|
|
|
if file[0].startswith("scripts") and file[0].endswith(".lua"):
|
|
|
|
env.CXXFLAGS += ['-DHAL_HAVE_AP_ROMFS_EMBEDDED_LUA']
|
|
|
|
break
|
2022-01-24 22:00:06 -04:00
|
|
|
env.CXXFLAGS += ['-DHAL_HAVE_AP_ROMFS_EMBEDDED_H']
|
|
|
|
|
2017-06-05 11:00:27 -03:00
|
|
|
def build(self, bld):
|
|
|
|
super(linux, self).build(bld)
|
|
|
|
if bld.options.upload:
|
|
|
|
waflib.Options.commands.append('rsync')
|
|
|
|
# Avoid infinite recursion
|
|
|
|
bld.options.upload = False
|
2016-06-25 12:40:08 -03:00
|
|
|
|
2021-09-17 12:22:16 -03:00
|
|
|
def get_name(self):
|
|
|
|
# get name of class
|
|
|
|
return self.__class__.__name__
|
|
|
|
|
|
|
|
|
2020-01-10 15:03:47 -04:00
|
|
|
class navigator(linux):
|
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(navigator, self).configure_env(cfg, env)
|
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE='HAL_BOARD_SUBTYPE_LINUX_NAVIGATOR',
|
|
|
|
)
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
class erleboard(linux):
|
2016-03-15 14:55:30 -03:00
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(erleboard, self).configure_env(cfg, env)
|
2016-02-15 17:26:14 -04:00
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_ERLEBOARD',
|
|
|
|
)
|
|
|
|
|
|
|
|
class navio(linux):
|
2016-03-15 14:55:30 -03:00
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(navio, self).configure_env(cfg, env)
|
2016-02-15 17:26:14 -04:00
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_NAVIO',
|
|
|
|
)
|
|
|
|
|
2016-02-25 08:43:01 -04:00
|
|
|
class navio2(linux):
|
2016-03-15 14:55:30 -03:00
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(navio2, self).configure_env(cfg, env)
|
2016-02-25 08:43:01 -04:00
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_NAVIO2',
|
|
|
|
)
|
|
|
|
|
2016-06-28 10:43:47 -03:00
|
|
|
class edge(linux):
|
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
2017-07-28 07:56:11 -03:00
|
|
|
def __init__(self):
|
2020-05-31 08:50:44 -03:00
|
|
|
self.with_can = True
|
2017-07-28 07:56:11 -03:00
|
|
|
|
2016-06-28 10:43:47 -03:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(edge, self).configure_env(cfg, env)
|
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_EDGE',
|
|
|
|
)
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
class zynq(linux):
|
2016-03-15 14:55:30 -03:00
|
|
|
toolchain = 'arm-xilinx-linux-gnueabi'
|
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(zynq, self).configure_env(cfg, env)
|
2016-02-15 17:26:14 -04:00
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_ZYNQ',
|
|
|
|
)
|
|
|
|
|
2017-08-17 19:40:16 -03:00
|
|
|
class ocpoc_zynq(linux):
|
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(ocpoc_zynq, self).configure_env(cfg, env)
|
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ',
|
|
|
|
)
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
class bbbmini(linux):
|
2016-03-15 14:55:30 -03:00
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
2019-01-20 04:21:23 -04:00
|
|
|
def __init__(self):
|
2020-05-31 08:50:44 -03:00
|
|
|
self.with_can = True
|
2019-01-20 04:21:23 -04:00
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(bbbmini, self).configure_env(cfg, env)
|
2023-01-07 23:46:36 -04:00
|
|
|
cfg.env.HAL_NUM_CAN_IFACES = 1
|
2016-02-15 17:26:14 -04:00
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_BBBMINI',
|
|
|
|
)
|
|
|
|
|
2016-12-29 10:29:02 -04:00
|
|
|
class blue(linux):
|
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
2019-01-20 04:21:23 -04:00
|
|
|
def __init__(self):
|
2020-05-31 08:50:44 -03:00
|
|
|
self.with_can = True
|
2019-01-20 04:21:23 -04:00
|
|
|
|
2016-12-29 10:29:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(blue, self).configure_env(cfg, env)
|
2023-01-07 23:46:36 -04:00
|
|
|
cfg.env.HAL_NUM_CAN_IFACES = 1
|
2016-12-29 10:29:02 -04:00
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_BLUE',
|
|
|
|
)
|
|
|
|
|
2017-12-13 15:34:09 -04:00
|
|
|
class pocket(linux):
|
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
2019-01-20 04:21:23 -04:00
|
|
|
def __init__(self):
|
2020-05-31 08:50:44 -03:00
|
|
|
self.with_can = True
|
2019-01-20 04:21:23 -04:00
|
|
|
|
2017-12-13 15:34:09 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(pocket, self).configure_env(cfg, env)
|
2023-01-07 23:46:36 -04:00
|
|
|
cfg.env.HAL_NUM_CAN_IFACES = 1
|
2017-12-13 15:34:09 -04:00
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_POCKET',
|
|
|
|
)
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
class pxf(linux):
|
2016-03-15 14:55:30 -03:00
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(pxf, self).configure_env(cfg, env)
|
2016-02-15 17:26:14 -04:00
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_PXF',
|
|
|
|
)
|
|
|
|
|
|
|
|
class bebop(linux):
|
2016-03-15 14:55:30 -03:00
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(bebop, self).configure_env(cfg, env)
|
2016-02-15 17:26:14 -04:00
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_BEBOP',
|
|
|
|
)
|
|
|
|
|
2021-01-13 17:08:05 -04:00
|
|
|
class vnav(linux):
|
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(vnav, self).configure_env(cfg, env)
|
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_VNAV',
|
|
|
|
)
|
|
|
|
|
2016-06-06 19:13:56 -03:00
|
|
|
class disco(linux):
|
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(disco, self).configure_env(cfg, env)
|
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_DISCO',
|
|
|
|
)
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
class erlebrain2(linux):
|
2016-03-15 14:55:30 -03:00
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(erlebrain2, self).configure_env(cfg, env)
|
2016-02-15 17:26:14 -04:00
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_ERLEBRAIN2',
|
|
|
|
)
|
|
|
|
|
|
|
|
class bhat(linux):
|
2016-03-15 14:55:30 -03:00
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(bhat, self).configure_env(cfg, env)
|
2016-02-15 17:26:14 -04:00
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_BH',
|
|
|
|
)
|
|
|
|
|
2016-10-17 16:06:23 -03:00
|
|
|
class dark(linux):
|
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(dark, self).configure_env(cfg, env)
|
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_DARK',
|
|
|
|
)
|
|
|
|
|
2016-02-15 17:26:14 -04:00
|
|
|
class pxfmini(linux):
|
2016-03-15 14:55:30 -03:00
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
2016-02-22 14:26:02 -04:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(pxfmini, self).configure_env(cfg, env)
|
2016-02-15 17:26:14 -04:00
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_PXFMINI',
|
|
|
|
)
|
2016-03-03 13:55:05 -04:00
|
|
|
|
2016-05-31 15:51:47 -03:00
|
|
|
class aero(linux):
|
2018-03-09 11:34:38 -04:00
|
|
|
def __init__(self):
|
2020-05-31 08:50:44 -03:00
|
|
|
self.with_can = True
|
2018-03-09 11:34:38 -04:00
|
|
|
|
2016-05-31 15:51:47 -03:00
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(aero, self).configure_env(cfg, env)
|
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_AERO',
|
|
|
|
)
|
|
|
|
|
2017-10-30 06:03:04 -03:00
|
|
|
class rst_zynq(linux):
|
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(rst_zynq, self).configure_env(cfg, env)
|
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_RST_ZYNQ',
|
|
|
|
)
|
2018-09-01 21:05:59 -03:00
|
|
|
|
2021-09-07 02:08:11 -03:00
|
|
|
class obal(linux):
|
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(obal, self).configure_env(cfg, env)
|
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_OBAL_V1',
|
|
|
|
)
|
|
|
|
|
2023-10-22 14:50:57 -03:00
|
|
|
class canzero(linux):
|
|
|
|
toolchain = 'arm-linux-gnueabihf'
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
self.with_can = True
|
|
|
|
|
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(canzero, self).configure_env(cfg, env)
|
|
|
|
|
|
|
|
env.DEFINES.update(
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_LINUX_CANZERO',
|
|
|
|
)
|
|
|
|
|
2019-03-14 05:40:19 -03:00
|
|
|
class SITL_static(sitl):
|
|
|
|
def configure_env(self, cfg, env):
|
|
|
|
super(SITL_static, self).configure_env(cfg, env)
|
|
|
|
cfg.env.STATIC_LINKING = True
|
|
|
|
|
|
|
|
class SITL_x86_64_linux_gnu(SITL_static):
|
|
|
|
toolchain = 'x86_64-linux-gnu'
|
|
|
|
|
|
|
|
class SITL_arm_linux_gnueabihf(SITL_static):
|
|
|
|
toolchain = 'arm-linux-gnueabihf'
|