Ok, so I found a kludge to include Lua scripting in the build for 1M boards. For now, it’s a brute force method that involves modifying Tools/ardupilotwaf/boards.py to always include scripting. Basically bypass the conditional check. From this conditional code:
# Setup scripting, had to defer this to allow checking board size
if ((not cfg.options.disable_scripting) and
(not cfg.env.DISABLE_SCRIPTING) and
((cfg.env.BOARD_FLASH_SIZE is None) or
(cfg.env.BOARD_FLASH_SIZE == []) or
(cfg.env.BOARD_FLASH_SIZE > 1024))):
env.DEFINES.update(
AP_SCRIPTING_ENABLED = 1,
LUA_32BITS = 1,
)
env.AP_LIBRARIES += [
'AP_Scripting',
'AP_Scripting/lua/src',
]
else:
cfg.options.disable_scripting = False
to just:
# Setup scripting, had to defer this to allow checking board size
env.DEFINES.update(
AP_SCRIPTING_ENABLED = 1,
LUA_32BITS = 1,
)
env.AP_LIBRARIES += [
'AP_Scripting',
'AP_Scripting/lua/src',
]
This will force ALL builds to always include scripting. Of course, you also have to reduce the size of your code to fit under 1M with scripting. To do that, include the following at the end of your hwdef.dat, adjusting it to the items you need.
define HAL_EXTERNAL_AHRS_ENABLED 0
define HAL_NAVEKF2_AVAILABLE 0
define HAL_NAVEKF3_AVAILABLE 1
define EK3_FEATURE_EXTERNAL_NAV 0
define HAL_INS_TEMPERATURE_CAL_ENABLE 0
define HAL_VISUALODOM_ENABLED 0
define HAL_PERIPH_SUPPORT_LONG_CAN_PRINTF 0
define AP_FETTEC_ONEWIRE_ENABLED 0
define AP_ROBOTISSERVO_ENABLED 0
define AP_VOLZ_ENABLED 0
define AP_AIRSPEED_ASP5033_ENABLED 0
define AP_AIRSPEED_ANALOG_ENABLED 0
define AP_AIRSPEED_DLVR_ENABLED 0
define AP_AIRSPEED_MS4525_ENABLED 0
define AP_AIRSPEED_MS5525_ENABLED 0
define AP_AIRSPEED_MSP_ENABLED 0
define AP_AIRSPEED_NMEA_ENABLED 0
define AP_AIRSPEED_SDP3X_ENABLED 0
define AP_AIRSPEED_UAVCAN_ENABLED 0
define AP_BATTMON_FUELFLOW_ENABLE 0
define AP_BATTMON_FUELLEVEL_ANALOG_ENABLE 0
define AP_BATTMON_FUELLEVEL_PWM_ENABLE 0
define HAL_BATTMON_INA2XX_ENABLED 0
define AP_BATTMON_SMBUS_ENABLE 0
define HAL_RUNCAM_ENABLED 0
define MODE_FLIP_ENABLED 0
define MODE_FLOWHOLD_ENABLED 0
define MODE_FOLLOW_ENABLED 0
define MODE_GUIDED_NOGPS_ENABLED 0
define MODE_SPORT_ENABLED 0
define MODE_SYSTEMID_ENABLED 0
define MODE_TURTLE_ENABLED 0
define MODE_ZIGZAG_ENABLED 0
define HAL_PICCOLO_CAN_ENABLE 0
define HAL_TORQEEDO_ENABLED 0
define AP_GPS_ERB_ENABLED 0
define AP_GPS_GSOF_ENABLED 0
define AP_GPS_MAV_ENABLED 0
define AP_GPS_NMEA_ENABLED 0
define AP_GPS_NOVA_ENABLED 0
define AP_GPS_SBF_ENABLED 0
define AP_GPS_SBP_ENABLED 0
define AP_GPS_SBP2_ENABLED 0
define AP_GPS_SIRF_ENABLED 0
define AP_GPS_UBLOX_ENABLED 1
define HAL_MOUNT_ALEXMOS_ENABLED 0
define HAL_MOUNT_GREMSY_ENABLED 0
define HAL_MOUNT_ENABLED 0
define HAL_MOUNT_SERVO_ENABLED 0
define HAL_MOUNT_SIYI_ENABLED 0
define HAL_SOLO_GIMBAL_ENABLED 0
define HAL_MOUNT_STORM32MAVLINK_ENABLED 0
define HAL_MOUNT_STORM32SERIAL_ENABLED 0
define HAL_EFI_ENABLED 0
define HAL_EFI_CURRAWONG_ECU_ENABLED 0
define HAL_EFI_DRONECAN_ENABLED 0
define HAL_EFI_NWPWU_ENABLED 0
define HAL_GENERATOR_ENABLED 0
define AP_ICENGINE_ENABLED 0
define HAL_ADSB_ENABLED 0
define HAL_ADSB_SAGETECH_ENABLED 0
define HAL_ADSB_SAGETECH_MXS_ENABLED 0
define HAL_ADSB_UAVIONIX_MAVLINK_ENABLED 0
define HAL_ADSB_UCP_ENABLED 0
define AP_AIS_ENABLED 0
define HAL_MSP_ENABLED 0
define HAL_MSP_COMPASS_ENABLED 0
define HAL_WITH_MSP_DISPLAYPORT 0
define HAL_MSP_GPS_ENABLED 0
define HAL_MSP_OPTICALFLOW_ENABLED 0
define HAL_MSP_RANGEFINDER_ENABLED 0
define HAL_MSP_SENSORS_ENABLED 0
# define OSD_ENABLED 0
define OSD_PARAM_ENABLED 0
define HAL_OSD_SIDEBAR_ENABLE 0
define HAL_PLUSCODE_ENABLE 0
define HAL_BARO_WIND_COMP_ENABLED 0
define HAL_DISPLAY_ENABLED 0
# define HAL_GYROFFT_ENABLED 0
define HAL_NMEA_OUTPUT_ENABLED 0
define AP_CAMERA_ENABLED 0
define AP_GRIPPER_ENABLED 0
define LANDING_GEAR_ENABLED 0
define HAL_SPRAYER_ENABLED 0
define WINCH_ENABLED 0
define HAL_LANDING_DEEPSTALL_ENABLED 0
define HAL_QUADPLANE_ENABLED 0
define HAL_SOARING_ENABLED 0
define AP_RANGEFINDER_ENABLED 0
define AP_RANGEFINDER_ANALOG_ENABLED 0
define AP_RANGEFINDER_BENEWAKE_CAN_ENABLED 0
define AP_RANGEFINDER_BENEWAKE_TF02_ENABLED 0
define AP_RANGEFINDER_BENEWAKE_TF03_ENABLED 0
define AP_RANGEFINDER_BENEWAKE_TFMINI_ENABLED 0
define AP_RANGEFINDER_BENEWAKE_TFMINIPLUS_ENABLED 0
define AP_RANGEFINDER_BLPING_ENABLED 0
define AP_RANGEFINDER_GYUS42V2_ENABLED 0
define AP_RANGEFINDER_HC_SR04_ENABLED 0
define AP_RANGEFINDER_LANBAO_ENABLED 0
define AP_RANGEFINDER_LEDDARONE_ENABLED 0
define AP_RANGEFINDER_LEDDARVU8_ENABLED 0
define AP_RANGEFINDER_LIGHTWARE_SERIAL_ENABLED 0
define AP_RANGEFINDER_LWI2C_ENABLED 0
define AP_RANGEFINDER_MAVLINK_ENABLED 0
define AP_RANGEFINDER_MAXBOTIX_SERIAL_ENABLED 0
define AP_RANGEFINDER_MAXSONARI2CXL_ENABLED 0
define AP_RANGEFINDER_NMEA_ENABLED 0
define AP_RANGEFINDER_PULSEDLIGHTLRF_ENABLED 0
define AP_RANGEFINDER_PWM_ENABLED 0
define AP_RANGEFINDER_TRI2C_ENABLED 0
define AP_RANGEFINDER_TERARANGER_SERIAL_ENABLED 0
define AP_RANGEFINDER_UAVCAN_ENABLED 0
define AP_RANGEFINDER_USD1_CAN_ENABLED 0
define AP_RANGEFINDER_USD1_SERIAL_ENABLED 0
define AP_RANGEFINDER_VL53L0X_ENABLED 0
define AP_RANGEFINDER_VL53L1X_ENABLED 0
define AP_RANGEFINDER_WASP_ENABLED 0
define AC_AVOID_ENABLED 0
define AC_OAPATHPLANNER_ENABLED 0
define AP_FENCE_ENABLED 0
define HAL_PARACHUTE_ENABLED 0
define HAL_PROXIMITY_ENABLED 0
define AP_AIRSPEED_ENABLED 0
define BEACON_ENABLED 0
define AP_BARO_BMP085_ENABLED 0
define AP_BARO_BMP280_ENABLED 1
define AP_BARO_BMP388_ENABLED 1
define AP_BARO_DPS280_ENABLED 0
define AP_BARO_DUMMY_ENABLED 0
define AP_BARO_EXTERNALAHRS_ENABLED 0
define AP_BARO_FBM320_ENABLED 0
define GPS_MOVING_BASELINE 0
define AP_BARO_ICM20789_ENABLED 0
define AP_BARO_ICP101XX_ENABLED 0
define AP_BARO_ICP201XX_ENABLED 0
define AP_BARO_KELLERLD_ENABLED 0
define AP_BARO_LPS2XH_ENABLED 0
define AP_BARO_MS56XX_ENABLED 0
define AP_BARO_MSP_ENABLED 0
define AP_OPTICALFLOW_ENABLED 0
define AP_OPTICALFLOW_CXOF_ENABLED 0
define AP_OPTICALFLOW_HEREFLOW_ENABLED 0
define AP_OPTICALFLOW_MAV_ENABLED 0
define AP_OPTICALFLOW_ONBOARD_ENABLED 0
define AP_OPTICALFLOW_PIXART_ENABLED 0
define AP_OPTICALFLOW_PX4FLOW_ENABLED 0
define AP_OPTICALFLOW_UPFLOW_ENABLED 0
define AP_RPM_EFI_ENABLED 0
define AP_RPM_ESC_TELEM_ENABLED 0
define AP_RPM_GENERATOR_ENABLED 0
define AP_RPM_HARMONICNOTCH_ENABLED 0
define AP_RPM_PIN_ENABLED 0
define AP_BARO_SPL06_ENABLED 0
define AP_TEMPERATURE_SENSOR_ENABLED 0
define AP_TEMPERATURE_SENSOR_MCP9600_ENABLED 0
define AP_TEMPERATURE_SENSOR_TSYS01_ENABLED 0
define AP_BARO_UAVCAN_ENABLED 0
define AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED 0
define HAL_CRSF_TELEM_ENABLED 0
define HAL_CRSF_TELEM_TEXT_SELECTION_ENABLED 0
define HAL_HIGH_LATENCY2_ENABLED 0
define HAL_HOTT_TELEM_ENABLED 0
define AP_LTM_TELEM_ENABLED 0
define HAL_SPEKTRUM_TELEM_ENABLED 0
define AP_MOTORS_FRAME_DECA_ENABLED 0
define AP_MOTORS_FRAME_DODECAHEXA_ENABLED 0
define AP_MOTORS_FRAME_HEXA_ENABLED 0
define AP_MOTORS_FRAME_OCTA_ENABLED 0
define AP_MOTORS_FRAME_OCTAQUAD_ENABLED 0
define AP_MOTORS_FRAME_QUAD_ENABLED 0
define AP_MOTORS_FRAME_Y6_ENABLED 0
define HAL_SMARTAUDIO_ENABLED 0
define AP_TRAMP_ENABLED 1
The above is the configuration I used for my ArduRover F405 FC. It compiles to about 830K.
So, the good news is that it compiles fine and Scripting is included in the code and it appears to run ok. The bad news, at least for F405 based processors is that there doesn’t seem to be enough RAM (192k) for scripting to run. I get a PreArm: Scripting: out of memory error, and no amount of playing with the SCR_HEAP_SIZE can get rid of it. Changing it also doesn’t affect freemem, which shows about 34k free, so something is off. I’m on a trip right now (had brought a Macbook and F405 with me for testing!) and can only test with it, but when I get back home in a few days, I will test with a F745 processor, which has 320K ram.