Skip to content

Added overridden new and delete for QURT HAL #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 73 commits into
base: pr-hal-qurt-v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
3f4d0f4
HAL_QURT: revive QURT HAL
tridge May 18, 2024
2623e72
AP_Filesystem: added QURT support
tridge May 18, 2024
d9595de
AP_HAL: added QURT HAL
tridge May 18, 2024
e120845
AP_Common: fixed QURT build
tridge May 18, 2024
11b62d7
AP_Baro: fixed QURT build
tridge May 18, 2024
439819c
Tools: added QURT build
tridge May 18, 2024
6a46d50
AP_Compass: cast to unsigned for QURT
tridge May 18, 2024
43cd984
AP_Filesystem: support no filesystem reading
tridge May 18, 2024
148a9cd
AP_HAL: added more replacement functions for QURT
tridge May 18, 2024
dee2f70
AP_OpticalFlow: cast to unsigned for QURT
tridge May 18, 2024
bf81eb7
AP_RangeFinder: cast to unsigned for QURT
tridge May 18, 2024
6d64063
GCS_MAVLink: support no filesystem reading
tridge May 18, 2024
6fd1fba
HAL_QURT: more hackery
tridge May 18, 2024
c32942d
AP_HAL: cope with lua longjmp for C++
tridge May 18, 2024
3f4c630
AP_HAL_ChibiOS: removed Util::run_debug_shell()
tridge May 19, 2024
ce9bb1b
AP_HAL_Empty: removed Util::run_debug_shell()
tridge May 19, 2024
9aea969
AP_HAL_ESP32: removed Util::run_debug_shell()
tridge May 19, 2024
8e7746a
AP_HAL: removed Util::run_debug_shell()
tridge May 19, 2024
56eda48
AP_HAL_Linux: removed Util::run_debug_shell()
tridge May 19, 2024
5997bbb
AP_HAL_SITL: removed Util::run_debug_shell()
tridge May 19, 2024
7a62c63
Tools: added posix includes for QURT
tridge May 19, 2024
74f462d
AP_HAL_ChibiOS: use if for ENABLE_HEAP
tridge May 19, 2024
105484d
AP_HAL_ESP32: use if for ENABLE_HEAP
tridge May 19, 2024
a6f4a44
AP_HAL: use if for ENABLE_HEAP
tridge May 19, 2024
1cef950
AP_HAL_Linux: use if for ENABLE_HEAP
tridge May 19, 2024
012694b
AP_HAL_SITL: use if for ENABLE_HEAP
tridge May 19, 2024
302e30c
HAL_QURT: got to link stage
tridge May 19, 2024
91ef39b
Tools: more QURT hackery
tridge May 19, 2024
53faa50
AP_Scripting: don't build luac.c
tridge May 19, 2024
60b1bfb
Tools: break out CAN libraries
tridge May 19, 2024
2a5bcac
Tools: QURT progress
tridge May 19, 2024
2bce578
AP_Baro: don't build sim specific fns without sim
tridge May 19, 2024
76382b6
AP_Filesystem: support QURT posix
tridge May 19, 2024
84d10db
AP_HAL: qurt fixups
tridge May 19, 2024
6cc9e24
HAL_QURT: fixups
tridge May 19, 2024
bdfe1f0
GCS_MAVLink: prevent all_stream_entries duplication
tridge May 19, 2024
7d9058c
AP_HAL: qurt update
tridge May 19, 2024
b919dc2
AP_Filesystem: QURT compat for posix filesystem
tridge May 19, 2024
b808b85
waf: added -lpthread for QURT
tridge May 19, 2024
c45f821
HAL_QURT: templates for replacement fns
tridge May 19, 2024
1325384
AP_JSON: only build with simulator enabled
tridge May 19, 2024
701da7e
waf: pthread link not needed for QURT
tridge May 19, 2024
d6f8f86
HAL_QURT: fixed semaphores
tridge May 19, 2024
15427a5
HAL_QURT: added interface.h
tridge May 20, 2024
3f93462
Tools: specify pymonocypher version in more places
tridge May 18, 2024
d9c5403
autotest: add support for minimum_duration to wait_ekf_flags
peterbarker May 17, 2024
0d625d3
autotest: pass kwargs straight through in wait_ekf_args
peterbarker May 17, 2024
b810bf2
AP_HAL_QURT: Moved Semaphore implementation to the Linux implementation
katzfey May 20, 2024
be872d6
Removed unnecessary dsp_main.cpp file
katzfey May 21, 2024
e5e7a2b
AP_HAL_QURT: Bunch of changes to link everything properly and call th…
katzfey May 21, 2024
358d249
Cleaned up a little more after hackfest to get link to work
katzfey May 22, 2024
571e5bb
Added support for console printf
katzfey May 23, 2024
3a91db9
Added some commented out definitions for SIM
katzfey May 23, 2024
53311cb
Implemented thread_create in scheduler based on Linux implementation
katzfey May 23, 2024
c4fa6dd
AP_HAL: more progress on getting through setup and into loop
katzfey May 24, 2024
dcac5ed
AP_HAL_QURT: more progress on getting through setup and into loop
katzfey May 24, 2024
933ac33
AP_Vehicle: more progress on getting through setup and into loop
katzfey May 24, 2024
9bde55a
ArduCopter: more progress on getting through setup and into loop
katzfey May 24, 2024
1e03205
Copter: start baro
tridge May 24, 2024
ffedf8c
HAL_QURT: fixed thread create
tridge May 24, 2024
3bc67f4
HAL_QURT: fixed interface fns
tridge May 25, 2024
285d8b1
waf: wrap printf on QURT
tridge May 25, 2024
a7ae56e
AP_HAL: added baro for QURT
tridge May 25, 2024
ec9b25a
HAL_QURT: initial I2C implementation
tridge May 25, 2024
88191f6
HAL_QURT: added SPI support
tridge May 25, 2024
e573b36
AP_HAL: added SPI probe list for QURT
tridge May 25, 2024
a12ef9c
Copter: QURT hacks
tridge May 25, 2024
2e17e91
AP_AHRS: QURT hacks
tridge May 25, 2024
ea1f908
AP_BoardConfig: QURT hacks
tridge May 25, 2024
098b581
AP_InertialSensor: disable gyro cal HACK
tridge May 25, 2024
dae73e6
waf: fixed QURT link
tridge May 25, 2024
04e5c08
AP_Common: Added overridden new and delete for QURT HAL to allow use …
katzfey Jun 4, 2024
1b00e03
AP_Common: Fixed formatting in c++.cpp
katzfey Jun 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 106 additions & 1 deletion ArduCopter/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,114 +13,186 @@ static void failsafe_check_static()
copter.failsafe_check();
}

