From d140d9c1fcbdb955eb43bbb9b43a0937dcfd929e Mon Sep 17 00:00:00 2001 From: James Cotton Date: Tue, 10 May 2011 02:11:34 -0500 Subject: [PATCH 1/4] Fix from Ivan for BootloaderUpdater not building with 4.5.1 --- flight/Bootloaders/BootloaderUpdater/main.c | 6 +- .../OpenPilotOSX.xcodeproj/project.pbxproj | 181 ++++++++++++++++++ 2 files changed, 184 insertions(+), 3 deletions(-) diff --git a/flight/Bootloaders/BootloaderUpdater/main.c b/flight/Bootloaders/BootloaderUpdater/main.c index 4db806ddf..9b1691dca 100644 --- a/flight/Bootloaders/BootloaderUpdater/main.c +++ b/flight/Bootloaders/BootloaderUpdater/main.c @@ -39,9 +39,9 @@ void error(int); * data. This is non-intuitive for _binary_size where you * might expect its value to hold the size but you'd be wrong. */ -extern void _binary_start; -extern void _binary_end; -extern void _binary_size; +extern uint32_t _binary_start; +extern uint32_t _binary_end; +extern uint32_t _binary_size; const uint32_t * embedded_image_start = (uint32_t *) &(_binary_start); const uint32_t * embedded_image_end = (uint32_t *) &(_binary_end); const uint32_t embedded_image_size = (uint32_t) &(_binary_size); diff --git a/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj b/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj index 45267f708..5dd95349b 100644 --- a/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj +++ b/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj @@ -3125,6 +3125,52 @@ 65FBE14412E7C98100176B5A /* pios_servo_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_servo_priv.h; sourceTree = ""; }; 65FC66AA123F30F100B04F74 /* ahrs_timer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ahrs_timer.c; path = ../../AHRS/ahrs_timer.c; sourceTree = SOURCE_ROOT; }; 65FC66AB123F312A00B04F74 /* ahrs_timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_timer.h; sourceTree = ""; }; + 65FF4BB513791C3300146BE4 /* ahrs_slave_test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_slave_test.c; sourceTree = ""; }; + 65FF4BB613791C3300146BE4 /* ahrs_spi_program.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_spi_program.c; sourceTree = ""; }; + 65FF4BB713791C3300146BE4 /* ahrs_spi_program_master.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_spi_program_master.c; sourceTree = ""; }; + 65FF4BB813791C3300146BE4 /* ahrs_spi_program_slave.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_spi_program_slave.c; sourceTree = ""; }; + 65FF4BB913791C3300146BE4 /* bl_fsm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bl_fsm.c; sourceTree = ""; }; + 65FF4BBB13791C3300146BE4 /* ahrs_bl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_bl.h; sourceTree = ""; }; + 65FF4BBC13791C3300146BE4 /* ahrs_spi_program.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_spi_program.h; sourceTree = ""; }; + 65FF4BBD13791C3300146BE4 /* ahrs_spi_program_master.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_spi_program_master.h; sourceTree = ""; }; + 65FF4BBE13791C3300146BE4 /* ahrs_spi_program_slave.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_spi_program_slave.h; sourceTree = ""; }; + 65FF4BBF13791C3300146BE4 /* bl_fsm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bl_fsm.h; sourceTree = ""; }; + 65FF4BC013791C3300146BE4 /* pios_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_config.h; sourceTree = ""; }; + 65FF4BC113791C3300146BE4 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; + 65FF4BC213791C3300146BE4 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 65FF4BC313791C3300146BE4 /* pios_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_board.c; sourceTree = ""; }; + 65FF4BC613791C3300146BE4 /* pios_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_config.h; sourceTree = ""; }; + 65FF4BC713791C3300146BE4 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; + 65FF4BC813791C3300146BE4 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 65FF4BC913791C3300146BE4 /* pios_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_board.c; sourceTree = ""; }; + 65FF4BCA13791C3300146BE4 /* test.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = test.bin; sourceTree = ""; }; + 65FF4BCD13791C3300146BE4 /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; + 65FF4BCE13791C3300146BE4 /* op_dfu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = op_dfu.h; sourceTree = ""; }; + 65FF4BCF13791C3300146BE4 /* pios_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_config.h; sourceTree = ""; }; + 65FF4BD013791C3300146BE4 /* pios_usb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_usb.h; sourceTree = ""; }; + 65FF4BD113791C3300146BE4 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; + 65FF4BD213791C3300146BE4 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 65FF4BD313791C3300146BE4 /* op_dfu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = op_dfu.c; sourceTree = ""; }; + 65FF4BD413791C3300146BE4 /* pios_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_board.c; sourceTree = ""; }; + 65FF4BD713791C3300146BE4 /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; + 65FF4BD813791C3300146BE4 /* op_dfu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = op_dfu.h; sourceTree = ""; }; + 65FF4BD913791C3300146BE4 /* pios_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_config.h; sourceTree = ""; }; + 65FF4BDA13791C3300146BE4 /* pios_usb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_usb.h; sourceTree = ""; }; + 65FF4BDB13791C3300146BE4 /* ssp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ssp.h; sourceTree = ""; }; + 65FF4BDC13791C3300146BE4 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; + 65FF4BDD13791C3300146BE4 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 65FF4BDE13791C3300146BE4 /* op_dfu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = op_dfu.c; sourceTree = ""; }; + 65FF4BDF13791C3300146BE4 /* pios_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_board.c; sourceTree = ""; }; + 65FF4BE013791C3300146BE4 /* ssp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssp.c; sourceTree = ""; }; + 65FF4BE113791C3300146BE4 /* ssp_timer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssp_timer.c; sourceTree = ""; }; + 65FF4BE413791C3300146BE4 /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; + 65FF4BE513791C3300146BE4 /* op_dfu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = op_dfu.h; sourceTree = ""; }; + 65FF4BE613791C3300146BE4 /* pios_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_config.h; sourceTree = ""; }; + 65FF4BE713791C3300146BE4 /* pios_usb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_usb.h; sourceTree = ""; }; + 65FF4BE813791C3300146BE4 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; + 65FF4BE913791C3300146BE4 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 65FF4BEA13791C3300146BE4 /* op_dfu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = op_dfu.c; sourceTree = ""; }; + 65FF4BEB13791C3300146BE4 /* pios_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_board.c; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXGroup section */ @@ -3505,6 +3551,7 @@ 657CEEB5121DBC49007A1FBE /* flight */ = { isa = PBXGroup; children = ( + 65FF4BB313791C3300146BE4 /* Bootloaders */, 65F93B9012EE09280047DB36 /* PipXtreme */, 65B7E6AC120DF1CD000C1123 /* AHRS */, 65E6DF7012E02E8E00058553 /* CopterControl */, @@ -8238,6 +8285,140 @@ path = inc; sourceTree = ""; }; + 65FF4BB313791C3300146BE4 /* Bootloaders */ = { + isa = PBXGroup; + children = ( + 65FF4BB413791C3300146BE4 /* AHRS */, + 65FF4BC413791C3300146BE4 /* BootloaderUpdater */, + 65FF4BCB13791C3300146BE4 /* CopterControl */, + 65FF4BD513791C3300146BE4 /* OpenPilot */, + 65FF4BE213791C3300146BE4 /* PipXtreme */, + ); + name = Bootloaders; + path = ../../Bootloaders; + sourceTree = SOURCE_ROOT; + }; + 65FF4BB413791C3300146BE4 /* AHRS */ = { + isa = PBXGroup; + children = ( + 65FF4BB513791C3300146BE4 /* ahrs_slave_test.c */, + 65FF4BB613791C3300146BE4 /* ahrs_spi_program.c */, + 65FF4BB713791C3300146BE4 /* ahrs_spi_program_master.c */, + 65FF4BB813791C3300146BE4 /* ahrs_spi_program_slave.c */, + 65FF4BB913791C3300146BE4 /* bl_fsm.c */, + 65FF4BBA13791C3300146BE4 /* inc */, + 65FF4BC113791C3300146BE4 /* main.c */, + 65FF4BC213791C3300146BE4 /* Makefile */, + 65FF4BC313791C3300146BE4 /* pios_board.c */, + ); + path = AHRS; + sourceTree = ""; + }; + 65FF4BBA13791C3300146BE4 /* inc */ = { + isa = PBXGroup; + children = ( + 65FF4BBB13791C3300146BE4 /* ahrs_bl.h */, + 65FF4BBC13791C3300146BE4 /* ahrs_spi_program.h */, + 65FF4BBD13791C3300146BE4 /* ahrs_spi_program_master.h */, + 65FF4BBE13791C3300146BE4 /* ahrs_spi_program_slave.h */, + 65FF4BBF13791C3300146BE4 /* bl_fsm.h */, + 65FF4BC013791C3300146BE4 /* pios_config.h */, + ); + path = inc; + sourceTree = ""; + }; + 65FF4BC413791C3300146BE4 /* BootloaderUpdater */ = { + isa = PBXGroup; + children = ( + 65FF4BC513791C3300146BE4 /* inc */, + 65FF4BC713791C3300146BE4 /* main.c */, + 65FF4BC813791C3300146BE4 /* Makefile */, + 65FF4BC913791C3300146BE4 /* pios_board.c */, + 65FF4BCA13791C3300146BE4 /* test.bin */, + ); + path = BootloaderUpdater; + sourceTree = ""; + }; + 65FF4BC513791C3300146BE4 /* inc */ = { + isa = PBXGroup; + children = ( + 65FF4BC613791C3300146BE4 /* pios_config.h */, + ); + path = inc; + sourceTree = ""; + }; + 65FF4BCB13791C3300146BE4 /* CopterControl */ = { + isa = PBXGroup; + children = ( + 65FF4BCC13791C3300146BE4 /* inc */, + 65FF4BD113791C3300146BE4 /* main.c */, + 65FF4BD213791C3300146BE4 /* Makefile */, + 65FF4BD313791C3300146BE4 /* op_dfu.c */, + 65FF4BD413791C3300146BE4 /* pios_board.c */, + ); + path = CopterControl; + sourceTree = ""; + }; + 65FF4BCC13791C3300146BE4 /* inc */ = { + isa = PBXGroup; + children = ( + 65FF4BCD13791C3300146BE4 /* common.h */, + 65FF4BCE13791C3300146BE4 /* op_dfu.h */, + 65FF4BCF13791C3300146BE4 /* pios_config.h */, + 65FF4BD013791C3300146BE4 /* pios_usb.h */, + ); + path = inc; + sourceTree = ""; + }; + 65FF4BD513791C3300146BE4 /* OpenPilot */ = { + isa = PBXGroup; + children = ( + 65FF4BD613791C3300146BE4 /* inc */, + 65FF4BDC13791C3300146BE4 /* main.c */, + 65FF4BDD13791C3300146BE4 /* Makefile */, + 65FF4BDE13791C3300146BE4 /* op_dfu.c */, + 65FF4BDF13791C3300146BE4 /* pios_board.c */, + 65FF4BE013791C3300146BE4 /* ssp.c */, + 65FF4BE113791C3300146BE4 /* ssp_timer.c */, + ); + path = OpenPilot; + sourceTree = ""; + }; + 65FF4BD613791C3300146BE4 /* inc */ = { + isa = PBXGroup; + children = ( + 65FF4BD713791C3300146BE4 /* common.h */, + 65FF4BD813791C3300146BE4 /* op_dfu.h */, + 65FF4BD913791C3300146BE4 /* pios_config.h */, + 65FF4BDA13791C3300146BE4 /* pios_usb.h */, + 65FF4BDB13791C3300146BE4 /* ssp.h */, + ); + path = inc; + sourceTree = ""; + }; + 65FF4BE213791C3300146BE4 /* PipXtreme */ = { + isa = PBXGroup; + children = ( + 65FF4BE313791C3300146BE4 /* inc */, + 65FF4BE813791C3300146BE4 /* main.c */, + 65FF4BE913791C3300146BE4 /* Makefile */, + 65FF4BEA13791C3300146BE4 /* op_dfu.c */, + 65FF4BEB13791C3300146BE4 /* pios_board.c */, + ); + path = PipXtreme; + sourceTree = ""; + }; + 65FF4BE313791C3300146BE4 /* inc */ = { + isa = PBXGroup; + children = ( + 65FF4BE413791C3300146BE4 /* common.h */, + 65FF4BE513791C3300146BE4 /* op_dfu.h */, + 65FF4BE613791C3300146BE4 /* pios_config.h */, + 65FF4BE713791C3300146BE4 /* pios_usb.h */, + ); + path = inc; + sourceTree = ""; + }; C6A0FF2B0290797F04C91782 /* Documentation */ = { isa = PBXGroup; children = ( From 163d41fb604620854addbd8b71fca33df2d1aa8f Mon Sep 17 00:00:00 2001 From: James Cotton Date: Tue, 10 May 2011 02:43:55 -0500 Subject: [PATCH 2/4] OP-466: Make the test output panel work when there is not a valid mixer configured. However unlike previous patch keeps alarms showing so you will be unable to arm normally. --- flight/Modules/Actuator/actuator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flight/Modules/Actuator/actuator.c b/flight/Modules/Actuator/actuator.c index c0a52b426..2766e1e0a 100644 --- a/flight/Modules/Actuator/actuator.c +++ b/flight/Modules/Actuator/actuator.c @@ -182,7 +182,7 @@ static void actuatorTask(void* parameters) nMixers ++; } } - if(nMixers < 2) //Nothing can fly with less than two mixers. + if((nMixers < 2) && !ActuatorCommandReadOnly(dummy)) //Nothing can fly with less than two mixers. { setFailsafe(); // So that channels like PWM buzzer keep working continue; From 5d28276c49a6b0f8560808ed9aded01a428af782 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Wed, 11 May 2011 17:35:52 -0500 Subject: [PATCH 3/4] Reshuffle memory allocation on CC after FlightStatus object introduced --- flight/CopterControl/System/inc/pios_config.h | 10 +++++----- flight/Modules/System/systemmod.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flight/CopterControl/System/inc/pios_config.h b/flight/CopterControl/System/inc/pios_config.h index 4362dbca2..af1b7d22d 100644 --- a/flight/CopterControl/System/inc/pios_config.h +++ b/flight/CopterControl/System/inc/pios_config.h @@ -84,16 +84,16 @@ #define AUXUART_BAUDRATE 19200 /* Alarm Thresholds */ -#define HEAP_LIMIT_WARNING 450 -#define HEAP_LIMIT_CRITICAL 350 +#define HEAP_LIMIT_WARNING 350 +#define HEAP_LIMIT_CRITICAL 250 #define CPULOAD_LIMIT_WARNING 80 #define CPULOAD_LIMIT_CRITICAL 95 /* Task stack sizes */ #define PIOS_ACTUATOR_STACK_SIZE 1020 -#define PIOS_MANUAL_STACK_SIZE 644 -#define PIOS_SYSTEM_STACK_SIZE 644 -#define PIOS_STABILIZATION_STACK_SIZE 624 +#define PIOS_MANUAL_STACK_SIZE 724 +#define PIOS_SYSTEM_STACK_SIZE 504 +#define PIOS_STABILIZATION_STACK_SIZE 524 #define PIOS_TELEM_STACK_SIZE 500 #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 diff --git a/flight/Modules/System/systemmod.c b/flight/Modules/System/systemmod.c index 1cc3a6a5b..c36160a1e 100644 --- a/flight/Modules/System/systemmod.c +++ b/flight/Modules/System/systemmod.c @@ -59,8 +59,8 @@ // optimisation options are changed. #endif -#if defined(PIOS_MANUAL_STACK_SIZE) -#define STACK_SIZE_BYTES PIOS_MANUAL_STACK_SIZE +#if defined(PIOS_SYSTEM_STACK_SIZE) +#define STACK_SIZE_BYTES PIOS_SYSTEM_STACK_SIZE #else #define STACK_SIZE_BYTES 924 #endif From 338d3632890cd5e81bbafcf34e619f41043e076a Mon Sep 17 00:00:00 2001 From: James Cotton Date: Wed, 11 May 2011 20:09:28 -0500 Subject: [PATCH 4/4] When a channel is disabled in the mixer force the channel to have a 0 us pulse duration. The default before was neutral in failsafe. --- flight/Modules/Actuator/actuator.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/flight/Modules/Actuator/actuator.c b/flight/Modules/Actuator/actuator.c index 2766e1e0a..b2f143adf 100644 --- a/flight/Modules/Actuator/actuator.c +++ b/flight/Modules/Actuator/actuator.c @@ -198,8 +198,12 @@ static void actuatorTask(void* parameters) float curve2 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve2); for(int ct=0; ct < MAX_MIX_ACTUATORS; ct++) { - if(mixers[ct].type == MIXERSETTINGS_MIXER1TYPE_DISABLED) + if(mixers[ct].type == MIXERSETTINGS_MIXER1TYPE_DISABLED) { + // Set to minimum if disabled. This is not the same as saying PWM pulse = 0 us + status[ct] = -1; + command.Channel[ct] = 0; continue; + } status[ct] = ProcessMixer(ct, curve1, curve2, &mixerSettings, &desired, dT); @@ -400,14 +404,19 @@ static void setFailsafe() // Reset ActuatorCommand to safe values for (int n = 0; n < ACTUATORCOMMAND_CHANNEL_NUMELEM; ++n) { + if(mixers[n].type == MIXERSETTINGS_MIXER1TYPE_MOTOR) { command.Channel[n] = settings.ChannelMin[n]; } - else + else if(mixers[n].type == MIXERSETTINGS_MIXER1TYPE_SERVO) { command.Channel[n] = settings.ChannelNeutral[n]; } + else + { + command.Channel[n] = 0; + } } // Set alarm