1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-04 12:24:11 +01:00

Merge branch 'master' into bugfix-ground

This commit is contained in:
elafargue 2011-06-01 11:29:10 +02:00
commit a953974dfa
42 changed files with 199 additions and 196 deletions

View File

@ -457,9 +457,9 @@ sim_win32_%: uavobjects_flight
############################## ##############################
# #
# Release packaging components # Packaging components
# #
############################## ##############################
.PHONY: release .PHONY: package
release: package:
$(V1) cd $@ && $(MAKE) --no-print-directory $@ $(V1) cd $@ && $(MAKE) --no-print-directory $@

View File

@ -187,6 +187,7 @@ SRC += $(PIOSSTM32F10X)/pios_spektrum.c
SRC += $(PIOSSTM32F10X)/pios_debug.c SRC += $(PIOSSTM32F10X)/pios_debug.c
SRC += $(PIOSSTM32F10X)/pios_gpio.c SRC += $(PIOSSTM32F10X)/pios_gpio.c
SRC += $(PIOSSTM32F10X)/pios_exti.c SRC += $(PIOSSTM32F10X)/pios_exti.c
SRC += $(PIOSSTM32F10X)/pios_rtc.c
SRC += $(PIOSSTM32F10X)/pios_wdg.c SRC += $(PIOSSTM32F10X)/pios_wdg.c

View File

@ -64,6 +64,7 @@
#define PIOS_INCLUDE_FREERTOS #define PIOS_INCLUDE_FREERTOS
#define PIOS_INCLUDE_GPIO #define PIOS_INCLUDE_GPIO
#define PIOS_INCLUDE_EXTI #define PIOS_INCLUDE_EXTI
#define PIOS_INCLUDE_RTC
#define PIOS_INCLUDE_WDG #define PIOS_INCLUDE_WDG
#define PIOS_INCLUDE_BL_HELPER #define PIOS_INCLUDE_BL_HELPER
@ -92,7 +93,7 @@
/* Task stack sizes */ /* Task stack sizes */
#define PIOS_ACTUATOR_STACK_SIZE 1020 #define PIOS_ACTUATOR_STACK_SIZE 1020
#define PIOS_MANUAL_STACK_SIZE 724 #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_STABILIZATION_STACK_SIZE 524
#define PIOS_TELEM_STACK_SIZE 500 #define PIOS_TELEM_STACK_SIZE 500

View File

