From ad0b3e911dd0387ea0d4ec39298be874b7de201a Mon Sep 17 00:00:00 2001 From: zedamota Date: Fri, 14 Jan 2011 15:33:24 +0000 Subject: [PATCH] OP-268/PipX Bootloader - Changed Timers for MD device, auto memory space fetching (as per people request ;)). Stripped unused functions to reduce size. TESTED WORKS. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2431 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/Bootloaders/PipXtreme/inc/pios_config.h | 4 ++-- flight/Bootloaders/PipXtreme/main.c | 5 +++-- flight/Bootloaders/PipXtreme/pios_board.c | 18 +++++++----------- flight/Bootloaders/PipXtreme/stopwatch.c | 12 +++++------- flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h | 4 ++-- .../link_STM32103CB_PIPXTREME_MD_BL.ld | 2 +- 6 files changed, 20 insertions(+), 25 deletions(-) diff --git a/flight/Bootloaders/PipXtreme/inc/pios_config.h b/flight/Bootloaders/PipXtreme/inc/pios_config.h index 8202c3163..d20e85e5b 100644 --- a/flight/Bootloaders/PipXtreme/inc/pios_config.h +++ b/flight/Bootloaders/PipXtreme/inc/pios_config.h @@ -38,9 +38,9 @@ #define PIOS_INCLUDE_LED //#define PIOS_INCLUDE_SPI #define PIOS_INCLUDE_SYS -#define PIOS_INCLUDE_USART +//#define PIOS_INCLUDE_USART #define PIOS_INCLUDE_USB_HID -#define PIOS_INCLUDE_OPAHRS +//#define PIOS_INCLUDE_OPAHRS #define PIOS_INCLUDE_COM #define PIOS_INCLUDE_GPIO #define PIOS_NO_GPS diff --git a/flight/Bootloaders/PipXtreme/main.c b/flight/Bootloaders/PipXtreme/main.c index 624825684..a1e13ffba 100644 --- a/flight/Bootloaders/PipXtreme/main.c +++ b/flight/Bootloaders/PipXtreme/main.c @@ -70,8 +70,8 @@ uint8_t processRX(); void jump_to_app(); #define BLUE LED1 -#define RED LED2 -#define LED_PWM_TIMER TIM6 +#define RED LED4 +#define LED_PWM_TIMER TIM3 int main() { /* NOTE: Do NOT modify the following start-up sequence */ /* Any new initialization functions should be added in OpenPilotInit() */ @@ -103,6 +103,7 @@ int main() { JumpToApp = TRUE; STOPWATCH_Reset(LED_PWM_TIMER); + while (TRUE) { if (JumpToApp == TRUE) jump_to_app(); diff --git a/flight/Bootloaders/PipXtreme/pios_board.c b/flight/Bootloaders/PipXtreme/pios_board.c index c28e442a9..7a08e9c21 100644 --- a/flight/Bootloaders/PipXtreme/pios_board.c +++ b/flight/Bootloaders/PipXtreme/pios_board.c @@ -324,19 +324,15 @@ extern const struct pios_com_driver pios_usart_com_driver; extern const struct pios_com_driver pios_usb_com_driver; #endif -struct pios_com_dev pios_com_devs[] = -{ - { - .id = PIOS_USART_SERIAL, - .driver = &pios_usart_com_driver, - }, +struct pios_com_dev pios_com_devs[] = { { .id = 0, + .driver = &pios_usb_com_driver, }, #if defined(PIOS_INCLUDE_USB_HID) - { - .id = 0, - .driver = &pios_usb_com_driver, - }, + { + .id = 0, + .driver = &pios_usb_com_driver, + }, #endif -}; + }; const uint8_t pios_com_num_devices = NELEMENTS(pios_com_devs); diff --git a/flight/Bootloaders/PipXtreme/stopwatch.c b/flight/Bootloaders/PipXtreme/stopwatch.c index af4155273..e66ac99ea 100644 --- a/flight/Bootloaders/PipXtreme/stopwatch.c +++ b/flight/Bootloaders/PipXtreme/stopwatch.c @@ -41,14 +41,12 @@ uint32_t STOPWATCH_Init(u32 resolution, TIM_TypeDef* TIM) { uint32_t STOPWATCH_TIMER_RCC; switch ((uint32_t)TIM) { - case (uint32_t)TIM6: - STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM6; - break; - case (uint32_t)TIM7: - STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM7; - break; + case (uint32_t)TIM1: STOPWATCH_TIMER_RCC = RCC_APB2Periph_TIM1;break; + case (uint32_t)TIM2: STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM2; break; + case (uint32_t)TIM3: STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM3; break; + case (uint32_t)TIM4: STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM4; break; default: - STOPWATCH_TIMER_RCC = RCC_APB1Periph_TIM6; + STOPWATCH_TIMER_RCC = RCC_APB2Periph_TIM1; } // enable timer clock diff --git a/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h b/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h index 0edd5e0fb..e31dd8e57 100644 --- a/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h +++ b/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h @@ -65,9 +65,9 @@ TIM8 | | | | #define FUNC_ID 3 #define HW_VERSION 21 #define BOOTLOADER_VERSION 0 -#define MEM_SIZE 0x20000 //128K +#define MEM_SIZE ((uint32_t)(*((volatile uint16_t *)(0x1FFFF7E0))) * 1024 - 1024) //128K #define SIZE_OF_DESCRIPTION 100 -#define START_OF_USER_CODE (uint32_t)0x08002000 +#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; diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_MD_BL.ld b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_MD_BL.ld index f4a0f11a3..2b9e1b983 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_MD_BL.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_MD_BL.ld @@ -1,6 +1,6 @@ MEMORY { - FLASH (rx) : ORIGIN = 0x08004000, LENGTH = 112K + FLASH (rx) : ORIGIN = 0x08003000, LENGTH = 116K SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00005000 }