mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
Move the bl_helper out of the common directory as it isn't
This commit is contained in:
parent
761da06b6f
commit
569b201b58
@ -102,12 +102,12 @@ SRC += $(PIOSSTM32F10X)/pios_gpio.c
|
|||||||
SRC += $(PIOSSTM32F10X)/pios_spi.c
|
SRC += $(PIOSSTM32F10X)/pios_spi.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_exti.c
|
SRC += $(PIOSSTM32F10X)/pios_exti.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_iap.c
|
SRC += $(PIOSSTM32F10X)/pios_iap.c
|
||||||
|
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
|
||||||
|
|
||||||
## PIOS Hardware (Common)
|
## PIOS Hardware (Common)
|
||||||
SRC += $(PIOSCOMMON)/pios_com.c
|
SRC += $(PIOSCOMMON)/pios_com.c
|
||||||
SRC += $(PIOSCOMMON)/pios_hmc5843.c
|
SRC += $(PIOSCOMMON)/pios_hmc5843.c
|
||||||
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
||||||
SRC += $(PIOSCOMMON)/pios_bl_helper.c
|
|
||||||
|
|
||||||
## CMSIS for STM32
|
## CMSIS for STM32
|
||||||
SRC += $(CMSISDIR)/core_cm3.c
|
SRC += $(CMSISDIR)/core_cm3.c
|
||||||
|
@ -86,6 +86,7 @@ SRC += $(PIOSSTM32F10X)/pios_irq.c
|
|||||||
SRC += $(PIOSSTM32F10X)/pios_gpio.c
|
SRC += $(PIOSSTM32F10X)/pios_gpio.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_spi.c
|
SRC += $(PIOSSTM32F10X)/pios_spi.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_iap.c
|
SRC += $(PIOSSTM32F10X)/pios_iap.c
|
||||||
|
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
|
||||||
|
|
||||||
## PIOS Hardware (Common)
|
## PIOS Hardware (Common)
|
||||||
#SRC += $(PIOSCOMMON)/pios_com.c
|
#SRC += $(PIOSCOMMON)/pios_com.c
|
||||||
@ -93,7 +94,6 @@ SRC += $(PIOSSTM32F10X)/pios_iap.c
|
|||||||
SRC += $(PIOSCOMMON)/pios_board_info.c
|
SRC += $(PIOSCOMMON)/pios_board_info.c
|
||||||
SRC += $(PIOSCOMMON)/pios_opahrs_proto.c
|
SRC += $(PIOSCOMMON)/pios_opahrs_proto.c
|
||||||
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
||||||
SRC += $(PIOSCOMMON)/pios_bl_helper.c
|
|
||||||
|
|
||||||
## CMSIS for STM32
|
## CMSIS for STM32
|
||||||
SRC += $(CMSISDIR)/core_cm3.c
|
SRC += $(CMSISDIR)/core_cm3.c
|
||||||
|
@ -112,11 +112,11 @@ SRC += $(PIOSSTM32F10X)/pios_usb_hid_desc.c
|
|||||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid_prop.c
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid_prop.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
|
||||||
|
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
|
||||||
|
|
||||||
## PIOS Hardware (Common)
|
## PIOS Hardware (Common)
|
||||||
SRC += $(PIOSCOMMON)/pios_board_info.c
|
SRC += $(PIOSCOMMON)/pios_board_info.c
|
||||||
SRC += $(PIOSCOMMON)/pios_com.c
|
SRC += $(PIOSCOMMON)/pios_com.c
|
||||||
SRC += $(PIOSCOMMON)/pios_bl_helper.c
|
|
||||||
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
||||||
|
|
||||||
## Libraries for flight calculations
|
## Libraries for flight calculations
|
||||||
|
@ -108,6 +108,7 @@ SRC += $(PIOSSTM32F10X)/pios_spi.c
|
|||||||
SRC += $(PIOSSTM32F10X)/pios_debug.c
|
SRC += $(PIOSSTM32F10X)/pios_debug.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_gpio.c
|
SRC += $(PIOSSTM32F10X)/pios_gpio.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_iap.c
|
SRC += $(PIOSSTM32F10X)/pios_iap.c
|
||||||
|
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
|
||||||
|
|
||||||
# PIOS USB related files (seperated to make code maintenance more easy)
|
# PIOS USB related files (seperated to make code maintenance more easy)
|
||||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid.c
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid.c
|
||||||
@ -120,7 +121,6 @@ SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
|
|||||||
SRC += $(PIOSCOMMON)/pios_board_info.c
|
SRC += $(PIOSCOMMON)/pios_board_info.c
|
||||||
SRC += $(PIOSCOMMON)/pios_com.c
|
SRC += $(PIOSCOMMON)/pios_com.c
|
||||||
SRC += $(PIOSCOMMON)/pios_opahrs_v0.c
|
SRC += $(PIOSCOMMON)/pios_opahrs_v0.c
|
||||||
SRC += $(PIOSCOMMON)/pios_bl_helper.c
|
|
||||||
SRC += $(PIOSCOMMON)/pios_opahrs_proto.c
|
SRC += $(PIOSCOMMON)/pios_opahrs_proto.c
|
||||||
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ SRC += $(PIOSSTM32F10X)/pios_irq.c
|
|||||||
SRC += $(PIOSSTM32F10X)/pios_debug.c
|
SRC += $(PIOSSTM32F10X)/pios_debug.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_gpio.c
|
SRC += $(PIOSSTM32F10X)/pios_gpio.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_iap.c
|
SRC += $(PIOSSTM32F10X)/pios_iap.c
|
||||||
|
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
|
||||||
|
|
||||||
# PIOS USB related files (seperated to make code maintenance more easy)
|
# PIOS USB related files (seperated to make code maintenance more easy)
|
||||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid.c
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid.c
|
||||||
@ -115,7 +116,6 @@ SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
|
|||||||
## PIOS Hardware (Common)
|
## PIOS Hardware (Common)
|
||||||
SRC += $(PIOSCOMMON)/pios_board_info.c
|
SRC += $(PIOSCOMMON)/pios_board_info.c
|
||||||
SRC += $(PIOSCOMMON)/pios_com.c
|
SRC += $(PIOSCOMMON)/pios_com.c
|
||||||
SRC += $(PIOSCOMMON)/pios_bl_helper.c
|
|
||||||
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
||||||
|
|
||||||
## Libraries for flight calculations
|
## Libraries for flight calculations
|
||||||
|
@ -86,7 +86,6 @@ SRC += $(FLIGHTLIB)/fifo_buffer.c
|
|||||||
SRC += $(PIOSCOMMON)/pios_board_info.c
|
SRC += $(PIOSCOMMON)/pios_board_info.c
|
||||||
SRC += $(PIOSCOMMON)/pios_opahrs_proto.c
|
SRC += $(PIOSCOMMON)/pios_opahrs_proto.c
|
||||||
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
||||||
SRC += $(PIOSCOMMON)/pios_bl_helper.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
|
||||||
|
@ -202,7 +202,7 @@ SRC += $(PIOSSTM32F10X)/pios_rtc.c
|
|||||||
SRC += $(PIOSSTM32F10X)/pios_wdg.c
|
SRC += $(PIOSSTM32F10X)/pios_wdg.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_iap.c
|
SRC += $(PIOSSTM32F10X)/pios_iap.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_tim.c
|
SRC += $(PIOSSTM32F10X)/pios_tim.c
|
||||||
|
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
|
||||||
|
|
||||||
# PIOS USB related files (seperated to make code maintenance more easy)
|
# PIOS USB related files (seperated to make code maintenance more easy)
|
||||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid.c
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid.c
|
||||||
@ -217,7 +217,6 @@ SRC += $(PIOSCOMMON)/pios_flash_w25x.c
|
|||||||
SRC += $(PIOSCOMMON)/pios_adxl345.c
|
SRC += $(PIOSCOMMON)/pios_adxl345.c
|
||||||
SRC += $(PIOSCOMMON)/pios_com.c
|
SRC += $(PIOSCOMMON)/pios_com.c
|
||||||
SRC += $(PIOSCOMMON)/pios_i2c_esc.c
|
SRC += $(PIOSCOMMON)/pios_i2c_esc.c
|
||||||
SRC += $(PIOSCOMMON)/pios_bl_helper.c
|
|
||||||
SRC += $(PIOSCOMMON)/pios_rcvr.c
|
SRC += $(PIOSCOMMON)/pios_rcvr.c
|
||||||
SRC += $(PIOSCOMMON)/pios_gcsrcvr.c
|
SRC += $(PIOSCOMMON)/pios_gcsrcvr.c
|
||||||
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
||||||
|
@ -187,6 +187,7 @@ SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c
|
|||||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid_prop.c
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid_prop.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
|
||||||
#SRC += $(PIOSSTM32F10X)/pios_bmp085.c
|
#SRC += $(PIOSSTM32F10X)/pios_bmp085.c
|
||||||
|
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
|
||||||
|
|
||||||
## PIOS Hardware (Common)
|
## PIOS Hardware (Common)
|
||||||
SRC += $(PIOSCOMMON)/pios_crc.c
|
SRC += $(PIOSCOMMON)/pios_crc.c
|
||||||
@ -194,7 +195,6 @@ SRC += $(PIOSCOMMON)/pios_sdcard.c
|
|||||||
SRC += $(PIOSCOMMON)/pios_com.c
|
SRC += $(PIOSCOMMON)/pios_com.c
|
||||||
SRC += $(PIOSCOMMON)/pios_hcsr04.c
|
SRC += $(PIOSCOMMON)/pios_hcsr04.c
|
||||||
SRC += $(PIOSCOMMON)/pios_i2c_esc.c
|
SRC += $(PIOSCOMMON)/pios_i2c_esc.c
|
||||||
SRC += $(PIOSCOMMON)/pios_bl_helper.c
|
|
||||||
SRC += $(PIOSCOMMON)/pios_rcvr.c
|
SRC += $(PIOSCOMMON)/pios_rcvr.c
|
||||||
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
||||||
SRC += $(FLIGHTLIB)/ahrs_spi_comm.c
|
SRC += $(FLIGHTLIB)/ahrs_spi_comm.c
|
||||||
|
102
flight/PiOS/STM32F4xx/pios_bl_helper.c
Normal file
102
flight/PiOS/STM32F4xx/pios_bl_helper.c
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @addtogroup PIOS PIOS Core hardware abstraction layer
|
||||||
|
* @{
|
||||||
|
* @addtogroup PIOS_BOOTLOADER Functions
|
||||||
|
* @brief HAL code to interface to the OpenPilot AHRS module
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @file pios_bl_helper.c
|
||||||
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||||
|
* @brief Bootloader Helper Functions
|
||||||
|
* @see The GNU Public License (GPL) Version 3
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Project Includes */
|
||||||
|
#include "pios.h"
|
||||||
|
#if defined(PIOS_INCLUDE_BL_HELPER)
|
||||||
|
#include <pios_board_info.h>
|
||||||
|
#include "stm32f10x_flash.h"
|
||||||
|
|
||||||
|
uint8_t *PIOS_BL_HELPER_FLASH_If_Read(uint32_t SectorAddress)
|
||||||
|
{
|
||||||
|
return (uint8_t *) (SectorAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT)
|
||||||
|
uint8_t PIOS_BL_HELPER_FLASH_Ini()
|
||||||
|
{
|
||||||
|
FLASH_Unlock();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t PIOS_BL_HELPER_FLASH_Start()
|
||||||
|
{
|
||||||
|
const struct pios_board_info * bdinfo = &pios_board_info_blob;
|
||||||
|
uint32_t pageAdress = bdinfo->fw_base;
|
||||||
|
uint8_t fail = FALSE;
|
||||||
|
while ((pageAdress < (bdinfo->fw_base + bdinfo->fw_size + bdinfo->desc_size))
|
||||||
|
|| (fail == TRUE)) {
|
||||||
|
for (int retry = 0; retry < MAX_DEL_RETRYS; ++retry) {
|
||||||
|
if (FLASH_ErasePage(pageAdress) == FLASH_COMPLETE) {
|
||||||
|
fail = FALSE;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
fail = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef STM32F10X_HD
|
||||||
|
pageAdress += 2048;
|
||||||
|
#elif defined (STM32F10X_MD)
|
||||||
|
pageAdress += 1024;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return (fail == TRUE) ? 0 : 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint32_t PIOS_BL_HELPER_CRC_Memory_Calc()
|
||||||
|
{
|
||||||
|
const struct pios_board_info * bdinfo = &pios_board_info_blob;
|
||||||
|
|
||||||
|
PIOS_BL_HELPER_CRC_Ini();
|
||||||
|
CRC_ResetDR();
|
||||||
|
CRC_CalcBlockCRC((uint32_t *) bdinfo->fw_base, (bdinfo->fw_size) >> 2);
|
||||||
|
return CRC_GetCRC();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PIOS_BL_HELPER_FLASH_Read_Description(uint8_t * array, uint8_t size)
|
||||||
|
{
|
||||||
|
const struct pios_board_info * bdinfo = &pios_board_info_blob;
|
||||||
|
uint8_t x = 0;
|
||||||
|
if (size > bdinfo->desc_size) size = bdinfo->desc_size;
|
||||||
|
for (uint32_t i = bdinfo->fw_base + bdinfo->fw_size; i < bdinfo->fw_base + bdinfo->fw_size + size; ++i) {
|
||||||
|
array[x] = *PIOS_BL_HELPER_FLASH_If_Read(i);
|
||||||
|
++x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PIOS_BL_HELPER_CRC_Ini()
|
||||||
|
{
|
||||||
|
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE);
|
||||||
|
}
|
||||||
|
#endif
|
@ -143,8 +143,6 @@ SRC += $(PIOSCOMMON)/pios_flash_w25x.c
|
|||||||
SRC += $(PIOSCOMMON)/pios_flashfs_objlist.c
|
SRC += $(PIOSCOMMON)/pios_flashfs_objlist.c
|
||||||
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
||||||
|
|
||||||
#SRC += $(PIOSCOMMON)/pios_bl_helper.c
|
|
||||||
|
|
||||||
include ./UAVObjects.inc
|
include ./UAVObjects.inc
|
||||||
SRC += $(UAVOBJSRC)
|
SRC += $(UAVOBJSRC)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user