mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
OP-21/Flight Bootloader - Clean up and linker files for the AHRS
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1691 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
400f832b3c
commit
3ba6372dc4
@ -53,12 +53,12 @@ USE_THUMB_MODE = YES
|
||||
MCU = cortex-m3
|
||||
CHIP = STM32F103CBT
|
||||
BOARD = STM32103CB_AHRS
|
||||
MODEL = MD
|
||||
ifeq ($(USE_BOOTLOADER), YES)
|
||||
MODEL = MD
|
||||
BOOT_MODEL = $(MODEL)_BL
|
||||
else
|
||||
MODEL = MD
|
||||
BOOT_MODEL = $(MODEL)_NB
|
||||
endif
|
||||
|
||||
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
|
||||
OUTDIR = Build
|
||||
|
||||
@ -216,7 +216,9 @@ DEBUGF = dwarf-2
|
||||
CDEFS = -DSTM32F10X_$(MODEL)
|
||||
CDEFS += -DUSE_STDPERIPH_DRIVER
|
||||
CDEFS += -DUSE_$(BOARD)
|
||||
|
||||
ifeq ($(USE_BOOTLOADER), YES)
|
||||
CDEFS += -DUSE_BOOTLOADER
|
||||
endif
|
||||
# Place project-specific -D and/or -U options for
|
||||
# Assembler with preprocessor here.
|
||||
#ADEFS = -DUSE_IRQ_ASM_WRAPPER
|
||||
@ -288,7 +290,7 @@ LDFLAGS += $(MATH_LIB)
|
||||
LDFLAGS += -lc -lgcc
|
||||
|
||||
# Set linker-script name depending on selected submodel name
|
||||
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_stm32f10x_$(MODEL).ld
|
||||
LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_stm32f10x_$(BOOT_MODEL).ld
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Options for OpenOCD flash-programming
|
||||
@ -427,12 +429,19 @@ gccversion :
|
||||
# @echo $(ALLOBJ)
|
||||
|
||||
# Program the device.
|
||||
ifeq ($(USE_BOOTLOADER), YES)
|
||||
# Program the device with OP Upload Tool".
|
||||
program: $(OUTDIR)/$(TARGET).bin
|
||||
@echo ${quote}Programming with OP Upload Tool${quote}
|
||||
../../ground/src/experimental/upload-build-desktop/debug/OPUploadTool.exe -d 1 -p $(OUTDIR)/$(TARGET).bin
|
||||
else
|
||||
ifeq ($(FLASH_TOOL),OPENOCD)
|
||||
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
|
||||
program: $(OUTDIR)/$(TARGET).elf
|
||||
@echo "Programming with OPENOCD"
|
||||
@echo ${quote}Programming with OPENOCD${quote}
|
||||
$(OOCD_EXE) $(OOCD_CL)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Create final output file (.hex) from ELF output file.
|
||||
%.hex: %.elf
|
||||
|
@ -53,11 +53,9 @@ USE_THUMB_MODE = YES
|
||||
MCU = cortex-m3
|
||||
CHIP = STM32F103CBT
|
||||
BOARD = STM32103CB_AHRS
|
||||
ifeq ($(USE_BOOTLOADER), YES)
|
||||
MODEL = MD
|
||||
else
|
||||
MODEL = MD
|
||||
endif
|
||||
|
||||
|
||||
|
||||
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
|
||||
OUTDIR = Build
|
||||
|
@ -68,15 +68,19 @@ int main() {
|
||||
/* Delay system */
|
||||
PIOS_DELAY_Init();
|
||||
|
||||
for (uint32_t t = 0; t < 2; ++t) {
|
||||
for (uint32_t t = 0; t < 10000000; ++t) {
|
||||
if (NSS_HOLD_STATE == 1)
|
||||
GO_dfu = TRUE;
|
||||
else {
|
||||
GO_dfu = FALSE;
|
||||
break;
|
||||
}
|
||||
PIOS_DELAY_WaitmS(1000);
|
||||
}
|
||||
//while(TRUE)
|
||||
// {
|
||||
// PIOS_LED_Toggle(LED1);
|
||||
// PIOS_DELAY_WaitmS(1000);
|
||||
// }
|
||||
//GO_dfu = TRUE;
|
||||
GO_dfu = GO_dfu;// OR with app boot request
|
||||
if (GO_dfu == FALSE) {
|
||||
@ -146,6 +150,7 @@ void process_spi_request(void) {
|
||||
PIOS_SYS_Reset();
|
||||
break;
|
||||
case OPAHRS_MSG_V0_REQ_VERSIONS:
|
||||
//PIOS_LED_On(LED1);
|
||||
opahrs_msg_v0_init_user_tx(&user_tx_v0, OPAHRS_MSG_V0_RSP_VERSIONS);
|
||||
user_tx_v0.payload.user.v.rsp.versions.bl_version = BOOTLOADER_VERSION;
|
||||
user_tx_v0.payload.user.v.rsp.versions.hw_version = HW_VERSION;
|
||||
@ -231,10 +236,12 @@ void process_spi_request(void) {
|
||||
return;
|
||||
}
|
||||
void jump_to_app() {
|
||||
while (TRUE) {
|
||||
PIOS_LED_Toggle(LED1);
|
||||
PIOS_DELAY_WaitmS(1000);
|
||||
}
|
||||
//while(TRUE)
|
||||
//{
|
||||
// PIOS_LED_Toggle(LED1);
|
||||
// PIOS_DELAY_WaitmS(1000);
|
||||
//}
|
||||
PIOS_LED_On(LED1);
|
||||
if (((*(__IO uint32_t*) START_OF_USER_CODE) & 0x2FFE0000) == 0x20000000) { /* Jump to user application */
|
||||
FLASH_Lock();
|
||||
RCC_APB2PeriphResetCmd(0xffffffff, ENABLE);
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
# Set developer code and compile options
|
||||
# Set to YES to compile for debugging
|
||||
DEBUG ?= YES
|
||||
DEBUG ?= NO
|
||||
|
||||
# Set to YES to use the Servo output pins for debugging via scope or logic analyser
|
||||
ENABLE_DEBUG_PINS ?= NO
|
||||
|
@ -153,7 +153,7 @@ int main() {
|
||||
|
||||
if (STOPWATCH_ValueGet() > 100 * 50 * 100)
|
||||
STOPWATCH_Reset();
|
||||
if ((STOPWATCH_ValueGet() > 70000) && (DeviceState == BLidle))
|
||||
if ((STOPWATCH_ValueGet() > 60000) && (DeviceState == BLidle))
|
||||
JumpToApp = TRUE;
|
||||
|
||||
processRX();
|
||||
|
@ -470,13 +470,13 @@ void OPDfuIni(uint8_t discover) {
|
||||
if (discover) {
|
||||
uint8_t found_spi_device = FALSE;
|
||||
|
||||
for (int t = 0; t < 10; ++t) {
|
||||
for (int t = 0; t < 3; ++t) {
|
||||
if (PIOS_OPAHRS_bl_resync() == OPAHRS_RESULT_OK) {
|
||||
found_spi_device = TRUE;
|
||||
dev.FW_Crc = 0;
|
||||
break;
|
||||
}
|
||||
PIOS_DELAY_WaitmS(50);
|
||||
PIOS_DELAY_WaitmS(100);
|
||||
}
|
||||
if (found_spi_device == TRUE) {
|
||||
struct opahrs_msg_v0 rsp;
|
||||
|
@ -605,12 +605,19 @@ gccversion :
|
||||
# @echo $(ALLOBJ)
|
||||
|
||||
# Program the device.
|
||||
ifeq ($(USE_BOOTLOADER), YES)
|
||||
# Program the device with OP Upload Tool".
|
||||
program: $(OUTDIR)/$(TARGET).bin
|
||||
@echo ${quote}Programming with OP Upload Tool${quote}
|
||||
../../ground/src/experimental/upload-build-desktop/debug/OPUploadTool.exe -d 0 -p $(OUTDIR)/$(TARGET).bin
|
||||
else
|
||||
ifeq ($(FLASH_TOOL),OPENOCD)
|
||||
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
|
||||
program: $(OUTDIR)/$(TARGET).elf
|
||||
@echo ${quote}Programming with OPENOCD${quote}
|
||||
$(OOCD_EXE) $(OOCD_CL)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Create final output file (.hex) from ELF output file.
|
||||
%.hex: %.elf
|
||||
|
@ -69,14 +69,14 @@ TIM8 | | | |
|
||||
#define BOOTLOADER_VERSION 0
|
||||
#define MEM_SIZE 0x20000 //128K
|
||||
#define SIZE_OF_DESCRIPTION 100
|
||||
#define START_OF_USER_CODE (uint32_t)0x08003400
|
||||
#define START_OF_USER_CODE (uint32_t)0x08003000
|
||||
#define SIZE_OF_CODE (uint32_t)(MEM_SIZE-(START_OF_USER_CODE-0x08000000)-SIZE_OF_DESCRIPTION)
|
||||
#ifdef STM32F10X_HD
|
||||
#define HW_TYPE 0 //0=high_density 1=medium_density;
|
||||
#elif STM32F10X_MD
|
||||
#define HW_TYPE 1 //0=high_density 1=medium_density;
|
||||
#endif
|
||||
#define BOARD_READABLE TRUE
|
||||
#define BOARD_READABLE FALSE
|
||||
#define BOARD_WRITABLA TRUE
|
||||
#define MAX_DEL_RETRYS 3
|
||||
|
||||
|
@ -74,7 +74,7 @@ TIM8 | Servo 5 | Servo 6 | Servo 7 | Servo 8
|
||||
#define MEM_SIZE 524288 //512K
|
||||
#define SIZE_OF_DESCRIPTION (uint8_t) 100
|
||||
#define SIZE_OF_CODE (uint32_t) (MEM_SIZE-(START_OF_USER_CODE-0x08000000)-SIZE_OF_DESCRIPTION)
|
||||
#define START_OF_USER_CODE 0x0800F000
|
||||
#define START_OF_USER_CODE (uint32_t)0x08007800//FF00
|
||||
#ifdef STM32F10X_HD
|
||||
#define HW_TYPE 0 //0=high_density 1=medium_density;
|
||||
#elif STM32F10X_MD
|
||||
|
@ -49,7 +49,7 @@ static int32_t opahrs_msg_txrx (const uint8_t * tx, uint8_t * rx, uint32_t len)
|
||||
#ifdef PIOS_INCLUDE_FREERTOS
|
||||
vTaskDelay(20 / portTICK_RATE_MS);
|
||||
#else
|
||||
//PIOS_DELAY_WaitmS(20);
|
||||
PIOS_DELAY_WaitmS(1);
|
||||
#endif
|
||||
rc = PIOS_SPI_TransferBlock(PIOS_OPAHRS_SPI, tx, rx, len, NULL);
|
||||
PIOS_SPI_RC_PinSet(PIOS_OPAHRS_SPI, 1);
|
||||
@ -166,6 +166,7 @@ static enum opahrs_result PIOS_OPAHRS_v0_simple_req (enum opahrs_msg_v0_tag req_
|
||||
opahrs_msg_v0_init_user_tx (&req, req_type);
|
||||
|
||||
/* Send the message until it is received */
|
||||
|
||||
rc = opahrs_msg_v0_send_req (&req);
|
||||
if ((rc == OPAHRS_RESULT_OK) && rsp) {
|
||||
/* We need a specific kind of reply, go get it */
|
||||
|
@ -28,7 +28,7 @@
|
||||
MEMORY
|
||||
{
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||
FLASH (rx) : ORIGIN = 0x08006000, LENGTH = 488K
|
||||
FLASH (rx) : ORIGIN = 0x08007800, LENGTH = 482K
|
||||
FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
|
||||
EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
|
||||
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
|
||||
|
54
flight/PiOS/STM32F10x/link_stm32f10x_MD_BL.ld
Normal file
54
flight/PiOS/STM32F10x/link_stm32f10x_MD_BL.ld
Normal file
@ -0,0 +1,54 @@
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08003000, LENGTH = 116K
|
||||
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00005000
|
||||
}
|
||||
|
||||
_estack = 0x20004FF0;
|
||||
|
||||
/* Section Definitions */
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.isr_vector .isr_vector.*))
|
||||
*(.text .text.* .gnu.linkonce.t.*)
|
||||
*(.glue_7t) *(.glue_7)
|
||||
*(.rodata .rodata* .gnu.linkonce.r.*)
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > FLASH
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .;
|
||||
_sidata = .;
|
||||
|
||||
.data : AT (_etext)
|
||||
{
|
||||
_sdata = .;
|
||||
*(.data .data.*)
|
||||
. = ALIGN(4);
|
||||
_edata = . ;
|
||||
} > SRAM
|
||||
|
||||
/* .bss section which is used for uninitialized data */
|
||||
.bss (NOLOAD) :
|
||||
{
|
||||
_sbss = . ;
|
||||
*(.bss .bss.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = . ;
|
||||
} > SRAM
|
||||
|
||||
. = ALIGN(4);
|
||||
_end = . ;
|
||||
}
|
54
flight/PiOS/STM32F10x/link_stm32f10x_MD_NB.ld
Normal file
54
flight/PiOS/STM32F10x/link_stm32f10x_MD_NB.ld
Normal file
@ -0,0 +1,54 @@
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x00020000
|
||||
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00005000
|
||||
}
|
||||
|
||||
_estack = 0x20004FF0;
|
||||
|
||||
/* Section Definitions */
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.isr_vector .isr_vector.*))
|
||||
*(.text .text.* .gnu.linkonce.t.*)
|
||||
*(.glue_7t) *(.glue_7)
|
||||
*(.rodata .rodata* .gnu.linkonce.r.*)
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > FLASH
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .;
|
||||
_sidata = .;
|
||||
|
||||
.data : AT (_etext)
|
||||
{
|
||||
_sdata = .;
|
||||
*(.data .data.*)
|
||||
. = ALIGN(4);
|
||||
_edata = . ;
|
||||
} > SRAM
|
||||
|
||||
/* .bss section which is used for uninitialized data */
|
||||
.bss (NOLOAD) :
|
||||
{
|
||||
_sbss = . ;
|
||||
*(.bss .bss.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = . ;
|
||||
} > SRAM
|
||||
|
||||
. = ALIGN(4);
|
||||
_end = . ;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user