@ -348,39 +348,38 @@ void PIOS_USART_spektrum_irq_handler(void)
} }
#include <pios_spektrum_priv.h> #include <pios_spektrum_priv.h>
void TIM2_IRQHandler(); void RTC_IRQHandler();
void TIM2_IRQHandler() __attribute__ ((alias ("PIOS_TIM2_irq_handler"))); void RTC_IRQHandler() __attribute__ ((alias ("PIOS_SUPV_irq_handler")));
const struct pios_spektrum_cfg pios_spektrum_cfg = { const struct pios_spektrum_cfg pios_spektrum_cfg = {
.pios_usart_spektrum_cfg = &pios_usart_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_init = { //used for bind feature
.GPIO_Mode = GPIO_Mode_Out_PP, .GPIO_Mode = GPIO_Mode_Out_PP,
.GPIO_Speed = GPIO_Speed_2MHz, .GPIO_Speed = GPIO_Speed_2MHz,
}, },
.remap = 0, .remap = 0,
.irq = { .irq = {
.handler = TIM2_IRQHandler, .handler = RTC_IRQHandler,
.init = { .init = {
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID, .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0, .NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE, .NVIC_IRQChannelCmd = ENABLE,
}, },
}, },
.timer = TIM2,
.port = GPIOB, .port = GPIOB,
.ccr = TIM_IT_Update,
.pin = GPIO_Pin_11, .pin = GPIO_Pin_11,
}; };
void PIOS_TIM2_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); 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 */ #endif /* PIOS_INCLUDE_SPEKTRUM */
@ -441,14 +440,12 @@ const struct pios_servo_channel pios_servo_channels[] = {
.channel = TIM_Channel_1, .channel = TIM_Channel_1,
.pin = GPIO_Pin_4, .pin = GPIO_Pin_4,
}, },
#ifndef PIOS_INCLUDE_SPEKTRUM
{ {
.timer = TIM2, .timer = TIM2,
.port = GPIOA, .port = GPIOA,
.channel = TIM_Channel_3, .channel = TIM_Channel_3,
.pin = GPIO_Pin_2, .pin = GPIO_Pin_2,
}, },
#endif
}; };
const struct pios_servo_cfg pios_servo_cfg = { const struct pios_servo_cfg pios_servo_cfg = {

View File

@ -75,7 +75,7 @@ NVIC value of 255. */
#if defined(DEBUG) #if defined(DEBUG)
#define configGENERATE_RUN_TIME_STATS 1 #define configGENERATE_RUN_TIME_STATS 1
#define INCLUDE_uxTaskGetRunTime 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 // 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() #define portGET_RUN_TIME_COUNTER_VALUE() PIOS_RTC_Counter()
#endif #endif

View File

@ -504,39 +504,38 @@ void PIOS_USART_spektrum_irq_handler(void)
} }
#include <pios_spektrum_priv.h> #include <pios_spektrum_priv.h>
void TIM6_IRQHandler(); void RTC_IRQHandler();
void TIM6_IRQHandler() __attribute__ ((alias ("PIOS_TIM6_irq_handler"))); void RTC_IRQHandler() __attribute__ ((alias ("PIOS_SUPV_irq_handler")));
const struct pios_spektrum_cfg pios_spektrum_cfg = { const struct pios_spektrum_cfg pios_spektrum_cfg = {
.pios_usart_spektrum_cfg = &pios_usart_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_init = { //used for bind feature
.GPIO_Mode = GPIO_Mode_Out_PP, .GPIO_Mode = GPIO_Mode_Out_PP,
.GPIO_Speed = GPIO_Speed_2MHz, .GPIO_Speed = GPIO_Speed_2MHz,
}, },
.remap = 0, .remap = 0,
.irq = { .irq = {
.handler = TIM6_IRQHandler, .handler = RTC_IRQHandler,
.init = { .init = {
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID, .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0, .NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE, .NVIC_IRQChannelCmd = ENABLE,
}, },
}, },
.timer = TIM6,
.port = GPIOA, .port = GPIOA,
.ccr = TIM_IT_Update,
.pin = GPIO_Pin_10, .pin = GPIO_Pin_10,
}; };
void PIOS_TIM6_irq_handler() void PIOS_SUPV_irq_handler() {
if (RTC_GetITStatus(RTC_IT_SEC))
{ {
PIOS_SPEKTRUM_irq_handler(); /* 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 */ #endif /* PIOS_COM_SPEKTRUM */
@ -1049,6 +1048,7 @@ void PIOS_Board_Init(void) {
#if defined(PIOS_INCLUDE_SPEKTRUM) #if defined(PIOS_INCLUDE_SPEKTRUM)
/* SPEKTRUM init must come before comms */ /* SPEKTRUM init must come before comms */
PIOS_RTC_Init(); // Spektrum uses RTC to check for frame failures
PIOS_SPEKTRUM_Init(); PIOS_SPEKTRUM_Init();
if (PIOS_USART_Init(&pios_usart_spektrum_id, &pios_usart_spektrum_cfg)) { if (PIOS_USART_Init(&pios_usart_spektrum_id, &pios_usart_spektrum_cfg)) {

View File

@ -138,7 +138,7 @@ extern void vPortYieldFromISR( void );
extern void vPortEnterCritical( void ); extern void vPortEnterCritical( void );
extern void vPortExitCritical( void ); extern void vPortExitCritical( void );
void PIOS_RTC_Start(); void PIOS_RTC_Init();
uint32_t PIOS_RTC_Counter(); uint32_t PIOS_RTC_Counter();
#define portDISABLE_INTERRUPTS() portSET_INTERRUPT_MASK() #define portDISABLE_INTERRUPTS() portSET_INTERRUPT_MASK()

View File

@ -33,7 +33,11 @@
#if defined(PIOS_INCLUDE_RTC) #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, RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP | RCC_APB1Periph_PWR,
ENABLE); ENABLE);
@ -44,7 +48,14 @@ void PIOS_RTC_Start()
RTC_WaitForLastTask(); RTC_WaitForLastTask();
RTC_WaitForSynchro(); RTC_WaitForSynchro();
RTC_WaitForLastTask(); 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_WaitForLastTask();
RTC_SetCounter(0); RTC_SetCounter(0);
RTC_WaitForLastTask(); RTC_WaitForLastTask();
@ -55,6 +66,15 @@ uint32_t PIOS_RTC_Counter()
return RTC_GetCounter(); 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 #endif

View File

@ -41,16 +41,24 @@
#error "AUX com cannot be used with SPEKTRUM" #error "AUX com cannot be used with SPEKTRUM"
#endif #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 */ /* Global Variables */
/* Local Variables, use pios_usart */ /* Local Variables */
static uint16_t CaptureValue[12],CaptureValueTemp[12]; 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 }; static uint8_t prev_byte = 0xFF, sync = 0, bytecount = 0, datalength=0, frame_error=0, byte_array[20] = { 0 };
uint8_t sync_of = 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) void PIOS_SPEKTRUM_Init(void)
{ {
@ -59,62 +67,15 @@ void PIOS_SPEKTRUM_Init(void)
PIOS_SPEKTRUM_Bind(); PIOS_SPEKTRUM_Bind();
} }
NVIC_InitTypeDef NVIC_InitStructure = pios_spektrum_cfg.irq.init; /* Init RTC supervisor timer interrupt */
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure = pios_spektrum_cfg.tim_base_init; NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = RTC_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID;
/* Enable appropriate clock to timer module */ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
switch((int32_t) pios_spektrum_cfg.timer) { NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
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
}
NVIC_Init(&NVIC_InitStructure); NVIC_Init(&NVIC_InitStructure);
/* Init RTC clock */
/* Configure timer clocks */ PIOS_RTC_Init();
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);
} }
/** /**
@ -263,8 +224,7 @@ int32_t PIOS_SPEKTRUM_Decode(uint8_t b)
} }
/* Interrupt handler for USART */ /* 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 */ /* 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 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; volatile uint8_t b = pios_spektrum_cfg.pios_usart_spektrum_cfg->regs->DR;
@ -280,34 +240,35 @@ void SPEKTRUM_IRQHandler(uint32_t usart_id)
/* Disable TXE interrupt (TXEIE=0) */ /* Disable TXE interrupt (TXEIE=0) */
USART_ITConfig(pios_spektrum_cfg.pios_usart_spektrum_cfg->regs, USART_IT_TXE, DISABLE); USART_ITConfig(pios_spektrum_cfg.pios_usart_spektrum_cfg->regs, USART_IT_TXE, DISABLE);
} }
/* clear "watchdog" timer */ /* byte arrived so clear "watchdog" timer */
TIM_SetCounter(pios_spektrum_cfg.timer, 0); 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() { void PIOS_SPEKTRUM_irq_handler() {
//PIOS_SPEKTRUM_SUPV_IRQ_FUNC { /* 125hz */
/* Clear timer interrupt pending bit */ supv_timer++;
TIM_ClearITPendingBit(pios_spektrum_cfg.timer, TIM_IT_Update); if(supv_timer > 5) {
/* sync between frames */ /* sync between frames */
sync = 0; sync = 0;
bytecount = 0; bytecount = 0;
prev_byte = 0xFF; prev_byte = 0xFF;
frame_error = 0; frame_error = 0;
sync_of++; sync_of++;
/* watchdog activated */ /* watchdog activated after 100ms silence */
if (sync_of > 12) { if (sync_of > 12) {
/* signal lost */ /* signal lost */
sync_of = 0; sync_of = 0;
for (int i = 0; i < 12; i++) for (int i = 0; i < 12; i++) {
{
CaptureValue[i] = 0; CaptureValue[i] = 0;
CaptureValueTemp[i] = 0; CaptureValueTemp[i] = 0;
} }
} }
supv_timer = 0;
}
} }
#endif #endif

View File

@ -27,12 +27,14 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef PIOS_SERVO_H #ifndef PIOS_RTC_H
#define PIOS_SERVO_H #define PIOS_RTC_H
/* Public Functions */ /* Public Functions */
extern void PIOS_RTC_Start(); extern void PIOS_RTC_Init();
extern uint32_t PIOS_RTC_Counter(); extern uint32_t PIOS_RTC_Counter();
extern float PIOS_RTC_Rate();
extern float PIOS_RTC_MsPerTick();
#endif /* PIOS_SERVO_H */ #endif /* PIOS_SERVO_H */

View File

@ -37,13 +37,10 @@
struct pios_spektrum_cfg { struct pios_spektrum_cfg {
const struct pios_usart_cfg * pios_usart_spektrum_cfg; const struct pios_usart_cfg * pios_usart_spektrum_cfg;
TIM_TimeBaseInitTypeDef tim_base_init;
GPIO_InitTypeDef gpio_init; GPIO_InitTypeDef gpio_init;
uint32_t remap; /* GPIO_Remap_* */ uint32_t remap; /* GPIO_Remap_* */
struct stm32_irq irq; struct stm32_irq irq;
TIM_TypeDef * timer;
GPIO_TypeDef * port; GPIO_TypeDef * port;
uint16_t ccr;
uint16_t pin; uint16_t pin;
}; };

