1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

Merge branch 'master' into OP-378_James_INS

This commit is contained in:
James Cotton 2011-05-26 12:19:30 -05:00
commit 0a60c5b57c
63 changed files with 414 additions and 294 deletions

View File

@ -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: ?

View File

@ -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 $@

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -0,0 +1,16 @@
#include <pios.h>
#include <pios_board.h>
#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,
};

View File

@ -45,4 +45,11 @@ SECTIONS
. = ALIGN(4);
_end = . ;
.boardinfo :
{
. = ALIGN(4);
KEEP(*(.boardinfo))
. = ALIGN(4);
} > BD_INFO
}

View File

@ -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
}

View File

@ -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.*))

View File

@ -61,6 +61,12 @@ SECTIONS
. = ALIGN(4);
_end = . ;
.boardinfo :
{
. = ALIGN(4);
KEEP(*(.boardinfo))
} > BD_INFO
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }

View File

@ -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
}

View File

@ -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.*))

View File

@ -50,4 +50,11 @@ SECTIONS
. = ALIGN(4);
_end = . ;
.boardinfo :
{
. = ALIGN(4);
KEEP(*(.boardinfo))
. = ALIGN(4);
} > BD_INFO
}

View File

@ -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
}

View File

@ -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.*))

View File

@ -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 */

View File

@ -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
}

View File

@ -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

View File

@ -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;

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -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%

View File

@ -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."

View File

@ -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
}

View File

@ -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="<<str;
return a.exec();
}

View File

@ -56,7 +56,9 @@ OP_DFU::OP_DFU(bool _debug,bool _use_serial,QString portname,bool umodereset): d
{
cout<<".";
delay::msleep(500);
numDevices = hidHandle.open(1,0x20a0,0x4117,0,0); //0xff9c,0x0001);
numDevices = hidHandle.open(1,0x20a0,0x415A,0,0); //0xff9c,0x0001);
if(numDevices==0)
numDevices = hidHandle.open(1,0x20a0,0x415B,0,0); //0xff9c,0x0001);
if(++count==10)
{
cout<<"\r";

View File

@ -138,7 +138,7 @@ struct PortSettings
#include <windows.h>
#include <QThread>
#include <QReadWriteLock>
#include <QtCore/private/qwineventnotifier_p.h>
#include "utils/qwineventnotifier_p.h"
#endif
/*!

View File

@ -33,7 +33,7 @@
#include <QtCore/QDir>
#include <QtCore/QTemporaryFile>
#include <QtCore/QAbstractEventDispatcher>
#include <QtCore/private/qwineventnotifier_p.h>
#include "qwineventnotifier_p.h"
#include <QtNetwork/QLocalSocket>

View File

@ -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

View File

@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tabWidgetPage1">
<attribute name="title">
@ -102,7 +102,7 @@
<item>
<widget class="QStackedWidget" name="airframesWidget">
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="fixedWing">
<property name="enabled">

View File

@ -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;

View File

@ -137,13 +137,6 @@
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="buildDate">
<property name="text">
<string>Build Date</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="commitTag">
<property name="text">
@ -151,6 +144,30 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="certifiedFW">
<property name="text">
<string>certified</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="buildDate">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>buildDate</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>

View File

@ -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.
}

View File

@ -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),

View File

@ -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} },
};

View File

@ -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?
-----------------

View File

@ -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

View File

@ -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

View File

@ -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

22
release/Makefile.winx86 Normal file
View File

@ -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

View File

@ -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

View File

@ -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}"

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB