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

Merge branch 'revo-next' into corvuscorax/new_navigation

This commit is contained in:
Corvus Corax 2012-05-28 13:27:51 +02:00
commit d50108ff53
14 changed files with 75 additions and 101 deletions

View File

@ -602,7 +602,7 @@ define EF_TEMPLATE
.PHONY: ef_$(1) .PHONY: ef_$(1)
ef_$(1): ef_$(1)_bin ef_$(1): ef_$(1)_bin
ef_$(1)_%: bl_$(1)_bin fw_$(1)_bin ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
$(V1) mkdir -p $(BUILD_DIR)/ef_$(1)/dep $(V1) mkdir -p $(BUILD_DIR)/ef_$(1)/dep
$(V1) cd $(ROOT_DIR)/flight/EntireFlash && \ $(V1) cd $(ROOT_DIR)/flight/EntireFlash && \
$$(MAKE) -r --no-print-directory \ $$(MAKE) -r --no-print-directory \
@ -646,10 +646,15 @@ BL_BOARDS := $(ALL_BOARDS)
BU_BOARDS := $(ALL_BOARDS) BU_BOARDS := $(ALL_BOARDS)
EF_BOARDS := $(ALL_BOARDS) EF_BOARDS := $(ALL_BOARDS)
# FIXME: The INS build doesn't have a bootloader or bootloader # FIXME: The BU image doesn't work for F4 boards so we need to
# updater yet so we need to filter them out to prevent errors. # filter them out to prevent errors.
BL_BOARDS := $(filter-out ins, $(BL_BOARDS)) BU_BOARDS := $(filter-out revolution, $(BU_BOARDS))
BU_BOARDS := $(filter-out ins, $(BU_BOARDS))
# SimPosix doesn't have a BL, BU or EF target so we need to
# filter them out to prevent errors on the all_flight target.
BL_BOARDS := $(filter-out simposix, $(BL_BOARDS))
BU_BOARDS := $(filter-out simposix, $(BU_BOARDS))
EF_BOARDS := $(filter-out simposix, $(EF_BOARDS))
# Generate the targets for whatever boards are left in each list # Generate the targets for whatever boards are left in each list
FW_TARGETS := $(addprefix fw_, $(FW_BOARDS)) FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
@ -670,7 +675,7 @@ all_bu: $(addsuffix _opfw, $(BU_TARGETS))
all_bu_clean: $(addsuffix _clean, $(BU_TARGETS)) all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
.PHONY: all_ef all_ef_clean .PHONY: all_ef all_ef_clean
all_ef: $(EF_TARGETS)) all_ef: $(EF_TARGETS)
all_ef_clean: $(addsuffix _clean, $(EF_TARGETS)) all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
.PHONY: all_flight all_flight_clean .PHONY: all_flight all_flight_clean

View File

@ -81,6 +81,7 @@ SRC += $(PIOSCOMMON)/pios_board_info.c
SRC += $(PIOSCOMMON)/pios_com_msg.c SRC += $(PIOSCOMMON)/pios_com_msg.c
SRC += $(PIOSCOMMON)/printf-stdarg.c SRC += $(PIOSCOMMON)/printf-stdarg.c
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c
SRC += $(PIOSCOMMON)/pios_usb_util.c
# List C source files here which must be compiled in ARM-Mode (no -mthumb). # List C source files here which must be compiled in ARM-Mode (no -mthumb).
# use file-extension c for "c-only"-files # use file-extension c for "c-only"-files

View File