View File

@ -73,6 +73,7 @@
#include <pios_irq.h> #include <pios_irq.h>
#include <pios_adc.h> #include <pios_adc.h>
#include <pios_servo.h> #include <pios_servo.h>
#include <pios_rtc.h>
#include <pios_i2c.h> #include <pios_i2c.h>
#include <pios_spi.h> #include <pios_spi.h>
#include <pios_ppm.h> #include <pios_ppm.h>

View File

@ -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() 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 <SDL>\bin\SDL.dll C:\Qt\2010.05\mingw\bin\SDL.dll
# xcopy /s /e <SDL>\include\SDL\* C:\Qt\2010.05\mingw\include\SDL
# xcopy /s /e <SDL>\lib\* C:\Qt\2010.05\mingw\lib
#
# - For Qt_SDK_Win_offline_v1_1_1_en.exe:
# xcopy /s /e <SDL>\bin\SDL.dll C:\QtSDK\Desktop\Qt\4.7.3\mingw\bin\SDL.dll
# xcopy /s /e <SDL>\include\SDL\* C:\QtSDK\Desktop\Qt\4.7.3\mingw\include\SDL
# xcopy /s /e <SDL>\lib\* C:\QtSDK\Desktop\Qt\4.7.3\mingw\lib
SDL_DLL = SDL.dll 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 data_copy.target = FORCE
QMAKE_EXTRA_TARGETS += data_copy QMAKE_EXTRA_TARGETS += data_copy

View File

@ -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): locations (but any other locations are fine as well):
- Python in C:\Python27 - 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 - CodeSourcery G++ in %ProgramFiles%\CodeSourcery\Sourcery G++ Lite
- msysGit in %ProgramFiles%\Git - msysGit in %ProgramFiles%\Git
- Unicode NSIS in %ProgramFiles%\NSIS\Unicode - 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 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 the PATH. Usually this is the case for msysGit installation if you have chosen

View File

@ -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 QtSDK's MinGW directory. In that case make sure that you have correct
rem directories specified here. rem directories specified here.
rem 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 Also you can add any paths below just by adding extra 'call :which'
rem lines with the following parameters: rem lines with the following parameters:
rem - environment variable which will be set to the tool location, if found; rem - environment variable which will be set to the tool location, if found;
@ -51,8 +54,12 @@ set NOT_FOUND=
set PATH_DIRS= set PATH_DIRS=
call :which MSYSGIT "%ProgramFiles%\Git\bin" git.exe 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 QTMINGW "C:\Qt\2010.05\mingw\bin" mingw32-make.exe
call :which QTSDK "C:\Qt\2010.05\qt\bin" qmake.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 CODESOURCERY "%ProgramFiles%\CodeSourcery\Sourcery G++ Lite\bin" cs-make.exe
call :which PYTHON "C:\Python27" python.exe call :which PYTHON "C:\Python27" python.exe
call :which UNSIS "%ProgramFiles%\NSIS\Unicode" makensis.exe call :which UNSIS "%ProgramFiles%\NSIS\Unicode" makensis.exe