#include <qurt.h>
// #define GOT_HERE() do { DEV_PRINTF("got to %s:%d\n", __FILE__, __LINE__); qurt_timer_sleep(5000); } while(false);
#define GOT_HERE() do {} while(0)


void Copter::init_ardupilot()
{
GOT_HERE();

// init winch
#if AP_WINCH_ENABLED
g2.winch.init();
#endif

GOT_HERE();

// initialise notify system
notify.init();

GOT_HERE();

notify_flight_mode();

GOT_HERE();

// initialise battery monitor
battery.init();

GOT_HERE();

// Init RSSI
rssi.init();


GOT_HERE();

// Any use of barometer crashes the DSP
barometer.init();

GOT_HERE();

// setup telem slots with serial ports
gcs().setup_uarts();

GOT_HERE();

#if OSD_ENABLED == ENABLED
osd.init();
#endif

GOT_HERE();

// update motor interlock state
update_using_interlock();

GOT_HERE();

#if FRAME_CONFIG == HELI_FRAME
// trad heli specific initialisation
heli_init();
#endif

GOT_HERE();

#if FRAME_CONFIG == HELI_FRAME
input_manager.set_loop_rate(scheduler.get_loop_rate_hz());
#endif

GOT_HERE();

init_rc_in(); // sets up rc channels from radio

GOT_HERE();

// initialise surface to be tracked in SurfaceTracking
// must be before rc init to not override initial switch position
surface_tracking.init((SurfaceTracking::Surface)copter.g2.surftrak_mode.get());

GOT_HERE();

// allocate the motors class
allocate_motors();

GOT_HERE();

// initialise rc channels including setting mode
rc().convert_options(RC_Channel::AUX_FUNC::ARMDISARM_UNUSED, RC_Channel::AUX_FUNC::ARMDISARM_AIRMODE);
GOT_HERE();

rc().init();

GOT_HERE();

// sets up motors and output to escs
init_rc_out();

GOT_HERE();

// check if we should enter esc calibration mode
esc_calibration_startup_check();

GOT_HERE();

// motors initialised so parameters can be sent
ap.initialised_params = true;

#if AP_RELAY_ENABLED
relay.init();
#endif

GOT_HERE();

/*
* setup the 'main loop is dead' check. Note that this relies on
* the RC library being initialised.
*/
hal.scheduler->register_timer_failsafe(failsafe_check_static, 1000);

GOT_HERE();

// Do GPS init
gps.set_log_gps_bit(MASK_LOG_GPS);
GOT_HERE();

gps.init();

GOT_HERE();

AP::compass().set_log_bit(MASK_LOG_COMPASS);
GOT_HERE();

AP::compass().init();

#if AP_AIRSPEED_ENABLED
GOT_HERE();

airspeed.set_log_bit(MASK_LOG_IMU);
#endif

#if AP_OAPATHPLANNER_ENABLED
GOT_HERE();

g2.oa.init();
#endif

GOT_HERE();

attitude_control->parameter_sanity_check();

#if AP_OPTICALFLOW_ENABLED
// initialise optical flow sensor
GOT_HERE();

optflow.init(MASK_LOG_OPTFLOW);
#endif // AP_OPTICALFLOW_ENABLED

#if HAL_MOUNT_ENABLED
// initialise camera mount
GOT_HERE();

camera_mount.init();
#endif

#if AP_CAMERA_ENABLED
// initialise camera
GOT_HERE();

camera.init();
#endif

#if AC_PRECLAND_ENABLED
// initialise precision landing
GOT_HERE();

init_precland();
#endif

#if AP_LANDINGGEAR_ENABLED
// initialise landing gear position
GOT_HERE();

landinggear.init();
#endif

Expand All @@ -130,67 +202,95 @@ void Copter::init_ardupilot()

// read Baro pressure at ground
//-----------------------------
GOT_HERE();

// Any use of barometer crashes the DSP
barometer.set_log_baro_bit(MASK_LOG_IMU);
barometer.calibrate();

#if RANGEFINDER_ENABLED == ENABLED
// initialise rangefinder
GOT_HERE();

init_rangefinder();
#endif

#if HAL_PROXIMITY_ENABLED
// init proximity sensor
GOT_HERE();

g2.proximity.init();
#endif

#if AP_BEACON_ENABLED
// init beacons used for non-gps position estimation
GOT_HERE();

g2.beacon.init();
#endif

#if AP_RPM_ENABLED
GOT_HERE();

// initialise AP_RPM library
rpm_sensor.init();
#endif

#if MODE_AUTO_ENABLED == ENABLED
GOT_HERE();

// initialise mission library
mode_auto.mission.init();
#endif

#if MODE_SMARTRTL_ENABLED == ENABLED
GOT_HERE();

// initialize SmartRTL
g2.smart_rtl.init();
#endif

#if HAL_LOGGING_ENABLED
GOT_HERE();

// initialise AP_Logger library
logger.setVehicle_Startup_Writer(FUNCTOR_BIND(&copter, &Copter::Log_Write_Vehicle_Startup_Messages, void));
#endif

GOT_HERE();

startup_INS_ground();

#if AC_CUSTOMCONTROL_MULTI_ENABLED == ENABLED
GOT_HERE();

custom_control.init();
#endif

// set landed flags
set_land_complete(true);
GOT_HERE();

set_land_complete_maybe(true);
GOT_HERE();

// enable CPU failsafe
failsafe_enable();
GOT_HERE();

ins.set_log_raw_bit(MASK_LOG_IMU_RAW);
GOT_HERE();

motors->output_min(); // output lowest possible value to motors

// attempt to set the initial_mode, else set to STABILIZE
GOT_HERE();
if (!set_mode((enum Mode::Number)g.initial_mode.get(), ModeReason::INITIALISED)) {
// set mode to STABILIZE will trigger mode change notification to pilot
set_mode(Mode::Number::STABILIZE, ModeReason::UNAVAILABLE);
}

GOT_HERE();
pos_variance_filt.set_cutoff_frequency(g2.fs_ekf_filt_hz);
vel_variance_filt.set_cutoff_frequency(g2.fs_ekf_filt_hz);
hgt_variance_filt.set_cutoff_frequency(g2.fs_ekf_filt_hz);
Expand All @@ -209,11 +309,16 @@ void Copter::startup_INS_ground()
ahrs.init();
ahrs.set_vehicle_class(AP_AHRS::VehicleClass::COPTER);

GOT_HERE();

// Warm up and calibrate gyro offsets
ins.init(scheduler.get_loop_rate_hz());

GOT_HERE();

// reset ahrs including gyro bias
ahrs.reset();
GOT_HERE();
}