@ -39,6 +39,7 @@
#define PIOS_USB_BOARD_PRODUCT_ID USB_PRODUCT_ID_REVOLUTION #define PIOS_USB_BOARD_PRODUCT_ID USB_PRODUCT_ID_REVOLUTION
#define PIOS_USB_BOARD_DEVICE_VER USB_OP_DEVICE_VER(USB_OP_BOARD_ID_REVOLUTION, USB_OP_BOARD_MODE_BL) #define PIOS_USB_BOARD_DEVICE_VER USB_OP_DEVICE_VER(USB_OP_BOARD_ID_REVOLUTION, USB_OP_BOARD_MODE_BL)
#define PIOS_USB_BOARD_SN_SUFFIX "+BL"
/* /*
* The bootloader uses a simplified report structure * The bootloader uses a simplified report structure

View File

@ -31,6 +31,7 @@
#include "pios_usb_board_data.h" /* struct usb_*, USB_* */ #include "pios_usb_board_data.h" /* struct usb_*, USB_* */
#include "pios_sys.h" /* PIOS_SYS_SerialNumberGet */ #include "pios_sys.h" /* PIOS_SYS_SerialNumberGet */
#include "pios_usbhook.h" /* PIOS_USBHOOK_* */ #include "pios_usbhook.h" /* PIOS_USBHOOK_* */
#include "pios_usb_util.h" /* PIOS_USB_UTIL_AsciiToUtf8 */
static const uint8_t usb_product_id[22] = { static const uint8_t usb_product_id[22] = {
sizeof(usb_product_id), sizeof(usb_product_id),
@ -47,40 +48,15 @@ static const uint8_t usb_product_id[22] = {
'n', 0, 'n', 0,
}; };
static uint8_t usb_serial_number[52] = { static uint8_t usb_serial_number[2 + PIOS_SYS_SERIAL_NUM_ASCII_LEN*2 + (sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1)*2] = {
sizeof(usb_serial_number), sizeof(usb_serial_number),
USB_DESC_TYPE_STRING, USB_DESC_TYPE_STRING,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0
}; };
static const struct usb_string_langid usb_lang_id = { static const struct usb_string_langid usb_lang_id = {
.bLength = sizeof(usb_lang_id), .bLength = sizeof(usb_lang_id),
.bDescriptorType = USB_DESC_TYPE_STRING, .bDescriptorType = USB_DESC_TYPE_STRING,
.bLangID = htousbs(USB_LANGID_ENGLISH_UK), .bLangID = htousbs(USB_LANGID_ENGLISH_US),
}; };
static const uint8_t usb_vendor_id[28] = { static const uint8_t usb_vendor_id[28] = {
@ -104,11 +80,13 @@ static const uint8_t usb_vendor_id[28] = {
int32_t PIOS_USB_BOARD_DATA_Init(void) int32_t PIOS_USB_BOARD_DATA_Init(void)
{ {
/* Load device serial number into serial number string */ /* Load device serial number into serial number string */
uint8_t sn[25]; uint8_t sn[PIOS_SYS_SERIAL_NUM_ASCII_LEN + 1];
PIOS_SYS_SerialNumberGet((char *)sn); PIOS_SYS_SerialNumberGet((char *)sn);
for (uint8_t i = 0; sn[i] != '\0' && (2 * i) < usb_serial_number[0]; i++) {
usb_serial_number[2 + 2 * i] = sn[i]; /* Concatenate the device serial number and the appropriate suffix ("+BL" or "+FW") into the USB serial number */
} uint8_t * utf8 = &(usb_serial_number[2]);
utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, sn, PIOS_SYS_SERIAL_NUM_ASCII_LEN);
utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, (uint8_t *)PIOS_USB_BOARD_SN_SUFFIX, sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1);
PIOS_USBHOOK_RegisterString(USB_STRING_DESC_PRODUCT, (uint8_t *)&usb_product_id, sizeof(usb_product_id)); PIOS_USBHOOK_RegisterString(USB_STRING_DESC_PRODUCT, (uint8_t *)&usb_product_id, sizeof(usb_product_id));
PIOS_USBHOOK_RegisterString(USB_STRING_DESC_SERIAL, (uint8_t *)&usb_serial_number, sizeof(usb_serial_number)); PIOS_USBHOOK_RegisterString(USB_STRING_DESC_SERIAL, (uint8_t *)&usb_serial_number, sizeof(usb_serial_number));

View File

@ -98,15 +98,8 @@ SECTIONS
_init_stack_top = . - 4 ; _init_stack_top = . - 4 ;
} > SRAM } > SRAM
_eram = ORIGIN(SRAM) + LENGTH(SRAM) ;
_free_ram = . ; _ebss = _eram;
.free_ram (NOLOAD) :
{
. = ORIGIN(SRAM) + LENGTH(SRAM) - _free_ram ;
/* This is used by the startup in order to initialize the .bss section */
_ebss = . ;
_eram = . ;
} > SRAM
/* keep the heap section at the end of the SRAM /* keep the heap section at the end of the SRAM
* this will allow to claim the remaining bytes not used * this will allow to claim the remaining bytes not used

View File

@ -45,6 +45,8 @@
#include "pios.h" #include "pios.h"
#include <pios_adc_priv.h> #include <pios_adc_priv.h>
#if defined(PIOS_INCLUDE_ADC)
#if !defined(PIOS_ADC_MAX_SAMPLES) #if !defined(PIOS_ADC_MAX_SAMPLES)
#define PIOS_ADC_MAX_SAMPLES 0 #define PIOS_ADC_MAX_SAMPLES 0
#endif #endif
@ -465,6 +467,8 @@ void PIOS_ADC_DMA_Handler(void)
#endif #endif
} }
#endif /* PIOS_INCLUDE_ADC */
/** /**
* @} * @}
* @} * @}

View File

@ -53,7 +53,7 @@ USE_GPS ?= NO
USE_I2C ?= YES USE_I2C ?= YES
# Set to YES when using Code Sourcery toolchain # Set to YES when using Code Sourcery toolchain
CODE_SOURCERY ?= YES CODE_SOURCERY ?= NO
# Remove command is different for Code Sourcery on Windows # Remove command is different for Code Sourcery on Windows
ifeq ($(CODE_SOURCERY), YES) ifeq ($(CODE_SOURCERY), YES)

View File

@ -190,6 +190,10 @@ void PIOS_Board_Init(void) {
#if defined(PIOS_INCLUDE_USB_HID) #if defined(PIOS_INCLUDE_USB_HID)
if (!usb_hid_present) {
PIOS_Assert(0);
}
/* Configure the usb HID port */ /* Configure the usb HID port */
#if defined(PIOS_INCLUDE_COM) #if defined(PIOS_INCLUDE_COM)
{ {

View File

@ -159,6 +159,7 @@ SRC += $(PIOSCOMMON)/pios_flashfs_objlist.c
SRC += $(PIOSCOMMON)/printf-stdarg.c SRC += $(PIOSCOMMON)/printf-stdarg.c
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c
SRC += $(PIOSCOMMON)/pios_usb_util.c
include ./UAVObjects.inc include ./UAVObjects.inc
SRC += $(UAVOBJSRC) SRC += $(UAVOBJSRC)

View File

@ -41,5 +41,6 @@
#define PIOS_USB_BOARD_PRODUCT_ID USB_PRODUCT_ID_REVOLUTION #define PIOS_USB_BOARD_PRODUCT_ID USB_PRODUCT_ID_REVOLUTION
#define PIOS_USB_BOARD_DEVICE_VER USB_OP_DEVICE_VER(USB_OP_BOARD_ID_REVOLUTION, USB_OP_BOARD_MODE_FW) #define PIOS_USB_BOARD_DEVICE_VER USB_OP_DEVICE_VER(USB_OP_BOARD_ID_REVOLUTION, USB_OP_BOARD_MODE_FW)
#define PIOS_USB_BOARD_SN_SUFFIX "+FW"
#endif /* PIOS_USB_BOARD_DATA_H */ #endif /* PIOS_USB_BOARD_DATA_H */

View File

@ -27,15 +27,21 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <pios.h> /* Pull in the board-specific static HW definitions.
* Including .c files is a bit ugly but this allows all of
* the HW definitions to be const and static to limit their
* scope.
*
* NOTE: THIS IS THE ONLY PLACE THAT SHOULD EVER INCLUDE THIS FILE
*/
#include "board_hw_defs.c"
#include <pios.h>
#include <openpilot.h> #include <openpilot.h>
#include <uavobjectsinit.h> #include <uavobjectsinit.h>
#include "hwsettings.h" #include "hwsettings.h"
#include "manualcontrolsettings.h" #include "manualcontrolsettings.h"
#include "board_hw_defs.c"
/** /**
* Sensor configurations * Sensor configurations
*/ */
@ -413,28 +419,18 @@ void PIOS_Board_Init(void) {
bool usb_hid_present = false; bool usb_hid_present = false;
bool usb_cdc_present = false; bool usb_cdc_present = false;
uint8_t hwsettings_usb_devicetype; #if defined(PIOS_INCLUDE_USB_CDC)
HwSettingsUSB_DeviceTypeGet(&hwsettings_usb_devicetype); if (PIOS_USB_DESC_HID_CDC_Init()) {
switch (hwsettings_usb_devicetype) {
case HWSETTINGS_USB_DEVICETYPE_HIDONLY:
if (PIOS_USB_DESC_HID_ONLY_Init()) {
PIOS_Assert(0);
}
usb_hid_present = true;
break;
case HWSETTINGS_USB_DEVICETYPE_HIDVCP:
if (PIOS_USB_DESC_HID_CDC_Init()) {
PIOS_Assert(0);
}
usb_hid_present = true;
usb_cdc_present = true;
break;
case HWSETTINGS_USB_DEVICETYPE_VCPONLY:
break;
default:
PIOS_Assert(0); PIOS_Assert(0);
} }
usb_hid_present = true;
usb_cdc_present = true;
#else
if (PIOS_USB_DESC_HID_ONLY_Init()) {
PIOS_Assert(0);
}
usb_hid_present = true;
#endif
uint32_t pios_usb_id; uint32_t pios_usb_id;
PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg); PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg);

View File

@ -31,6 +31,7 @@
#include "pios_usb_board_data.h" /* struct usb_*, USB_* */ #include "pios_usb_board_data.h" /* struct usb_*, USB_* */
#include "pios_sys.h" /* PIOS_SYS_SerialNumberGet */ #include "pios_sys.h" /* PIOS_SYS_SerialNumberGet */
#include "pios_usbhook.h" /* PIOS_USBHOOK_* */ #include "pios_usbhook.h" /* PIOS_USBHOOK_* */
#include "pios_usb_util.h" /* PIOS_USB_UTIL_AsciiToUtf8 */
static const uint8_t usb_product_id[22] = { static const uint8_t usb_product_id[22] = {
sizeof(usb_product_id), sizeof(usb_product_id),
@ -47,40 +48,15 @@ static const uint8_t usb_product_id[22] = {
'n', 0, 'n', 0,
}; };
static uint8_t usb_serial_number[52] = { static uint8_t usb_serial_number[2 + PIOS_SYS_SERIAL_NUM_ASCII_LEN*2 + (sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1)*2] = {
sizeof(usb_serial_number), sizeof(usb_serial_number),
USB_DESC_TYPE_STRING, USB_DESC_TYPE_STRING,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0
}; };
static const struct usb_string_langid usb_lang_id = { static const struct usb_string_langid usb_lang_id = {
.bLength = sizeof(usb_lang_id), .bLength = sizeof(usb_lang_id),
.bDescriptorType = USB_DESC_TYPE_STRING, .bDescriptorType = USB_DESC_TYPE_STRING,
.bLangID = htousbs(USB_LANGID_ENGLISH_UK), .bLangID = htousbs(USB_LANGID_ENGLISH_US),
}; };
static const uint8_t usb_vendor_id[28] = { static const uint8_t usb_vendor_id[28] = {
@ -104,11 +80,13 @@ static const uint8_t usb_vendor_id[28] = {
int32_t PIOS_USB_BOARD_DATA_Init(void) int32_t PIOS_USB_BOARD_DATA_Init(void)
{ {
/* Load device serial number into serial number string */ /* Load device serial number into serial number string */
uint8_t sn[25]; uint8_t sn[PIOS_SYS_SERIAL_NUM_ASCII_LEN + 1];
PIOS_SYS_SerialNumberGet((char *)sn); PIOS_SYS_SerialNumberGet((char *)sn);
for (uint8_t i = 0; sn[i] != '\0' && (2 * i) < usb_serial_number[0]; i++) {
usb_serial_number[2 + 2 * i] = sn[i]; /* Concatenate the device serial number and the appropriate suffix ("+BL" or "+FW") into the USB serial number */
} uint8_t * utf8 = &(usb_serial_number[2]);
utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, sn, PIOS_SYS_SERIAL_NUM_ASCII_LEN);
utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, (uint8_t *)PIOS_USB_BOARD_SN_SUFFIX, sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1);
PIOS_USBHOOK_RegisterString(USB_STRING_DESC_PRODUCT, (uint8_t *)&usb_product_id, sizeof(usb_product_id)); PIOS_USBHOOK_RegisterString(USB_STRING_DESC_PRODUCT, (uint8_t *)&usb_product_id, sizeof(usb_product_id));
PIOS_USBHOOK_RegisterString(USB_STRING_DESC_SERIAL, (uint8_t *)&usb_serial_number, sizeof(usb_serial_number)); PIOS_USBHOOK_RegisterString(USB_STRING_DESC_SERIAL, (uint8_t *)&usb_serial_number, sizeof(usb_serial_number));

View File

@ -1,4 +1,5 @@
#include <pios_config.h> #include <pios_config.h>
#include <pios_board_info.h>
#if defined(PIOS_INCLUDE_LED) #if defined(PIOS_INCLUDE_LED)
@ -51,6 +52,11 @@ static const struct pios_led_cfg pios_led_cfg = {
.num_leds = NELEMENTS(pios_leds), .num_leds = NELEMENTS(pios_leds),
}; };
const struct pios_led_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t board_revision)
{
return &pios_led_cfg;
}
#endif /* PIOS_INCLUDE_LED */ #endif /* PIOS_INCLUDE_LED */
#if defined(PIOS_INCLUDE_SPI) #if defined(PIOS_INCLUDE_SPI)

View File

@ -27,6 +27,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <pios_config.h> #include <pios_config.h>
#include <pios_board_info.h>
#if defined(PIOS_INCLUDE_LED) #if defined(PIOS_INCLUDE_LED)
@ -63,6 +64,11 @@ static const struct pios_led_cfg pios_led_cfg = {
.num_leds = NELEMENTS(pios_leds), .num_leds = NELEMENTS(pios_leds),
}; };
const struct pios_led_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t board_revision)
{
return &pios_led_cfg;
}
#endif /* PIOS_INCLUDE_LED */ #endif /* PIOS_INCLUDE_LED */
#if defined(PIOS_INCLUDE_SPI) #if defined(PIOS_INCLUDE_SPI)