View File

@ -14,9 +14,9 @@ ROOT_DIR := $(realpath $(WHEREAMI)/../)
# Set up some macros # Set up some macros
BUILD_DIR := $(ROOT_DIR)/build BUILD_DIR := $(ROOT_DIR)/build
VERSION_CMD := python $(ROOT_DIR)/make/scripts/version-info.py --path="$(ROOT_DIR)" VERSION_CMD := python $(ROOT_DIR)/make/scripts/version-info.py --path="$(ROOT_DIR)"
RELEASE_LBL := $(shell $(VERSION_CMD) --format=\$${DATE}-\$${TAG_OR_HASH8}\$${DIRTY}) PACKAGE_LBL := $(shell $(VERSION_CMD) --format=\$${DATE}-\$${TAG_OR_HASH8}\$${DIRTY})
RELEASE_DIR := $(BUILD_DIR)/release-$(RELEASE_LBL) PACKAGE_DIR := $(BUILD_DIR)/package-$(PACKAGE_LBL)
FW_DIR := $(RELEASE_DIR)/firmware-$(RELEASE_LBL) FW_DIR := $(PACKAGE_DIR)/firmware-$(PACKAGE_LBL)
BL_DIR := $(FW_DIR)/bootloaders BL_DIR := $(FW_DIR)/bootloaders
BU_DIR := $(FW_DIR)/bootloader-updaters BU_DIR := $(FW_DIR)/bootloader-updaters
FE_DIR := $(FW_DIR)/flash-erase-tools FE_DIR := $(FW_DIR)/flash-erase-tools
@ -52,11 +52,11 @@ help:
@echo " Here is a summary of the available targets:" @echo " Here is a summary of the available targets:"
@echo @echo
@echo " [Packaging]" @echo " [Packaging]"
@echo " release - Build and package the OpenPilot distributable" @echo " package - Build and package the OpenPilot distributable"
@echo " release_flight - Build and package the OpenPilot flight firmware only" @echo " package_flight - Build and package the OpenPilot flight firmware only"
@echo @echo
@echo " Notes:" @echo " Notes:"
@echo " - package will be placed in $(RELEASE_DIR)" @echo " - package will be placed in $(PACKAGE_DIR)"
@echo @echo
@echo " - the build directory will be removed first on every run unless one" @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 " of CLEAN_BUILD=NO or CLEAN_BUILD=NEVER options is defined."
@ -101,19 +101,19 @@ endif
endef endef
# Firmware for different input drivers # 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_common,uavobjects,$(FW_DIR),,-$(PACKAGE_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_pwm,uavobjects,$(FW_DIR),,-pwm-$(PACKAGE_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_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-$(RELEASE_LBL),USE_PPM=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) # 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 # 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 # 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 # Order-only dependencies
# They are bit complicated to support parallel (-j) builds and to create # 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 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 # Decide on a verbosity level based on the V= parameter
export AT := @ export AT := @

20
package/Makefile.osx Normal file
View File

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

View File

