diff --git a/flight/AHRS/Makefile b/flight/AHRS/Makefile index 4a66ff2a8..09230f439 100644 --- a/flight/AHRS/Makefile +++ b/flight/AHRS/Makefile @@ -121,6 +121,7 @@ SRC += $(PIOSCOMMON)/pios_com.c SRC += $(PIOSCOMMON)/pios_hmc5843.c SRC += $(PIOSCOMMON)/printf-stdarg.c SRC += $(PIOSCOMMON)/pios_iap.c +SRC += $(PIOSCOMMON)/pios_bl_helper.c ## CMSIS for STM32 SRC += $(CMSISDIR)/core_cm3.c diff --git a/flight/AHRS/ahrs.c b/flight/AHRS/ahrs.c index 1c15d5c69..57f9e11e2 100644 --- a/flight/AHRS/ahrs.c +++ b/flight/AHRS/ahrs.c @@ -99,8 +99,6 @@ void affine_rotate(float scale[3][4], float rotation[3]); void calibration(float result[3], float scale[3][4], float arg[3]); /* Bootloader related functions and var*/ -static uint32_t iap_calc_crc(void); -static void read_description(uint8_t *); void firmwareiapobj_callback(AhrsObjHandle obj); volatile uint8_t reset_count=0; @@ -1249,36 +1247,15 @@ void firmwareiapobj_callback(AhrsObjHandle obj) } } } - else if(firmwareIAPObj.BoardType==BOARD_TYPE && firmwareIAPObj.crc!=iap_calc_crc()) + else if(firmwareIAPObj.BoardType==BOARD_TYPE && firmwareIAPObj.crc!=PIOS_BL_HELPER_CRC_Memory_Calc()) { - read_description(firmwareIAPObj.Description); - firmwareIAPObj.crc=iap_calc_crc(); + PIOS_BL_HELPER_FLASH_Read_Description(firmwareIAPObj.Description,SIZE_OF_DESCRIPTION); + firmwareIAPObj.crc=PIOS_BL_HELPER_CRC_Memory_Calc(); firmwareIAPObj.BoardRevision=BOARD_REVISION; FirmwareIAPObjSet(&firmwareIAPObj); } } -static uint32_t iap_calc_crc(void) -{ - RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE); - CRC_ResetDR(); - CRC_CalcBlockCRC((uint32_t *) START_OF_USER_CODE, (SIZE_OF_CODE) >> 2); - return CRC_GetCRC(); -} -static uint8_t *FLASH_If_Read(uint32_t SectorAddress) -{ - return (uint8_t *) (SectorAddress); -} -static void read_description(uint8_t * array) -{ - uint8_t x = 0; - for (uint32_t i = START_OF_USER_CODE + SIZE_OF_CODE; i < START_OF_USER_CODE + SIZE_OF_CODE + SIZE_OF_DESCRIPTION; ++i) { - array[x] = *FLASH_If_Read(i); - ++x; - } -} - - /** * @} */ diff --git a/flight/AHRS/inc/pios_config.h b/flight/AHRS/inc/pios_config.h index e60544d60..64f3559a0 100644 --- a/flight/AHRS/inc/pios_config.h +++ b/flight/AHRS/inc/pios_config.h @@ -40,5 +40,6 @@ #define PIOS_INCLUDE_HMC5843 #define PIOS_INCLUDE_GPIO #define PIOS_INCLUDE_EXTI +#define PIOS_INCLUDE_BL_HELPER #endif /* PIOS_CONFIG_H */ diff --git a/flight/Bootloaders/AHRS/inc/pios_config.h b/flight/Bootloaders/AHRS/inc/pios_config.h index 601701c1e..488d99b83 100644 --- a/flight/Bootloaders/AHRS/inc/pios_config.h +++ b/flight/Bootloaders/AHRS/inc/pios_config.h @@ -35,6 +35,7 @@ #define PIOS_INCLUDE_SPI #define PIOS_INCLUDE_SYS #define PIOS_INCLUDE_BL_HELPER +#define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT #define PIOS_INCLUDE_GPIO #endif /* PIOS_CONFIG_H */ diff --git a/flight/Bootloaders/AHRS/main.c b/flight/Bootloaders/AHRS/main.c index 41d04175a..1a8798702 100644 --- a/flight/Bootloaders/AHRS/main.c +++ b/flight/Bootloaders/AHRS/main.c @@ -96,7 +96,7 @@ int main() { } PIOS_Board_Init(); boot_status = idle; - Fw_crc = crc_memory_calc(); + Fw_crc = PIOS_BL_HELPER_CRC_Memory_Calc(); PIOS_LED_On(LED1); while (1) { process_spi_request(); @@ -146,7 +146,7 @@ void process_spi_request(void) { case OPAHRS_MSG_V0_REQ_FWUP_VERIFY: opahrs_msg_v0_init_user_tx(&user_tx_v0, OPAHRS_MSG_V0_RSP_FWUP_STATUS); - Fw_crc = crc_memory_calc(); + Fw_crc = PIOS_BL_HELPER_CRC_Memory_Calc(); lfsm_user_set_tx_v0(&user_tx_v0); boot_status = idle; PIOS_LED_Off(LED1); @@ -216,7 +216,7 @@ void process_spi_request(void) { uint32_t adr=user_rx_v0.payload.user.v.req.fwdn_data.adress; for(uint8_t x=0;x<4;++x) { - user_tx_v0.payload.user.v.rsp.fw_dn.data[x]=*FLASH_If_Read(adr+x); + user_tx_v0.payload.user.v.rsp.fw_dn.data[x]=*PIOS_BL_HELPER_FLASH_If_Read(adr+x); } lfsm_user_set_tx_v0(&user_tx_v0); break; @@ -226,7 +226,7 @@ void process_spi_request(void) { user_tx_v0.payload.user.v.rsp.fwup_status.status = boot_status; lfsm_user_set_tx_v0(&user_tx_v0); PIOS_LED_On(LED1); - if (FLASH_Start() == TRUE) { + if (PIOS_BL_HELPER_FLASH_Start() == TRUE) { boot_status = started; PIOS_LED_Off(LED1); } else { diff --git a/flight/Bootloaders/CopterControl/inc/pios_config.h b/flight/Bootloaders/CopterControl/inc/pios_config.h index bfdea4f1a..594029bba 100644 --- a/flight/Bootloaders/CopterControl/inc/pios_config.h +++ b/flight/Bootloaders/CopterControl/inc/pios_config.h @@ -31,6 +31,7 @@ #ifndef PIOS_CONFIG_H #define PIOS_CONFIG_H #define PIOS_INCLUDE_BL_HELPER +#define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT #define USB_HID /* Enable/Disable PiOS Modules */ #define PIOS_INCLUDE_DELAY @@ -61,4 +62,4 @@ /** * @} * @} - */ + */ diff --git a/flight/Bootloaders/CopterControl/op_dfu.c b/flight/Bootloaders/CopterControl/op_dfu.c index 3a84d4d16..9da07835b 100644 --- a/flight/Bootloaders/CopterControl/op_dfu.c +++ b/flight/Bootloaders/CopterControl/op_dfu.c @@ -116,10 +116,10 @@ void DataDownload(DownloadAction action) { } break; case Self_flash: - SendBuffer[6 + (x * 4)] = *FLASH_If_Read(offset); - SendBuffer[7 + (x * 4)] = *FLASH_If_Read(offset + 1); - SendBuffer[8 + (x * 4)] = *FLASH_If_Read(offset + 2); - SendBuffer[9 + (x * 4)] = *FLASH_If_Read(offset + 3); + SendBuffer[6 + (x * 4)] = *PIOS_BL_HELPER_FLASH_If_Read(offset); + SendBuffer[7 + (x * 4)] = *PIOS_BL_HELPER_FLASH_If_Read(offset + 1); + SendBuffer[8 + (x * 4)] = *PIOS_BL_HELPER_FLASH_If_Read(offset + 2); + SendBuffer[9 + (x * 4)] = *PIOS_BL_HELPER_FLASH_If_Read(offset + 3); break; } */ @@ -178,7 +178,7 @@ void processComand(uint8_t *xReceive_Buffer) { uint8_t result = 0; switch (currentProgrammingDestination) { case Self_flash: - result = FLASH_Ini(); + result = PIOS_BL_HELPER_FLASH_Ini(); break; case Remote_flash_via_spi: result = TRUE; @@ -214,7 +214,7 @@ void processComand(uint8_t *xReceive_Buffer) { if (TransferType == FW) { switch (currentProgrammingDestination) { case Self_flash: - result = FLASH_Start(); + result = PIOS_BL_HELPER_FLASH_Start(); break; case Remote_flash_via_spi: result = FALSE; @@ -459,7 +459,7 @@ uint8_t isBiggerThanAvailable(DFUTransfer type, uint32_t size) { uint32_t CalcFirmCRC() { switch (currentProgrammingDestination) { case Self_flash: - return crc_memory_calc(); + return PIOS_BL_HELPER_CRC_Memory_Calc(); break; case Remote_flash_via_spi: return 0; @@ -484,7 +484,7 @@ bool flash_read(uint8_t * buffer, uint32_t adr, DFUProgType type) { break; case Self_flash: for (uint8_t x = 0; x < 4; ++x) { - buffer[x] = *FLASH_If_Read(adr + x); + buffer[x] = *PIOS_BL_HELPER_FLASH_If_Read(adr + x); } return TRUE; break; diff --git a/flight/Bootloaders/OpenPilot/inc/pios_config.h b/flight/Bootloaders/OpenPilot/inc/pios_config.h index f0c46c8ed..4f881c26f 100644 --- a/flight/Bootloaders/OpenPilot/inc/pios_config.h +++ b/flight/Bootloaders/OpenPilot/inc/pios_config.h @@ -31,6 +31,7 @@ #ifndef PIOS_CONFIG_H #define PIOS_CONFIG_H #define PIOS_INCLUDE_BL_HELPER +#define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT #define USB_HID /* Enable/Disable PiOS Modules */ #define PIOS_INCLUDE_DELAY @@ -64,4 +65,4 @@ /** * @} * @} - */ + */ diff --git a/flight/Bootloaders/OpenPilot/op_dfu.c b/flight/Bootloaders/OpenPilot/op_dfu.c index 3b3fa159e..92b3c7d7b 100644 --- a/flight/Bootloaders/OpenPilot/op_dfu.c +++ b/flight/Bootloaders/OpenPilot/op_dfu.c @@ -158,7 +158,7 @@ void processComand(uint8_t *xReceive_Buffer) { uint8_t result = 0; switch (currentProgrammingDestination) { case Self_flash: - result = FLASH_Ini(); + result = PIOS_BL_HELPER_FLASH_Ini(); break; case Remote_flash_via_spi: result = TRUE; @@ -195,7 +195,7 @@ void processComand(uint8_t *xReceive_Buffer) { if (TransferType == FW) { switch (currentProgrammingDestination) { case Self_flash: - result = FLASH_Start(); + result = PIOS_BL_HELPER_FLASH_Start(); break; case Remote_flash_via_spi: PIOS_OPAHRS_bl_FwupStart(&rsp); @@ -525,7 +525,7 @@ uint32_t CalcFirmCRC() { struct opahrs_msg_v0 rsp; switch (currentProgrammingDestination) { case Self_flash: - return crc_memory_calc(); + return PIOS_BL_HELPER_CRC_Memory_Calc(); break; case Remote_flash_via_spi: PIOS_OPAHRS_bl_FwupVerify(&rsp); @@ -574,7 +574,7 @@ bool flash_read(uint8_t * buffer, uint32_t adr, DFUProgType type) { break; case Self_flash: for (uint8_t x = 0; x < 4; ++x) { - buffer[x] = *FLASH_If_Read(adr + x); + buffer[x] = *PIOS_BL_HELPER_FLASH_If_Read(adr + x); } return TRUE; break; diff --git a/flight/Bootloaders/PipXtreme/inc/pios_config.h b/flight/Bootloaders/PipXtreme/inc/pios_config.h index bfdea4f1a..594029bba 100644 --- a/flight/Bootloaders/PipXtreme/inc/pios_config.h +++ b/flight/Bootloaders/PipXtreme/inc/pios_config.h @@ -31,6 +31,7 @@ #ifndef PIOS_CONFIG_H #define PIOS_CONFIG_H #define PIOS_INCLUDE_BL_HELPER +#define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT #define USB_HID /* Enable/Disable PiOS Modules */ #define PIOS_INCLUDE_DELAY @@ -61,4 +62,4 @@ /** * @} * @} - */ + */ diff --git a/flight/Bootloaders/PipXtreme/op_dfu.c b/flight/Bootloaders/PipXtreme/op_dfu.c index 3a84d4d16..9da07835b 100644 --- a/flight/Bootloaders/PipXtreme/op_dfu.c +++ b/flight/Bootloaders/PipXtreme/op_dfu.c @@ -116,10 +116,10 @@ void DataDownload(DownloadAction action) { } break; case Self_flash: - SendBuffer[6 + (x * 4)] = *FLASH_If_Read(offset); - SendBuffer[7 + (x * 4)] = *FLASH_If_Read(offset + 1); - SendBuffer[8 + (x * 4)] = *FLASH_If_Read(offset + 2); - SendBuffer[9 + (x * 4)] = *FLASH_If_Read(offset + 3); + SendBuffer[6 + (x * 4)] = *PIOS_BL_HELPER_FLASH_If_Read(offset); + SendBuffer[7 + (x * 4)] = *PIOS_BL_HELPER_FLASH_If_Read(offset + 1); + SendBuffer[8 + (x * 4)] = *PIOS_BL_HELPER_FLASH_If_Read(offset + 2); + SendBuffer[9 + (x * 4)] = *PIOS_BL_HELPER_FLASH_If_Read(offset + 3); break; } */ @@ -178,7 +178,7 @@ void processComand(uint8_t *xReceive_Buffer) { uint8_t result = 0; switch (currentProgrammingDestination) { case Self_flash: - result = FLASH_Ini(); + result = PIOS_BL_HELPER_FLASH_Ini(); break; case Remote_flash_via_spi: result = TRUE; @@ -214,7 +214,7 @@ void processComand(uint8_t *xReceive_Buffer) { if (TransferType == FW) { switch (currentProgrammingDestination) { case Self_flash: - result = FLASH_Start(); + result = PIOS_BL_HELPER_FLASH_Start(); break; case Remote_flash_via_spi: result = FALSE; @@ -459,7 +459,7 @@ uint8_t isBiggerThanAvailable(DFUTransfer type, uint32_t size) { uint32_t CalcFirmCRC() { switch (currentProgrammingDestination) { case Self_flash: - return crc_memory_calc(); + return PIOS_BL_HELPER_CRC_Memory_Calc(); break; case Remote_flash_via_spi: return 0; @@ -484,7 +484,7 @@ bool flash_read(uint8_t * buffer, uint32_t adr, DFUProgType type) { break; case Self_flash: for (uint8_t x = 0; x < 4; ++x) { - buffer[x] = *FLASH_If_Read(adr + x); + buffer[x] = *PIOS_BL_HELPER_FLASH_If_Read(adr + x); } return TRUE; break; diff --git a/flight/CopterControl/Makefile b/flight/CopterControl/Makefile index a48ae8d7c..a6ff62c70 100644 --- a/flight/CopterControl/Makefile +++ b/flight/CopterControl/Makefile @@ -216,6 +216,7 @@ SRC += $(PIOSCOMMON)/pios_adxl345.c SRC += $(PIOSCOMMON)/pios_com.c SRC += $(PIOSCOMMON)/pios_i2c_esc.c SRC += $(PIOSCOMMON)/pios_iap.c +SRC += $(PIOSCOMMON)/pios_bl_helper.c SRC += $(PIOSCOMMON)/printf-stdarg.c ## Libraries for flight calculations SRC += $(FLIGHTLIB)/fifo_buffer.c diff --git a/flight/CopterControl/System/alarms.c b/flight/CopterControl/System/alarms.c index 2ebc6385f..e899be779 100644 --- a/flight/CopterControl/System/alarms.c +++ b/flight/CopterControl/System/alarms.c @@ -77,7 +77,6 @@ int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity { alarms.Alarm[alarm] = severity; SystemAlarmsSet(&alarms); - SystemAlarmsUpdated(); // force telemetry update since the alarm was changed } // Release lock diff --git a/flight/CopterControl/System/inc/pios_config.h b/flight/CopterControl/System/inc/pios_config.h index ed4e83aab..67328c0f8 100644 --- a/flight/CopterControl/System/inc/pios_config.h +++ b/flight/CopterControl/System/inc/pios_config.h @@ -65,6 +65,7 @@ #define PIOS_INCLUDE_GPIO #define PIOS_INCLUDE_EXTI #define PIOS_INCLUDE_WDG +#define PIOS_INCLUDE_BL_HELPER #define PIOS_INCLUDE_ADXL345 #define PIOS_INCLUDE_FLASH diff --git a/flight/Modules/FirmwareIAP/firmwareiap.c b/flight/Modules/FirmwareIAP/firmwareiap.c index 2301363ba..71de8c390 100644 --- a/flight/Modules/FirmwareIAP/firmwareiap.c +++ b/flight/Modules/FirmwareIAP/firmwareiap.c @@ -47,7 +47,6 @@ #define RESET_DELAY 500 /* delay between sending reset ot INS */ - #define TICKS2MS(t) ((t)/portTICK_RATE_MS) #define MS2TICKS(m) ((m)*portTICK_RATE_MS) @@ -59,18 +58,12 @@ const uint32_t iap_time_3_high_end = 5000; // Private types // Private variables -const static uint8_t version[] = { 0, 0, 1 }; -const static uint16_t SVN = 12345; static uint8_t reset_count = 0; static portTickType lastResetSysTime; // Private functions static void FirmwareIAPCallback(UAVObjEvent* ev); -static uint32_t iap_calc_crc(void); - -static void read_description(uint8_t *); - FirmwareIAPObjData data; static uint32_t get_time(void); @@ -97,7 +90,8 @@ static void resetTask(UAVObjEvent *); int32_t FirmwareIAPInitialize() { data.BoardType= BOARD_TYPE; - read_description(data.Description); + PIOS_BL_HELPER_FLASH_Read_Description(data.Description,FIRMWAREIAPOBJ_DESCRIPTION_NUMELEM); + PIOS_SYS_SerialNumberGetBinary(data.CPUSerial); data.BoardRevision= BOARD_REVISION; data.ArmReset=0; data.crc = 0; @@ -130,11 +124,12 @@ static void FirmwareIAPCallback(UAVObjEvent* ev) this_time = get_time(); delta = this_time - last_time; last_time = this_time; - if((data.BoardType==BOARD_TYPE)&&(data.crc != iap_calc_crc())) + if((data.BoardType==BOARD_TYPE)&&(data.crc != PIOS_BL_HELPER_CRC_Memory_Calc())) { - read_description(data.Description); + PIOS_BL_HELPER_FLASH_Read_Description(data.Description,FIRMWAREIAPOBJ_DESCRIPTION_NUMELEM); + PIOS_SYS_SerialNumberGetBinary(data.CPUSerial); data.BoardRevision=BOARD_REVISION; - data.crc = iap_calc_crc(); + data.crc = PIOS_BL_HELPER_CRC_Memory_Calc(); FirmwareIAPObjSet( &data ); } if((data.ArmReset==1)&&(iap_state!=IAP_STATE_RESETTING)) @@ -213,41 +208,6 @@ static uint32_t get_time(void) return TICKS2MS(ticks); } - - -/*! - * \brief Calculate the CRC value of the code in flash. - * \param None - * \return calculated CRC value using STM32's builtin CRC hardware - * - * \note - * I copied this function as the function crc calc function in pios_bl_helper.c - * is only included when the PIOS_BL_HELPER is defined, but this also includes - * the flash unlock and erase functions. It is safer to only have the flash - * functions in the bootloader. - * - */ - -static uint32_t iap_calc_crc(void) -{ - RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE); - CRC_ResetDR(); - CRC_CalcBlockCRC((uint32_t *) START_OF_USER_CODE, (SIZE_OF_CODE) >> 2); - return CRC_GetCRC(); -} -static uint8_t *FLASH_If_Read(uint32_t SectorAddress) -{ - return (uint8_t *) (SectorAddress); -} -static void read_description(uint8_t * array) -{ - uint8_t x = 0; - for (uint32_t i = START_OF_USER_CODE + SIZE_OF_CODE; i < START_OF_USER_CODE + SIZE_OF_CODE + SIZE_OF_DESCRIPTION; ++i) { - array[x] = *FLASH_If_Read(i); - ++x; - } -} - /** * Executed by event dispatcher callback to reset INS before resetting OP */ diff --git a/flight/Modules/GPS/GPS.c b/flight/Modules/GPS/GPS.c index 7878e90dd..80fb044d9 100644 --- a/flight/Modules/GPS/GPS.c +++ b/flight/Modules/GPS/GPS.c @@ -53,8 +53,11 @@ // Private functions static void gpsTask(void *parameters); + +#ifdef PIOS_GPS_SETS_HOMELOCATION static void setHomeLocation(GPSPositionData * gpsData); static float GravityAccel(float latitude, float longitude, float altitude); +#endif // **************** // Private constants @@ -65,11 +68,19 @@ static float GravityAccel(float latitude, float longitude, float altitude); #define GPS_TIMEOUT_MS 500 #define GPS_COMMAND_RESEND_TIMEOUT_MS 2000 +#ifdef PIOS_GPS_SETS_HOMELOCATION // Unfortunately need a good size stack for the WMM calculation -#ifdef ENABLE_GPS_BINARY_GTOP - #define STACK_SIZE_BYTES 800 + #ifdef ENABLE_GPS_BINARY_GTOP + #define STACK_SIZE_BYTES 800 + #else + #define STACK_SIZE_BYTES 800 + #endif #else - #define STACK_SIZE_BYTES 800 + #ifdef ENABLE_GPS_BINARY_GTOP + #define STACK_SIZE_BYTES 440 + #else + #define STACK_SIZE_BYTES 440 + #endif #endif #define TASK_PRIORITY (tskIDLE_PRIORITY + 1) @@ -311,12 +322,15 @@ static void gpsTask(void *parameters) else { // we appear to be receiving GPS sentences OK, we've had an update + GPSPositionGet(&GpsData); + +#ifdef PIOS_GPS_SETS_HOMELOCATION HomeLocationData home; HomeLocationGet(&home); - GPSPositionGet(&GpsData); if ((GpsData.Status == GPSPOSITION_STATUS_FIX3D) && (home.Set == HOMELOCATION_SET_FALSE)) setHomeLocation(&GpsData); +#endif //criteria for GPS-OK taken from this post... //http://forums.openpilot.org/topic/1523-professors-insgps-in-svn/page__view__findpost__p__5220 @@ -334,6 +348,7 @@ static void gpsTask(void *parameters) } } +#ifdef PIOS_GPS_SETS_HOMELOCATION /* * Estimate the acceleration due to gravity for a particular location in LLA */ @@ -389,6 +404,7 @@ static void setHomeLocation(GPSPositionData * gpsData) } } } +#endif // **************** diff --git a/flight/OpenPilot/Makefile b/flight/OpenPilot/Makefile index cf990388c..e281af9bd 100644 --- a/flight/OpenPilot/Makefile +++ b/flight/OpenPilot/Makefile @@ -208,6 +208,7 @@ SRC += $(PIOSCOMMON)/pios_bmp085.c SRC += $(PIOSCOMMON)/pios_hcsr04.c SRC += $(PIOSCOMMON)/pios_i2c_esc.c SRC += $(PIOSCOMMON)/pios_iap.c +SRC += $(PIOSCOMMON)/pios_bl_helper.c SRC += $(PIOSCOMMON)/printf-stdarg.c SRC += $(FLIGHTLIB)/ahrs_spi_comm.c SRC += $(FLIGHTLIB)/ahrs_comm_objects.c diff --git a/flight/OpenPilot/System/alarms.c b/flight/OpenPilot/System/alarms.c index 2ebc6385f..e899be779 100644 --- a/flight/OpenPilot/System/alarms.c +++ b/flight/OpenPilot/System/alarms.c @@ -77,7 +77,6 @@ int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity { alarms.Alarm[alarm] = severity; SystemAlarmsSet(&alarms); - SystemAlarmsUpdated(); // force telemetry update since the alarm was changed } // Release lock diff --git a/flight/OpenPilot/System/inc/pios_config.h b/flight/OpenPilot/System/inc/pios_config.h index 3f4b1e706..f3fe8671b 100644 --- a/flight/OpenPilot/System/inc/pios_config.h +++ b/flight/OpenPilot/System/inc/pios_config.h @@ -66,6 +66,7 @@ #define PIOS_INCLUDE_RTC #define PIOS_INCLUDE_WDG #define PIOS_INCLUDE_I2C_ESC +#define PIOS_INCLUDE_BL_HELPER /* Defaults for Logging */ #define LOG_FILENAME "PIOS.LOG" @@ -89,6 +90,9 @@ /* Stabilization options */ #define PIOS_QUATERNION_STABILIZATION +/* GPS options */ +#define PIOS_GPS_SETS_HOMELOCATION + #endif /* PIOS_CONFIG_H */ /** diff --git a/flight/PiOS/Common/pios_bl_helper.c b/flight/PiOS/Common/pios_bl_helper.c index 99058b2cb..545a008c6 100644 --- a/flight/PiOS/Common/pios_bl_helper.c +++ b/flight/PiOS/Common/pios_bl_helper.c @@ -33,18 +33,19 @@ #if defined(PIOS_INCLUDE_BL_HELPER) #include "stm32f10x_flash.h" -uint8_t *FLASH_If_Read(uint32_t SectorAddress) +uint8_t *PIOS_BL_HELPER_FLASH_If_Read(uint32_t SectorAddress) { return (uint8_t *) (SectorAddress); } -uint8_t FLASH_Ini() +#if defined(PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT) +uint8_t PIOS_BL_HELPER_FLASH_Ini() { FLASH_Unlock(); return 1; } -uint8_t FLASH_Start() +uint8_t PIOS_BL_HELPER_FLASH_Start() { uint32_t pageAdress; pageAdress = START_OF_USER_CODE; @@ -70,24 +71,27 @@ uint8_t FLASH_Start() return (fail == TRUE) ? 0 : 1; } +#endif -uint32_t crc_memory_calc() +uint32_t PIOS_BL_HELPER_CRC_Memory_Calc() { + PIOS_BL_HELPER_CRC_Ini(); CRC_ResetDR(); CRC_CalcBlockCRC((uint32_t *) START_OF_USER_CODE, (SIZE_OF_CODE) >> 2); return CRC_GetCRC(); } -void read_description(uint8_t * array) +void PIOS_BL_HELPER_FLASH_Read_Description(uint8_t * array, uint8_t size) { uint8_t x = 0; - for (uint32_t i = START_OF_USER_CODE + SIZE_OF_CODE; i < START_OF_USER_CODE + SIZE_OF_CODE + SIZE_OF_DESCRIPTION; ++i) { - array[x] = *FLASH_If_Read(i); + if (size>SIZE_OF_DESCRIPTION) size = SIZE_OF_DESCRIPTION; + for (uint32_t i = START_OF_USER_CODE + SIZE_OF_CODE; i < START_OF_USER_CODE + SIZE_OF_CODE + size; ++i) { + array[x] = *PIOS_BL_HELPER_FLASH_If_Read(i); ++x; } } -void CRC_Ini() +void PIOS_BL_HELPER_CRC_Ini() { RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE); } diff --git a/flight/PiOS/STM32F10x/pios_sys.c b/flight/PiOS/STM32F10x/pios_sys.c index a6d67e701..2170c7811 100644 --- a/flight/PiOS/STM32F10x/pios_sys.c +++ b/flight/PiOS/STM32F10x/pios_sys.c @@ -134,6 +134,27 @@ uint32_t PIOS_SYS_getCPUFlashSize(void) return ((uint32_t) MEM16(0x1FFFF7E0) * 1000); } +/** +* Returns the serial number as a string +* param[out] str pointer to a string which can store at least 32 digits + zero terminator! +* (24 digits returned for STM32) +* return < 0 if feature not supported +*/ +int32_t PIOS_SYS_SerialNumberGetBinary(uint8_t *array) +{ + int i; + + /* Stored in the so called "electronic signature" */ + for (i = 0; i < 12; ++i) { + uint8_t b = MEM8(0x1ffff7e8 + i); + + array[i] = b; + } + + /* No error */ + return 0; +} + /** * Returns the serial number as a string * param[out] str pointer to a string which can store at least 32 digits + zero terminator! diff --git a/flight/PiOS/inc/pios_bl_helper.h b/flight/PiOS/inc/pios_bl_helper.h index ca241c922..e2e9e694e 100644 --- a/flight/PiOS/inc/pios_bl_helper.h +++ b/flight/PiOS/inc/pios_bl_helper.h @@ -31,16 +31,16 @@ #ifndef PIOS_BL_HELPER_H_ #define PIOS_BL_HELPER_H_ -extern uint8_t *FLASH_If_Read(uint32_t SectorAddress); +extern uint8_t *PIOS_BL_HELPER_FLASH_If_Read(uint32_t SectorAddress); -extern uint8_t FLASH_Ini(); +extern uint8_t PIOS_BL_HELPER_FLASH_Ini(); -extern uint32_t crc_memory_calc(); +extern uint32_t PIOS_BL_HELPER_CRC_Memory_Calc(); -extern void read_description(uint8_t * array); +extern void PIOS_BL_HELPER_FLASH_Read_Description(uint8_t * array, uint8_t size); -extern uint8_t FLASH_Start(); +extern uint8_t PIOS_BL_HELPER_FLASH_Start(); -extern void CRC_Ini(); +extern void PIOS_BL_HELPER_CRC_Ini(); #endif /* PIOS_BL_HELPER_H_ */ diff --git a/flight/PiOS/inc/pios_sys.h b/flight/PiOS/inc/pios_sys.h index d1f53f26b..9407fa720 100644 --- a/flight/PiOS/inc/pios_sys.h +++ b/flight/PiOS/inc/pios_sys.h @@ -36,6 +36,7 @@ extern void PIOS_SYS_Init(void); extern int32_t PIOS_SYS_Reset(void); extern uint32_t PIOS_SYS_getCPUFlashSize(void); +extern int32_t PIOS_SYS_SerialNumberGetBinary(uint8_t *array); extern int32_t PIOS_SYS_SerialNumberGet(char *str); #endif /* PIOS_SYS_H */ diff --git a/flight/UAVObjects/inc/uavobjectmanager.h b/flight/UAVObjects/inc/uavobjectmanager.h index dba819c7c..e7bb8b9c7 100644 --- a/flight/UAVObjects/inc/uavobjectmanager.h +++ b/flight/UAVObjects/inc/uavobjectmanager.h @@ -63,10 +63,10 @@ typedef struct { uint8_t gcsAccess; /** Defines the access level for the local GCS transactions (readonly and readwrite), not used in the flight s/w */ uint8_t telemetryAcked; /** Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) */ uint8_t telemetryUpdateMode; /** Update mode used by the telemetry module (UAVObjUpdateMode) */ - int32_t telemetryUpdatePeriod; /** Update period used by the telemetry module (only if telemetry mode is PERIODIC) */ + uint32_t telemetryUpdatePeriod; /** Update period used by the telemetry module (only if telemetry mode is PERIODIC) */ uint8_t gcsTelemetryAcked; /** Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) */ uint8_t gcsTelemetryUpdateMode; /** Update mode used by the GCS (UAVObjUpdateMode) */ - int32_t gcsTelemetryUpdatePeriod; /** Update period used by the GCS (only if telemetry mode is PERIODIC) */ + uint32_t gcsTelemetryUpdatePeriod; /** Update period used by the GCS (only if telemetry mode is PERIODIC) */ uint8_t loggingUpdateMode; /** Update mode used by the logging module (UAVObjUpdateMode) */ uint32_t loggingUpdatePeriod; /** Update period used by the logging module (only if logging mode is PERIODIC) */ } __attribute__((packed)) UAVObjMetadata; diff --git a/ground/ground.pro b/ground/ground.pro index 9792d15ef..3d7aeef0f 100644 --- a/ground/ground.pro +++ b/ground/ground.pro @@ -2,21 +2,20 @@ # Top level Qt-Creator project file # -# This meta-project allows qt-creator users to open -# and configure a single project and to build all -# required software to produce a GCS. This includes -# regenerating all uavobject output. +# This meta-project allows qt-creator users to open and configure a +# single project and to build all required software to produce a GCS. +# This includes regenerating all uavobject output. # -# NOTE: To use this meta-project, you MUST perform these -# steps once for each SVN checkout: +# NOTE: to use this meta-project, you MUST perform these steps once +# for each source tree checkout: # - Open /ground/ground.pro in qt-creator # - Select the "Projects" tab # - Under Build Settings/General heading, click "Show Details" # - Activate "Shadow Build" # - Set your Build Directory to /build/ground # -# = The full path to the base of your svn tree which should -# contain "flight", "ground", etc. +# = the full path to the base of your git source tree which +# should contain "flight", "ground", etc. # There is a small problem with dependencies. qmake needs synthetic # files when it generates GCS Makefiles. But we do not have diff --git a/ground/openpilotgcs/packaging/winx86/make_header.cmd b/ground/openpilotgcs/packaging/winx86/make_header.cmd new file mode 100644 index 000000000..247b17af1 --- /dev/null +++ b/ground/openpilotgcs/packaging/winx86/make_header.cmd @@ -0,0 +1,86 @@ +@echo off +rem +rem make_header - a workaround to build NSIS version info header from +rem Makefile using different environments (Windows cmd or Unix-like sh) +rem still being more or less portable. +rem +rem This script tries to find any git command line utility on the system. +rem First, it looks at the predefined location of git.exe installed by +rem msysgit package available at http://code.google.com/p/msysgit/ +rem If not found, it searches for git executables in the system PATH. +rem If also not found, then it gives up and no commit info will be available. +rem +rem Expected parameters: +rem %1: repository source path +rem %2: header file full path and name +rem + +rem FIXME: we should have product version info somewhere else +set OUT_FILE=OpenPilotGCS-%%%%ad-%%%%h-install.exe +set PRODUCT_VERSION=0.0.0.0 +set FILE_VERSION=%%%%ad %%BRANCH%%:%%%%h +set BUILD_DESCRIPTION=Built using %%ORIGIN%% as origin, branch %%BRANCH%%, commit %%%%H, committed %%%%ci + +set REPO=%1 +set HEADER=%2 +if "%REPO%" == "" goto NoRepo +if "%HEADER%" == "" goto NoHeader +goto OK + +:NoRepo +:NoHeader +echo This script should be called from Makefile only +goto :eof + +:Ok +rem Looking for git command line utility at the predefined msysgit location +rem first, and in the PATH last. Also note that we use call command which is +rem required if we execute a .cmd or .bat file instead of .exe + +set GIT=%ProgramFiles%\Git\bin\git.exe +if exist "%GIT%" goto Found + +for %%G in (git.exe) do set GIT=%%~$PATH:G +if exist "%GIT%" goto Found + +for %%G in (git.cmd) do set GIT=%%~$PATH:G +if exist "%GIT%" goto Found + +for %%G in (git.bat) do set GIT=%%~$PATH:G +if exist "%GIT%" goto Found + +:NotFound +echo git not found, no version info available +goto :eof + +:Found +echo Using "%GIT%" to extract version info from "%REPO%"... + +rem Getting remote origin name +for /F "usebackq tokens=1-3" %%G in (`call "%GIT%" remote -v`) do ( + if "%%G" == "origin" if "%%I" == "(fetch)" set ORIGIN=%%H +) + +rem Getting branch name +for /F "usebackq tokens=1,2" %%G in (`call "%GIT%" branch --no-color`) do ( + if "%%G" == "*" set BRANCH=%%H +) + +rem Getting commit info +set OPTS=-1 --no-color --date=short +set OPTS=%OPTS% "--format=format: +set OPTS=%OPTS%;%%%%n +set OPTS=%OPTS%; AUTOGENERATED HEADER FILE%%%%n +set OPTS=%OPTS%;%%%%n +set OPTS=%OPTS%%%%%n +set OPTS=%OPTS%; Installer file name%%%%n +set OPTS=%OPTS%!define OUT_FILE \"%OUT_FILE%\"%%%%n +set OPTS=%OPTS%%%%%n +set OPTS=%OPTS%; Installer version info%%%%n +set OPTS=%OPTS%!define PRODUCT_VERSION \"%PRODUCT_VERSION%\"%%%%n +set OPTS=%OPTS%!define FILE_VERSION \"%FILE_VERSION%\"%%%%n +set OPTS=%OPTS%!define BUILD_DESCRIPTION \"%BUILD_DESCRIPTION%\"%%%%n" + +pushd "%REPO%" +call "%GIT%" log %OPTS% >%HEADER% +popd diff --git a/ground/openpilotgcs/packaging/winx86/Makefile.cmd b/ground/openpilotgcs/packaging/winx86/make_installer.cmd similarity index 64% rename from ground/openpilotgcs/packaging/winx86/Makefile.cmd rename to ground/openpilotgcs/packaging/winx86/make_installer.cmd index 5127caa79..a487d682e 100644 --- a/ground/openpilotgcs/packaging/winx86/Makefile.cmd +++ b/ground/openpilotgcs/packaging/winx86/make_installer.cmd @@ -1,16 +1,11 @@ @echo off rem -rem Project: OpenPilot rem NSIS installer script file for OpenPilot GCS rem The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2010-2011. rem rem This script requires Unicode NSIS 2.46 or higher: rem http://www.scratchpaper.com/ rem -rem Optional SVN utility to get currently used SVN revision is SubWCRev.exe, -rem it is a part of TortoiseSVN package or is available separately: -rem http://sourceforge.net/projects/tortoisesvn/files/Tools/1.6.7/SubWCRev-1.6.7.18415.msi/download -rem rem Set path to NSIS compiler set NSIS=%ProgramFiles%/NSIS/Unicode diff --git a/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsh b/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsh index cc161bfac..222ed0d68 100644 --- a/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsh +++ b/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsh @@ -1,11 +1,11 @@ # -# SubWCRev not found, default values used instead. +# git not found, default values used instead. # ; Installer file name -!define OUT_FILE "OpenPilotGCS-XXXX-install.exe" +!define OUT_FILE "OpenPilotGCS-unreleased-install.exe" ; Installer version info !define PRODUCT_VERSION "0.0.0.0" !define FILE_VERSION "0.0.0.0" -!define BUILD_DESCRIPTION "Unknown revision." +!define BUILD_DESCRIPTION "Unreleased version." diff --git a/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsi b/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsi index bcd39f81f..5d36ab881 100644 --- a/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsi +++ b/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsi @@ -20,16 +20,9 @@ # This script requires Unicode NSIS 2.46 or higher: # http://www.scratchpaper.com/ -# -# Optionally used SubWCRev utility to extract SVN info from working copy. -# SubWCRev is a part of TortoiseSVN client distribution: -# http://tortoisesvn.net/ -# SubWCRev is also available separately: -# http://sourceforge.net/projects/tortoisesvn/files/Tools/1.6.7/SubWCRev-1.6.7.18415.msi/download # Features: # - Installs to the user local appdata path, no admin rights required. -# - Multilingual, needs translations for custom installer strings. # # TODO: # - optionally install for all users (to Program Files with admin rights on Vista/7). @@ -69,7 +62,7 @@ VIProductVersion ${PRODUCT_VERSION} VIAddVersionKey "ProductName" "${INSTALLER_NAME}" - VIAddVersionKey "FileVersion" ${FILE_VERSION} + VIAddVersionKey "FileVersion" "${FILE_VERSION}" VIAddVersionKey "Comments" "${INSTALLER_NAME}. ${BUILD_DESCRIPTION}" VIAddVersionKey "CompanyName" "The OpenPilot Team, http://www.openpilot.org" VIAddVersionKey "LegalTrademarks" "${PRODUCT_NAME} is a trademark of The OpenPilot Team" diff --git a/ground/openpilotgcs/packaging/winx86/openpilotgcs.tpl b/ground/openpilotgcs/packaging/winx86/openpilotgcs.tpl deleted file mode 100644 index 14c4383e4..000000000 --- a/ground/openpilotgcs/packaging/winx86/openpilotgcs.tpl +++ /dev/null @@ -1,12 +0,0 @@ -# -# SubWCRev autogenerated file, do not modify. -# Generated using nsis.tpl template. -# - -; Installer file name -!define OUT_FILE "OpenPilotGCS-$WCREV$-install.exe" - -; Installer version info -!define PRODUCT_VERSION "0.0.0.$WCREV$" -!define FILE_VERSION "0.0.0.$WCREV$" -!define BUILD_DESCRIPTION "Last committed revision $WCREV$ ($WCDATE$) using$WCMIXED? mixed:$ SVN revision range $WCRANGE$$WCMODS? (locally modified):$. Built from $WCURL$ ($WCNOW$)." diff --git a/ground/openpilotgcs/packaging/winx86/svninfo.mk b/ground/openpilotgcs/packaging/winx86/svninfo.mk deleted file mode 100644 index cec5b81e1..000000000 --- a/ground/openpilotgcs/packaging/winx86/svninfo.mk +++ /dev/null @@ -1,37 +0,0 @@ -# -# SubWCRev not found, default values used instead. -# Generated using svninfo.tpl template. -# - -# Highest committed revision number -WCREV = NA - -# Date of highest committed revision -WCDATE = NA - -# Mixed update revision state and revision range -WCMIXED = 0 -WCMIXED_TXT = NA -WCRANGE = NA - -# Repository URL of the working copy -WCURL = NA - -# Current system date & time -WCNOW = NA - -# Lock status, date, owner, and comment for this item -WCISLOCKED = 0 -WCLOCKDATE = NA -WCLOCKOWNER = NA -WCLOCKCOMMENT = NA - -# True if local modifications found -WCMODS = 0 -WCMODS_TXT = NA - -# True if the item is versioned -WCINSVN = 0 - -# True if the svn:needs-lock property is set -WCNEEDSLOCK = 0 diff --git a/ground/openpilotgcs/packaging/winx86/svninfo.tpl b/ground/openpilotgcs/packaging/winx86/svninfo.tpl deleted file mode 100644 index 86aecde32..000000000 --- a/ground/openpilotgcs/packaging/winx86/svninfo.tpl +++ /dev/null @@ -1,37 +0,0 @@ -# -# SubWCRev autogenerated file, do not modify. -# Generated using svninfo.tpl template. -# - -# Highest committed revision number -WCREV = $WCREV$ - -# Date of highest committed revision -WCDATE = $WCDATE=%Y/%m/%d %H:%M:%S$ - -# Mixed update revision state and revision range -WCMIXED = $WCMIXED?1:0$ -WCMIXED_TXT = $WCMIXED?(mixed):$ -WCRANGE = $WCRANGE$ - -# Repository URL of the working copy -WCURL = $WCURL$ - -# Current system date & time -WCNOW = $WCNOW=%Y/%m/%d %H:%M:%S$ - -# Lock status, date, owner, and comment for this item -WCISLOCKED = $WCISLOCKED?1:0$ -WCLOCKDATE = $WCLOCKDATE=%Y/%m/%d %H:%M:%S$ -WCLOCKOWNER = $WCLOCKOWNER$ -WCLOCKCOMMENT = $WCLOCKCOMMENT$ - -# True if local modifications found -WCMODS = $WCMODS?1:0$ -WCMODS_TXT = $WCMODS?(modified):$ - -# True if the item is versioned -WCINSVN = $WCINSVN?1:0$ - -# True if the svn:needs-lock property is set -WCNEEDSLOCK = $WCNEEDSLOCK?1:0$ diff --git a/ground/openpilotgcs/packaging/winx86/winx86.pro b/ground/openpilotgcs/packaging/winx86/winx86.pro index 001d36e3e..f1364166a 100644 --- a/ground/openpilotgcs/packaging/winx86/winx86.pro +++ b/ground/openpilotgcs/packaging/winx86/winx86.pro @@ -5,67 +5,46 @@ TEMPLATE = subdirs # Some Windows packaging magic (for release build only) equals(copydata, 1):win32:CONFIG(release, debug|release) { - WINX86_PATH = packaging/winx86 - SVN_INFO_TEMPLATE = svninfo.tpl - SVN_INFO_MAKEFILE = svninfo.mk - NSIS_TEMPLATE = openpilotgcs.tpl - NSIS_HEADER = openpilotgcs.nsh - - # Check for SubWCRev.exe executable required to get some useful SVN repository info. - # For example, currently checked out SVN revision (highest for the working copy). - # SubWCRev is a part of TortoiseSVN client distribution: - # http://tortoisesvn.net/ - # SubWCRev is also available separately: - # http://sourceforge.net/projects/tortoisesvn/files/Tools/1.6.7/SubWCRev-1.6.7.18415.msi/download - - # Default location is TortoiseSVN bin folder. - # FIXME: it should try to find in the PATH first, and use hardcoded reference last - SUBWCREV_EXE = $$targetPath(\"$$(ProgramFiles)/TortoiseSVN/bin/SubWCRev.exe\") - - exists($$SUBWCREV_EXE) { - message("SubWCRev found: $${SUBWCREV_EXE}") - svninfo.commands += @echo Copying stubs... $$addNewline() - svninfo.commands += $(COPY_FILE) - svninfo.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$SVN_INFO_MAKEFILE) - svninfo.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$SVN_INFO_MAKEFILE) - svninfo.commands += $$addNewline() - svninfo.commands += $(COPY_FILE) - svninfo.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$NSIS_HEADER) - svninfo.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$NSIS_HEADER) - svninfo.commands += $$addNewline() - svninfo.commands += @echo Executing $${SUBWCREV_EXE} $$SVN_INFO_TEMPLATE $$SVN_INFO_MAKEFILE $$addNewline() - svninfo.commands += -@$$SUBWCREV_EXE $$targetPath($$GCS_SOURCE_TREE) - svninfo.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$SVN_INFO_TEMPLATE) - svninfo.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$SVN_INFO_MAKEFILE) - svninfo.commands += $$addNewline() - svninfo.commands += @echo Executing $${SUBWCREV_EXE} $$NSIS_TEMPLATE $$NSIS_HEADER $$addNewline() - svninfo.commands += -@$$SUBWCREV_EXE $$targetPath($$GCS_SOURCE_TREE) - svninfo.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$NSIS_TEMPLATE) - svninfo.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$NSIS_HEADER) - svninfo.commands += $$addNewline() - } else { - message("SubWCRev not found, SVN info is not available") - svninfo.commands += $(COPY_FILE) - svninfo.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$SVN_INFO_MAKEFILE) - svninfo.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$SVN_INFO_MAKEFILE) - svninfo.commands += $$addNewline() - svninfo.commands += $(COPY_FILE) - svninfo.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$NSIS_HEADER) - svninfo.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$NSIS_HEADER) - svninfo.commands += $$addNewline() + # We need this Windows macro since building under Unix-like shell the top level + # targetPath macro will use forward slashes which don't work for such Windows + # commands like pushd, etc. But note that we still use targetPath for $(COPY_FILE) + # parameters because this command is different under native Windows and Unix-like + # build environments. + defineReplace(winTargetPath) { + return($$replace(1, /, \\)) } - svninfo.target = svninfo.dummy - QMAKE_EXTRA_TARGETS += svninfo - force.depends += svninfo + + # Some file locations + WINX86_PATH = packaging/winx86 + NSIS_HEADER = openpilotgcs.nsh + HEADER_MAKER = make_header.cmd + INSTALLER_MAKER = make_installer.cmd + + # copy defaults first (will be used if no git available) + git.commands += @echo Copying default version info... $$addNewline() + git.commands += $(COPY_FILE) + git.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$NSIS_HEADER) + git.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$NSIS_HEADER) + git.commands += $$addNewline() + + # extract repository info if command line git is available + git.commands += $$winTargetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$HEADER_MAKER) + git.commands += $$winTargetPath($$GCS_SOURCE_TREE) + git.commands += $$winTargetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$NSIS_HEADER) + git.commands += $$addNewline() + + git.target = git.dummy + QMAKE_EXTRA_TARGETS += git + force.depends += git # Redefine FORCE target to collect data every time force.target = FORCE QMAKE_EXTRA_TARGETS += force # Create installer build target - this WILL NOT run during build, run it by hand - message("Run \"make installer\" in $$GCS_BUILD_TREE/$$WINX86_PATH to build Windows installer (Unicode NSIS 2.46+ required)") - nsis.target = installer - nsis.depends = svninfo - nsis.commands += @$$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/Makefile.cmd) + message("Run \"make gcs_installer\" in $$GCS_BUILD_TREE/$$WINX86_PATH to build Windows installer (Unicode NSIS 2.46+ required)") + nsis.target = gcs_installer + nsis.depends = git + nsis.commands += @$$winTargetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$INSTALLER_MAKER) QMAKE_EXTRA_TARGETS += nsis } diff --git a/ground/openpilotgcs/share/share.pro b/ground/openpilotgcs/share/share.pro index 0c316e028..e6ecc4243 100644 --- a/ground/openpilotgcs/share/share.pro +++ b/ground/openpilotgcs/share/share.pro @@ -8,14 +8,8 @@ DATACOLLECTIONS = dials models pfd sounds diagrams mapicons equals(copydata, 1) { for(dir, DATACOLLECTIONS) { exists($$GCS_SOURCE_TREE/share/openpilotgcs/$$dir) { - # remove r/o and hidden attributes from .svn/* files from old build: they prevent copy over with cp -rp - win32:data_copy.commands += -@attrib -R -S -H $$targetPath(\"$$GCS_DATA_PATH/$$dir/*\") /S /D >nul 2>&1 $$addNewline() - macx:data_copy.commands += $(COPY_DIR) $$targetPath(\"$$GCS_SOURCE_TREE/share/openpilotgcs/$$dir\") $$targetPath(\"$$GCS_DATA_PATH/\") $$addNewline() !macx:data_copy.commands += $(COPY_DIR) $$targetPath(\"$$GCS_SOURCE_TREE/share/openpilotgcs/$$dir\") $$targetPath(\"$$GCS_DATA_PATH/$$dir\") $$addNewline() - - # remove r/o and hidden attributes from .svn/* files: they prevent cleaning with rm -rf - win32:data_copy.commands += attrib -R -S -H $$targetPath(\"$$GCS_DATA_PATH/$$dir/*\") /S /D $$addNewline() } } diff --git a/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.cpp b/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.cpp index ff8784746..784048b92 100644 --- a/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.cpp +++ b/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.cpp @@ -408,7 +408,7 @@ bool UAVTalk::receiveObject(quint8 type, quint32 objId, quint16 instId, quint8* UAVObject* obj = NULL; bool error = false; - bool allInstances = (instId == ALL_INSTANCES? true : false); + bool allInstances = (instId == ALL_INSTANCES); // Process message type switch (type) { diff --git a/shared/uavobjectdefinition/firmwareiapobj.xml b/shared/uavobjectdefinition/firmwareiapobj.xml index 1b167cc3d..51438395e 100644 --- a/shared/uavobjectdefinition/firmwareiapobj.xml +++ b/shared/uavobjectdefinition/firmwareiapobj.xml @@ -1,8 +1,9 @@ - Firmware IAP + Queries board for SN, model, revision, and sends reset command - + + diff --git a/shared/uavobjectdefinition/systemalarms.xml b/shared/uavobjectdefinition/systemalarms.xml index 622afc173..54eedc8cd 100644 --- a/shared/uavobjectdefinition/systemalarms.xml +++ b/shared/uavobjectdefinition/systemalarms.xml @@ -5,7 +5,7 @@ elementnames="OutOfMemory,StackOverflow,CPUOverload,EventSystem,SDCard,Telemetry,ManualControl,Actuator,Attitude,Stabilization,Guidance,AHRSComms,Battery,FlightTime,I2C,GPS" defaultvalue="Uninitialised"/> - +