diff --git a/Tools/autotest/test_build_options.py b/Tools/autotest/test_build_options.py index 305ec8e30403bd..7b3bec40bae6d3 100755 --- a/Tools/autotest/test_build_options.py +++ b/Tools/autotest/test_build_options.py @@ -24,6 +24,7 @@ import optparse import os import pathlib +import re import sys from pysim import util @@ -53,6 +54,7 @@ def __init__(self, board="CubeOrange", # DevEBoxH7v2 also works extra_hwdef=None, emit_disable_all_defines=None, + resume=False, ): self.extra_hwdef = extra_hwdef self.sizes_nothing_disabled = None @@ -67,6 +69,7 @@ def __init__(self, self.build_targets = self.all_targets() self._board = board self.emit_disable_all_defines = emit_disable_all_defines + self.resume = resume self.results = {} self.enable_in_turn_results = {} @@ -187,6 +190,9 @@ def test_disable_feature(self, feature, options): self.test_compile_with_defines(defines) + self.assert_feature_not_in_code(defines, feature) + + def assert_feature_not_in_code(self, defines, feature): # if the feature is truly disabled then extract_features.py # should say so: for target in self.build_targets: @@ -198,8 +204,7 @@ def test_disable_feature(self, feature, options): # or all vehicles: feature_define_whitelist = set([ 'AP_RANGEFINDER_ENABLED', # only at vehicle level ATM - 'BEACON_ENABLED', # Rover doesn't obey this (should also be AP_BEACON_ENABLED) - 'WINCH_ENABLED', # Copter doesn't use this; should use AP_WINCH_ENABLED + 'HAL_PERIPH_SUPPORT_LONG_CAN_PRINTF', # no symbol ]) if define in compiled_in_feature_defines: error = f"feature gated by {define} still compiled into ({target}); extract_features.py bug?" @@ -220,6 +225,177 @@ def test_enable_feature(self, feature, options): self.test_compile_with_defines(defines) + self.assert_feature_in_code(defines, feature) + + def define_is_whitelisted_for_feature_in_code(self, target, define): + '''returns true if we can not expect the define to be extracted from + the binary''' + # the following defines are known not to work on some + # or all vehicles: + feature_define_whitelist = set([ + 'AP_RANGEFINDER_ENABLED', # only at vehicle level ATM + 'HAL_PERIPH_SUPPORT_LONG_CAN_PRINTF', # no symbol + 'AP_DRONECAN_VOLZ_FEEDBACK_ENABLED', # broken, no subscriber + # Baro drivers either come in because you have + # external-probing enabled or you have them specified in + # your hwdef. If you're not probing and its not in your + # hwdef then the code will be elided as unreachable + 'AP_BARO_ICM20789_ENABLED', + 'AP_BARO_ICP101XX_ENABLED', + 'AP_BARO_ICP201XX_ENABLED', + 'AP_BARO_BMP085_ENABLED', + 'AP_BARO_BMP280_ENABLED', + 'AP_BARO_BMP388_ENABLED', + 'AP_BARO_BMP581_ENABLED', + 'AP_BARO_DPS280_ENABLED', + 'AP_BARO_FBM320_ENABLED', + 'AP_BARO_KELLERLD_ENABLED', + 'AP_BARO_LPS2XH_ENABLED', + 'AP_BARO_MS56XX_ENABLED', + 'AP_BARO_SPL06_ENABLED', + 'AP_CAMERA_SEND_FOV_STATUS_ENABLED', # elided unless AP_CAMERA_SEND_FOV_STATUS_ENABLED + 'AP_COMPASS_LSM9DS1_ENABLED', # must be in hwdef, not probed + 'AP_COMPASS_MAG3110_ENABLED', # must be in hwdef, not probed + 'AP_COMPASS_MMC5XX3_ENABLED', # must be in hwdef, not probed + 'AP_MAVLINK_AUTOPILOT_VERSION_REQUEST_ENABLED', # completely elided + 'AP_MAVLINK_MSG_HIL_GPS_ENABLED', # no symbol available + 'AP_MAVLINK_MSG_RELAY_STATUS_ENABLED', # no symbol available + 'AP_MAVLINK_MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES_ENABLED', # no symbol available + 'HAL_MSP_SENSORS_ENABLED', # no symbol available + 'AP_OSD_LINK_STATS_EXTENSIONS_ENABLED', # FIXME: need a new define/feature + 'HAL_OSD_SIDEBAR_ENABLE', # FIXME: need a new define/feature + 'HAL_PLUSCODE_ENABLE', # FIXME: need a new define/feature + 'AP_SERIALMANAGER_REGISTER_ENABLED', # completely elided without a caller + 'AP_OPTICALFLOW_ONBOARD_ENABLED', # only instantiated on Linux + 'HAL_WITH_FRSKY_TELEM_BIDIRECTIONAL', # entirely elided if no user + 'AP_PLANE_BLACKBOX_LOGGING', # entirely elided if no user + ]) + if target.lower() != "copter": + feature_define_whitelist.add('MODE_ZIGZAG_ENABLED') + feature_define_whitelist.add('MODE_SYSTEMID_ENABLED') + feature_define_whitelist.add('MODE_SPORT_ENABLED') + feature_define_whitelist.add('MODE_FOLLOW_ENABLED') + feature_define_whitelist.add('MODE_TURTLE_ENABLED') + feature_define_whitelist.add('MODE_GUIDED_NOGPS_ENABLED') + feature_define_whitelist.add('MODE_FLOWHOLD_ENABLED') + feature_define_whitelist.add('MODE_FLIP_ENABLED') + feature_define_whitelist.add('MODE_BRAKE_ENABLED') + feature_define_whitelist.add('AP_TEMPCALIBRATION_ENABLED') + feature_define_whitelist.add('AC_PAYLOAD_PLACE_ENABLED') + feature_define_whitelist.add('AP_AVOIDANCE_ENABLED') + feature_define_whitelist.add('AP_WINCH_ENABLED') + feature_define_whitelist.add('AP_WINCH_DAIWA_ENABLED') + feature_define_whitelist.add('AP_WINCH_PWM_ENABLED') + feature_define_whitelist.add(r'AP_MOTORS_FRAME_.*_ENABLED') + + if target.lower() != "plane": + # only on Plane: + feature_define_whitelist.add('AP_ICENGINE_ENABLED') + feature_define_whitelist.add('AP_PLANE_OFFBOARD_GUIDED_SLEW_ENABLED') + feature_define_whitelist.add('AP_MAVLINK_MAV_CMD_SET_HAGL_ENABLED') + feature_define_whitelist.add('AP_ADVANCEDFAILSAFE_ENABLED') + feature_define_whitelist.add('AP_TUNING_ENABLED') + feature_define_whitelist.add('HAL_LANDING_DEEPSTALL_ENABLED') + feature_define_whitelist.add('HAL_SOARING_ENABLED') + feature_define_whitelist.add('AP_PLANE_BLACKBOX_LOGGING') + feature_define_whitelist.add('QAUTOTUNE_ENABLED') + feature_define_whitelist.add('AP_PLANE_OFFBOARD_GUIDED_SLEW_ENABLED') + feature_define_whitelist.add('HAL_QUADPLANE_ENABLED') + feature_define_whitelist.add('AP_BATTERY_WATT_MAX_ENABLED') + + if target.lower() not in ["plane", "copter"]: + feature_define_whitelist.add('HAL_ADSB_ENABLED') + feature_define_whitelist.add('AP_LANDINGGEAR_ENABLED') + # only Plane and Copter instantiate Parachute + feature_define_whitelist.add('HAL_PARACHUTE_ENABLED') + # only Plane and Copter have AP_Motors: + + if target.lower() not in ["rover", "copter"]: + # only Plane and Copter instantiate Beacon + feature_define_whitelist.add('AP_BEACON_ENABLED') + + if target.lower() != "rover": + # only on Rover: + feature_define_whitelist.add('HAL_TORQEEDO_ENABLED') + feature_define_whitelist.add('AP_ROVER_ADVANCED_FAILSAFE_ENABLED') + if target.lower() != "sub": + # only on Sub: + feature_define_whitelist.add('AP_BARO_KELLERLD_ENABLED') + if target.lower() not in frozenset(["rover", "sub"]): + # only Rover and Sub get nmea airspeed + feature_define_whitelist.add('AP_AIRSPEED_NMEA_ENABLED') + if target.lower() not in frozenset(["copter", "rover"]): + feature_define_whitelist.add('HAL_SPRAYER_ENABLED') + feature_define_whitelist.add('HAL_PROXIMITY_ENABLED') + feature_define_whitelist.add('AP_PROXIMITY_.*_ENABLED') + feature_define_whitelist.add('AP_OAPATHPLANNER_ENABLED') + + if target.lower() in ["blimp", "antennatracker"]: + # no airspeed on blimp/tracker + feature_define_whitelist.add(r'AP_AIRSPEED_.*_ENABLED') + feature_define_whitelist.add(r'HAL_MOUNT_ENABLED') + feature_define_whitelist.add(r'AP_MOUNT_.*_ENABLED') + feature_define_whitelist.add(r'HAL_MOUNT_.*_ENABLED') + feature_define_whitelist.add(r'HAL_SOLO_GIMBAL_ENABLED') + feature_define_whitelist.add(r'AP_OPTICALFLOW_ENABLED') + feature_define_whitelist.add(r'AP_OPTICALFLOW_.*_ENABLED') + feature_define_whitelist.add(r'HAL_MSP_OPTICALFLOW_ENABLED') + # missing calls to fence.check(): + feature_define_whitelist.add(r'AP_FENCE_ENABLED') + # RPM not instantiated on Blimp or Rover: + feature_define_whitelist.add(r'AP_RPM_ENABLED') + feature_define_whitelist.add(r'AP_RPM_.*_ENABLED') + # rangefinder init is not called: + feature_define_whitelist.add(r'HAL_MSP_RANGEFINDER_ENABLED') + # these guys don't instantiate anything which uses sd-card storage: + feature_define_whitelist.add(r'AP_SDCARD_STORAGE_ENABLED') + feature_define_whitelist.add(r'AP_RANGEFINDER_ENABLED') + feature_define_whitelist.add(r'AP_RANGEFINDER_.*_ENABLED') + + if target.lower() in ["blimp", "antennatracker", "sub"]: + # no OSD on Sub/blimp/tracker + feature_define_whitelist.add(r'OSD_ENABLED') + feature_define_whitelist.add(r'OSD_PARAM_ENABLED') + # AP_OSD is not instantiated, , so no MSP backend: + feature_define_whitelist.add(r'HAL_WITH_MSP_DISPLAYPORT') + # camera instantiated in specific vehicles: + feature_define_whitelist.add(r'AP_CAMERA_ENABLED') + feature_define_whitelist.add(r'AP_CAMERA_.*_ENABLED') + # button update is not called in these vehicles + feature_define_whitelist.add(r'HAL_BUTTON_ENABLED') + # precland not instantiated on these vehicles + feature_define_whitelist.add(r'AC_PRECLAND_ENABLED') + feature_define_whitelist.add(r'AC_PRECLAND_.*_ENABLED') + # RSSI is not initialised - probably should be for some + feature_define_whitelist.add(r'AP_RSSI_ENABLED') + + if target.lower() in ["antennatracker", "sub"]: + # missing the init call to the relay library: + feature_define_whitelist.add(r'AP_RELAY_ENABLED') + feature_define_whitelist.add(r'AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED') + + for some_re in feature_define_whitelist: + if re.match(some_re, define): + return True + + def assert_feature_in_code(self, defines, feature): + # if the feature is truly disabled then extract_features.py + # should say so: + for target in self.build_targets: + path = self.target_to_elf_path(target) + extracter = extract_features.ExtractFeatures(path) + (compiled_in_feature_defines, not_compiled_in_feature_defines) = extracter.extract() + for define in defines: + if not defines[define]: + continue + if define in compiled_in_feature_defines: + continue + error = f"feature gated by {define} not compiled into ({target}); extract_features.py bug?" + if self.define_is_whitelisted_for_feature_in_code(target, define): + print("warn: " + error) + continue + raise ValueError(error) + def board(self): '''returns board to build for''' return self._board @@ -314,9 +490,15 @@ def disable_in_turn_check_sizes(self, feature, sizes_nothing_disabled): f.write(self.csv_for_results(self.results)) def run_disable_in_turn(self): + progress_file = pathlib.Path("/tmp/run-disable-in-turn-progress") + resume_number = self.resume_number_from_progress_Path(progress_file) options = self.get_build_options_from_ardupilot_tree() count = 1 for feature in sorted(options, key=lambda x : x.define): + if resume_number is not None: + if count < resume_number: + count += 1 + continue if self.match_glob is not None: if not fnmatch.fnmatch(feature.define, self.match_glob): continue @@ -351,16 +533,35 @@ def enable_in_turn_check_sizes(self, feature, sizes_everything_disabled): with open("/tmp/enable-in-turn.csv", "w") as f: f.write(self.csv_for_results(self.enable_in_turn_results)) + def resume_number_from_progress_Path(self, progress_file): + if not self.resume: + return None + try: + content = progress_file.read_text().rstrip() + m = re.match(r"(\d+)/\d+ \w+", content) + if m is None: + raise ValueError(f"{progress_file} not matched") + return int(m.group(1)) + except FileNotFoundError: + pass + return None + def run_enable_in_turn(self): + progress_file = pathlib.Path("/tmp/run-enable-in-turn-progress") + resume_number = self.resume_number_from_progress_Path(progress_file) options = self.get_build_options_from_ardupilot_tree() count = 1 for feature in options: + if resume_number is not None: + if count < resume_number: + count += 1 + continue if self.match_glob is not None: if not fnmatch.fnmatch(feature.define, self.match_glob): continue self.progress("Enabling feature %s(%s) (%u/%u)" % (feature.label, feature.define, count, len(options))) - with open("/tmp/run-enable-in-turn-progress", "w") as f: + with open(progress_file, "w") as f: f.write(f"{count}/{len(options)} {feature.define}\n") self.test_enable_feature(feature, options) count += 1 @@ -482,11 +683,14 @@ def run(self): help="file containing extra hwdef information") parser.add_option("--board", type='string', - default="DevEBoxH7v2", + default="CubeOrange", # DevEBoxH7v2 also works help='board to build for') parser.add_option("--emit-disable-all-defines", action='store_true', help='emit defines used for disabling all features then exit') + parser.add_option("--resume", + action='store_true', + help='resume from previous progress file') opts, args = parser.parse_args() @@ -501,6 +705,7 @@ def run(self): board=opts.board, extra_hwdef=opts.extra_hwdef, emit_disable_all_defines=opts.emit_disable_all_defines, + resume=opts.resume, ) tbo.run() diff --git a/Tools/scripts/build_options.py b/Tools/scripts/build_options.py index f07483c72761b6..4f908820c3087d 100644 --- a/Tools/scripts/build_options.py +++ b/Tools/scripts/build_options.py @@ -36,7 +36,7 @@ def __init__(self, Feature('AHRS', 'AHRS_EXT_VECTORNAV', 'AP_EXTERNAL_AHRS_VECTORNAV_ENABLED', 'Enable VectorNav External AHRS', 0, "AHRS_EXT"), # noqa Feature('AHRS', 'InertialLabs', 'AP_EXTERNAL_AHRS_INERTIALLABS_ENABLED', 'Enable InertialLabs External AHRS', 0, "AHRS_EXT"), # noqa Feature('AHRS', 'TEMPCAL', 'HAL_INS_TEMPERATURE_CAL_ENABLE', 'Enable IMU Temperature Calibration', 0, None), - Feature('AHRS', 'VISUALODOM', 'HAL_VISUALODOM_ENABLED', 'Enable Visual Odometry', 0, 'EKF3_EXTNAV'), + Feature('AHRS', 'VISUALODOM', 'HAL_VISUALODOM_ENABLED', 'Enable Visual Odometry', 0, None), Feature('AHRS', 'EKF3_EXTNAV', 'EK3_FEATURE_EXTERNAL_NAV', 'Enable External Navigation for EKF3', 0, 'EKF3'), Feature('AHRS', 'EKF3_WINDEST', 'EK3_FEATURE_DRAG_FUSION', 'Enable Wind Estimation for EKF3', 0, 'EKF3'), Feature('AHRS', 'BARO_WIND_COMP', 'HAL_BARO_WIND_COMP_ENABLED', 'Enable Baro Wind Compensation', 0, None), @@ -113,7 +113,7 @@ def __init__(self, Feature('OSD', 'OSD', 'OSD_ENABLED', 'Enable OSD', 0, None), Feature('OSD', 'PLUSCODE', 'HAL_PLUSCODE_ENABLE', 'Enable PlusCode', 0, 'OSD'), - Feature('OSD', 'OSD_PARAM', 'OSD_PARAM_ENABLED', 'Enable OSD param', 0, 'OSD'), + Feature('OSD', 'OSD_PARAM', 'OSD_PARAM_ENABLED', 'Enable OSD param', 0, None), Feature('OSD', 'OSD_SIDEBARS', 'HAL_OSD_SIDEBAR_ENABLE', 'Enable Scrolling Sidebars', 0, 'OSD'), Feature('OSD', 'OSD_EXTENDED_LINK_STATS', 'AP_OSD_LINK_STATS_EXTENSIONS_ENABLED', 'Enable OSD panels with extended link stats data', 0, "OSD,RC_CRSF,MSP"), # noqa @@ -121,7 +121,7 @@ def __init__(self, Feature('VTX', 'SMARTAUDIO', 'AP_SMARTAUDIO_ENABLED', 'Enable SmartAudio VTX Contol', 0, "VIDEO_TX"), Feature('VTX', 'TRAMP', 'AP_TRAMP_ENABLED', 'Enable IRC Tramp VTX Control', 0, "VIDEO_TX"), - Feature('ESC', 'PICCOLOCAN', 'HAL_PICCOLO_CAN_ENABLE', 'Enable PiccoloCAN', 0, None), + Feature('ESC', 'PICCOLOCAN', 'HAL_PICCOLO_CAN_ENABLE', 'Enable PiccoloCAN', 0, 'DroneCAN'), Feature('ESC', 'TORQEEDO', 'HAL_TORQEEDO_ENABLED', 'Enable Torqeedo Motors', 0, None), Feature('ESC', 'ESC_EXTENDED_TELM', 'AP_EXTENDED_ESC_TELEM_ENABLED', 'Enable Extended ESC Telem', 0, 'DroneCAN'), @@ -149,7 +149,7 @@ def __init__(self, Feature('Copter', 'MODE_FLIP', 'MODE_FLIP_ENABLED', 'Enable Mode Flip', 0, None), Feature('Copter', 'MODE_BRAKE', 'MODE_BRAKE_ENABLED', 'Enable Mode Brake', 0, None), - Feature('Rover', 'ROVER_ADVANCED_FAILSAFE', 'AP_ROVER_ADVANCED_FAILSAFE_ENABLED', 'Enable Advanced Failsafe', 0, None), + Feature('Rover', 'ROVER_ADVANCED_FAILSAFE', 'AP_ROVER_ADVANCED_FAILSAFE_ENABLED', 'Enable Advanced Failsafe', 0, "ADVANCED_FAILSAFE"), # NOQA: 501 Feature('Mission', 'MISSION_NAV_PAYLOAD_PLACE', 'AP_MISSION_NAV_PAYLOAD_PLACE_ENABLED', 'Enable handling of NAV_PAYLOAD_PLACE mission items', 0, None), # noqa Feature('Copter', 'AC_PAYLOAD_PLACE_ENABLED', 'AC_PAYLOAD_PLACE_ENABLED', 'Enable Payload Place flight behaviour', 0, 'MISSION_NAV_PAYLOAD_PLACE'), # noqa @@ -291,18 +291,18 @@ def __init__(self, Feature('Baro', 'BMP388', 'AP_BARO_BMP388_ENABLED', 'Enable BMP388 Barometric Sensor', 1, None), Feature('Baro', 'BMP581', 'AP_BARO_BMP581_ENABLED', 'Enable BMP581 Barometric Sensor', 1, None), Feature('Baro', 'DPS280', 'AP_BARO_DPS280_ENABLED', 'Enable DPS280/DPS310 Barometric Sensor', 1, None), - Feature('Baro', 'DUMMY', 'AP_BARO_DUMMY_ENABLED', 'Enable DUMMY Barometric Sensor', 0, None), + # Feature('Baro', 'DUMMY', 'AP_BARO_DUMMY_ENABLED', 'Enable DUMMY Barometric Sensor', 0, None), Feature('Baro', 'EXTERNALAHRS', 'AP_BARO_EXTERNALAHRS_ENABLED', 'Enable EXTERNALAHRS Barometric Sensor', 0, 'AHRS_EXT'), Feature('Baro', 'FBM320', 'AP_BARO_FBM320_ENABLED', 'Enable FBM320 Barometric Sensor', 1, None), - Feature('Baro', 'ICM20789', 'AP_BARO_ICM20789_ENABLED', 'Enable ICM20789 Barometric Sensor', 1, None), + # Feature('Baro', 'ICM20789', 'AP_BARO_ICM20789_ENABLED', 'Enable ICM20789 Barometric Sensor', 1, None), Feature('Baro', 'KELLERLD', 'AP_BARO_KELLERLD_ENABLED', 'Enable KELLERLD Barometric Sensor', 1, None), Feature('Baro', 'LPS2XH', 'AP_BARO_LPS2XH_ENABLED', 'Enable LPS2XH Barometric Sensor', 1, None), Feature('Baro', 'MS56XX', 'AP_BARO_MS56XX_ENABLED', 'Enable MS56XX Barometric Sensor', 1, None), Feature('Baro', 'MSP_BARO', 'AP_BARO_MSP_ENABLED', 'Enable MSP Barometric Sensor', 0, 'MSP'), Feature('Baro', 'SPL06', 'AP_BARO_SPL06_ENABLED', 'Enable SPL06 Barometric Sensor', 1, None), Feature('Baro', 'DRONECAN_BARO', 'AP_BARO_DRONECAN_ENABLED', 'Enable DroneCAN Barometric Sensor', 0, "DroneCAN"), - Feature('Baro', 'ICP101XX', 'AP_BARO_ICP101XX_ENABLED', 'Enable ICP101XX Barometric Sensor', 0, None), - Feature('Baro', 'ICP201XX', 'AP_BARO_ICP201XX_ENABLED', 'Enable ICP201XX Barometric Sensor', 0, None), + # Feature('Baro', 'ICP101XX', 'AP_BARO_ICP101XX_ENABLED', 'Enable ICP101XX Barometric Sensor', 0, None), + # Feature('Baro', 'ICP201XX', 'AP_BARO_ICP201XX_ENABLED', 'Enable ICP201XX Barometric Sensor', 0, None), Feature('Baro', 'BARO_TEMPCAL', 'AP_TEMPCALIBRATION_ENABLED', 'Enable Baro Temperature Calibration', 0, None), Feature('Baro', 'BARO_PROBEXT', 'AP_BARO_PROBE_EXTERNAL_I2C_BUSES', 'Enable Probing of External i2c buses', 0, None), @@ -330,11 +330,12 @@ def __init__(self, Feature('Other', 'SDCARD_FORMATTING', 'AP_FILESYSTEM_FORMAT_ENABLED', 'Enable formatting of microSD cards', 0, None), Feature('Other', 'BOOTLOADER_FLASHING', 'AP_BOOTLOADER_FLASHING_ENABLED', 'Enable Bootloader flashing', 0, "FILESYSTEM_ROMFS"), # noqa Feature('Other', 'SCRIPTING', 'AP_SCRIPTING_ENABLED', 'Enable Lua scripting', 0, None), - Feature('Other', 'SCRIPTING_SERIALDEVICE', 'AP_SCRIPTING_SERIALDEVICE_ENABLED', 'Enable Lua serial device simulation', 0, "SCRIPTING"), # noqa + Feature('Other', 'SERIALDEVICE_REGISTER', 'AP_SERIALMANAGER_REGISTER_ENABLED', 'Enable Serial Device Registration', 0, None), # noqa + Feature('Other', 'SCRIPTING_SERIALDEVICE', 'AP_SCRIPTING_SERIALDEVICE_ENABLED', 'Enable Lua serial device simulation', 0, "SCRIPTING,SERIALDEVICE_REGISTER"), # noqa Feature('Other', 'SLCAN', 'AP_CAN_SLCAN_ENABLED', 'Enable SLCAN serial protocol', 0, None), Feature('Other', 'SDCARD_MISSION', 'AP_SDCARD_STORAGE_ENABLED', 'Enable storing mission on microSD cards', 0, None), Feature('Other', 'COMPASS_CAL', 'COMPASS_CAL_ENABLED', 'Enable "tumble" compass calibration', 0, None), - Feature('Other', 'DRONECAN_SERIAL', 'AP_DRONECAN_SERIAL_ENABLED', 'Enable DroneCAN virtual serial ports', 0, "DroneCAN"), + Feature('Other', 'DRONECAN_SERIAL', 'AP_DRONECAN_SERIAL_ENABLED', 'Enable DroneCAN virtual serial ports', 0, "DroneCAN,SERIALDEVICE_REGISTER"), # NOQA: E501 Feature('Other', 'Buttons', 'HAL_BUTTON_ENABLED', 'Enable Buttons', 0, None), Feature('Other', 'Logging', 'HAL_LOGGING_ENABLED', 'Enable Logging', 0, None), Feature('Other', 'CUSTOM_ROTATIONS', 'AP_CUSTOMROTATIONS_ENABLED', 'Enable Custom Rotations', 0, None), @@ -347,9 +348,9 @@ def __init__(self, Feature('MAVLink', 'MAVLINK_VERSION_REQUEST', 'AP_MAVLINK_AUTOPILOT_VERSION_REQUEST_ENABLED', 'Enable old AUTOPILOT_VERSION_REQUEST mesage', 0, None), # noqa Feature('MAVLink', 'REQUEST_AUTOPILOT_CAPA', 'AP_MAVLINK_MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES_ENABLED', 'Enable old REQUEST_AUTOPILOT_CAPABILITIES command', 0, None), # noqa Feature('MAVLink', 'MAV_MSG_RELAY_STATUS', 'AP_MAVLINK_MSG_RELAY_STATUS_ENABLED', 'Enable sending of RELAY_STATUS message', 0, 'RELAY'), # noqa - Feature('MAVLink', 'MAV_MSG_HIL_GPS', 'AP_MAVLINK_MSG_HIL_GPS_ENABLED', 'Enable receiving of HIL_GPS messages', 0, None), # noqa - Feature('MAVLink', 'MAV_MSG_MOUNT_CONTROL', 'AP_MAVLINK_MSG_MOUNT_CONTROL_ENABLED', 'Enable handling of deprecated MOUNT_CONTROL message', 0, None), # noqa - Feature('MAVLink', 'MAV_MSG_MOUNT_CONFIGURE', 'AP_MAVLINK_MSG_MOUNT_CONFIGURE_ENABLED', 'Enable handling of deprecated MOUNT_CONFIGURE message', 0, None), # noqa + Feature('MAVLink', 'MAV_MSG_HIL_GPS', 'AP_MAVLINK_MSG_HIL_GPS_ENABLED', 'Enable receiving of HIL_GPS messages', 0, 'MAV'), # noqa + Feature('MAVLink', 'MAV_MSG_MOUNT_CONTROL', 'AP_MAVLINK_MSG_MOUNT_CONTROL_ENABLED', 'Enable handling of deprecated MOUNT_CONTROL message', 0, "MOUNT"), # noqa + Feature('MAVLink', 'MAV_MSG_MOUNT_CONFIGURE', 'AP_MAVLINK_MSG_MOUNT_CONFIGURE_ENABLED', 'Enable handling of deprecated MOUNT_CONFIGURE message', 0, "MOUNT"), # noqa Feature('MAVLink', 'AP_MAVLINK_BATTERY2_ENABLED', 'AP_MAVLINK_BATTERY2_ENABLED', 'Enable sending of old BATTERY2 message', 0, None), # noqa Feature('MAVLink', 'MAV_DEVICE_OP', 'AP_MAVLINK_MSG_DEVICE_OP_ENABLED', 'Enable handling of DeviceOp mavlink messages', 0, None), # noqa Feature('MAVLink', 'MAV_SERVO_RELAY', 'AP_MAVLINK_SERVO_RELAY_ENABLED', 'Enable handling of ServoRelay mavlink messages', 0, 'SERVORELAY_EVENTS'), # noqa @@ -388,7 +389,7 @@ def __init__(self, Feature('Airspeed Drivers', 'DRONECAN_ASPD', 'AP_AIRSPEED_DRONECAN_ENABLED', 'ENABLE DroneCAN AIRSPEED', 0, 'AIRSPEED,DroneCAN'), # NOQA: E501 Feature('Actuators', 'Volz', 'AP_VOLZ_ENABLED', 'Enable Volz Protocol', 0, None), - Feature('Actuators', 'Volz_DroneCAN', 'AP_DRONECAN_VOLZ_FEEDBACK_ENABLED', 'Enable Volz DroneCAN Feedback', 0, "DroneCAN"), + Feature('Actuators', 'Volz_DroneCAN', 'AP_DRONECAN_VOLZ_FEEDBACK_ENABLED', 'Enable Volz DroneCAN Feedback', 0, "DroneCAN,Volz"), # noqa: E501 Feature('Actuators', 'RobotisServo', 'AP_ROBOTISSERVO_ENABLED', 'Enable RobotisServo Protocol', 0, None), Feature('Actuators', 'SBUS Output', 'AP_SBUSOUTPUT_ENABLED', 'Enable SBUS Output on serial ports', 0, None), Feature('Actuators', 'FETTecOneWire', 'AP_FETTEC_ONEWIRE_ENABLED', 'Enable FETTec OneWire ESCs', 0, None), diff --git a/Tools/scripts/extract_features.py b/Tools/scripts/extract_features.py index 454e57391ca6e5..28e551b80a3b72 100755 --- a/Tools/scripts/extract_features.py +++ b/Tools/scripts/extract_features.py @@ -89,6 +89,7 @@ def __init__(self, filename, nm="arm-none-eabi-nm", strings="strings"): ('AP_RANGEFINDER_JRE_SERIAL_ENABLED', r'AP_RangeFinder_JRE_Serial::get_reading\b',), ('AP_RANGEFINDER_RDS02UF_ENABLED', r'AP_RangeFinder_RDS02UF::get_reading\b',), + ('AP_GPS_NMEA_UNICORE_ENABLED', r'AP_GPS_NMEA::parse_agrica_field',), ('AP_GPS_{type}_ENABLED', r'AP_GPS_(?P.*)::read\b',), ('AP_OPTICALFLOW_ENABLED', 'AP_OpticalFlow::AP_OpticalFlow',), @@ -106,14 +107,15 @@ def __init__(self, filename, nm="arm-none-eabi-nm", strings="strings"): ('AP_BATTERY_{type}_ENABLED', r'AP_BattMonitor_(?P.*)::init\b',), ('AP_BATTERY_ESC_TELEM_OUTBOUND_ENABLED', r'AP_BattMonitor_Backend::update_esc_telem_outbound\b',), - ('AP_BATTERY_WATT_MAX_ENABLED', 'AP_BattMonitor_Params::_watt_max',), + ('AP_BATTERY_WATT_MAX_ENABLED', 'Plane::throttle_watt_limiter',), ('HAL_MOUNT_ENABLED', 'AP_Mount::AP_Mount',), ('HAL_MOUNT_{type}_ENABLED', r'AP_Mount_(?P.*)::update\b',), ('HAL_SOLO_GIMBAL_ENABLED', 'AP_Mount_SoloGimbal::init',), - ('HAL_MOUNT_STORM32SERIAL_ENABLED', 'AP_Mount_SToRM32_serial::init',), - ('HAL_MOUNT_STORM32MAVLINK_ENABLED', 'AP_Mount_SToRM32::init',), + ('HAL_MOUNT_STORM32SERIAL_ENABLED', 'AP_Mount_SToRM32_serial::update',), + ('HAL_MOUNT_STORM32MAVLINK_ENABLED', 'AP_Mount_SToRM32::update',), + ('HAL_SPEKTRUM_TELEM_ENABLED', r'AP::spektrum_telem',), ('HAL_{type}_TELEM_ENABLED', r'AP_(?P.*)_Telem::init',), ('AP_{type}_TELEM_ENABLED', r'AP_(?P.*)_Telem::init',), ('HAL_CRSF_TELEM_TEXT_SELECTION_ENABLED', 'AP_CRSF_Telem::calc_text_selection',), @@ -123,7 +125,7 @@ def __init__(self, filename, nm="arm-none-eabi-nm", strings="strings"): ('AP_FRSKY_TELEM_ENABLED', 'AP::frsky_telem',), ('AP_FRSKY_D_TELEM_ENABLED', 'AP_Frsky_D::send',), ('AP_FRSKY_SPORT_TELEM_ENABLED', 'AP_Frsky_SPort::send_sport_frame',), - ('AP_FRSKY_SPORT_PASSTHROUGH_ENABLED', 'AP::frsky_passthrough_telem',), + ('AP_FRSKY_SPORT_PASSTHROUGH_ENABLED', 'AP_Frsky_SPort_Passthrough::process_packet',), ('HAL_WITH_FRSKY_TELEM_BIDIRECTIONAL', 'AP_Frsky_SPort_Passthrough::set_telem_data'), ('AP_IBUS_TELEM_ENABLED', 'AP_IBus_Telem::init',), @@ -170,7 +172,7 @@ def __init__(self, filename, nm="arm-none-eabi-nm", strings="strings"): ('HAL_QUADPLANE_ENABLED', 'QuadPlane::QuadPlane',), ('QAUTOTUNE_ENABLED', 'ModeQAutotune::_enter',), ('HAL_SOARING_ENABLED', 'SoaringController::var_info',), - ('HAL_LANDING_DEEPSTALL_ENABLED', r'AP_Landing_Deepstall::terminate\b',), + ('HAL_LANDING_DEEPSTALL_ENABLED', r'AP_Landing_Deepstall::override_servos',), ('AP_GRIPPER_ENABLED', r'AP_Gripper::init\b',), ('HAL_SPRAYER_ENABLED', 'AC_Sprayer::AC_Sprayer',), @@ -181,8 +183,9 @@ def __init__(self, filename, nm="arm-none-eabi-nm", strings="strings"): ('AP_SERVORELAYEVENTS_ENABLED', 'AP_ServoRelayEvents::update_events',), ('AP_RCPROTOCOL_ENABLED', r'AP_RCProtocol::init\b',), + ('AP_RCPROTOCOL_MAVLINK_RADIO_ENABLED', r'AP_RCProtocol_MAVLinkRadio::update_radio_rc_channels',), ('AP_RCPROTOCOL_{type}_ENABLED', r'AP_RCProtocol_(?P.*)::_process_byte\b',), - ('AP_RCPROTOCOL_{type}_ENABLED', r'AP_RCProtocol_(?P.*)::_process_pulse\b',), + ('AP_RCPROTOCOL_{type}_ENABLED', r'AP_RCProtocol_(?P.*)::process_pulse\b',), ('AP_VOLZ_ENABLED', r'AP_Volz_Protocol::init\b',), ('AP_DRONECAN_VOLZ_FEEDBACK_ENABLED', r'AP_DroneCAN::handle_actuator_status_Volz\b',), @@ -196,7 +199,7 @@ def __init__(self, filename, nm="arm-none-eabi-nm", strings="strings"): ('AP_OPENDRONEID_ENABLED', 'AP_OpenDroneID::update',), - ('GPS_MOVING_BASELINE', r'AP_GPS_Backend::calculate_moving_base_yaw\b',), + ('GPS_MOVING_BASELINE', r'MovingBase::var_info',), ('AP_DRONECAN_SEND_GPS', r'AP_GPS_DroneCAN::instance_exists\b',), ('AP_GPS_BLENDED_ENABLED', r'AP_GPS::calc_blend_weights\b',), @@ -209,7 +212,7 @@ def __init__(self, filename, nm="arm-none-eabi-nm", strings="strings"): ('AP_TEMPCALIBRATION_ENABLED', r'AP_TempCalibration::apply_calibration',), ('HAL_PICCOLO_CAN_ENABLE', r'AP_PiccoloCAN::update',), - ('EK3_FEATURE_EXTERNAL_NAV', r'NavEKF3::writeExtNavVelData'), + ('EK3_FEATURE_EXTERNAL_NAV', r'NavEKF3_core::CorrectExtNavVelForSensorOffset'), ('EK3_FEATURE_DRAG_FUSION', r'NavEKF3_core::FuseDragForces'), ('AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED', r'RC_Channel::lookuptable',), @@ -243,10 +246,10 @@ def __init__(self, filename, nm="arm-none-eabi-nm", strings="strings"): ('AP_MAVLINK_MSG_DEVICE_OP_ENABLED', 'GCS_MAVLINK::handle_device_op_write'), ('AP_MAVLINK_SERVO_RELAY_ENABLED', 'GCS_MAVLINK::handle_servorelay_message'), ('AP_MAVLINK_MSG_SERIAL_CONTROL_ENABLED', 'GCS_MAVLINK::handle_serial_control'), - ('AP_MAVLINK_MSG_MISSION_REQUEST_ENABLED', 'GCS_MAVLINK::handle_mission_request\b'), - ('AP_MAVLINK_MSG_RC_CHANNELS_RAW_ENABLED', 'GCS_MAVLINK::send_rc_channels_raw\b'), + ('AP_MAVLINK_MSG_MISSION_REQUEST_ENABLED', r'GCS_MAVLINK::handle_mission_request\b'), + ('AP_MAVLINK_MSG_RC_CHANNELS_RAW_ENABLED', r'GCS_MAVLINK::send_rc_channels_raw\b'), ('AP_MAVLINK_FTP_ENABLED', 'GCS_MAVLINK::ftp_worker'), - ('AP_MAVLINK_MAV_CMD_SET_HAGL_ENABLED', 'Plane::get_external_HAGL'), + ('AP_MAVLINK_MAV_CMD_SET_HAGL_ENABLED', 'Plane::handle_external_hagl'), ('AP_DRONECAN_HIMARK_SERVO_SUPPORT', 'AP_DroneCAN::SRV_send_himark'), ('AP_DRONECAN_HOBBYWING_ESC_SUPPORT', 'AP_DroneCAN::hobbywing_ESC_update'), @@ -264,12 +267,13 @@ def __init__(self, filename, nm="arm-none-eabi-nm", strings="strings"): ('AP_OSD_LINK_STATS_EXTENSIONS_ENABLED', r'AP_OSD_Screen::draw_rc_tx_power'), ('HAL_ENABLE_DRONECAN_DRIVERS', r'AP_DroneCAN::init'), ('AP_MAVLINK_MSG_HIL_GPS_ENABLED', r'mavlink_msg_hil_gps_decode'), - ('AP_BARO_PROBE_EXTERNAL_I2C_BUSES', r'AP_Compass::_probe_external_i2c_compasses'), + ('AP_BARO_PROBE_EXTERNAL_I2C_BUSES', r'AP_Baro::_probe_i2c_barometers'), ('AP_RSSI_ENABLED', r'AP_RSSI::init'), ('AP_ROVER_ADVANCED_FAILSAFE_ENABLED', r'Rover::afs_fs_check'), ('AP_PLANE_OFFBOARD_GUIDED_SLEW_ENABLED', r'GCS_MAVLINK_Plane::handle_command_int_guided_slew_commands'), + ('AP_SERIALMANAGER_REGISTER_ENABLED', r'AP_SerialManager::register_port'), ] def progress(self, msg):