diff --git a/MILESTONES.txt b/MILESTONES.txt index f4568be90..63cccf17d 100644 --- a/MILESTONES.txt +++ b/MILESTONES.txt @@ -111,9 +111,9 @@ D: May 2011 V: http://www.vimeo.com/23637586 M: First CopterControl flight on a Flybarless Heli -C: ? -D: ? -V: +C: Oleg Semyonov (Osnwt) +D: May 2011 +V: http://www.youtube.com/watch?v=-J8cxqzxxWw M: First Y6 CopterControl flight C: ? diff --git a/Makefile b/Makefile index 127d031f9..0d2700868 100644 --- a/Makefile +++ b/Makefile @@ -270,18 +270,6 @@ openpilotgcs: uavobjects_gcs $(MAKE) -w ; \ ) -.PHONY: gcs_installer -gcs_installer: openpilotgcs -ifeq ($(QT_SPEC), win32-g++) -ifeq ($(GCS_BUILD_CONF), release) - $(V1) cd $(BUILD_DIR)/ground/openpilotgcs/packaging/winx86 && $(MAKE) -r --no-print-directory $@ -else - $(error $@ can be generated for release build only (GCS_BUILD_CONF=release)) -endif -else - $(error $@ is currently only available on Windows) -endif - .PHONY: openpilotgcs_clean openpilotgcs_clean: $(V0) @echo " CLEAN $@" @@ -587,3 +575,12 @@ sim_win32_%: uavobjects_flight $(V1) mkdir -p $(BUILD_DIR)/sitl_win32 $(V1) $(MAKE) --no-print-directory \ -C $(ROOT_DIR)/flight/OpenPilot --file=$(ROOT_DIR)/flight/OpenPilot/Makefile.win32 $* + +############################## +# +# Release packaging components +# +############################## +.PHONY: release +release: + $(V1) cd $@ && $(MAKE) --no-print-directory $@ diff --git a/flight/Bootloaders/AHRS/Makefile b/flight/Bootloaders/AHRS/Makefile index ada1b99e3..4a43a6081 100644 --- a/flight/Bootloaders/AHRS/Makefile +++ b/flight/Bootloaders/AHRS/Makefile @@ -100,6 +100,7 @@ SRC += $(PIOSSTM32F10X)/pios_spi.c ## PIOS Hardware (Common) #SRC += $(PIOSCOMMON)/pios_com.c #SRC += $(PIOSCOMMON)/pios_hmc5843.c +SRC += $(PIOSCOMMON)/pios_board_info.c SRC += $(PIOSCOMMON)/pios_opahrs_proto.c SRC += $(PIOSCOMMON)/printf-stdarg.c SRC += $(PIOSCOMMON)/pios_bl_helper.c diff --git a/flight/Bootloaders/CopterControl/Makefile b/flight/Bootloaders/CopterControl/Makefile index 955d948d0..08b97701c 100644 --- a/flight/Bootloaders/CopterControl/Makefile +++ b/flight/Bootloaders/CopterControl/Makefile @@ -123,6 +123,7 @@ SRC += $(PIOSSTM32F10X)/pios_usb_hid_prop.c SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c ## PIOS Hardware (Common) +SRC += $(PIOSCOMMON)/pios_board_info.c SRC += $(PIOSCOMMON)/pios_com.c SRC += $(PIOSCOMMON)/pios_bl_helper.c SRC += $(PIOSCOMMON)/pios_iap.c diff --git a/flight/Bootloaders/OpenPilot/Makefile b/flight/Bootloaders/OpenPilot/Makefile index 735a63003..33a7f8705 100644 --- a/flight/Bootloaders/OpenPilot/Makefile +++ b/flight/Bootloaders/OpenPilot/Makefile @@ -124,6 +124,7 @@ SRC += $(PIOSSTM32F10X)/pios_usb_hid_prop.c SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c ## PIOS Hardware (Common) +SRC += $(PIOSCOMMON)/pios_board_info.c SRC += $(PIOSCOMMON)/pios_com.c SRC += $(PIOSCOMMON)/pios_opahrs_v0.c SRC += $(PIOSCOMMON)/pios_bl_helper.c diff --git a/flight/Bootloaders/PipXtreme/Makefile b/flight/Bootloaders/PipXtreme/Makefile index e1d2e8156..00fa37f81 100644 --- a/flight/Bootloaders/PipXtreme/Makefile +++ b/flight/Bootloaders/PipXtreme/Makefile @@ -122,6 +122,7 @@ SRC += $(PIOSSTM32F10X)/pios_usb_hid_prop.c SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c ## PIOS Hardware (Common) +SRC += $(PIOSCOMMON)/pios_board_info.c SRC += $(PIOSCOMMON)/pios_com.c SRC += $(PIOSCOMMON)/pios_bl_helper.c SRC += $(PIOSCOMMON)/pios_iap.c diff --git a/flight/CopterControl/Makefile b/flight/CopterControl/Makefile index c158a04fa..627882539 100644 --- a/flight/CopterControl/Makefile +++ b/flight/CopterControl/Makefile @@ -420,9 +420,10 @@ CSTANDARD = -std=gnu99 # Flags for C and C++ (arm-elf-gcc/arm-elf-g++) ifeq ($(DEBUG),YES) -CFLAGS = -g$(DEBUGF) -DDEBUG +CFLAGS = -DDEBUG endif +CFLAGS += -g$(DEBUGF) CFLAGS += -O$(OPT) CFLAGS += -mcpu=$(MCU) CFLAGS += $(CDEFS) diff --git a/flight/PiOS/Boards/STM32103CB_CC_Rev1.h b/flight/PiOS/Boards/STM32103CB_CC_Rev1.h index a39b8b457..09405bfa3 100644 --- a/flight/PiOS/Boards/STM32103CB_CC_Rev1.h +++ b/flight/PiOS/Boards/STM32103CB_CC_Rev1.h @@ -66,8 +66,6 @@ TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1 #define BOOTLOADER_VERSION 0 #define BOARD_TYPE 0x04 #define BOARD_REVISION 0x01 -//#define HW_VERSION (BOARD_TYPE << 8) | BOARD_REVISION - #define MEM_SIZE 0x20000 //128K #define SIZE_OF_DESCRIPTION 100 #define START_OF_USER_CODE (uint32_t)0x08003000 diff --git a/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h b/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h index 3234b8014..a4792a717 100644 --- a/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h +++ b/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h @@ -61,7 +61,7 @@ TIM4 | STOPWATCH | #define BOOTLOADER_VERSION 0 #define BOARD_TYPE 0x03 #define BOARD_REVISION 0x01 -#define MEM_SIZE ((uint32_t)(*((volatile uint16_t *)(0x1FFFF7E0))) * 1024 - 1024) //128K +#define MEM_SIZE (0x20000 - 0x00400) // 128K - 1K (reserved for config data) #define SIZE_OF_DESCRIPTION 100 #define START_OF_USER_CODE (uint32_t)0x08003000 #define SIZE_OF_CODE (uint32_t)(MEM_SIZE-(START_OF_USER_CODE-0x08000000)-SIZE_OF_DESCRIPTION) diff --git a/flight/PiOS/Common/pios_board_info.c b/flight/PiOS/Common/pios_board_info.c new file mode 100644 index 000000000..db9e72f9e --- /dev/null +++ b/flight/PiOS/Common/pios_board_info.c @@ -0,0 +1,16 @@ +#include +#include + +#include "pios_board_info.h" + +const struct pios_board_info __attribute__((__used__)) __attribute__((__section__(".boardinfo"))) pios_board_info_blob = { + .magic = PIOS_BOARD_INFO_BLOB_MAGIC, + .board_type = BOARD_TYPE, + .board_rev = BOARD_REVISION, + .bl_rev = BOOTLOADER_VERSION, + .hw_type = HW_TYPE, + .fw_base = START_OF_USER_CODE, + .fw_size = SIZE_OF_CODE, + .desc_base = START_OF_USER_CODE + SIZE_OF_CODE, + .desc_size = SIZE_OF_DESCRIPTION, +}; diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld index ccc2cfe7a..4f3c77d4c 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld @@ -45,4 +45,11 @@ SECTIONS . = ALIGN(4); _end = . ; + + .boardinfo : + { + . = ALIGN(4); + KEEP(*(.boardinfo)) + . = ALIGN(4); + } > BD_INFO } diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_memory.ld b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_memory.ld index 50823e432..9f7bf0f19 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_memory.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_memory.ld @@ -1,6 +1,7 @@ MEMORY { - BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 8K - FLASH (rx) : ORIGIN = 0x08000000 + 8K, LENGTH = 128K - 8K - SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 20K + BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x02000 - 0x00080 + BD_INFO (r) : ORIGIN = 0x08002000 - 0x80, LENGTH = 0x00080 + FLASH (rx) : ORIGIN = 0x08002000, LENGTH = 0x20000 - 0x02000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x05000 } diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld index 207956b53..82a8ae7f4 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld @@ -3,6 +3,12 @@ _estack = 0x20004FF0; /* Section Definitions */ SECTIONS { + .boardinfo : + { + . = ALIGN(4); + PROVIDE(pios_board_info_blob = .); + } > BD_INFO + .text : { KEEP(*(.isr_vector .isr_vector.*)) diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_BL_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_BL_sections.ld index b5b4e07d0..13cd35df6 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_BL_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_BL_sections.ld @@ -61,6 +61,12 @@ SECTIONS . = ALIGN(4); _end = . ; + .boardinfo : + { + . = ALIGN(4); + KEEP(*(.boardinfo)) + } > BD_INFO + /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_memory.ld b/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_memory.ld index 57146d7d6..fd36c31ba 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_memory.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_memory.ld @@ -1,6 +1,7 @@ MEMORY { - BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 12K - FLASH (rx) : ORIGIN = 0x08000000 + 12K, LENGTH = 128K - 12K - SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 20K + BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x03000 - 0x00080 + BD_INFO (r) : ORIGIN = 0x08003000 - 0x80, LENGTH = 0x00080 + FLASH (rx) : ORIGIN = 0x08003000, LENGTH = 0x20000 - 0x03000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x05000 } diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_sections.ld index 17534b780..6e46c43c5 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_sections.ld @@ -8,6 +8,12 @@ _estack = 0x20004FF0; /* Section Definitions */ SECTIONS { + .boardinfo : + { + . = ALIGN(4); + PROVIDE(pios_board_info_blob = .); + } > BD_INFO + .text : { KEEP(*(.isr_vector .isr_vector.*)) diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_BL_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_BL_sections.ld index de9efa6fc..4b35cd71b 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_BL_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_BL_sections.ld @@ -50,4 +50,11 @@ SECTIONS . = ALIGN(4); _end = . ; + + .boardinfo : + { + . = ALIGN(4); + KEEP(*(.boardinfo)) + . = ALIGN(4); + } > BD_INFO } diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_memory.ld b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_memory.ld index 57146d7d6..fd36c31ba 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_memory.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_memory.ld @@ -1,6 +1,7 @@ MEMORY { - BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 12K - FLASH (rx) : ORIGIN = 0x08000000 + 12K, LENGTH = 128K - 12K - SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 20K + BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x03000 - 0x00080 + BD_INFO (r) : ORIGIN = 0x08003000 - 0x80, LENGTH = 0x00080 + FLASH (rx) : ORIGIN = 0x08003000, LENGTH = 0x20000 - 0x03000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x05000 } diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_sections.ld index 678f164c8..dc09e6f1c 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_sections.ld @@ -8,6 +8,12 @@ _estack = 0x20004FF0; /* Section Definitions */ SECTIONS { + .boardinfo : + { + . = ALIGN(4); + PROVIDE(pios_board_info_blob = .); + } > BD_INFO + .text : { KEEP(*(.isr_vector .isr_vector.*)) diff --git a/flight/PiOS/STM32F10x/link_STM3210E_OP_BL_sections.ld b/flight/PiOS/STM32F10x/link_STM3210E_OP_BL_sections.ld index 120a2ba1b..3add614d6 100644 --- a/flight/PiOS/STM32F10x/link_STM3210E_OP_BL_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM3210E_OP_BL_sections.ld @@ -163,7 +163,6 @@ PROVIDE ( SCB = (SCS_BASE + 0x0D00) ) ; SECTIONS { - /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */ .isr_vector : { @@ -313,6 +312,13 @@ SECTIONS __exidx_start = .; __exidx_end = .; + .boardinfo : + { + . = ALIGN(4); + KEEP(*(.boardinfo)) + . = ALIGN(4); + } > BD_INFO + /* after that it's only debugging information. */ /* remove the debugging information from the standard libraries */ diff --git a/flight/PiOS/STM32F10x/link_STM3210E_OP_memory.ld b/flight/PiOS/STM32F10x/link_STM3210E_OP_memory.ld index 72ed542d2..ce70e2e5c 100644 --- a/flight/PiOS/STM32F10x/link_STM3210E_OP_memory.ld +++ b/flight/PiOS/STM32F10x/link_STM3210E_OP_memory.ld @@ -1,11 +1,12 @@ MEMORY { - RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K - BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 20K - FLASH (rx) : ORIGIN = 0x08000000 + 20K, LENGTH = 512K - 20K - FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0 - EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0 - EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0 - EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0 - EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0 + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x10000 + BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x05000 - 0x00080 + BD_INFO (r) : ORIGIN = 0x08005000 - 0x80, LENGTH = 0x00080 + FLASH (rx) : ORIGIN = 0x08005000, LENGTH = 0x80000 - 0x05000 + FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0 + EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0 + EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0 + EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0 + EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0 } diff --git a/flight/PiOS/STM32F10x/link_STM3210E_OP_sections.ld b/flight/PiOS/STM32F10x/link_STM3210E_OP_sections.ld index 97e60b135..2292a40e2 100644 --- a/flight/PiOS/STM32F10x/link_STM3210E_OP_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM3210E_OP_sections.ld @@ -163,7 +163,12 @@ PROVIDE ( SCB = (SCS_BASE + 0x0D00) ) ; SECTIONS { - + .boardinfo : + { + . = ALIGN(4); + PROVIDE(pios_board_info_blob = .); + } > BD_INFO + /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */ .isr_vector : { @@ -208,7 +213,6 @@ SECTIONS _sidata = _etext; } >FLASH - /* * This stack is used both as the initial sp during early init as well as ultimately * being used as the STM32's MSP (Main Stack Pointer) which is the same stack that diff --git a/flight/PiOS/inc/pios_board_info.h b/flight/PiOS/inc/pios_board_info.h new file mode 100644 index 000000000..579a3ec2b --- /dev/null +++ b/flight/PiOS/inc/pios_board_info.h @@ -0,0 +1,15 @@ +#define PIOS_BOARD_INFO_BLOB_MAGIC 0xBDBDBDBD + +struct pios_board_info { + uint32_t magic; + uint8_t board_type; + uint8_t board_rev; + uint8_t bl_rev; + uint8_t hw_type; + uint32_t fw_base; + uint32_t fw_size; + uint32_t desc_base; + uint32_t desc_size; +} __attribute__((packed)); + +extern const struct pios_board_info pios_board_info_blob; diff --git a/ground/openpilotgcs/packaging/packaging.pro b/ground/openpilotgcs/copydata.pro similarity index 96% rename from ground/openpilotgcs/packaging/packaging.pro rename to ground/openpilotgcs/copydata.pro index 5fa82fa70..c50ad9330 100644 --- a/ground/openpilotgcs/packaging/packaging.pro +++ b/ground/openpilotgcs/copydata.pro @@ -1,7 +1,6 @@ -include(../openpilotgcs.pri) +include(openpilotgcs.pri) TEMPLATE = subdirs -SUBDIRS = winx86 # Copy Qt runtime libraries into the build directory (to run or package) equals(copydata, 1) { diff --git a/ground/openpilotgcs/openpilotgcs.pro b/ground/openpilotgcs/openpilotgcs.pro index 5c2611a11..22a893f52 100644 --- a/ground/openpilotgcs/openpilotgcs.pro +++ b/ground/openpilotgcs/openpilotgcs.pro @@ -9,5 +9,7 @@ include(openpilotgcs.pri) TEMPLATE = subdirs CONFIG += ordered -SUBDIRS = src share packaging +SUBDIRS = src share copydata unix:!macx:!isEmpty(copydata):SUBDIRS += bin + +copydata.file = copydata.pro diff --git a/ground/openpilotgcs/packaging/winx86/make_header.cmd b/ground/openpilotgcs/packaging/winx86/make_header.cmd deleted file mode 100644 index 247b17af1..000000000 --- a/ground/openpilotgcs/packaging/winx86/make_header.cmd +++ /dev/null @@ -1,86 +0,0 @@ -@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/make_installer.cmd b/ground/openpilotgcs/packaging/winx86/make_installer.cmd deleted file mode 100644 index 46c6567ac..000000000 --- a/ground/openpilotgcs/packaging/winx86/make_installer.cmd +++ /dev/null @@ -1,19 +0,0 @@ -@echo off -rem -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 Set path to NSIS compiler -set NSIS=%ProgramFiles%/NSIS/Unicode -set NSISC=%NSIS%/makensis.exe - -rem Input script file (in the same directory as this batch file) -for %%D in (%0) do set NSI=%%~dD%%~pD\openpilotgcs.nsi - -rem Build installer -echo Generating Windows installer... -"%NSISC%" /V3 %NSI% diff --git a/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsh b/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsh deleted file mode 100644 index 222ed0d68..000000000 --- a/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsh +++ /dev/null @@ -1,11 +0,0 @@ -# -# git not found, default values used instead. -# - -; Installer file name -!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 "Unreleased version." diff --git a/ground/openpilotgcs/packaging/winx86/winx86.pro b/ground/openpilotgcs/packaging/winx86/winx86.pro deleted file mode 100644 index f1364166a..000000000 --- a/ground/openpilotgcs/packaging/winx86/winx86.pro +++ /dev/null @@ -1,50 +0,0 @@ -include(../../openpilotgcs.pri) - -TEMPLATE = subdirs - -# Some Windows packaging magic (for release build only) -equals(copydata, 1):win32:CONFIG(release, debug|release) { - - # 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, /, \\)) - } - - # 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 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/src/experimental/USB_UPLOAD_TOOL/main.cpp b/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/main.cpp index e846cbea6..c9c687986 100644 --- a/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/main.cpp +++ b/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/main.cpp @@ -324,13 +324,5 @@ int main(int argc, char *argv[]) return 0; } -// OP_DFU dfu(true); -// //dfu.findDevices(); -// dfu.enterDFU(1); -// dfu.UploadFirmware("c:/ahrs.bin",true,1); -// // dfu.UploadDescription("josemanuel"); -// // QString str=dfu.DownloadDescription(12); - // dfu.JumpToApp(); - // qDebug()<<"Description="< #include #include -#include +#include "utils/qwineventnotifier_p.h" #endif /*! diff --git a/ground/openpilotgcs/src/libs/utils/consoleprocess_win.cpp b/ground/openpilotgcs/src/libs/utils/consoleprocess_win.cpp index f58007c5c..15eec8361 100644 --- a/ground/openpilotgcs/src/libs/utils/consoleprocess_win.cpp +++ b/ground/openpilotgcs/src/libs/utils/consoleprocess_win.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include "qwineventnotifier_p.h" #include diff --git a/ground/openpilotgcs/src/libs/utils/qwineventnotifier_p.h b/ground/openpilotgcs/src/libs/utils/qwineventnotifier_p.h new file mode 100644 index 000000000..459cd6730 --- /dev/null +++ b/ground/openpilotgcs/src/libs/utils/qwineventnotifier_p.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINEVENTNOTIFIER_P_H +#define QWINEVENTNOTIFIER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "QtCore/qobject.h" +#include "QtCore/qt_windows.h" + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QWinEventNotifier : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QObject) + +public: + explicit QWinEventNotifier(QObject *parent = 0); + explicit QWinEventNotifier(HANDLE hEvent, QObject *parent = 0); + ~QWinEventNotifier(); + + void setHandle(HANDLE hEvent); + HANDLE handle() const; + + bool isEnabled() const; + +public Q_SLOTS: + void setEnabled(bool enable); + +Q_SIGNALS: + void activated(HANDLE hEvent); + +protected: + bool event(QEvent * e); + +private: + Q_DISABLE_COPY(QWinEventNotifier) + + HANDLE handleToEvent; + bool enabled; +}; + +QT_END_NAMESPACE + +#endif // QWINEVENTNOTIFIER_P_H diff --git a/ground/openpilotgcs/src/plugins/config/airframe.ui b/ground/openpilotgcs/src/plugins/config/airframe.ui index 3b7fb1d57..44d65930a 100644 --- a/ground/openpilotgcs/src/plugins/config/airframe.ui +++ b/ground/openpilotgcs/src/plugins/config/airframe.ui @@ -17,7 +17,7 @@ - 1 + 0 @@ -102,7 +102,7 @@ - 3 + 0 diff --git a/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp b/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp index d892c6f7a..7284d5d55 100644 --- a/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp @@ -42,6 +42,8 @@ deviceWidget::deviceWidget(QWidget *parent) : QPixmap pix = QPixmap(QString(":uploader/images/view-refresh.svg")); myDevice->statusIcon->setPixmap(pix); + + myDevice->certifiedFW->setText(""); } @@ -123,6 +125,9 @@ void deviceWidget::populate() QString str = m_dfu->DownloadDescription(size); myDevice->description->setMaxLength(size); myDevice->description->setText(str.left(str.indexOf(QChar(255)))); + QPixmap pix = QPixmap(QString(":uploader/images/gtk-info.svg")); + myDevice->certifiedFW->setPixmap(pix); + myDevice->certifiedFW->setToolTip(tr("Custom Firmware Build")); myDevice->buildDate->setText("Warning: development firmware"); myDevice->commitTag->setText(""); } @@ -182,6 +187,9 @@ bool deviceWidget::populateStructuredDescription(QByteArray desc) QString dscText = QString(desc.mid(14,26)); myDevice->description->setText(dscText); + QPixmap pix = QPixmap(QString(":uploader/images/application-certificate.svg")); + myDevice->certifiedFW->setPixmap(pix); + myDevice->certifiedFW->setToolTip(tr("Official Firmware Build")); return true; } @@ -268,12 +276,7 @@ void deviceWidget::uploadFirmware() if (firmwareBoard != board) { status("Error: firmware does not match board", STATUSICON_FAIL); return; - } else { - // Not a structured description: warn user - myDevice->buildDate->setText("Warning: development firmware"); - myDevice->commitTag->setText(""); } - // Check the firmware embedded in the file: QByteArray firmwareHash = desc.mid(40,20); QByteArray fileHash = QCryptographicHash::hash(arr.left(arr.length()-100), QCryptographicHash::Sha1); @@ -281,9 +284,6 @@ void deviceWidget::uploadFirmware() status("Error: firmware file corrupt", STATUSICON_FAIL); return; } - - - } else { // The firmware is not packaged, just upload the text in the description field // if it is there. @@ -291,8 +291,6 @@ void deviceWidget::uploadFirmware() } - - status("Starting firmware upload", STATUSICON_RUNNING); // We don't know which device was used previously, so we // are cautious and reenter DFU for this deviceID: @@ -416,7 +414,7 @@ QString deviceWidget::setOpenFileName() QString fileName = QFileDialog::getOpenFileName(this, tr("Select firmware file"), "", - tr("Firmware Files (*.bin)"), + tr("Firmware Files (*.bin *.opfw)"), &selectedFilter, options); return fileName; diff --git a/ground/openpilotgcs/src/plugins/uploader/devicewidget.ui b/ground/openpilotgcs/src/plugins/uploader/devicewidget.ui index 5d09b3d1a..a5f17794e 100644 --- a/ground/openpilotgcs/src/plugins/uploader/devicewidget.ui +++ b/ground/openpilotgcs/src/plugins/uploader/devicewidget.ui @@ -137,13 +137,6 @@ - - - - Build Date - - - @@ -151,6 +144,30 @@ + + + + + + certified + + + + + + + + 0 + 0 + + + + buildDate + + + + + diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp index d9823a36c..2943bcdfd 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp @@ -291,7 +291,10 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success) /* m_config->haltButton->setEnabled(false); m_config->resetButton->setEnabled(false); + */ + // Need to re-enable in case we were not connected m_config->bootButton->setEnabled(true); + /* m_config->telemetryLink->setEnabled(false); m_config->rescueButton->setEnabled(false); */ @@ -359,6 +362,7 @@ void UploaderGadgetWidget::systemBoot() delete dfu; dfu = NULL; m_config->bootButton->setEnabled(true); + m_config->rescueButton->setEnabled(true); // Boot not possible, maybe Rescue OK? return; } log("Booting system..."); @@ -503,7 +507,7 @@ void UploaderGadgetWidget::systemRescue() } m_config->haltButton->setEnabled(false); m_config->resetButton->setEnabled(false); - //m_config->bootButton->setEnabled(true); + m_config->bootButton->setEnabled(true); m_config->rescueButton->setEnabled(false); currentStep = IAP_STATE_BOOTLOADER; // So that we can boot from the GUI afterwards. } diff --git a/make/scripts/version-info.py b/make/scripts/version-info.py index ad747ce74..5022cbd73 100644 --- a/make/scripts/version-info.py +++ b/make/scripts/version-info.py @@ -11,7 +11,7 @@ from subprocess import Popen, PIPE from re import search, MULTILINE from datetime import datetime from string import Template -import argparse +import optparse import hashlib import sys @@ -47,7 +47,7 @@ class Repo: self._rc = git.poll() def _get_origin(self): - """Get and store the repository origin URL""" + """Get and store the repository fetch origin path""" self._origin = None self._exec('remote -v') if self._rc == 0: @@ -82,6 +82,14 @@ class Repo: if m: self._branch = m.group(1) + def _get_dirty(self): + """Check for dirty state of repository""" + self._dirty = False + self._exec('update-index --refresh --unmerged') + self._exec('diff-index --name-only --exit-code --quiet HEAD') + if self._rc: + self._dirty = True + def __init__(self, path = "."): """Initialize object instance and read repo info""" self._path = path @@ -92,12 +100,14 @@ class Repo: self._get_time() self._get_tag() self._get_branch() + self._get_dirty() else: self._hash = None self._origin = None self._time = None self._tag = None self._branch = None + self._dirty = None def path(self): """Return the repository path""" @@ -141,6 +151,13 @@ class Repo: else: return self._branch + def dirty(self, dirty = "-dirty", clean = ""): + """Return git repository dirty state or empty string""" + if self._dirty: + return dirty + else: + return clean + def info(self): """Print some repository info""" print "path: ", self.path() @@ -151,6 +168,7 @@ class Repo: print "short hash: ", self.hash(8) print "branch: ", self.branch() print "commit tag: ", self.tag() + print "dirty: ", self.dirty('yes', 'no') def file_from_template(tpl_name, out_name, dict): """Create or update file from template using dictionary @@ -206,7 +224,7 @@ def file_from_template(tpl_name, out_name, dict): of.close() def sha1(file): - """Provides C source representation of sha1 sum of file.""" + """Provides C source representation of sha1 sum of file""" if file == None: return "" else: @@ -240,29 +258,39 @@ dependent targets. """ # Parse command line. - parser = argparse.ArgumentParser( - formatter_class=argparse.RawDescriptionHelpFormatter, + class RawDescriptionHelpFormatter(optparse.IndentedHelpFormatter): + """optparse formatter function to pretty print raw epilog""" + def format_epilog(self, epilog): + if epilog: + return "\n" + epilog + "\n" + else: + return "" + + parser = optparse.OptionParser( + formatter=RawDescriptionHelpFormatter(), description = "Performs variable substitution in template file or string.", epilog = main.__doc__); - parser.add_argument('--path', default='.', + parser.add_option('--path', default='.', help='path to the git repository'); - parser.add_argument('--info', action='store_true', + parser.add_option('--info', action='store_true', help='print repository info to stdout'); - parser.add_argument('--format', + parser.add_option('--format', help='format string to print to stdout'); - parser.add_argument('--template', + parser.add_option('--template', help='name of template file'); - parser.add_argument('--outfile', + parser.add_option('--outfile', help='name of output file'); - parser.add_argument('--image', + parser.add_option('--image', help='name of image file for sha1 calculation'); - parser.add_argument('--type', default="", + parser.add_option('--type', default="", help='board type, for example, 0x04 for CopterControl'); - parser.add_argument('--revision', default = "", + parser.add_option('--revision', default = "", help='board revision, for example, 0x01'); - args = parser.parse_args() + (args, positional_args) = parser.parse_args() + if len(positional_args) != 0: + parser.error("incorrect number of arguments, try --help for help") # Process arguments. No advanced error handling is here. # Any error will raise an exception and terminate process @@ -277,8 +305,10 @@ dependent targets. HASH8 = r.hash(8), TAG_OR_BRANCH = r.tag(r.branch('unreleased')), TAG_OR_HASH8 = r.tag(r.hash(8, 'untagged')), + DIRTY = r.dirty(), UNIXTIME = r.time(), DATE = r.time('%Y%m%d'), + DATETIME = r.time('%Y%m%d %H:%M'), BOARD_TYPE = args.type, BOARD_REVISION = args.revision, SHA1 = sha1(args.image), diff --git a/make/templates/firmwareinfotemplate.c b/make/templates/firmwareinfotemplate.c index e703d2e24..3f3829cc6 100644 --- a/make/templates/firmwareinfotemplate.c +++ b/make/templates/firmwareinfotemplate.c @@ -38,7 +38,7 @@ * 4 bytes: GIT commit tag (short version of SHA1). * 4 bytes: Unix timestamp of compile time. * 2 bytes: target platform. Should follow same rule as BOARD_TYPE and BOARD_REVISION in board define files. - * 26 bytes: commit tag if it is there, otherwise branch name. Zero-padded. + * 26 bytes: commit tag if it is there, otherwise branch name. '-dirty' may be added if needed. Zero-padded. * ---- 40 bytes limit --- * 20 bytes: SHA1 sum of the firmware. * 40 bytes: free for now. @@ -62,7 +62,7 @@ const struct fw_version_info fw_version_blob __attribute__((used)) __attribute__ .timestamp = ${UNIXTIME}, .board_type = ${BOARD_TYPE}, .board_revision = ${BOARD_REVISION}, - .commit_tag_name = "${TAG_OR_BRANCH}", + .commit_tag_name = "${TAG_OR_BRANCH}${DIRTY}", .sha1sum = { ${SHA1} }, }; diff --git a/make/winx86/README.txt b/make/winx86/README.txt index fb383fa17..24f160f34 100644 --- a/make/winx86/README.txt +++ b/make/winx86/README.txt @@ -33,8 +33,8 @@ 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 - - CodeSourcery G++ in C:\CodeSourcery - QtSDK in C:\Qt\2010.05 + - 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 @@ -55,6 +55,10 @@ accordingly. Also if you have tools installed into different directories and they are not in the PATH, then you may want to update paths in the sh.cmd script too (it is self-documented). +Note for Windows 64-bit users: 64-bit systems use %ProgramFiles(x86)% folder +as default for program files instead of %ProgramFiles%. You have to check where +your tools are installed and update paths above accordingly. + 3. How to use it? ----------------- diff --git a/make/winx86/cmd/sh.cmd b/make/winx86/cmd/sh.cmd index d82c7ec99..dd70a8e44 100644 --- a/make/winx86/cmd/sh.cmd +++ b/make/winx86/cmd/sh.cmd @@ -53,7 +53,7 @@ set PATH_DIRS= call :which MSYSGIT "%ProgramFiles%\Git\bin" git.exe call :which QTMINGW "C:\Qt\2010.05\mingw\bin" mingw32-make.exe call :which QTSDK "C:\Qt\2010.05\qt\bin" qmake.exe -call :which CODESOURCERY "C:\CodeSourcery\bin" cs-make.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 call :which OPENOCDBIN "C:\OpenOCD\0.4.0\bin" openocd.exe diff --git a/release/Makefile b/release/Makefile index cfb131028..8f5af3008 100644 --- a/release/Makefile +++ b/release/Makefile @@ -13,13 +13,25 @@ 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}) +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) BL_DIR := $(FW_DIR)/bootloaders BLUPD_DIR := $(FW_DIR)/bootloader_updaters +# Clean build options (recommended for package testing only) +ifeq ($(CLEAN_BUILD), NO) +CLEAN_GROUND := NO +CLEAN_FLIGHT := YES +else ifeq ($(CLEAN_BUILD), NEVER) +CLEAN_GROUND := NO +CLEAN_FLIGHT := NO +else +CLEAN_GROUND := YES +CLEAN_FLIGHT := YES +endif + # Setup targets FW_TARGETS_COMMON := ahrs pipxtreme FW_TARGETS_INPUT := coptercontrol openpilot @@ -35,14 +47,23 @@ help: @echo @echo " Here is a summary of the available targets:" @echo - @echo " [Release build and packaging]" - @echo " release - Build and package the OpenPilot release" - @echo " release_flight - Build and package the OpenPilot flight firmware" + @echo " [Packaging]" + @echo " release - Build and package the OpenPilot distributable" + @echo " release_flight - Build and package the OpenPilot flight firmware only" @echo @echo " Notes:" - @echo " - the build directory will be removed first on every run" - @echo " unless CLEAN_BUILD=NO is defined (recommended for testing only)" - @echo " - release packages will be placed in $(RELEASE_DIR)" + @echo " - package will be placed in $(RELEASE_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." + @echo + @echo " CLEAN_BUILD=NO means no clean before build except for multi-input" + @echo " firmware binaries like CopterControl or OpenPilot. This usually is" + @echo " safe." + @echo + @echo " CLEAN_BUILD=NEVER means no clean will be done at all. This will," + @echo " probably, give invalid multi-input firmware and is recommended" + @echo " for package testing only. Do not use for release builds." @echo # Clean and build uavobjects since all parts depend on them @@ -50,7 +71,7 @@ uavobjects: all_clean $(V1) $(MAKE) -C $(ROOT_DIR) $@ all_clean: -ifneq ($(CLEAN_BUILD), NO) +ifneq ($(CLEAN_GROUND), NO) $(V1) $(MAKE) -C $(ROOT_DIR) $@ endif @@ -61,13 +82,15 @@ endif # $4 = installed file name prefix (optional) # $5 = installed file name suffix (optional) # $6 = extra make options (for instance, USE_SPEKTRUM=YES) -# $7 = optional target suffix (for instance, clean, if target must be cleaned first) +# $7 = optional 'clean' string to clean target before rebuild # $8 = list of targets to install (without _install suffix) # $9 = inner make target (usually install, but can be other to just build) define INSTALL_TEMPLATE $(1): $(2) -ifneq ($(7),) +ifeq ($(7),clean) +ifneq ($$(CLEAN_FLIGHT), NO) $$(V1) +$(MAKE) -C $(ROOT_DIR) $(6) $(addsuffix _$(7), $(8)) +endif endif $$(V1) +$(MAKE) -C $(ROOT_DIR) INSTALL_DIR=$(3) INSTALL_PFX=$(4) INSTALL_SFX=$(5) $(6) $(addsuffix _$(9), $(8)) .PHONY: $(1) @@ -92,16 +115,16 @@ $(eval $(call INSTALL_TEMPLATE,blupd_pipxtreme,all_bl,$(BLUPD_DIR),PipXtreme_,-$ $(eval $(call INSTALL_TEMPLATE,fw_tools,uavobjects,$(BLUPD_DIR),,-FlashEraser-$(RELEASE_LBL),ERASE_FLASH=YES,clean,$(FW_TARGETS_TOOLS),install)) # Order-only dependencies -# They are bit complicated to support parallel (-j) builds and to -# create the pwm/ppm/spektrum and CC flash eraser targets in a sequence of build steps +# They are bit complicated to support parallel (-j) builds and to create +# the pwm/ppm/spektrum and CC flash eraser targets in some fixed order -fw_pwm: | # default dependencies +fw_pwm: | # default dependencies, will be built first -fw_spektrum: | fw_pwm # sequential build +fw_spektrum: | fw_pwm # ordered build -fw_ppm: | fw_spektrum # sequential build +fw_ppm: | fw_spektrum # ordered build -fw_tools: | fw_spektrum # sequential build, replace fw_spektrum by fw_ppm if uncommented below +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 @@ -132,7 +155,7 @@ MAKEFLAGS += --no-print-directory endif # Platform-dependent stuff -PLATFORM := win32 +PLATFORM := winx86 UNAME := $(shell uname) ifeq ($(UNAME), Linux) PLATFORM := linux diff --git a/release/Makefile.win32 b/release/Makefile.win32 deleted file mode 100644 index b1283c3cf..000000000 --- a/release/Makefile.win32 +++ /dev/null @@ -1,11 +0,0 @@ -# -# Windows-specific packaging -# - -# Generate GCS installer -gcs_installer: uavobjects - $(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@ - -ground_package: | gcs_installer - -.PHONY: gcs_installer ground_package diff --git a/release/Makefile.winx86 b/release/Makefile.winx86 new file mode 100644 index 000000000..1c8a1db4c --- /dev/null +++ b/release/Makefile.winx86 @@ -0,0 +1,22 @@ +# +# Windows-specific packaging +# + +NSIS_CMD := makensis.exe +NSIS_OPTS := /V3 +NSIS_DIR := $(ROOT_DIR)/release/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))" + $(VERSION_CMD) --template="$(NSIS_TEMPLATE)" --outfile="$(NSIS_HEADER)" + $(NSIS_CMD) $(NSIS_OPTS) $(NSIS_SCRIPT) + +gcs: uavobjects + $(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@ + +ground_package: | package + +.PHONY: gcs ground_package package diff --git a/ground/openpilotgcs/packaging/winx86/licenses/GPLv3_de.rtf b/release/winx86/licenses/GPLv3_de.rtf similarity index 100% rename from ground/openpilotgcs/packaging/winx86/licenses/GPLv3_de.rtf rename to release/winx86/licenses/GPLv3_de.rtf diff --git a/ground/openpilotgcs/packaging/winx86/licenses/GPLv3_en.rtf b/release/winx86/licenses/GPLv3_en.rtf similarity index 100% rename from ground/openpilotgcs/packaging/winx86/licenses/GPLv3_en.rtf rename to release/winx86/licenses/GPLv3_en.rtf diff --git a/ground/openpilotgcs/packaging/winx86/licenses/GPLv3_es.rtf b/release/winx86/licenses/GPLv3_es.rtf similarity index 100% rename from ground/openpilotgcs/packaging/winx86/licenses/GPLv3_es.rtf rename to release/winx86/licenses/GPLv3_es.rtf diff --git a/ground/openpilotgcs/packaging/winx86/licenses/GPLv3_fr.rtf b/release/winx86/licenses/GPLv3_fr.rtf similarity index 100% rename from ground/openpilotgcs/packaging/winx86/licenses/GPLv3_fr.rtf rename to release/winx86/licenses/GPLv3_fr.rtf diff --git a/ground/openpilotgcs/packaging/winx86/licenses/GPLv3_ru.rtf b/release/winx86/licenses/GPLv3_ru.rtf similarity index 100% rename from ground/openpilotgcs/packaging/winx86/licenses/GPLv3_ru.rtf rename to release/winx86/licenses/GPLv3_ru.rtf diff --git a/ground/openpilotgcs/packaging/winx86/licenses/GPLv3_zh_CN.rtf b/release/winx86/licenses/GPLv3_zh_CN.rtf similarity index 100% rename from ground/openpilotgcs/packaging/winx86/licenses/GPLv3_zh_CN.rtf rename to release/winx86/licenses/GPLv3_zh_CN.rtf diff --git a/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsi b/release/winx86/openpilotgcs.nsi similarity index 91% rename from ground/openpilotgcs/packaging/winx86/openpilotgcs.nsi rename to release/winx86/openpilotgcs.nsi index 47037b59b..93a61d785 100644 --- a/ground/openpilotgcs/packaging/winx86/openpilotgcs.nsi +++ b/release/winx86/openpilotgcs.nsi @@ -34,8 +34,7 @@ ; Tree root locations (relative to this script location) !define NSIS_DATA_TREE "." - !define GCS_BUILD_TREE "..\..\..\..\build\ground\openpilotgcs" - !define WINX86_PATH "packaging\winx86" + !define GCS_BUILD_TREE "..\..\build\ground\openpilotgcs" ; Default installation folder InstallDir "$LOCALAPPDATA\OpenPilot" @@ -51,14 +50,17 @@ !define INSTALLER_NAME "OpenPilot GCS Installer" ; Read automatically generated version info -; !define OUT_FILE "OpenPilotGCS-XXXX-install.exe" +; !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 PRODUCT_VERSION "0.0.0.0" -; !define FILE_VERSION "0.0.0.0" -; !define BUILD_DESCRIPTION "Unknown revision." - !include "${GCS_BUILD_TREE}\${WINX86_PATH}\openpilotgcs.nsh" +; !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 "${GCS_BUILD_TREE}\${WINX86_PATH}\${OUT_FILE}" + OutFile "${RELEASE_DIR}\${OUT_FILE}" VIProductVersion ${PRODUCT_VERSION} VIAddVersionKey "ProductName" "${INSTALLER_NAME}" @@ -149,6 +151,8 @@ Section "Core files" InSecCore SectionIn RO SetOutPath "$INSTDIR\bin" File /r "${GCS_BUILD_TREE}\bin\*" + SetOutPath "$INSTDIR\share\${FIRMWARE_DIR}" + File /r "${RELEASE_DIR}\${FIRMWARE_DIR}\*" SectionEnd Section "Plugins" InSecPlugins diff --git a/release/winx86/openpilotgcs.tpl b/release/winx86/openpilotgcs.tpl new file mode 100644 index 000000000..f75c6503a --- /dev/null +++ b/release/winx86/openpilotgcs.tpl @@ -0,0 +1,23 @@ +# +# ***************************************************************************** +# +# @file ${OUTFILENAME} +# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011. +# @brief Autogenerated NSIS header file, built using template +# ${TEMPLATE} +# +# @see The GNU Public License (GPL) Version 3 +# +# ***************************************************************************** +# + +; 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}" + +; Installer version info +!define PRODUCT_VERSION "0.0.0.0" +!define FILE_VERSION "${TAG_OR_BRANCH}:${HASH8}${DIRTY} ${DATETIME}" +!define BUILD_DESCRIPTION "${TAG_OR_BRANCH}:${HASH8}${DIRTY} built using ${ORIGIN} as origin, committed ${DATETIME} as ${HASH}" diff --git a/ground/openpilotgcs/packaging/winx86/resources/header.bmp b/release/winx86/resources/header.bmp similarity index 100% rename from ground/openpilotgcs/packaging/winx86/resources/header.bmp rename to release/winx86/resources/header.bmp diff --git a/ground/openpilotgcs/packaging/winx86/resources/openpilot.ico b/release/winx86/resources/openpilot.ico similarity index 100% rename from ground/openpilotgcs/packaging/winx86/resources/openpilot.ico rename to release/winx86/resources/openpilot.ico diff --git a/ground/openpilotgcs/packaging/winx86/resources/welcome.bmp b/release/winx86/resources/welcome.bmp similarity index 100% rename from ground/openpilotgcs/packaging/winx86/resources/welcome.bmp rename to release/winx86/resources/welcome.bmp diff --git a/ground/openpilotgcs/packaging/winx86/translations/languages.nsh b/release/winx86/translations/languages.nsh similarity index 100% rename from ground/openpilotgcs/packaging/winx86/translations/languages.nsh rename to release/winx86/translations/languages.nsh diff --git a/ground/openpilotgcs/packaging/winx86/translations/strings_de.nsh b/release/winx86/translations/strings_de.nsh similarity index 100% rename from ground/openpilotgcs/packaging/winx86/translations/strings_de.nsh rename to release/winx86/translations/strings_de.nsh diff --git a/ground/openpilotgcs/packaging/winx86/translations/strings_en.nsh b/release/winx86/translations/strings_en.nsh similarity index 100% rename from ground/openpilotgcs/packaging/winx86/translations/strings_en.nsh rename to release/winx86/translations/strings_en.nsh diff --git a/ground/openpilotgcs/packaging/winx86/translations/strings_es.nsh b/release/winx86/translations/strings_es.nsh similarity index 100% rename from ground/openpilotgcs/packaging/winx86/translations/strings_es.nsh rename to release/winx86/translations/strings_es.nsh diff --git a/ground/openpilotgcs/packaging/winx86/translations/strings_fr.nsh b/release/winx86/translations/strings_fr.nsh similarity index 100% rename from ground/openpilotgcs/packaging/winx86/translations/strings_fr.nsh rename to release/winx86/translations/strings_fr.nsh diff --git a/ground/openpilotgcs/packaging/winx86/translations/strings_ru.nsh b/release/winx86/translations/strings_ru.nsh similarity index 100% rename from ground/openpilotgcs/packaging/winx86/translations/strings_ru.nsh rename to release/winx86/translations/strings_ru.nsh diff --git a/ground/openpilotgcs/packaging/winx86/translations/strings_zh_CN.nsh b/release/winx86/translations/strings_zh_CN.nsh similarity index 100% rename from ground/openpilotgcs/packaging/winx86/translations/strings_zh_CN.nsh rename to release/winx86/translations/strings_zh_CN.nsh