@ -4,19 +4,22 @@
NSIS_CMD := makensis.exe NSIS_CMD := makensis.exe
NSIS_OPTS := /V3 NSIS_OPTS := /V3
NSIS_DIR := $(ROOT_DIR)/release/winx86 NSIS_DIR := $(ROOT_DIR)/package/winx86
NSIS_SCRIPT := $(NSIS_DIR)/openpilotgcs.nsi NSIS_SCRIPT := $(NSIS_DIR)/openpilotgcs.nsi
NSIS_TEMPLATE := $(NSIS_DIR)/openpilotgcs.tpl NSIS_TEMPLATE := $(NSIS_DIR)/openpilotgcs.tpl
NSIS_HEADER := $(BUILD_DIR)/ground/openpilotgcs/openpilotgcs.nsh NSIS_HEADER := $(BUILD_DIR)/ground/openpilotgcs/openpilotgcs.nsh
package: gcs release_flight win_package: gcs package_flight
mkdir -p "$(dir $(NSIS_HEADER))" $(V1) mkdir -p "$(dir $(NSIS_HEADER))"
$(VERSION_CMD) --template="$(NSIS_TEMPLATE)" --outfile="$(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) $(NSIS_CMD) $(NSIS_OPTS) $(NSIS_SCRIPT)
gcs: uavobjects gcs: uavobjects
$(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@ $(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

View File

@ -20,7 +20,7 @@ do
done done
# should be redundant but some libs missed by main app and macdeployqt # should be redundant but some libs missed by main app and macdeployqt
for f in ${QT_LIBS} SDL for f in ${QT_LIBS}
do do
echo "Copying ${f}" echo "Copying ${f}"
cp -r /Library/Frameworks/${f}.framework "${APP}/Contents/Frameworks/" cp -r /Library/Frameworks/${f}.framework "${APP}/Contents/Frameworks/"
@ -44,4 +44,4 @@ done
echo "Deleting unnecessary files" echo "Deleting unnecessary files"
find "${APP}/Contents/Frameworks" -iname "current" -exec rm -rf \{\} \; find "${APP}/Contents/Frameworks" -iname "current" -exec rm -rf \{\} \;
find "${APP}/Contents/Frameworks" -iname "4.0" -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 \{\} \;

View File

@ -1,19 +1,19 @@
#!/bin/bash #!/bin/bash
# the following environment variables must be set # 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 # more variables
APP_PATH="${BUILD_DIR}/ground/openpilotgcs/bin/OpenPilot GCS.app" APP_PATH="${BUILD_DIR}/ground/openpilotgcs/bin/OpenPilot GCS.app"
TEMP_FILE="${RELEASE_DIR}/OpenPilot-temp.dmg" TEMP_FILE="${PACKAGE_DIR}/OpenPilot-temp.dmg"
OUT_FILE="${RELEASE_DIR}/OpenPilot-${RELEASE_LBL}.dmg" OUT_FILE="${PACKAGE_DIR}/OpenPilot-${PACKAGE_LBL}.dmg"
VOL_NAME="OpenPilot" VOL_NAME="OpenPilot"
# prepare the stage # prepare the stage
rm -f "${TEMP_FILE}" rm -f "${TEMP_FILE}"
rm -f "${OUT_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}" -format UDRW -o "${TEMP_FILE}"
device=$(hdiutil attach "${TEMP_FILE}" | \ device=$(hdiutil attach "${TEMP_FILE}" | \
egrep '^/dev/' | sed 1q | awk '{print $1}') 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 "${APP_PATH}" "/Volumes/${VOL_NAME}"
cp -r "${FW_DIR}" "/Volumes/${VOL_NAME}/firmware" 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 "/Volumes/${VOL_NAME}/OpenPilot GCS.app" || exit 1
hdiutil detach ${device} hdiutil detach ${device}

View File

@ -50,17 +50,17 @@
!define INSTALLER_NAME "OpenPilot GCS Installer" !define INSTALLER_NAME "OpenPilot GCS Installer"
; Read automatically generated version info ; Read automatically generated version info
; !define RELEASE_LBL "${DATE}-${TAG_OR_HASH8}" ; !define PACKAGE_LBL "${DATE}-${TAG_OR_HASH8}"
; !define RELEASE_DIR "..\..\build\release-$${RELEASE_LBL}" ; !define PACKAGE_DIR "..\..\build\package-$${PACKAGE_LBL}"
; !define OUT_FILE "OpenPilotGCS-$${RELEASE_LBL}-install.exe" ; !define OUT_FILE "OpenPilotGCS-$${PACKAGE_LBL}-install.exe"
; !define FIRMWARE_DIR "firmware-$${RELEASE_LBL}" ; !define FIRMWARE_DIR "firmware-$${PACKAGE_LBL}"
; !define PRODUCT_VERSION "0.0.0.0" ; !define PRODUCT_VERSION "0.0.0.0"
; !define FILE_VERSION "${TAG_OR_BRANCH}:${HASH8} ${DATETIME}" ; !define FILE_VERSION "${TAG_OR_BRANCH}:${HASH8} ${DATETIME}"
; !define BUILD_DESCRIPTION "${TAG_OR_BRANCH}:${HASH8} built using ${ORIGIN} as origin, committed ${DATETIME} as ${HASH}" ; !define BUILD_DESCRIPTION "${TAG_OR_BRANCH}:${HASH8} built using ${ORIGIN} as origin, committed ${DATETIME} as ${HASH}"
!include "${GCS_BUILD_TREE}\openpilotgcs.nsh" !include "${GCS_BUILD_TREE}\openpilotgcs.nsh"
Name "${PRODUCT_NAME}" Name "${PRODUCT_NAME}"
OutFile "${RELEASE_DIR}\${OUT_FILE}" OutFile "${PACKAGE_DIR}\${OUT_FILE}"
VIProductVersion ${PRODUCT_VERSION} VIProductVersion ${PRODUCT_VERSION}
VIAddVersionKey "ProductName" "${INSTALLER_NAME}" VIAddVersionKey "ProductName" "${INSTALLER_NAME}"
@ -185,7 +185,7 @@ SectionEnd
Section "Firmware" InSecFirmware Section "Firmware" InSecFirmware
SetOutPath "$INSTDIR\firmware\${FIRMWARE_DIR}" SetOutPath "$INSTDIR\firmware\${FIRMWARE_DIR}"
File /r "${RELEASE_DIR}\${FIRMWARE_DIR}\*" File /r "${PACKAGE_DIR}\${FIRMWARE_DIR}\*"
SectionEnd SectionEnd
Section "Shortcuts" InSecShortcuts Section "Shortcuts" InSecShortcuts

View File

@ -12,10 +12,10 @@
# #
; Some names, paths and constants ; Some names, paths and constants
!define RELEASE_LBL "${DATE}-${TAG_OR_HASH8}${DIRTY}" !define PACKAGE_LBL "${DATE}-${TAG_OR_HASH8}${DIRTY}"
!define RELEASE_DIR "..\..\build\release-$${RELEASE_LBL}" !define PACKAGE_DIR "..\..\build\package-$${PACKAGE_LBL}"
!define OUT_FILE "OpenPilot-$${RELEASE_LBL}-install.exe" !define OUT_FILE "OpenPilot-$${PACKAGE_LBL}-install.exe"
!define FIRMWARE_DIR "firmware-$${RELEASE_LBL}" !define FIRMWARE_DIR "firmware-$${PACKAGE_LBL}"
; Installer version info ; Installer version info
!define PRODUCT_VERSION "0.0.0.0" !define PRODUCT_VERSION "0.0.0.0"

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

View File

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

View File

@ -2,7 +2,7 @@
<object name="AttitudeSettings" singleinstance="true" settings="true"> <object name="AttitudeSettings" singleinstance="true" settings="true">
<description>Settings for the @ref Attitude module used on CopterControl</description> <description>Settings for the @ref Attitude module used on CopterControl</description>
<field name="AccelBias" units="lsb" type="int16" elementnames="X,Y,Z" defaultvalue="0"/> <field name="AccelBias" units="lsb" type="int16" elementnames="X,Y,Z" defaultvalue="0"/>
<field name="BoardRotation" units="deg" type="int8" elementnames="Roll,Pitch,Yaw" defaultvalue="0,0,0"/> <field name="BoardRotation" units="deg" type="int16" elementnames="Roll,Pitch,Yaw" defaultvalue="0,0,0"/>
<field name="GyroGain" units="(rad/s)/lsb" type="float" elements="1" defaultvalue="0.42"/> <field name="GyroGain" units="(rad/s)/lsb" type="float" elements="1" defaultvalue="0.42"/>
<field name="AccelKp" units="channel" type="float" elements="1" defaultvalue="0.05"/> <field name="AccelKp" units="channel" type="float" elements="1" defaultvalue="0.05"/>
<field name="AccelKi" units="channel" type="float" elements="1" defaultvalue="0.0001"/> <field name="AccelKi" units="channel" type="float" elements="1" defaultvalue="0.0001"/>