diff --git a/Makefile b/Makefile index 79c9cf292..6b0601ebb 100644 --- a/Makefile +++ b/Makefile @@ -457,9 +457,9 @@ sim_win32_%: uavobjects_flight ############################## # -# Release packaging components +# Packaging components # ############################## -.PHONY: release -release: +.PHONY: package +package: $(V1) cd $@ && $(MAKE) --no-print-directory $@ diff --git a/flight/CopterControl/Makefile b/flight/CopterControl/Makefile index 2467968cb..bdfa8e2b5 100644 --- a/flight/CopterControl/Makefile +++ b/flight/CopterControl/Makefile @@ -187,6 +187,7 @@ SRC += $(PIOSSTM32F10X)/pios_spektrum.c SRC += $(PIOSSTM32F10X)/pios_debug.c SRC += $(PIOSSTM32F10X)/pios_gpio.c SRC += $(PIOSSTM32F10X)/pios_exti.c +SRC += $(PIOSSTM32F10X)/pios_rtc.c SRC += $(PIOSSTM32F10X)/pios_wdg.c diff --git a/flight/CopterControl/System/inc/pios_config.h b/flight/CopterControl/System/inc/pios_config.h index af1b7d22d..98c900387 100644 --- a/flight/CopterControl/System/inc/pios_config.h +++ b/flight/CopterControl/System/inc/pios_config.h @@ -64,6 +64,7 @@ #define PIOS_INCLUDE_FREERTOS #define PIOS_INCLUDE_GPIO #define PIOS_INCLUDE_EXTI +#define PIOS_INCLUDE_RTC #define PIOS_INCLUDE_WDG #define PIOS_INCLUDE_BL_HELPER @@ -92,7 +93,7 @@ /* Task stack sizes */ #define PIOS_ACTUATOR_STACK_SIZE 1020 #define PIOS_MANUAL_STACK_SIZE 724 -#define PIOS_SYSTEM_STACK_SIZE 504 +#define PIOS_SYSTEM_STACK_SIZE 560 #define PIOS_STABILIZATION_STACK_SIZE 524 #define PIOS_TELEM_STACK_SIZE 500 diff --git a/flight/CopterControl/System/pios_board.c b/flight/CopterControl/System/pios_board.c index c5943ca3c..53dd5b505 100644 --- a/flight/CopterControl/System/pios_board.c +++ b/flight/CopterControl/System/pios_board.c @@ -348,39 +348,38 @@ void PIOS_USART_spektrum_irq_handler(void) } #include -void TIM2_IRQHandler(); -void TIM2_IRQHandler() __attribute__ ((alias ("PIOS_TIM2_irq_handler"))); +void RTC_IRQHandler(); +void RTC_IRQHandler() __attribute__ ((alias ("PIOS_SUPV_irq_handler"))); const struct pios_spektrum_cfg pios_spektrum_cfg = { .pios_usart_spektrum_cfg = &pios_usart_spektrum_cfg, - .tim_base_init = { - .TIM_Prescaler = (PIOS_MASTER_CLOCK / 1000000) - 1, /* For 1 uS accuracy */ - .TIM_ClockDivision = TIM_CKD_DIV1, - .TIM_CounterMode = TIM_CounterMode_Up, - .TIM_Period = ((1000000 / 120) - 1), //11ms-10*16b/115200bps atleast one interrupt between frames - .TIM_RepetitionCounter = 0x0000, - }, .gpio_init = { //used for bind feature .GPIO_Mode = GPIO_Mode_Out_PP, .GPIO_Speed = GPIO_Speed_2MHz, }, .remap = 0, .irq = { - .handler = TIM2_IRQHandler, + .handler = RTC_IRQHandler, .init = { .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID, .NVIC_IRQChannelSubPriority = 0, .NVIC_IRQChannelCmd = ENABLE, }, }, - .timer = TIM2, .port = GPIOB, - .ccr = TIM_IT_Update, .pin = GPIO_Pin_11, }; -void PIOS_TIM2_irq_handler() -{ - PIOS_SPEKTRUM_irq_handler(pios_usart_spektrum_id); +void PIOS_SUPV_irq_handler() { + if (RTC_GetITStatus(RTC_IT_SEC)) + { + /* Call the right handler */ + PIOS_SPEKTRUM_irq_handler(pios_usart_spektrum_id); + + /* Wait until last write operation on RTC registers has finished */ + RTC_WaitForLastTask(); + /* Clear the RTC Second interrupt */ + RTC_ClearITPendingBit(RTC_IT_SEC); + } } #endif /* PIOS_INCLUDE_SPEKTRUM */ @@ -441,14 +440,12 @@ const struct pios_servo_channel pios_servo_channels[] = { .channel = TIM_Channel_1, .pin = GPIO_Pin_4, }, -#ifndef PIOS_INCLUDE_SPEKTRUM { .timer = TIM2, .port = GPIOA, .channel = TIM_Channel_3, .pin = GPIO_Pin_2, }, -#endif }; const struct pios_servo_cfg pios_servo_cfg = { diff --git a/flight/OpenPilot/System/inc/FreeRTOSConfig.h b/flight/OpenPilot/System/inc/FreeRTOSConfig.h index c2a07fa67..6336639a4 100644 --- a/flight/OpenPilot/System/inc/FreeRTOSConfig.h +++ b/flight/OpenPilot/System/inc/FreeRTOSConfig.h @@ -75,7 +75,7 @@ NVIC value of 255. */ #if defined(DEBUG) #define configGENERATE_RUN_TIME_STATS 1 #define INCLUDE_uxTaskGetRunTime 1 -#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() PIOS_RTC_Start() +#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() PIOS_RTC_Init() // Note: Using the tick count defeats the purpose here, need some timer on the scale of 10khz #define portGET_RUN_TIME_COUNTER_VALUE() PIOS_RTC_Counter() #endif diff --git a/flight/OpenPilot/System/pios_board.c b/flight/OpenPilot/System/pios_board.c index ccbf8fced..14be197e8 100644 --- a/flight/OpenPilot/System/pios_board.c +++ b/flight/OpenPilot/System/pios_board.c @@ -504,39 +504,38 @@ void PIOS_USART_spektrum_irq_handler(void) } #include -void TIM6_IRQHandler(); -void TIM6_IRQHandler() __attribute__ ((alias ("PIOS_TIM6_irq_handler"))); +void RTC_IRQHandler(); +void RTC_IRQHandler() __attribute__ ((alias ("PIOS_SUPV_irq_handler"))); const struct pios_spektrum_cfg pios_spektrum_cfg = { .pios_usart_spektrum_cfg = &pios_usart_spektrum_cfg, - .tim_base_init = { - .TIM_Prescaler = (PIOS_MASTER_CLOCK / 1000000) - 1, /* For 1 uS accuracy */ - .TIM_ClockDivision = TIM_CKD_DIV1, - .TIM_CounterMode = TIM_CounterMode_Up, - .TIM_Period = ((1000000 / 120) - 1), //11ms-10*16b/115200bps, atleast one interrupt between frames - .TIM_RepetitionCounter = 0x0000, - }, .gpio_init = { //used for bind feature .GPIO_Mode = GPIO_Mode_Out_PP, .GPIO_Speed = GPIO_Speed_2MHz, }, .remap = 0, .irq = { - .handler = TIM6_IRQHandler, + .handler = RTC_IRQHandler, .init = { .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID, .NVIC_IRQChannelSubPriority = 0, .NVIC_IRQChannelCmd = ENABLE, }, }, - .timer = TIM6, .port = GPIOA, - .ccr = TIM_IT_Update, .pin = GPIO_Pin_10, }; -void PIOS_TIM6_irq_handler() -{ - PIOS_SPEKTRUM_irq_handler(); +void PIOS_SUPV_irq_handler() { + if (RTC_GetITStatus(RTC_IT_SEC)) + { + /* Call the right handler */ + PIOS_SPEKTRUM_irq_handler(pios_usart_spektrum_id); + + /* Wait until last write operation on RTC registers has finished */ + RTC_WaitForLastTask(); + /* Clear the RTC Second interrupt */ + RTC_ClearITPendingBit(RTC_IT_SEC); + } } #endif /* PIOS_COM_SPEKTRUM */ @@ -1049,6 +1048,7 @@ void PIOS_Board_Init(void) { #if defined(PIOS_INCLUDE_SPEKTRUM) /* SPEKTRUM init must come before comms */ + PIOS_RTC_Init(); // Spektrum uses RTC to check for frame failures PIOS_SPEKTRUM_Init(); if (PIOS_USART_Init(&pios_usart_spektrum_id, &pios_usart_spektrum_cfg)) { diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h index 81839c07f..caee2a839 100755 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h @@ -138,7 +138,7 @@ extern void vPortYieldFromISR( void ); extern void vPortEnterCritical( void ); extern void vPortExitCritical( void ); -void PIOS_RTC_Start(); +void PIOS_RTC_Init(); uint32_t PIOS_RTC_Counter(); #define portDISABLE_INTERRUPTS() portSET_INTERRUPT_MASK() diff --git a/flight/PiOS/STM32F10x/pios_rtc.c b/flight/PiOS/STM32F10x/pios_rtc.c index 0a950e913..98d3160c1 100644 --- a/flight/PiOS/STM32F10x/pios_rtc.c +++ b/flight/PiOS/STM32F10x/pios_rtc.c @@ -33,7 +33,11 @@ #if defined(PIOS_INCLUDE_RTC) -void PIOS_RTC_Start() +#ifndef PIOS_RTC_PRESCALAR +#define PIOS_RTC_PRESCALAR 100 +#endif + +void PIOS_RTC_Init() { RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP | RCC_APB1Periph_PWR, ENABLE); @@ -44,7 +48,14 @@ void PIOS_RTC_Start() RTC_WaitForLastTask(); RTC_WaitForSynchro(); RTC_WaitForLastTask(); - RTC_SetPrescaler(0); // counting at 8e6 / 128 + +#if defined(PIOS_INCLUDE_SPEKTRUM) + /* Enable the RTC Second interrupt */ + RTC_ITConfig( RTC_IT_SEC, ENABLE ); + /* Wait until last write operation on RTC registers has finished */ + RTC_WaitForLastTask(); +#endif + RTC_SetPrescaler(PIOS_RTC_PRESCALAR); // counting at 8e6 / 128 RTC_WaitForLastTask(); RTC_SetCounter(0); RTC_WaitForLastTask(); @@ -55,6 +66,15 @@ uint32_t PIOS_RTC_Counter() return RTC_GetCounter(); } +float PIOS_RTC_Rate() +{ + return (float) (8e6 / 128) / (1 + PIOS_RTC_PRESCALAR); +} + +float PIOS_RTC_MsPerTick() +{ + return 1000.0f / PIOS_RTC_Rate(); +} #endif diff --git a/flight/PiOS/STM32F10x/pios_spektrum.c b/flight/PiOS/STM32F10x/pios_spektrum.c index 16b9b9883..0eabe36a2 100644 --- a/flight/PiOS/STM32F10x/pios_spektrum.c +++ b/flight/PiOS/STM32F10x/pios_spektrum.c @@ -41,16 +41,24 @@ #error "AUX com cannot be used with SPEKTRUM" #endif +/** + * @Note Framesyncing: + * The code resets the watchdog timer whenever a single byte is received, so what watchdog code + * is never called if regularly getting bytes. + * RTC timer is running @625Hz, supervisor timer has divider 5 so frame sync comes every 1/125Hz=8ms. + * Good for both 11ms and 22ms framecycles + */ + /* Global Variables */ -/* Local Variables, use pios_usart */ +/* Local Variables */ static uint16_t CaptureValue[12],CaptureValueTemp[12]; static uint8_t prev_byte = 0xFF, sync = 0, bytecount = 0, datalength=0, frame_error=0, byte_array[20] = { 0 }; - uint8_t sync_of = 0; +uint16_t supv_timer=0; /** -* Initialise the onboard USARTs +* Bind and Initialise Spektrum satellite receiver */ void PIOS_SPEKTRUM_Init(void) { @@ -59,62 +67,15 @@ void PIOS_SPEKTRUM_Init(void) PIOS_SPEKTRUM_Bind(); } - NVIC_InitTypeDef NVIC_InitStructure = pios_spektrum_cfg.irq.init; - TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure = pios_spektrum_cfg.tim_base_init; - - - /* Enable appropriate clock to timer module */ - switch((int32_t) pios_spektrum_cfg.timer) { - case (int32_t)TIM1: - NVIC_InitStructure.NVIC_IRQChannel = TIM1_CC_IRQn; - RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE); - break; - case (int32_t)TIM2: - NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn; - RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE); - break; - case (int32_t)TIM3: - NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn; - RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); - break; - case (int32_t)TIM4: - NVIC_InitStructure.NVIC_IRQChannel = TIM4_IRQn; - RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE); - break; -#ifdef STM32F10X_HD - - case (int32_t)TIM5: - NVIC_InitStructure.NVIC_IRQChannel = TIM5_IRQn; - RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5, ENABLE); - break; - case (int32_t)TIM6: - NVIC_InitStructure.NVIC_IRQChannel = TIM6_IRQn; - RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM6, ENABLE); - break; - case (int32_t)TIM7: - NVIC_InitStructure.NVIC_IRQChannel = TIM7_IRQn; - RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM7, ENABLE); - break; - case (int32_t)TIM8: - NVIC_InitStructure.NVIC_IRQChannel = TIM8_CC_IRQn; - RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM8, ENABLE); - break; -#endif - } + /* Init RTC supervisor timer interrupt */ + NVIC_InitTypeDef NVIC_InitStructure; + NVIC_InitStructure.NVIC_IRQChannel = RTC_IRQn; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); - - /* Configure timer clocks */ - TIM_InternalClockConfig(pios_spektrum_cfg.timer); - TIM_TimeBaseInit(pios_spektrum_cfg.timer, &TIM_TimeBaseStructure); - - /* Enable the Capture Compare Interrupt Request */ - TIM_ITConfig(pios_spektrum_cfg.timer, pios_spektrum_cfg.ccr, ENABLE); - - /* Clear update pending flag */ - TIM_ClearFlag(pios_spektrum_cfg.timer, TIM_FLAG_Update); - - /* Enable timers */ - TIM_Cmd(pios_spektrum_cfg.timer, ENABLE); + /* Init RTC clock */ + PIOS_RTC_Init(); } /** @@ -263,8 +224,7 @@ int32_t PIOS_SPEKTRUM_Decode(uint8_t b) } /* Interrupt handler for USART */ -void SPEKTRUM_IRQHandler(uint32_t usart_id) -{ +void SPEKTRUM_IRQHandler(uint32_t usart_id) { /* by always reading DR after SR make sure to clear any error interrupts */ volatile uint16_t sr = pios_spektrum_cfg.pios_usart_spektrum_cfg->regs->SR; volatile uint8_t b = pios_spektrum_cfg.pios_usart_spektrum_cfg->regs->DR; @@ -280,33 +240,34 @@ void SPEKTRUM_IRQHandler(uint32_t usart_id) /* Disable TXE interrupt (TXEIE=0) */ USART_ITConfig(pios_spektrum_cfg.pios_usart_spektrum_cfg->regs, USART_IT_TXE, DISABLE); } - /* clear "watchdog" timer */ - TIM_SetCounter(pios_spektrum_cfg.timer, 0); + /* byte arrived so clear "watchdog" timer */ + supv_timer=0; } /** -* This function handles TIM6 global interrupt request. -*/ + *@brief This function is called between frames and when a spektrum word hasnt been decoded for too long + *@brief clears the channel values + */ void PIOS_SPEKTRUM_irq_handler() { -//PIOS_SPEKTRUM_SUPV_IRQ_FUNC { - /* Clear timer interrupt pending bit */ - TIM_ClearITPendingBit(pios_spektrum_cfg.timer, TIM_IT_Update); - - /* sync between frames */ - sync = 0; - bytecount = 0; - prev_byte = 0xFF; - frame_error=0; - sync_of++; - /* watchdog activated */ - if (sync_of > 12) { - /* signal lost */ - sync_of = 0; - for (int i = 0; i < 12; i++) - { - CaptureValue[i] = 0; - CaptureValueTemp[i] = 0; + /* 125hz */ + supv_timer++; + if(supv_timer > 5) { + /* sync between frames */ + sync = 0; + bytecount = 0; + prev_byte = 0xFF; + frame_error = 0; + sync_of++; + /* watchdog activated after 100ms silence */ + if (sync_of > 12) { + /* signal lost */ + sync_of = 0; + for (int i = 0; i < 12; i++) { + CaptureValue[i] = 0; + CaptureValueTemp[i] = 0; + } } + supv_timer = 0; } } diff --git a/flight/PiOS/inc/pios_rtc.h b/flight/PiOS/inc/pios_rtc.h index c9ad5661f..f68b54af8 100644 --- a/flight/PiOS/inc/pios_rtc.h +++ b/flight/PiOS/inc/pios_rtc.h @@ -27,12 +27,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef PIOS_SERVO_H -#define PIOS_SERVO_H +#ifndef PIOS_RTC_H +#define PIOS_RTC_H /* Public Functions */ -extern void PIOS_RTC_Start(); +extern void PIOS_RTC_Init(); extern uint32_t PIOS_RTC_Counter(); +extern float PIOS_RTC_Rate(); +extern float PIOS_RTC_MsPerTick(); #endif /* PIOS_SERVO_H */ diff --git a/flight/PiOS/inc/pios_spektrum_priv.h b/flight/PiOS/inc/pios_spektrum_priv.h index 19a1db20b..b5dd384d1 100644 --- a/flight/PiOS/inc/pios_spektrum_priv.h +++ b/flight/PiOS/inc/pios_spektrum_priv.h @@ -37,13 +37,10 @@ struct pios_spektrum_cfg { const struct pios_usart_cfg * pios_usart_spektrum_cfg; - TIM_TimeBaseInitTypeDef tim_base_init; GPIO_InitTypeDef gpio_init; uint32_t remap; /* GPIO_Remap_* */ struct stm32_irq irq; - TIM_TypeDef * timer; GPIO_TypeDef * port; - uint16_t ccr; uint16_t pin; }; diff --git a/flight/PiOS/pios.h b/flight/PiOS/pios.h index 0fdb03570..8362a3af4 100644 --- a/flight/PiOS/pios.h +++ b/flight/PiOS/pios.h @@ -73,6 +73,7 @@ #include #include #include +#include #include #include #include diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index c50ad9330..a963e4673 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -52,11 +52,21 @@ equals(copydata, 1) { data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_PLUGINS]/sqldrivers/$$dll\") $$targetPath(\"$$GCS_APP_PATH/sqldrivers/$$dll\") $$addNewline() } - # copy SDL (if available) - Simple DirectMedia Layer (www.libsdl.org) + # copy SDL - Simple DirectMedia Layer (www.libsdl.org) + # Check the wiki for SDL installation, it should be copied first + # (make sure that the Qt installation path below is correct) + # + # - For qt-sdk-win-opensource-2010.05.exe: + # xcopy /s /e \bin\SDL.dll C:\Qt\2010.05\mingw\bin\SDL.dll + # xcopy /s /e \include\SDL\* C:\Qt\2010.05\mingw\include\SDL + # xcopy /s /e \lib\* C:\Qt\2010.05\mingw\lib + # + # - For Qt_SDK_Win_offline_v1_1_1_en.exe: + # xcopy /s /e \bin\SDL.dll C:\QtSDK\Desktop\Qt\4.7.3\mingw\bin\SDL.dll + # xcopy /s /e \include\SDL\* C:\QtSDK\Desktop\Qt\4.7.3\mingw\include\SDL + # xcopy /s /e \lib\* C:\QtSDK\Desktop\Qt\4.7.3\mingw\lib SDL_DLL = SDL.dll - exists($$targetPath(\"$$[QT_INSTALL_BINS]/../../mingw/bin/$$SDL_DLL\")) { - data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_BINS]/../../mingw/bin/$$SDL_DLL\") $$targetPath(\"$$GCS_APP_PATH/$$SDL_DLL\") $$addNewline() - } + data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_BINS]/../../mingw/bin/$$SDL_DLL\") $$targetPath(\"$$GCS_APP_PATH/$$SDL_DLL\") $$addNewline() data_copy.target = FORCE QMAKE_EXTRA_TARGETS += data_copy diff --git a/make/winx86/README.txt b/make/winx86/README.txt index 24f160f34..17477d098 100644 --- a/make/winx86/README.txt +++ b/make/winx86/README.txt @@ -33,11 +33,14 @@ It is expected that you have the following tools installed into the listed locations (but any other locations are fine as well): - Python in C:\Python27 - - QtSDK in C:\Qt\2010.05 + - QtSDK in C:\Qt\2010.05 or C:\QtSDK (depending on SDK version) - CodeSourcery G++ in %ProgramFiles%\CodeSourcery\Sourcery G++ Lite - msysGit in %ProgramFiles%\Git - Unicode NSIS in %ProgramFiles%\NSIS\Unicode - - OpenOCD in C:\OpenOCD\0.4.0\bin + - OpenOCD in C:\OpenOCD\0.4.0\bin (optional) + +The SDL library and headers should be installed into Qt directories to build +the GCS. Check the wiki or ground/openpilotgcs/copydata.pro for details. Also it is assumed that you have the C:\Program Files\Git\cmd\ directory in the PATH. Usually this is the case for msysGit installation if you have chosen diff --git a/make/winx86/cmd/sh.cmd b/make/winx86/cmd/sh.cmd index dd70a8e44..480044ab7 100644 --- a/make/winx86/cmd/sh.cmd +++ b/make/winx86/cmd/sh.cmd @@ -38,6 +38,9 @@ rem As a result, the SDL headers will not be found, if they were copied into rem QtSDK's MinGW directory. In that case make sure that you have correct rem directories specified here. rem +rem Also the SDL should be installed into Qt directories to build the GCS. +rem Check the wiki or ground/openpilotgcs/copydata.pro for details. +rem rem Also you can add any paths below just by adding extra 'call :which' rem lines with the following parameters: rem - environment variable which will be set to the tool location, if found; @@ -51,8 +54,12 @@ set NOT_FOUND= set PATH_DIRS= call :which MSYSGIT "%ProgramFiles%\Git\bin" git.exe +rem These two lines for qt-sdk-win-opensource-2010.05.exe: call :which QTMINGW "C:\Qt\2010.05\mingw\bin" mingw32-make.exe call :which QTSDK "C:\Qt\2010.05\qt\bin" qmake.exe +rem These two lines for Qt_SDK_Win_offline_v1_1_1_en.exe: +rem call :which QTMINGW "C:\QtSDK\mingw\bin" mingw32-make.exe +rem call :which QTSDK "C:\QtSDK\Desktop\Qt\4.7.3\mingw\bin" qmake.exe call :which CODESOURCERY "%ProgramFiles%\CodeSourcery\Sourcery G++ Lite\bin" cs-make.exe call :which PYTHON "C:\Python27" python.exe call :which UNSIS "%ProgramFiles%\NSIS\Unicode" makensis.exe diff --git a/release/Makefile b/package/Makefile similarity index 80% rename from release/Makefile rename to package/Makefile index 645a67758..67db6b129 100644 --- a/release/Makefile +++ b/package/Makefile @@ -14,9 +14,9 @@ ROOT_DIR := $(realpath $(WHEREAMI)/../) # Set up some macros BUILD_DIR := $(ROOT_DIR)/build VERSION_CMD := python $(ROOT_DIR)/make/scripts/version-info.py --path="$(ROOT_DIR)" -RELEASE_LBL := $(shell $(VERSION_CMD) --format=\$${DATE}-\$${TAG_OR_HASH8}\$${DIRTY}) -RELEASE_DIR := $(BUILD_DIR)/release-$(RELEASE_LBL) -FW_DIR := $(RELEASE_DIR)/firmware-$(RELEASE_LBL) +PACKAGE_LBL := $(shell $(VERSION_CMD) --format=\$${DATE}-\$${TAG_OR_HASH8}\$${DIRTY}) +PACKAGE_DIR := $(BUILD_DIR)/package-$(PACKAGE_LBL) +FW_DIR := $(PACKAGE_DIR)/firmware-$(PACKAGE_LBL) BL_DIR := $(FW_DIR)/bootloaders BU_DIR := $(FW_DIR)/bootloader-updaters FE_DIR := $(FW_DIR)/flash-erase-tools @@ -52,11 +52,11 @@ help: @echo " Here is a summary of the available targets:" @echo @echo " [Packaging]" - @echo " release - Build and package the OpenPilot distributable" - @echo " release_flight - Build and package the OpenPilot flight firmware only" + @echo " package - Build and package the OpenPilot distributable" + @echo " package_flight - Build and package the OpenPilot flight firmware only" @echo @echo " Notes:" - @echo " - package will be placed in $(RELEASE_DIR)" + @echo " - package will be placed in $(PACKAGE_DIR)" @echo @echo " - the build directory will be removed first on every run unless one" @echo " of CLEAN_BUILD=NO or CLEAN_BUILD=NEVER options is defined." @@ -101,19 +101,19 @@ endif endef # Firmware for different input drivers -$(eval $(call INSTALL_TEMPLATE,fw_common,uavobjects,$(FW_DIR),,-$(RELEASE_LBL),,,$(FW_TARGETS_COMMON),install)) -$(eval $(call INSTALL_TEMPLATE,fw_pwm,uavobjects,$(FW_DIR),,-pwm-$(RELEASE_LBL),,clean,$(FW_TARGETS_INPUT),install)) -$(eval $(call INSTALL_TEMPLATE,fw_spektrum,uavobjects,$(FW_DIR),,-spektrum-$(RELEASE_LBL),USE_SPEKTRUM=YES,clean,$(FW_TARGETS_INPUT),install)) -$(eval $(call INSTALL_TEMPLATE,fw_ppm,uavobjects,$(FW_DIR),,-ppm-$(RELEASE_LBL),USE_PPM=YES,clean,$(FW_TARGETS_INPUT),install)) +$(eval $(call INSTALL_TEMPLATE,fw_common,uavobjects,$(FW_DIR),,-$(PACKAGE_LBL),,,$(FW_TARGETS_COMMON),install)) +$(eval $(call INSTALL_TEMPLATE,fw_pwm,uavobjects,$(FW_DIR),,-pwm-$(PACKAGE_LBL),,clean,$(FW_TARGETS_INPUT),install)) +$(eval $(call INSTALL_TEMPLATE,fw_spektrum,uavobjects,$(FW_DIR),,-spektrum-$(PACKAGE_LBL),USE_SPEKTRUM=YES,clean,$(FW_TARGETS_INPUT),install)) +$(eval $(call INSTALL_TEMPLATE,fw_ppm,uavobjects,$(FW_DIR),,-ppm-$(PACKAGE_LBL),USE_PPM=YES,clean,$(FW_TARGETS_INPUT),install)) # Bootloaders (change 'install' to 'bin' if you don't want to install bootloaders) -$(eval $(call INSTALL_TEMPLATE,all_bl,uavobjects,$(BL_DIR),,-$(RELEASE_LBL),,,$(BL_TARGETS),install)) +$(eval $(call INSTALL_TEMPLATE,all_bl,uavobjects,$(BL_DIR),,-$(PACKAGE_LBL),,,$(BL_TARGETS),install)) # Bootloader updaters -$(eval $(call INSTALL_TEMPLATE,all_bu,all_bl,$(BU_DIR),,-$(RELEASE_LBL),,,$(BU_TARGETS),install)) +$(eval $(call INSTALL_TEMPLATE,all_bu,all_bl,$(BU_DIR),,-$(PACKAGE_LBL),,,$(BU_TARGETS),install)) # CopterControl flash eraser tool -$(eval $(call INSTALL_TEMPLATE,fw_tools,uavobjects,$(FE_DIR),,-flash-erase-$(RELEASE_LBL),ERASE_FLASH=YES,clean,$(FW_TARGETS_TOOLS),install)) +$(eval $(call INSTALL_TEMPLATE,fw_tools,uavobjects,$(FE_DIR),,-flash-erase-$(PACKAGE_LBL),ERASE_FLASH=YES,clean,$(FW_TARGETS_TOOLS),install)) # Order-only dependencies # They are bit complicated to support parallel (-j) builds and to create @@ -127,17 +127,17 @@ fw_ppm: | fw_spektrum # ordered build fw_tools: | fw_spektrum # ordered build, replace fw_spektrum by fw_ppm if uncommented below -release_fw: | fw_common fw_pwm fw_spektrum # fw_ppm +package_fw: | fw_common fw_pwm fw_spektrum # fw_ppm -release_bu: | all_bu +package_bu: | all_bu -release_flight: | release_fw release_bu fw_tools +package_flight: | package_fw package_bu fw_tools -release_ground: | ground_package +package_ground: | ground_package -release: | release_flight release_ground +package: | package_flight package_ground -.PHONY: help uavobjects all_clean release release_flight release_fw release_bu release_ground +.PHONY: help uavobjects all_clean package package_flight package_fw package_bu package_ground # Decide on a verbosity level based on the V= parameter export AT := @ diff --git a/release/Makefile.linux b/package/Makefile.linux similarity index 100% rename from release/Makefile.linux rename to package/Makefile.linux diff --git a/package/Makefile.osx b/package/Makefile.osx new file mode 100644 index 000000000..e2b3c62ba --- /dev/null +++ b/package/Makefile.osx @@ -0,0 +1,20 @@ +# +# MacOSX-specific packaging +# + +osx_package: gcs package_flight + ( \ + ROOT_DIR="$(ROOT_DIR)" \ + BUILD_DIR="$(BUILD_DIR)" \ + PACKAGE_LBL="$(PACKAGE_LBL)" \ + PACKAGE_DIR="$(PACKAGE_DIR)" \ + FW_DIR="$(FW_DIR)" \ + "$(ROOT_DIR)/package/osx/package" \ + ) + +gcs: uavobjects + $(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@ + +ground_package: | osx_package + +.PHONY: gcs ground_package osx_package diff --git a/release/Makefile.winx86 b/package/Makefile.winx86 similarity index 54% rename from release/Makefile.winx86 rename to package/Makefile.winx86 index 1c8a1db4c..5ff65a97d 100644 --- a/release/Makefile.winx86 +++ b/package/Makefile.winx86 @@ -4,19 +4,22 @@ NSIS_CMD := makensis.exe NSIS_OPTS := /V3 -NSIS_DIR := $(ROOT_DIR)/release/winx86 +NSIS_DIR := $(ROOT_DIR)/package/winx86 NSIS_SCRIPT := $(NSIS_DIR)/openpilotgcs.nsi NSIS_TEMPLATE := $(NSIS_DIR)/openpilotgcs.tpl NSIS_HEADER := $(BUILD_DIR)/ground/openpilotgcs/openpilotgcs.nsh -package: gcs release_flight - mkdir -p "$(dir $(NSIS_HEADER))" +win_package: gcs package_flight + $(V1) mkdir -p "$(dir $(NSIS_HEADER))" $(VERSION_CMD) --template="$(NSIS_TEMPLATE)" --outfile="$(NSIS_HEADER)" + $(V1) echo "Building Windows installer, please wait..." + $(V1) echo "If you have a script error in line 1 - use Unicode NSIS 2.46+" + $(V1) echo " http://www.scratchpaper.com" $(NSIS_CMD) $(NSIS_OPTS) $(NSIS_SCRIPT) gcs: uavobjects $(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@ -ground_package: | package +ground_package: | win_package -.PHONY: gcs ground_package package +.PHONY: gcs ground_package win_package diff --git a/release/osx/OpenPilot.dmg b/package/osx/OpenPilot.dmg similarity index 100% rename from release/osx/OpenPilot.dmg rename to package/osx/OpenPilot.dmg diff --git a/release/osx/libraries b/package/osx/libraries similarity index 93% rename from release/osx/libraries rename to package/osx/libraries index dff0d9e0e..f97b969b8 100755 --- a/release/osx/libraries +++ b/package/osx/libraries @@ -20,7 +20,7 @@ do done # should be redundant but some libs missed by main app and macdeployqt -for f in ${QT_LIBS} SDL +for f in ${QT_LIBS} do echo "Copying ${f}" cp -r /Library/Frameworks/${f}.framework "${APP}/Contents/Frameworks/" @@ -44,4 +44,4 @@ done echo "Deleting unnecessary files" find "${APP}/Contents/Frameworks" -iname "current" -exec rm -rf \{\} \; find "${APP}/Contents/Frameworks" -iname "4.0" -exec rm -rf \{\} \; -find "${APP}/Contents/Frameworks" -iname "*_debug*" -exec rm -rf \{\} \; +find "${APP}/Contents/Frameworks" -iname "*_debug" -exec rm -rf \{\} \; diff --git a/release/osx/package b/package/osx/package similarity index 71% rename from release/osx/package rename to package/osx/package index 2983d98cc..a12e7e9fe 100755 --- a/release/osx/package +++ b/package/osx/package @@ -1,19 +1,19 @@ #!/bin/bash # the following environment variables must be set -: ${ROOT_DIR?} ${BUILD_DIR?} ${RELEASE_LBL?} ${RELEASE_DIR?} ${FW_DIR?} +: ${ROOT_DIR?} ${BUILD_DIR?} ${PACKAGE_LBL?} ${PACKAGE_DIR?} ${FW_DIR?} # more variables APP_PATH="${BUILD_DIR}/ground/openpilotgcs/bin/OpenPilot GCS.app" -TEMP_FILE="${RELEASE_DIR}/OpenPilot-temp.dmg" -OUT_FILE="${RELEASE_DIR}/OpenPilot-${RELEASE_LBL}.dmg" +TEMP_FILE="${PACKAGE_DIR}/OpenPilot-temp.dmg" +OUT_FILE="${PACKAGE_DIR}/OpenPilot-${PACKAGE_LBL}.dmg" VOL_NAME="OpenPilot" # prepare the stage rm -f "${TEMP_FILE}" rm -f "${OUT_FILE}" -hdiutil convert "${ROOT_DIR}/release/osx/OpenPilot.dmg" \ +hdiutil convert "${ROOT_DIR}/package/osx/OpenPilot.dmg" \ -format UDRW -o "${TEMP_FILE}" device=$(hdiutil attach "${TEMP_FILE}" | \ egrep '^/dev/' | sed 1q | awk '{print $1}') @@ -22,7 +22,7 @@ device=$(hdiutil attach "${TEMP_FILE}" | \ cp -r "${APP_PATH}" "/Volumes/${VOL_NAME}" cp -r "${FW_DIR}" "/Volumes/${VOL_NAME}/firmware" -"${ROOT_DIR}/release/osx/libraries" \ +"${ROOT_DIR}/package/osx/libraries" \ "/Volumes/${VOL_NAME}/OpenPilot GCS.app" || exit 1 hdiutil detach ${device} diff --git a/release/winx86/licenses/GPLv3_de.rtf b/package/winx86/licenses/GPLv3_de.rtf similarity index 100% rename from release/winx86/licenses/GPLv3_de.rtf rename to package/winx86/licenses/GPLv3_de.rtf diff --git a/release/winx86/licenses/GPLv3_en.rtf b/package/winx86/licenses/GPLv3_en.rtf similarity index 100% rename from release/winx86/licenses/GPLv3_en.rtf rename to package/winx86/licenses/GPLv3_en.rtf diff --git a/release/winx86/licenses/GPLv3_es.rtf b/package/winx86/licenses/GPLv3_es.rtf similarity index 100% rename from release/winx86/licenses/GPLv3_es.rtf rename to package/winx86/licenses/GPLv3_es.rtf diff --git a/release/winx86/licenses/GPLv3_fr.rtf b/package/winx86/licenses/GPLv3_fr.rtf similarity index 100% rename from release/winx86/licenses/GPLv3_fr.rtf rename to package/winx86/licenses/GPLv3_fr.rtf diff --git a/release/winx86/licenses/GPLv3_ru.rtf b/package/winx86/licenses/GPLv3_ru.rtf similarity index 100% rename from release/winx86/licenses/GPLv3_ru.rtf rename to package/winx86/licenses/GPLv3_ru.rtf diff --git a/release/winx86/licenses/GPLv3_zh_CN.rtf b/package/winx86/licenses/GPLv3_zh_CN.rtf similarity index 100% rename from release/winx86/licenses/GPLv3_zh_CN.rtf rename to package/winx86/licenses/GPLv3_zh_CN.rtf diff --git a/release/winx86/openpilotgcs.nsi b/package/winx86/openpilotgcs.nsi similarity index 94% rename from release/winx86/openpilotgcs.nsi rename to package/winx86/openpilotgcs.nsi index 0bf5eb52a..9cad5d233 100644 --- a/release/winx86/openpilotgcs.nsi +++ b/package/winx86/openpilotgcs.nsi @@ -50,17 +50,17 @@ !define INSTALLER_NAME "OpenPilot GCS Installer" ; Read automatically generated version info -; !define RELEASE_LBL "${DATE}-${TAG_OR_HASH8}" -; !define RELEASE_DIR "..\..\build\release-$${RELEASE_LBL}" -; !define OUT_FILE "OpenPilotGCS-$${RELEASE_LBL}-install.exe" -; !define FIRMWARE_DIR "firmware-$${RELEASE_LBL}" +; !define PACKAGE_LBL "${DATE}-${TAG_OR_HASH8}" +; !define PACKAGE_DIR "..\..\build\package-$${PACKAGE_LBL}" +; !define OUT_FILE "OpenPilotGCS-$${PACKAGE_LBL}-install.exe" +; !define FIRMWARE_DIR "firmware-$${PACKAGE_LBL}" ; !define PRODUCT_VERSION "0.0.0.0" ; !define FILE_VERSION "${TAG_OR_BRANCH}:${HASH8} ${DATETIME}" ; !define BUILD_DESCRIPTION "${TAG_OR_BRANCH}:${HASH8} built using ${ORIGIN} as origin, committed ${DATETIME} as ${HASH}" !include "${GCS_BUILD_TREE}\openpilotgcs.nsh" Name "${PRODUCT_NAME}" - OutFile "${RELEASE_DIR}\${OUT_FILE}" + OutFile "${PACKAGE_DIR}\${OUT_FILE}" VIProductVersion ${PRODUCT_VERSION} VIAddVersionKey "ProductName" "${INSTALLER_NAME}" @@ -185,7 +185,7 @@ SectionEnd Section "Firmware" InSecFirmware SetOutPath "$INSTDIR\firmware\${FIRMWARE_DIR}" - File /r "${RELEASE_DIR}\${FIRMWARE_DIR}\*" + File /r "${PACKAGE_DIR}\${FIRMWARE_DIR}\*" SectionEnd Section "Shortcuts" InSecShortcuts diff --git a/release/winx86/openpilotgcs.tpl b/package/winx86/openpilotgcs.tpl similarity index 74% rename from release/winx86/openpilotgcs.tpl rename to package/winx86/openpilotgcs.tpl index f75c6503a..bb0adc452 100644 --- a/release/winx86/openpilotgcs.tpl +++ b/package/winx86/openpilotgcs.tpl @@ -12,10 +12,10 @@ # ; Some names, paths and constants -!define RELEASE_LBL "${DATE}-${TAG_OR_HASH8}${DIRTY}" -!define RELEASE_DIR "..\..\build\release-$${RELEASE_LBL}" -!define OUT_FILE "OpenPilot-$${RELEASE_LBL}-install.exe" -!define FIRMWARE_DIR "firmware-$${RELEASE_LBL}" +!define PACKAGE_LBL "${DATE}-${TAG_OR_HASH8}${DIRTY}" +!define PACKAGE_DIR "..\..\build\package-$${PACKAGE_LBL}" +!define OUT_FILE "OpenPilot-$${PACKAGE_LBL}-install.exe" +!define FIRMWARE_DIR "firmware-$${PACKAGE_LBL}" ; Installer version info !define PRODUCT_VERSION "0.0.0.0" diff --git a/release/winx86/resources/header.bmp b/package/winx86/resources/header.bmp similarity index 100% rename from release/winx86/resources/header.bmp rename to package/winx86/resources/header.bmp diff --git a/release/winx86/resources/openpilot.ico b/package/winx86/resources/openpilot.ico similarity index 100% rename from release/winx86/resources/openpilot.ico rename to package/winx86/resources/openpilot.ico diff --git a/release/winx86/resources/welcome.bmp b/package/winx86/resources/welcome.bmp similarity index 100% rename from release/winx86/resources/welcome.bmp rename to package/winx86/resources/welcome.bmp diff --git a/release/winx86/translations/languages.nsh b/package/winx86/translations/languages.nsh similarity index 100% rename from release/winx86/translations/languages.nsh rename to package/winx86/translations/languages.nsh diff --git a/release/winx86/translations/strings_de.nsh b/package/winx86/translations/strings_de.nsh similarity index 100% rename from release/winx86/translations/strings_de.nsh rename to package/winx86/translations/strings_de.nsh diff --git a/release/winx86/translations/strings_en.nsh b/package/winx86/translations/strings_en.nsh similarity index 100% rename from release/winx86/translations/strings_en.nsh rename to package/winx86/translations/strings_en.nsh diff --git a/release/winx86/translations/strings_es.nsh b/package/winx86/translations/strings_es.nsh similarity index 100% rename from release/winx86/translations/strings_es.nsh rename to package/winx86/translations/strings_es.nsh diff --git a/release/winx86/translations/strings_fr.nsh b/package/winx86/translations/strings_fr.nsh similarity index 100% rename from release/winx86/translations/strings_fr.nsh rename to package/winx86/translations/strings_fr.nsh diff --git a/release/winx86/translations/strings_ru.nsh b/package/winx86/translations/strings_ru.nsh similarity index 100% rename from release/winx86/translations/strings_ru.nsh rename to package/winx86/translations/strings_ru.nsh diff --git a/release/winx86/translations/strings_zh_CN.nsh b/package/winx86/translations/strings_zh_CN.nsh similarity index 100% rename from release/winx86/translations/strings_zh_CN.nsh rename to package/winx86/translations/strings_zh_CN.nsh diff --git a/release/Makefile.osx b/release/Makefile.osx deleted file mode 100644 index 52e4670ef..000000000 --- a/release/Makefile.osx +++ /dev/null @@ -1,20 +0,0 @@ -# -# MacOSX-specific packaging -# - -package: gcs release_flight - ( \ - ROOT_DIR="$(ROOT_DIR)" \ - BUILD_DIR="$(BUILD_DIR)" \ - RELEASE_LBL="$(RELEASE_LBL)" \ - RELEASE_DIR="$(RELEASE_DIR)" \ - FW_DIR="$(FW_DIR)" \ - "$(ROOT_DIR)/release/osx/package" \ - ) - -gcs: uavobjects - $(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@ - -ground_package: | package - -.PHONY: gcs ground_package package diff --git a/shared/uavobjectdefinition/attitudesettings.xml b/shared/uavobjectdefinition/attitudesettings.xml index 808bbe80f..af89cc0d6 100644 --- a/shared/uavobjectdefinition/attitudesettings.xml +++ b/shared/uavobjectdefinition/attitudesettings.xml @@ -2,7 +2,7 @@ Settings for the @ref Attitude module used on CopterControl - +