// position_ok - returns true if the horizontal absolute position is ok and home position is set
Expand Down
18 changes: 9 additions & 9 deletions Tools/ardupilotwaf/ardupilotwaf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
'*.cpp',
]

COMMON_VEHICLE_DEPENDENT_CAN_LIBRARIES = [
'AP_CANManager',
'AP_KDECAN',
'AP_PiccoloCAN',
'AP_PiccoloCAN/piccolo_protocol',
]

COMMON_VEHICLE_DEPENDENT_LIBRARIES = [
'AP_Airspeed',
'AP_AccelCal',
Expand All @@ -26,15 +33,13 @@
'AP_BattMonitor',
'AP_BoardConfig',
'AP_Camera',
'AP_CANManager',
'AP_Common',
'AP_Compass',
'AP_Declination',
'AP_GPS',
'AP_HAL',
'AP_HAL_Empty',
'AP_InertialSensor',
'AP_KDECAN',
'AP_Math',
'AP_Mission',
'AP_DAL',
Expand Down Expand Up @@ -73,8 +78,6 @@
'AP_SBusOut',
'AP_IOMCU',
'AP_Parachute',
'AP_PiccoloCAN',
'AP_PiccoloCAN/piccolo_protocol',
'AP_RAMTRON',
'AP_RCProtocol',
'AP_Radio',
Expand Down Expand Up @@ -248,11 +251,8 @@ def ap_get_all_libraries(bld):
def ap_common_vehicle_libraries(bld):
libraries = COMMON_VEHICLE_DEPENDENT_LIBRARIES

if bld.env.DEST_BINFMT == 'pe':
libraries += [
'AC_Fence',
'AC_AttitudeControl',
]
if bld.env.with_can:
libraries.extend(COMMON_VEHICLE_DEPENDENT_CAN_LIBRARIES)

return libraries

Expand Down
Loading