mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
Merge remote-tracking branch 'baseorigin/corvuscorax/simposix_firmwareiap' into corvuscorax/sanity_additions
This commit is contained in:
commit
5862346d40
@ -108,6 +108,17 @@ int32_t FirmwareIAPInitialize()
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the module, called on startup
|
||||
* \returns 0 on success or -1 if initialisation failed
|
||||
*/
|
||||
int32_t FirmwareIAPStart(void)
|
||||
{
|
||||
/* nothing, no running task */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief FirmwareIAPCallback - callback function for firmware IAP requests
|
||||
* \param[in] ev - pointer objevent
|
||||
|
46
flight/PiOS.posix/inc/pios_bl_helper.h
Normal file
46
flight/PiOS.posix/inc/pios_bl_helper.h
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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
|
||||
*/
|
||||
|
||||
#ifndef PIOS_BL_HELPER_H_
|
||||
#define PIOS_BL_HELPER_H_
|
||||
|
||||
extern uint8_t *PIOS_BL_HELPER_FLASH_If_Read(uint32_t SectorAddress);
|
||||
|
||||
extern uint8_t PIOS_BL_HELPER_FLASH_Ini();
|
||||
|
||||
extern uint32_t PIOS_BL_HELPER_CRC_Memory_Calc();
|
||||
|
||||
extern void PIOS_BL_HELPER_FLASH_Read_Description(uint8_t * array, uint8_t size);
|
||||
|
||||
extern uint8_t PIOS_BL_HELPER_FLASH_Start();
|
||||
|
||||
extern void PIOS_BL_HELPER_CRC_Ini();
|
||||
|
||||
#endif /* PIOS_BL_HELPER_H_ */
|
24
flight/PiOS.posix/inc/pios_board_info.h
Normal file
24
flight/PiOS.posix/inc/pios_board_info.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef PIOS_BOARD_INFO_H
|
||||
#define PIOS_BOARD_INFO_H
|
||||
|
||||
#include <stdint.h> /* uint* */
|
||||
|
||||
#define PIOS_BOARD_INFO_BLOB_MAGIC 0xBDBDBDBD
|
||||
|
||||
struct pios_board_info {
|
||||
uint32_t magic;
|
||||
uint8_t board_type;
|
||||
uint8_t board_rev;
|
||||
uint8_t bl_rev;
|
||||
uint8_t hw_type;
|
||||
uint32_t fw_base;
|
||||
uint32_t fw_size;
|
||||
uint32_t desc_base;
|
||||
uint32_t desc_size;
|
||||
uint32_t ee_base;
|
||||
uint32_t ee_size;
|
||||
} __attribute__((packed));
|
||||
|
||||
extern const struct pios_board_info pios_board_info_blob;
|
||||
|
||||
#endif /* PIOS_BOARD_INFO_H */
|
45
flight/PiOS.posix/inc/pios_iap.h
Normal file
45
flight/PiOS.posix/inc/pios_iap.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*!
|
||||
* @File iap.h
|
||||
* @Brief Header file for the In-Application-Programming Module
|
||||
*
|
||||
* Created on: Sep 6, 2010
|
||||
* Author: joe
|
||||
*/
|
||||
|
||||
#ifndef PIOS_IAP_H_
|
||||
#define PIOS_IAP_H_
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
* Header files
|
||||
****************************************************************************************/
|
||||
|
||||
/*****************************************************************************************
|
||||
* Public Definitions/Macros
|
||||
****************************************************************************************/
|
||||
#if defined(STM32F4XX)
|
||||
#define MAGIC_REG_1 RTC_BKP_DR1
|
||||
#define MAGIC_REG_2 RTC_BKP_DR2
|
||||
#define IAP_BOOTCOUNT RTC_BKP_DR3
|
||||
#else
|
||||
#define MAGIC_REG_1 BKP_DR1
|
||||
#define MAGIC_REG_2 BKP_DR2
|
||||
#define IAP_BOOTCOUNT BKP_DR3
|
||||
#endif
|
||||
|
||||
/****************************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************************/
|
||||
void PIOS_IAP_Init(void);
|
||||
uint32_t PIOS_IAP_CheckRequest( void );
|
||||
void PIOS_IAP_SetRequest1(void);
|
||||
void PIOS_IAP_SetRequest2(void);
|
||||
void PIOS_IAP_ClearRequest(void);
|
||||
uint16_t PIOS_IAP_ReadBootCount(void);
|
||||
void PIOS_IAP_WriteBootCount(uint16_t);
|
||||
|
||||
/****************************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************************/
|
||||
|
||||
#endif /* PIOS_IAP_H_ */
|
@ -1,5 +1,10 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup PIOS PIOS Core hardware abstraction layer
|
||||
* @{
|
||||
* @addtogroup PIOS_SYS System Functions
|
||||
* @brief PIOS System Initialization code
|
||||
* @{
|
||||
*
|
||||
* @file pios_sys.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
@ -27,9 +32,19 @@
|
||||
#ifndef PIOS_SYS_H
|
||||
#define PIOS_SYS_H
|
||||
|
||||
#define PIOS_SYS_SERIAL_NUM_BINARY_LEN 12
|
||||
#define PIOS_SYS_SERIAL_NUM_ASCII_LEN (PIOS_SYS_SERIAL_NUM_BINARY_LEN * 2)
|
||||
|
||||
/* Public Functions */
|
||||
extern void PIOS_SYS_Init(void);
|
||||
extern int32_t PIOS_SYS_Reset(void);
|
||||
extern int32_t PIOS_SYS_SerialNumberGet(char *str);
|
||||
extern uint32_t PIOS_SYS_getCPUFlashSize(void);
|
||||
extern int32_t PIOS_SYS_SerialNumberGetBinary(uint8_t array[PIOS_SYS_SERIAL_NUM_BINARY_LEN]);
|
||||
extern int32_t PIOS_SYS_SerialNumberGet(char str[PIOS_SYS_SERIAL_NUM_ASCII_LEN+1]);
|
||||
|
||||
#endif /* PIOS_SYS_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
@ -68,6 +68,13 @@
|
||||
#include <pios_crc.h>
|
||||
#include <pios_rcvr.h>
|
||||
|
||||
#if defined(PIOS_INCLUDE_IAP)
|
||||
#include <pios_iap.h>
|
||||
#endif
|
||||
#if defined(PIOS_INCLUDE_BL_HELPER)
|
||||
#include <pios_bl_helper.h>
|
||||
#endif
|
||||
|
||||
#define NELEMENTS(x) (sizeof(x) / sizeof(*(x)))
|
||||
|
||||
#endif /* PIOS_H */
|
||||
|
53
flight/PiOS.posix/posix/pios_bl_helper.c
Normal file
53
flight/PiOS.posix/posix/pios_bl_helper.c
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @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) 2012.
|
||||
* @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>
|
||||
|
||||
uint32_t PIOS_BL_HELPER_CRC_Memory_Calc()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern const struct fw_version_info fw_version_blob;
|
||||
void PIOS_BL_HELPER_FLASH_Read_Description(uint8_t * array, uint8_t size)
|
||||
{
|
||||
uint8_t * desc = (uint8_t *) &fw_version_blob;
|
||||
for (uint32_t i = 0; i < size; i++) {
|
||||
array[i] = desc[i];
|
||||
}
|
||||
}
|
||||
|
||||
void PIOS_BL_HELPER_CRC_Ini()
|
||||
{
|
||||
}
|
||||
#endif
|
20
flight/PiOS.posix/posix/pios_board_info.c
Normal file
20
flight/PiOS.posix/posix/pios_board_info.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include <pios.h>
|
||||
#include <pios_board.h>
|
||||
|
||||
#include "pios_board_info.h"
|
||||
|
||||
const struct pios_board_info pios_board_info_blob = {
|
||||
.magic = PIOS_BOARD_INFO_BLOB_MAGIC,
|
||||
.board_type = BOARD_TYPE,
|
||||
.board_rev = BOARD_REVISION,
|
||||
.bl_rev = BOOTLOADER_VERSION,
|
||||
.hw_type = HW_TYPE,
|
||||
.fw_base = FW_BANK_BASE,
|
||||
.fw_size = FW_BANK_SIZE - FW_DESC_SIZE,
|
||||
.desc_base = FW_BANK_BASE + FW_BANK_SIZE - FW_DESC_SIZE,
|
||||
.desc_size = FW_DESC_SIZE,
|
||||
#ifdef EE_BANK_BASE
|
||||
.ee_base = EE_BANK_BASE,
|
||||
.ee_size = EE_BANK_SIZE,
|
||||
#endif
|
||||
};
|
69
flight/PiOS.posix/posix/pios_iap.c
Normal file
69
flight/PiOS.posix/posix/pios_iap.c
Normal file
@ -0,0 +1,69 @@
|
||||
/*!
|
||||
* @File iap.c
|
||||
* @Brief
|
||||
*
|
||||
* Created on: Sep 6, 2010
|
||||
* Author: joe
|
||||
*/
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
* Header files
|
||||
****************************************************************************************/
|
||||
#include <pios.h>
|
||||
|
||||
/*!
|
||||
* \brief PIOS_IAP_Init - performs required initializations for iap module.
|
||||
* \param none.
|
||||
* \return none.
|
||||
* \retval none.
|
||||
*
|
||||
* Created: Sep 8, 2010 10:10:48 PM by joe
|
||||
*/
|
||||
void PIOS_IAP_Init( void )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Determines if an In-Application-Programming request has been made.
|
||||
* \param *comm - Which communication stream to use for the IAP (USB, Telemetry, I2C, SPI, etc)
|
||||
* \return TRUE - if correct sequence found, along with 'comm' updated.
|
||||
* FALSE - Note that 'comm' will have an invalid comm identifier.
|
||||
* \retval
|
||||
*
|
||||
*/
|
||||
uint32_t PIOS_IAP_CheckRequest( void )
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Sets the 1st word of the request sequence.
|
||||
* \param n/a
|
||||
* \return n/a
|
||||
* \retval
|
||||
*/
|
||||
void PIOS_IAP_SetRequest1(void)
|
||||
{
|
||||
}
|
||||
|
||||
void PIOS_IAP_SetRequest2(void)
|
||||
{
|
||||
}
|
||||
|
||||
void PIOS_IAP_ClearRequest(void)
|
||||
{
|
||||
}
|
||||
|
||||
uint16_t PIOS_IAP_ReadBootCount(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PIOS_IAP_WriteBootCount (uint16_t boot_count)
|
||||
{
|
||||
}
|
@ -110,6 +110,23 @@ int32_t PIOS_SYS_Reset(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the serial number as a string
|
||||
* param[out] uint8_t pointer to a string which can store at least 12 bytes
|
||||
* (12 bytes returned for STM32)
|
||||
* return < 0 if feature not supported
|
||||
*/
|
||||
int32_t PIOS_SYS_SerialNumberGetBinary(uint8_t *array)
|
||||
{
|
||||
/* Stored in the so called "electronic signature" */
|
||||
for (int i = 0; i < PIOS_SYS_SERIAL_NUM_BINARY_LEN; ++i) {
|
||||
array[i] = 0xff;
|
||||
}
|
||||
|
||||
/* No error */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the serial number as a string
|
||||
* param[out] str pointer to a string which can store at least 32 digits + zero terminator!
|
||||
@ -118,19 +135,12 @@ int32_t PIOS_SYS_Reset(void)
|
||||
*/
|
||||
int32_t PIOS_SYS_SerialNumberGet(char *str)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Stored in the so called "electronic signature" */
|
||||
for(i=0; i<24; ++i) {
|
||||
//uint8_t b = MEM8(0x1ffff7e8 + (i/2));
|
||||
//if( !(i & 1) )
|
||||
//b >>= 4;
|
||||
//b &= 0x0f;
|
||||
|
||||
//str[i] = ((b > 9) ? ('A'-10) : '0') + b;
|
||||
str[i]='6';
|
||||
int i;
|
||||
for (i = 0; i < PIOS_SYS_SERIAL_NUM_ASCII_LEN; ++i) {
|
||||
str[i] = 'F';
|
||||
}
|
||||
str[i] = 0;
|
||||
str[i] = '\0';
|
||||
|
||||
/* No error */
|
||||
return 0;
|
||||
|
@ -55,6 +55,7 @@ FLASH_TOOL = OPENOCD
|
||||
MODULES = ManualControl Stabilization GPS
|
||||
MODULES += CameraStab
|
||||
MODULES += Telemetry
|
||||
MODULES += FirmwareIAP
|
||||
#MODULES += OveroSync
|
||||
PYMODULES =
|
||||
#FlightPlan
|
||||
@ -242,6 +243,19 @@ EXTRA_LIBS =
|
||||
# 0 = turn off optimization. s = optimize for size.
|
||||
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
||||
|
||||
|
||||
BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE)
|
||||
BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION)
|
||||
BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE)
|
||||
BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION)
|
||||
BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE)
|
||||
BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE)
|
||||
BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE)
|
||||
|
||||
# Since we are simulating all this firmware the code needs to know what the BL would
|
||||
# normally contain
|
||||
CFLAGS += $(BLONLY_CDEFS)
|
||||
|
||||
ifeq ($(DEBUG),YES)
|
||||
CFLAGS += -O0
|
||||
CFLAGS += -DGENERAL_COV
|
||||
@ -370,7 +384,7 @@ ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC)
|
||||
ALLSRCBASE = $(notdir $(basename $(ALLSRC)))
|
||||
|
||||
# Define all object files.
|
||||
ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE)))
|
||||
ALLOBJ = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(ALLSRCBASE) uavobjectsinit.o.firmwareinfo ))
|
||||
|
||||
# Define all listing files (used for make clean).
|
||||
LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE)))
|
||||
@ -426,6 +440,8 @@ $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin
|
||||
|
||||
$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION)))
|
||||
|
||||
$(eval $(call OPFW_TEMPLATE,$(OUTDIR)/uavobjectsinit.o,$(BOARD_TYPE),$(BOARD_REVISION)))
|
||||
|
||||
# Add jtag targets (program and wipe)
|
||||
$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG)))
|
||||
|
||||
|
@ -84,6 +84,8 @@
|
||||
#define PIOS_INCLUDE_PPM
|
||||
#define PIOS_INCLUDE_PWM
|
||||
//#define PIOS_INCLUDE_GCSRCVR
|
||||
#define PIOS_INCLUDE_IAP
|
||||
#define PIOS_INCLUDE_BL_HELPER
|
||||
|
||||
#define PIOS_INCLUDE_SETTINGS
|
||||
#define PIOS_INCLUDE_FLASH
|
||||
|
@ -13,12 +13,12 @@ OPENOCD_JTAG_CONFIG :=
|
||||
OPENOCD_CONFIG :=
|
||||
|
||||
# Note: These must match the values in link_$(BOARD)_memory.ld
|
||||
#BL_BANK_BASE := 0x08000000 # Start of bootloader flash
|
||||
#BL_BANK_SIZE := 0x00008000 # Should include BD_INFO region
|
||||
#FW_BANK_BASE := 0x08008000 # Start of firmware flash
|
||||
#FW_BANK_SIZE := 0x00038000 # Should include FW_DESC_SIZE
|
||||
BL_BANK_BASE := 0x08000000 # Start of bootloader flash
|
||||
BL_BANK_SIZE := 0x00008000 # Should include BD_INFO region
|
||||
FW_BANK_BASE := 0x08008000 # Start of firmware flash
|
||||
FW_BANK_SIZE := 0x00038000 # Should include FW_DESC_SIZE
|
||||
|
||||
#FW_DESC_SIZE := 0x00000064
|
||||
FW_DESC_SIZE := 0x00000064
|
||||
|
||||
OSCILLATOR_FREQ := 8000000
|
||||
SYSCLK_FREQ := 168000000
|
||||
|
Loading…
Reference in New Issue
Block a user