1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

OP-21: Made bootloader startup faster and more reliable.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@301 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
gussy 2010-03-13 20:02:06 +00:00 committed by gussy
parent a0a92d5a59
commit 9b1e548550
5 changed files with 13 additions and 20 deletions

View File

@ -203,11 +203,6 @@ CDEFS = -DSTM32F10X_$(MODEL)
CDEFS += -DUSE_STDPERIPH_DRIVER
CDEFS += -DUSE_$(BOARD)
ifeq ($(ENABLE_DEBUG_PINS),YES)
CDEFS += -DPIOS_ENABLE_DEBUG_PINS
endif
# Place project-specific -D and/or -U options for
# Assembler with preprocessor here.
#ADEFS = -DUSE_IRQ_ASM_WRAPPER

View File

@ -79,6 +79,9 @@ void StartBootloader(void)
if(PIOS_COM_ReceiveBufferUsed(OPBL_COM_PORT) > 0) {
key = PIOS_COM_ReceiveBuffer(OPBL_COM_PORT);
if(key == 0x31) {
/* Flash unlock */
FLASH_Unlock();
/* Download user application in the Flash */
SerialDownload();
return;

View File

@ -31,7 +31,7 @@ typedef void (*pFunction)(void);
/* Global Defines */
#define CMD_STRING_SIZE 128
#define ApplicationAddress 0x8008000
#define ApplicationAddress (0x8008000)
#define PAGE_SIZE (0x800)
#define FLASH_SIZE (0x80000) /* 512K */

View File

@ -27,7 +27,7 @@
#ifndef OPENPILOT_BL_H
#define OPENPILOT_BL_H
#define OPBL_MAGIC_TIMEOUT 2000
#define OPBL_MAGIC_TIMEOUT 200
#define OPBL_COM_PORT COM_DEBUG_USART
/* PIOS Includes */

View File

@ -31,9 +31,6 @@
static pFunction Jump_To_Application;
static uint32_t JumpAddress;
/* Local Variables */
/* Function Prototypes */
/**
* OpenPilot Bootloader Main function
@ -43,25 +40,23 @@ int main()
/* Brings up System using CMSIS functions, enables the LEDs. */
PIOS_SYS_Init();
/* Initialise LED's */
PIOS_LED_Off(LED1);
PIOS_LED_Off(LED2);
/* Only go into bootloader when the USB cable is connected */
if(PIOS_USB_CableConnected()) {
/* Delay system */
PIOS_DELAY_Init();
/* Initialise the USB system */
PIOS_USB_Init(0);
if(PIOS_USB_IsInitialized()) {
/* Initialise the USB system */
PIOS_USB_Init(0);
}
/* Initialise COM Ports */
PIOS_COM_Init();
/* Initialise LED's */
PIOS_LED_Init();
PIOS_LED_Off(LED1);
PIOS_LED_Off(LED2);
/* Flash unlock */
FLASH_Unlock();
/* Execute the IAP driver in order to re-program the Flash */
StartBootloader();
}