mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Merge remote-tracking branch 'origin/next' into thread/OP-935_Changes_Basic_Stab
This commit is contained in:
commit
95cb657940
72
Makefile
72
Makefile
@ -261,9 +261,9 @@ fw_$(1)_%: uavobjects_flight
|
||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep
|
||||
$(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/firmware && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=fw \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
BUILD_TYPE=fw \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
|
||||
OUTDIR=$(BUILD_DIR)/fw_$(1) \
|
||||
TARGET=fw_$(1) \
|
||||
@ -288,9 +288,9 @@ bl_$(1)_%:
|
||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep
|
||||
$(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/bootloader && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=bl \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
BUILD_TYPE=bl \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
|
||||
OUTDIR=$(BUILD_DIR)/bl_$(1) \
|
||||
TARGET=bl_$(1) \
|
||||
@ -326,9 +326,9 @@ bu_$(1)_%: bl_$(1)_bino
|
||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep
|
||||
$(V1) cd $(ROOT_DIR)/flight/targets/common/bootloader_updater && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=bu \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
BUILD_TYPE=bu \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
|
||||
OUTDIR=$(BUILD_DIR)/bu_$(1) \
|
||||
TARGET=bu_$(1) \
|
||||
@ -350,9 +350,9 @@ ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
|
||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)
|
||||
$(V1) cd $(ROOT_DIR)/flight/targets/common/entire_flash && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=ef \
|
||||
BOARD_NAME=$(1) \
|
||||
BOARD_SHORT_NAME=$(2) \
|
||||
BUILD_TYPE=ef \
|
||||
DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
|
||||
TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
|
||||
OUTDIR=$(BUILD_DIR)/ef_$(1) \
|
||||
@ -656,20 +656,9 @@ ut_$(1)_%: $$(UT_OUT_DIR)
|
||||
$(V1) cd $(ROOT_DIR)/flight/tests/$(1) && \
|
||||
$$(MAKE) -r --no-print-directory \
|
||||
BUILD_TYPE=ut \
|
||||
BOARD_SHORT_NAME=$(1) \
|
||||
TCHAIN_PREFIX="" \
|
||||
REMOVE_CMD="$(RM)" \
|
||||
\
|
||||
TARGET=$(1) \
|
||||
TOPDIR=$(ROOT_DIR)/flight/tests/$(1) \
|
||||
OUTDIR="$(UT_OUT_DIR)/$(1)" \
|
||||
\
|
||||
PIOS=$(PIOS) \
|
||||
OPUAVOBJ=$(OPUAVOBJ) \
|
||||
OPUAVTALK=$(OPUAVTALK) \
|
||||
FLIGHTLIB=$(FLIGHTLIB) \
|
||||
\
|
||||
GTEST_DIR=$(GTEST_DIR) \
|
||||
\
|
||||
TARGET=$(1) \
|
||||
$$*
|
||||
|
||||
.PHONY: ut_$(1)_clean
|
||||
@ -879,6 +868,7 @@ help:
|
||||
@$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)"
|
||||
@$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
|
||||
@$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
|
||||
@$(ECHO) " gtest_install - Install the GoogleTest framework"
|
||||
@$(ECHO) " These targets are not updated yet and are probably broken:"
|
||||
@$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
|
||||
@$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
|
||||
@ -886,6 +876,7 @@ help:
|
||||
@$(ECHO) " android_sdk_install - Install the Android SDK tools"
|
||||
@$(ECHO) " Install all available tools:"
|
||||
@$(ECHO) " all_sdk_install - Install all of above (platform-dependent)"
|
||||
@$(ECHO) " build_sdk_install - Install only essential for build tools (platform-dependent)"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " Other tool options are:"
|
||||
@$(ECHO) " <tool>_version - Display <tool> version"
|
||||
@ -914,32 +905,32 @@ help:
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Firmware]"
|
||||
@$(ECHO) " <board> - Build firmware for <board>"
|
||||
@$(ECHO) " supported boards are ($(ALL_BOARDS))"
|
||||
@$(ECHO) " Supported boards are ($(ALL_BOARDS))"
|
||||
@$(ECHO) " fw_<board> - Build firmware for <board>"
|
||||
@$(ECHO) " supported boards are ($(FW_BOARDS))"
|
||||
@$(ECHO) " Supported boards are ($(FW_BOARDS))"
|
||||
@$(ECHO) " fw_<board>_clean - Remove firmware for <board>"
|
||||
@$(ECHO) " fw_<board>_program - Use OpenOCD + JTAG to write firmware to <board>"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Bootloader]"
|
||||
@$(ECHO) " bl_<board> - Build bootloader for <board>"
|
||||
@$(ECHO) " supported boards are ($(BL_BOARDS))"
|
||||
@$(ECHO) " Supported boards are ($(BL_BOARDS))"
|
||||
@$(ECHO) " bl_<board>_clean - Remove bootloader for <board>"
|
||||
@$(ECHO) " bl_<board>_program - Use OpenOCD + JTAG to write bootloader to <board>"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Entire Flash]"
|
||||
@$(ECHO) " ef_<board> - Build entire flash image for <board>"
|
||||
@$(ECHO) " supported boards are ($(EF_BOARDS))"
|
||||
@$(ECHO) " Supported boards are ($(EF_BOARDS))"
|
||||
@$(ECHO) " ef_<board>_clean - Remove entire flash image for <board>"
|
||||
@$(ECHO) " ef_<board>_program - Use OpenOCD + JTAG to write entire flash image to <board>"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Bootloader Updater]"
|
||||
@$(ECHO) " bu_<board> - Build bootloader updater for <board>"
|
||||
@$(ECHO) " supported boards are ($(BU_BOARDS))"
|
||||
@$(ECHO) " Supported boards are ($(BU_BOARDS))"
|
||||
@$(ECHO) " bu_<board>_clean - Remove bootloader updater for <board>"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Unbrick a board]"
|
||||
@$(ECHO) " unbrick_<board> - Use the STM32's built in boot ROM to write a bootloader to <board>"
|
||||
@$(ECHO) " supported boards are ($(BL_BOARDS))"
|
||||
@$(ECHO) " Supported boards are ($(BL_BOARDS))"
|
||||
@$(ECHO) " [Unittests]"
|
||||
@$(ECHO) " ut_<test> - Build unit test <test>"
|
||||
@$(ECHO) " ut_<test>_xml - Run test and capture XML output into a file"
|
||||
@ -948,14 +939,14 @@ help:
|
||||
@$(ECHO) " [Simulation]"
|
||||
@$(ECHO) " sim_osx - Build OpenPilot simulation firmware for OSX"
|
||||
@$(ECHO) " sim_osx_clean - Delete all build output for the osx simulation"
|
||||
@$(ECHO) " sim_win32 - Build OpenPilot simulation firmware for"
|
||||
@$(ECHO) " Windows using mingw and msys"
|
||||
@$(ECHO) " sim_win32 - Build OpenPilot simulation firmware for Windows"
|
||||
@$(ECHO) " using mingw and msys"
|
||||
@$(ECHO) " sim_win32_clean - Delete all build output for the win32 simulation"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [GCS]"
|
||||
@$(ECHO) " gcs - Build the Ground Control System (GCS) application (debug|release)"
|
||||
@$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application (debug|release)"
|
||||
@$(ECHO) " supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
|
||||
@$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
|
||||
@$(ECHO) " gcs_all_clean - Remove the Ground Control System (GCS) application (all build confgurations)"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [AndroidGCS]"
|
||||
@ -966,22 +957,35 @@ help:
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [UAVObjects]"
|
||||
@$(ECHO) " uavobjects - Generate source files from the UAVObject definition XML files"
|
||||
@$(ECHO) " uavobjects_test - parse xml-files - check for valid, duplicate ObjId's, ... "
|
||||
@$(ECHO) " uavobjects_test - Parse xml-files - check for valid, duplicate ObjId's, ..."
|
||||
@$(ECHO) " uavobjects_<group> - Generate source files from a subset of the UAVObject definition XML files"
|
||||
@$(ECHO) " supported groups are ($(UAVOBJ_TARGETS))"
|
||||
@$(ECHO) " Supported groups are ($(UAVOBJ_TARGETS))"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Packaging]"
|
||||
@$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS"
|
||||
@$(ECHO) " clean_package - Clean, build and package the OpenPilot platform-dependent package"
|
||||
@$(ECHO) " package - Build and package the OpenPilot platform-dependent package"
|
||||
@$(ECHO) " package - Build and package the OpenPilot platform-dependent package (no clean)"
|
||||
@$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Code Formatting]"
|
||||
@$(ECHO) " uncrustify_<source> - Reformat <source> code. <source> can be flight or ground"
|
||||
@$(ECHO) " uncrustify_<source> - Reformat <source> code according to the project's standards"
|
||||
@$(ECHO) " Supported sources are ($(UNCRUSTIFY_TARGETS))"
|
||||
@$(ECHO) " uncrustify_all - Reformat all source code"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " [Code Documentation]"
|
||||
@$(ECHO) " docs_<source> - Generate HTML documentation for <source>"
|
||||
@$(ECHO) " Supported sources are ($(DOCS_TARGETS))"
|
||||
@$(ECHO) " docs_all - Generate HTML documentation for all"
|
||||
@$(ECHO) " docs_<source>_clean - Delete generated documentation for <source>"
|
||||
@$(ECHO) " docs_all_clean - Delete all generated documentation"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " Hint: Add V=1 to your command line to see verbose build output."
|
||||
@$(ECHO)
|
||||
@$(ECHO) " Notes: All tool distribution files will be downloaded into $(DL_DIR)"
|
||||
@$(ECHO) " All tools will be installed into $(TOOLS_DIR)"
|
||||
@$(ECHO) " All build output will be placed in $(BUILD_DIR)"
|
||||
@$(ECHO) " Notes: All tool distribution files will be downloaded into $(DL_DIR)"
|
||||
@$(ECHO) " All tools will be installed into $(TOOLS_DIR)"
|
||||
@$(ECHO) " All build output will be placed in $(BUILD_DIR)"
|
||||
@$(ECHO)
|
||||
@$(ECHO) " Tool download and install directories can be changed using environment variables:"
|
||||
@$(ECHO) " OPENPILOT_DL_DIR full path to downloads directory [downloads if not set]"
|
||||
@$(ECHO) " OPENPILOT_TOOLS_DIR full path to installed tools directory [tools if not set]"
|
||||
@$(ECHO) " More info: http://wiki.openpilot.org/display/Doc/OpenPilot+Build+System+Overview"
|
||||
@$(ECHO)
|
||||
|
@ -71,8 +71,9 @@ typedef struct {
|
||||
|
||||
// The task handles.
|
||||
xTaskHandle telemetryTxTaskHandle;
|
||||
xTaskHandle radioRxTaskHandle;
|
||||
xTaskHandle telemetryRxTaskHandle;
|
||||
xTaskHandle radioTxTaskHandle;
|
||||
xTaskHandle radioRxTaskHandle;
|
||||
|
||||
// The UAVTalk connection on the com side.
|
||||
UAVTalkConnection outUAVTalkCon;
|
||||
@ -103,8 +104,9 @@ typedef struct {
|
||||
// Private functions
|
||||
|
||||
static void telemetryTxTask(void *parameters);
|
||||
static void radioRxTask(void *parameters);
|
||||
static void telemetryRxTask(void *parameters);
|
||||
static void radioTxTask(void *parameters);
|
||||
static void radioRxTask(void *parameters);
|
||||
static int32_t UAVTalkSendHandler(uint8_t *buf, int32_t length);
|
||||
static int32_t RadioSendHandler(uint8_t *buf, int32_t length);
|
||||
static void ProcessInputStream(UAVTalkConnection connectionHandle, uint8_t rxbyte);
|
||||
@ -172,26 +174,32 @@ static int32_t RadioComBridgeStart(void)
|
||||
|
||||
// Set the frequency range.
|
||||
PIOS_RFM22B_SetFrequencyRange(pios_rfm22b_id, oplinkSettings.MinFrequency, oplinkSettings.MaxFrequency, oplinkSettings.ChannelSpacing);
|
||||
|
||||
|
||||
// Reinitilize the modem.
|
||||
PIOS_RFM22B_Reinit(pios_rfm22b_id);
|
||||
|
||||
// We will not parse/send UAVTalk if any ports are configured as Serial (except for over the USB HID port).
|
||||
data->parseUAVTalk = ((oplinkSettings.MainPort != OPLINKSETTINGS_MAINPORT_SERIAL) &&
|
||||
(oplinkSettings.FlexiPort != OPLINKSETTINGS_FLEXIPORT_SERIAL) &&
|
||||
(oplinkSettings.VCPPort != OPLINKSETTINGS_VCPPORT_SERIAL));
|
||||
}
|
||||
|
||||
// Set the initial frequency.
|
||||
PIOS_RFM22B_SetInitialFrequency(pios_rfm22b_id, oplinkSettings.InitFrequency);
|
||||
|
||||
// Start the primary tasks for receiving/sending UAVTalk packets from the GCS.
|
||||
xTaskCreate(telemetryTxTask, (signed char *)"telemTxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->telemetryTxTaskHandle));
|
||||
xTaskCreate(radioRxTask, (signed char *)"radioRxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->radioRxTaskHandle));
|
||||
xTaskCreate(telemetryTxTask, (signed char *)"telemetryTxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->telemetryTxTaskHandle));
|
||||
xTaskCreate(telemetryRxTask, (signed char *)"telemetryRxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->telemetryRxTaskHandle));
|
||||
xTaskCreate(radioTxTask, (signed char *)"radioTxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->radioTxTaskHandle));
|
||||
xTaskCreate(radioRxTask, (signed char *)"radioRxTask", STACK_SIZE_BYTES, NULL, TASK_PRIORITY, &(data->radioRxTaskHandle));
|
||||
|
||||
// Register the watchdog timers.
|
||||
#ifdef PIOS_INCLUDE_WDG
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_TELEMETRY);
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_RADIORX);
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_TELEMETRYTX);
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_TELEMETRYRX);
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_RADIOTX);
|
||||
PIOS_WDG_RegisterFlag(PIOS_WDG_RADIORX);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -234,7 +242,7 @@ static int32_t RadioComBridgeInitialize(void)
|
||||
data->comTxErrors = 0;
|
||||
data->comTxRetries = 0;
|
||||
data->UAVTalkErrors = 0;
|
||||
data->parseUAVTalk = false;
|
||||
data->parseUAVTalk = true;
|
||||
data->configured = false;
|
||||
data->comSpeed = OPLINKSETTINGS_COMSPEED_9600;
|
||||
PIOS_COM_RADIO = PIOS_COM_RFM22B;
|
||||
@ -255,7 +263,7 @@ static void telemetryTxTask(void *parameters)
|
||||
// Loop forever
|
||||
while (1) {
|
||||
#ifdef PIOS_INCLUDE_WDG
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_TELEMETRY);
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_TELEMETRYTX);
|
||||
#endif
|
||||
// Wait for queue message
|
||||
if (xQueueReceive(data->uavtalkEventQueue, &ev, MAX_PORT_DELAY) == pdTRUE) {
|
||||
@ -294,6 +302,34 @@ static void telemetryTxTask(void *parameters)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Radio tx task. Receive data packets from the com port and send to the radio.
|
||||
*
|
||||
* @param[in] parameters The task parameters
|
||||
*/
|
||||
static void radioTxTask(void *parameters)
|
||||
{
|
||||
// Task loop
|
||||
while (1) {
|
||||
#ifdef PIOS_INCLUDE_WDG
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_RADIOTX);
|
||||
#endif
|
||||
|
||||
// Wait until the com port is available.
|
||||
if (data->parseUAVTalk || !PIOS_COM_TELEMETRY) {
|
||||
vTaskDelay(5);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Read from the com port.
|
||||
uint8_t serial_data[1];
|
||||
uint16_t bytes_to_process = PIOS_COM_ReceiveBuffer(PIOS_COM_TELEMETRY, serial_data, sizeof(serial_data), MAX_PORT_DELAY);
|
||||
if (bytes_to_process > 0) {
|
||||
PIOS_COM_SendBufferNonBlocking(PIOS_COM_RADIO, serial_data, bytes_to_process);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Radio rx task. Receive data packets from the radio and pass them on.
|
||||
*
|
||||
@ -309,27 +345,32 @@ static void radioRxTask(void *parameters)
|
||||
uint8_t serial_data[1];
|
||||
uint16_t bytes_to_process = PIOS_COM_ReceiveBuffer(PIOS_COM_RADIO, serial_data, sizeof(serial_data), MAX_PORT_DELAY);
|
||||
if (bytes_to_process > 0) {
|
||||
for (uint8_t i = 0; i < bytes_to_process; i++) {
|
||||
if (UAVTalkRelayInputStream(data->outUAVTalkCon, serial_data[i]) == UAVTALK_STATE_ERROR) {
|
||||
data->UAVTalkErrors++;
|
||||
// Either pass the data through the UAVTalk parser, or just send it to the radio (if we're doing raw comms).
|
||||
if (data->parseUAVTalk) {
|
||||
for (uint8_t i = 0; i < bytes_to_process; i++) {
|
||||
if (UAVTalkRelayInputStream(data->outUAVTalkCon, serial_data[i]) == UAVTALK_STATE_ERROR) {
|
||||
data->UAVTalkErrors++;
|
||||
}
|
||||
}
|
||||
} else if (PIOS_COM_TELEMETRY) {
|
||||
PIOS_COM_SendBufferNonBlocking(PIOS_COM_TELEMETRY, serial_data, bytes_to_process);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Radio rx task. Receive data from a com port and pass it on to the radio.
|
||||
* Receive telemetry from the USB/COM port.
|
||||
*
|
||||
* @param[in] parameters The task parameters
|
||||
*/
|
||||
static void radioTxTask(void *parameters)
|
||||
static void telemetryRxTask(void *parameters)
|
||||
{
|
||||
// Task loop
|
||||
while (1) {
|
||||
uint32_t inputPort = PIOS_COM_TELEMETRY;
|
||||
uint32_t inputPort = data->parseUAVTalk ? PIOS_COM_TELEMETRY : 0;
|
||||
#ifdef PIOS_INCLUDE_WDG
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_RADIOTX);
|
||||
PIOS_WDG_UpdateFlag(PIOS_WDG_TELEMETRYRX);
|
||||
#endif
|
||||
#if defined(PIOS_INCLUDE_USB)
|
||||
// Determine output port (USB takes priority over telemetry port)
|
||||
@ -360,7 +401,7 @@ static void radioTxTask(void *parameters)
|
||||
*/
|
||||
static int32_t UAVTalkSendHandler(uint8_t *buf, int32_t length)
|
||||
{
|
||||
uint32_t outputPort = PIOS_COM_TELEMETRY;
|
||||
uint32_t outputPort = data->parseUAVTalk ? PIOS_COM_TELEMETRY : 0;
|
||||
#if defined(PIOS_INCLUDE_USB)
|
||||
// Determine output port (USB takes priority over telemetry port)
|
||||
if (PIOS_COM_TELEM_USB_HID && PIOS_COM_Available(PIOS_COM_TELEM_USB_HID)) {
|
||||
@ -577,6 +618,11 @@ static void configureComCallback(OPLinkSettingsRemoteMainPortOptions main_port,
|
||||
// Set the frequency range.
|
||||
PIOS_RFM22B_SetFrequencyRange(pios_rfm22b_id, min_frequency, max_frequency, channel_spacing);
|
||||
|
||||
// We will not parse/send UAVTalk if any ports are configured as Serial (except for over the USB HID port).
|
||||
data->parseUAVTalk = ((oplinkSettings.MainPort != OPLINKSETTINGS_MAINPORT_SERIAL) &&
|
||||
(oplinkSettings.FlexiPort != OPLINKSETTINGS_FLEXIPORT_SERIAL) &&
|
||||
(oplinkSettings.VCPPort != OPLINKSETTINGS_VCPPORT_SERIAL));
|
||||
|
||||
// Update the OPLinkSettings object.
|
||||
OPLinkSettingsSet(&oplinkSettings);
|
||||
}
|
||||
@ -604,7 +650,6 @@ static void updateSettings()
|
||||
bool is_coordinator = PIOS_RFM22B_IsCoordinator(pios_rfm22b_id);
|
||||
switch (oplinkSettings.MainPort) {
|
||||
case OPLINKSETTINGS_MAINPORT_TELEMETRY:
|
||||
data->parseUAVTalk = true;
|
||||
case OPLINKSETTINGS_MAINPORT_SERIAL:
|
||||
/* Configure the main port for uart serial */
|
||||
PIOS_InitUartMainPort();
|
||||
@ -620,7 +665,6 @@ static void updateSettings()
|
||||
// Configure the flexi port
|
||||
switch (oplinkSettings.FlexiPort) {
|
||||
case OPLINKSETTINGS_FLEXIPORT_TELEMETRY:
|
||||
data->parseUAVTalk = true;
|
||||
case OPLINKSETTINGS_FLEXIPORT_SERIAL:
|
||||
/* Configure the flexi port as uart serial */
|
||||
PIOS_InitUartFlexiPort();
|
||||
|
@ -387,12 +387,15 @@ static int32_t PIOS_Flash_Jedec_EraseChip(uintptr_t flash_id)
|
||||
while (PIOS_Flash_Jedec_Busy(flash_dev) != 0) {
|
||||
#if defined(FLASH_FREERTOS)
|
||||
vTaskDelay(1);
|
||||
if ((i++) % 100 == 0)
|
||||
if ((i++) % 100 == 0) {
|
||||
#else
|
||||
if ((i++) % 10000 == 0)
|
||||
if ((i++) % 10000 == 0) {
|
||||
#endif
|
||||
|
||||
#ifdef PIOS_LED_HEARTBEAT
|
||||
PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,9 @@ static int32_t logfs_erase_all_arenas()
|
||||
uint16_t num_arenas = logfs.cfg->total_fs_size / logfs.cfg->arena_size;
|
||||
|
||||
for (uint16_t arena = 0; arena < num_arenas; arena++) {
|
||||
PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
|
||||
#ifdef PIOS_LED_HEARTBEAT
|
||||
PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
|
||||
#endif
|
||||
if (logfs_erase_arena(arena) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
@ -2192,7 +2192,6 @@ static enum pios_rfm22b_event rfm22_receiveAck(struct pios_rfm22b_dev *rfm22b_de
|
||||
portTickType local_tx_time = rfm22_coordinatorTime(rfm22b_dev, rfm22b_dev->tx_complete_ticks);
|
||||
portTickType remote_rx_time = aph->packet_recv_time;
|
||||
// Adjust the time delta based on the difference between our estimated time offset and the coordinator offset.
|
||||
// This is not working yet
|
||||
rfm22b_dev->time_delta += remote_rx_time - local_tx_time;
|
||||
}
|
||||
|
||||
|
@ -49,11 +49,11 @@
|
||||
#include <math.h>
|
||||
|
||||
/* STM32 Std Peripherals Lib */
|
||||
#ifdef STM32F4XX
|
||||
#if defined(STM32F10X)
|
||||
#include <stm32f10x.h>
|
||||
#elif defined(STM32F4XX)
|
||||
#include <stm32f4xx.h>
|
||||
#include <stm32f4xx_rcc.h>
|
||||
#else
|
||||
#include <stm32f10x.h>
|
||||
#endif
|
||||
|
||||
/* PIOS board specific feature selection */
|
||||
|
@ -9,16 +9,8 @@ BOARD := STM32103CB_OPLINKMINI
|
||||
MODEL := MD
|
||||
MODEL_SUFFIX := _PX
|
||||
|
||||
OPENOCD_CONFIG := stm32f1x.cfg
|
||||
|
||||
OPENOCD_JTAG_CONFIG := foss-jtag.revb.cfg
|
||||
OPENOCD_CONFIG := stm32f1x.cfg
|
||||
|
||||
OPENOCD_JTAG_CONFIG := foss-jtag.revb.cfg
|
||||
OPENOCD_CONFIG := stm32f1x.cfg
|
||||
|
||||
OPENOCD_JTAG_CONFIG := foss-jtag.revb.cfg
|
||||
OPENOCD_CONFIG := stm32f1x.cfg
|
||||
OPENOCD_JTAG_CONFIG := stlink-v2.cfg
|
||||
OPENOCD_CONFIG := stm32f1x.stlink.cfg
|
||||
|
||||
# Note: These must match the values in link_$(BOARD)_memory.ld
|
||||
BL_BANK_BASE := 0x08000000 # Start of bootloader flash
|
||||
|
@ -71,10 +71,11 @@ TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1
|
||||
//------------------------
|
||||
#define PIOS_WATCHDOG_TIMEOUT 500
|
||||
#define PIOS_WDG_REGISTER BKP_DR4
|
||||
#define PIOS_WDG_TELEMETRY 0x0001
|
||||
#define PIOS_WDG_RADIORX 0x0002
|
||||
#define PIOS_WDG_TELEMETRYTX 0x0001
|
||||
#define PIOS_WDG_TELEMETRYRX 0x0002
|
||||
#define PIOS_WDG_RADIOTX 0x0004
|
||||
#define PIOS_WDG_RFM22B 0x0008
|
||||
#define PIOS_WDG_RADIORX 0x0008
|
||||
#define PIOS_WDG_RFM22B 0x0016
|
||||
|
||||
//------------------------
|
||||
// TELEMETRY
|
||||
|
@ -1,6 +1,7 @@
|
||||
###############################################################################
|
||||
# @file Makefile
|
||||
# @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
|
||||
# Copyright (c) 2013, The OpenPilot Team, http://www.openpilot.org
|
||||
# @addtogroup
|
||||
# @{
|
||||
# @addtogroup
|
||||
@ -23,21 +24,17 @@
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
WHEREAMI := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
TOP := $(realpath $(WHEREAMI)/../../../)
|
||||
include $(TOP)/make/firmware-defs.mk
|
||||
ifndef OPENPILOT_IS_COOL
|
||||
$(error Top level Makefile must be used to build this target)
|
||||
endif
|
||||
|
||||
include $(ROOT_DIR)/make/firmware-defs.mk
|
||||
|
||||
EXTRAINCDIRS += $(TOPDIR)
|
||||
EXTRAINCDIRS += $(PIOS)/inc
|
||||
|
||||
CFLAGS += -O0
|
||||
CFLAGS += -Wall -Werror
|
||||
CFLAGS += -g
|
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
|
||||
SRC += $(PIOS)/common/pios_flashfs_logfs.c
|
||||
|
||||
CFLAGS += "-DFLASH_IMAGE_FILE=\"$(OUTDIR)/theflash.bin\""
|
||||
|
||||
CONLYFLAGS += -std=gnu99
|
||||
|
||||
SRC := $(PIOS)/common/pios_flashfs_logfs.c
|
||||
|
||||
include $(TOP)/make/unittest.mk
|
||||
include $(ROOT_DIR)/make/unittest.mk
|
||||
|
@ -1,5 +1,9 @@
|
||||
#ifndef OPENPILOT_H
|
||||
#define OPENPILOT_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define PIOS_Assert(x) if (!(x)) { while (1) ; }
|
||||
|
||||
#define PIOS_DEBUG_Assert(x) PIOS_Assert(x)
|
||||
|
||||
#endif /* OPENPILOT_H */
|
||||
|
@ -1,4 +1,12 @@
|
||||
#if defined(PIOS_INCLUDE_FLASH)
|
||||
#ifndef PIOS_H
|
||||
#define PIOS_H
|
||||
|
||||
/* PIOS board specific feature selection */
|
||||
#include "pios_config.h"
|
||||
|
||||
#ifdef PIOS_INCLUDE_FLASH
|
||||
#include <pios_flash.h>
|
||||
#include <pios_flashfs.h>
|
||||
#endif
|
||||
|
||||
#endif /* PIOS_H */
|
||||
|
@ -1 +1,7 @@
|
||||
#ifndef PIOS_CONFIG_H
|
||||
#define PIOS_CONFIG_H
|
||||
|
||||
/* Enable/Disable PiOS modules */
|
||||
#define PIOS_INCLUDE_FLASH
|
||||
|
||||
#endif /* PIOS_CONFIG_H */
|
||||
|
@ -14,6 +14,7 @@
|
||||
# nsis_install (Windows only)
|
||||
# uncrustify_install
|
||||
# doxygen_install
|
||||
# gtest_install
|
||||
#
|
||||
# TODO:
|
||||
# openocd_install
|
||||
@ -24,7 +25,6 @@
|
||||
# stm32flash_install
|
||||
# dfuutil_install
|
||||
# android_sdk_install
|
||||
# gtest_install
|
||||
#
|
||||
# TODO:
|
||||
# help in the top Makefile
|
||||
@ -79,6 +79,8 @@ else ifeq ($(UNAME), Windows)
|
||||
DOXYGEN_URL := http://wiki.openpilot.org/download/attachments/18612236/doxygen-1.8.3.1-windows.tar.bz2
|
||||
endif
|
||||
|
||||
GTEST_URL := http://wiki.openpilot.org/download/attachments/18612236/gtest-1.6.0.zip
|
||||
|
||||
# Changing PYTHON_DIR, also update it in ground\openpilotgcs\src\app\gcsversioninfo.pri
|
||||
ARM_SDK_DIR := $(TOOLS_DIR)/gcc-arm-none-eabi-4_7-2013q1
|
||||
QT_SDK_DIR := $(TOOLS_DIR)/qt-4.8.4
|
||||
@ -87,24 +89,30 @@ PYTHON_DIR := $(TOOLS_DIR)/python-2.7.4
|
||||
NSIS_DIR := $(TOOLS_DIR)/nsis-2.46-unicode
|
||||
UNCRUSTIFY_DIR := $(TOOLS_DIR)/uncrustify-0.60
|
||||
DOXYGEN_DIR := $(TOOLS_DIR)/doxygen-1.8.3.1
|
||||
GTEST_DIR := $(TOOLS_DIR)/gtest-1.6.0
|
||||
|
||||
##############################
|
||||
#
|
||||
# All toolchains available for the platform
|
||||
# Build only and all toolchains available for the platform
|
||||
#
|
||||
##############################
|
||||
|
||||
ALL_SDK_TARGETS := arm_sdk qt_sdk
|
||||
BUILD_SDK_TARGETS := arm_sdk qt_sdk
|
||||
ifeq ($(UNAME), Windows)
|
||||
ALL_SDK_TARGETS += mingw python nsis
|
||||
BUILD_SDK_TARGETS += mingw python nsis
|
||||
endif
|
||||
ALL_SDK_TARGETS += uncrustify doxygen
|
||||
ALL_SDK_TARGETS := $(BUILD_SDK_TARGETS) gtest uncrustify doxygen
|
||||
|
||||
.PHONY: all_sdk_install all_sdk_clean all_sdk_distclean all_sdk_version
|
||||
all_sdk_install: $(addsuffix _install,$(ALL_SDK_TARGETS))
|
||||
all_sdk_clean: $(addsuffix _clean,$(ALL_SDK_TARGETS))
|
||||
all_sdk_distclean: $(addsuffix _distclean,$(ALL_SDK_TARGETS))
|
||||
all_sdk_version: $(addsuffix _version,$(ALL_SDK_TARGETS))
|
||||
define GROUP_SDK_TEMPLATE
|
||||
.PHONY: $(1)_install $(1)_clean $(1)_distclean $(1)_version
|
||||
$(1)_install: $(addsuffix _install,$(2))
|
||||
$(1)_clean: $(addsuffix _clean,$(2))
|
||||
$(1)_distclean: $(addsuffix _distclean,$(2))
|
||||
$(1)_version: $(addsuffix _version,$(2))
|
||||
endef
|
||||
|
||||
$(eval $(call GROUP_SDK_TEMPLATE,build_sdk,$(BUILD_SDK_TARGETS)))
|
||||
$(eval $(call GROUP_SDK_TEMPLATE,all_sdk,$(ALL_SDK_TARGETS)))
|
||||
|
||||
##############################
|
||||
#
|
||||
@ -122,14 +130,14 @@ export CUT := cut
|
||||
export SED := sed
|
||||
|
||||
# Used only by this Makefile
|
||||
GIT := git
|
||||
CURL := curl
|
||||
TAR := tar
|
||||
UNZIP := unzip
|
||||
OPENSSL := openssl
|
||||
ANT := ant
|
||||
JAVAC := javac
|
||||
JAR := jar
|
||||
GIT := git
|
||||
CURL := curl
|
||||
OPENSSL := openssl
|
||||
DOXYGEN := doxygen
|
||||
|
||||
# Echo in recipes is a bit tricky in a Windows Git Bash window in some cases.
|
||||
# It does not work if make started under msysGit installed into a path with spaces.
|
||||
@ -171,11 +179,13 @@ MSG_NOTICE = $(QUOTE) NOTE $(QUOTE)
|
||||
|
||||
# Verbosity level
|
||||
ifeq ($(V), 1)
|
||||
CURL_OPTIONS :=
|
||||
MAKE_SILENT :=
|
||||
CURL_OPTIONS :=
|
||||
MAKE_SILENT :=
|
||||
UNZIP_SILENT :=
|
||||
else
|
||||
CURL_OPTIONS := --silent
|
||||
MAKE_SILENT := --silent
|
||||
CURL_OPTIONS := --silent
|
||||
MAKE_SILENT := --silent
|
||||
UNZIP_SILENT := -q
|
||||
endif
|
||||
|
||||
# MSYS tar workaround
|
||||
@ -237,7 +247,10 @@ $(1)_install: $(1)_clean | $(DL_DIR) $(TOOLS_DIR)
|
||||
|
||||
@$(ECHO) $(MSG_EXTRACTING) $$(call toprel, $(2))
|
||||
$(V1) $(MKDIR) -p $$(call toprel, $(dir $(2)))
|
||||
$(V1) $(TAR) $(TAR_OPTIONS) -C $$(call toprel, $(dir $(2))) -xf $$(call toprel, $(DL_DIR)/$(4))
|
||||
$(if $(filter $(suffix $(4)), .zip),
|
||||
$(V1) $(UNZIP) $(UNZIP_SILENT) -d $$(call toprel, $(dir $(2))) $$(call toprel, $(DL_DIR)/$(4)),
|
||||
$(V1) $(TAR) $(TAR_OPTIONS) -C $$(call toprel, $(dir $(2))) -xf $$(call toprel, $(DL_DIR)/$(4))
|
||||
)
|
||||
|
||||
$(5)
|
||||
|
||||
@ -523,7 +536,19 @@ endif
|
||||
doxygen_version:
|
||||
-$(V1) $(ECHO) "Doxygen `$(DOXYGEN) --version`"
|
||||
|
||||
##############################
|
||||
#
|
||||
# GoogleTest
|
||||
#
|
||||
##############################
|
||||
|
||||
$(eval $(call TOOL_INSTALL_TEMPLATE,gtest,$(GTEST_DIR),$(GTEST_URL),$(notdir $(GTEST_URL))))
|
||||
|
||||
export GTEST_DIR
|
||||
|
||||
.PHONY: gtest_version
|
||||
gtest_version:
|
||||
-$(V1) $(SED) -n "s/^PACKAGE_STRING='\(.*\)'/\1/p" < $(GTEST_DIR)/configure
|
||||
|
||||
|
||||
|
||||
@ -790,28 +815,6 @@ android_sdk_update:
|
||||
$(V0) @echo " UPDATE $(ANDROID_SDK_DIR)"
|
||||
$(ANDROID_SDK_DIR)/tools/android update sdk --no-ui -t platform-tools,android-16,addon-google_apis-google-16
|
||||
|
||||
# Set up Google Test (gtest) tools
|
||||
GTEST_DIR := $(TOOLS_DIR)/gtest-1.6.0
|
||||
|
||||
.PHONY: gtest_install
|
||||
gtest_install: | $(DL_DIR) $(TOOLS_DIR)
|
||||
gtest_install: GTEST_URL := http://googletest.googlecode.com/files/gtest-1.6.0.zip
|
||||
gtest_install: GTEST_FILE := $(notdir $(GTEST_URL))
|
||||
gtest_install: gtest_clean
|
||||
# download the file unconditionally since google code gives back 404
|
||||
# for HTTP HEAD requests which are used when using the wget -N option
|
||||
$(V1) [ ! -f "$(DL_DIR)/$(GTEST_FILE)" ] || $(RM) -f "$(DL_DIR)/$(GTEST_FILE)"
|
||||
$(V1) $(WGET) -P "$(DL_DIR)" --trust-server-name "$(GTEST_URL)"
|
||||
|
||||
# extract the source
|
||||
$(V1) [ ! -d "$(GTEST_DIR)" ] || $(RM) -rf "$(GTEST_DIR)"
|
||||
$(V1) mkdir -p "$(GTEST_DIR)"
|
||||
$(V1) unzip -q -d "$(TOOLS_DIR)" "$(DL_DIR)/$(GTEST_FILE)"
|
||||
|
||||
.PHONY: gtest_clean
|
||||
gtest_clean:
|
||||
$(V0) @echo " CLEAN $(GTEST_DIR)"
|
||||
$(V1) [ ! -d "$(GTEST_DIR)" ] || $(RM) -rf "$(GTEST_DIR)"
|
||||
|
||||
##############################
|
||||
#
|
||||
|
@ -1,6 +1,7 @@
|
||||
###############################################################################
|
||||
# @file unittest.mk
|
||||
# @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
|
||||
# Copyright (c) 2013, The OpenPilot Team, http://www.openpilot.org
|
||||
# @addtogroup
|
||||
# @{
|
||||
# @addtogroup
|
||||
@ -23,40 +24,42 @@
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# Flags passed to the preprocessor.
|
||||
CPPFLAGS += -I$(GTEST_DIR)/include
|
||||
|
||||
# Flags passed to the C++ compiler.
|
||||
CXXFLAGS += -g -Wall -Wextra
|
||||
|
||||
# Google Test needs the pthread library
|
||||
LDFLAGS += -lpthread
|
||||
|
||||
#################################
|
||||
#
|
||||
# Template to build the user test
|
||||
#
|
||||
#################################
|
||||
|
||||
# Need to disable THUMB mode for unit tests
|
||||
# Use native toolchain and disable THUMB mode for unit tests
|
||||
override ARM_SDK_PREFIX :=
|
||||
override THUMB :=
|
||||
|
||||
EXTRAINCDIRS += .
|
||||
ALLSRC := $(SRC) $(wildcard ./*.c)
|
||||
ALLCPPSRC := $(wildcard ./*.cpp) $(GTEST_DIR)/src/gtest_main.cc
|
||||
ALLSRCBASE := $(notdir $(basename $(ALLSRC) $(ALLCPPSRC)))
|
||||
ALLOBJ := $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE)))
|
||||
# Unit test source files
|
||||
ALLSRC := $(SRC) $(wildcard ./*.c)
|
||||
ALLCPPSRC := $(wildcard ./*.cpp) $(GTEST_DIR)/src/gtest_main.cc
|
||||
ALLSRCBASE := $(notdir $(basename $(ALLSRC) $(ALLCPPSRC)))
|
||||
ALLOBJ := $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE)))
|
||||
|
||||
$(foreach src,$(ALLSRC),$(eval $(call COMPILE_C_TEMPLATE,$(src))))
|
||||
$(foreach src,$(ALLCPPSRC),$(eval $(call COMPILE_CXX_TEMPLATE,$(src))))
|
||||
|
||||
|
||||
# Specific extensions to CPPFLAGS only for the google test library
|
||||
$(OUTDIR)/gtest-all.o : CPPFLAGS += -I$(GTEST_DIR)
|
||||
$(eval $(call COMPILE_CXX_TEMPLATE, $(GTEST_DIR)/src/gtest-all.cc))
|
||||
$(OUTDIR)/gtest-all.o: CPPFLAGS += -I$(GTEST_DIR)
|
||||
|
||||
$(eval $(call COMPILE_CXX_TEMPLATE, $(GTEST_DIR)/src/gtest-all.cc))
|
||||
$(eval $(call LINK_CXX_TEMPLATE,$(OUTDIR)/$(TARGET).elf,$(ALLOBJ) $(OUTDIR)/gtest-all.o))
|
||||
|
||||
# Flags passed to the preprocessor
|
||||
CPPFLAGS += -I$(GTEST_DIR)/include
|
||||
|
||||
# Flags passed to the C++ compiler
|
||||
CXXFLAGS += -g -Wall -Wextra
|
||||
|
||||
# Flags passed to the C compiler
|
||||
CONLYFLAGS += -std=gnu99
|
||||
|
||||
# Common compiler flags
|
||||
CFLAGS += -O0 -g
|
||||
CFLAGS += -Wall -Werror
|
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
|
||||
# Google Test needs the pthread library
|
||||
LDFLAGS += -lpthread
|
||||
|
||||
.PHONY: elf
|
||||
elf: $(OUTDIR)/$(TARGET).elf
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user