diff --git a/flight/AHRS/Makefile b/flight/AHRS/Makefile index c1823e437..257efbad7 100644 --- a/flight/AHRS/Makefile +++ b/flight/AHRS/Makefile @@ -303,7 +303,7 @@ LDFLAGS += $(MATH_LIB) LDFLAGS += -lc -lgcc # Set linker-script name depending on selected submodel name -LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_stm32f10x_$(BOOT_MODEL).ld +LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_$(BOARD)_$(BOOT_MODEL).ld # --------------------------------------------------------------------------- # Options for OpenOCD flash-programming diff --git a/flight/Bootloaders/PipXtreme/inc/op_dfu.h b/flight/Bootloaders/PipXtreme/inc/op_dfu.h index fd77afa03..3c4e7b3a2 100644 --- a/flight/Bootloaders/PipXtreme/inc/op_dfu.h +++ b/flight/Bootloaders/PipXtreme/inc/op_dfu.h @@ -37,7 +37,7 @@ typedef struct uint32_t sizeOfCode; uint8_t sizeOfDescription; uint8_t BL_Version; - uint8_t devID; + uint16_t devID; DeviceType devType; uint32_t FW_Crc; }Device; diff --git a/flight/Bootloaders/PipXtreme/inc/pios_board.h b/flight/Bootloaders/PipXtreme/inc/pios_board.h deleted file mode 100644 index 8c2d05bb9..000000000 --- a/flight/Bootloaders/PipXtreme/inc/pios_board.h +++ /dev/null @@ -1,384 +0,0 @@ - /** - ****************************************************************************** - * - * @file pios_board.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Defines board hardware for the OpenPilot Version 1.1 hardware. - * @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_BOARD_H -#define PIOS_BOARD_H - -// ***************************************************************** -// Timers and Channels Used - -/* -Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4 -------+-----------+-----------+-----------+---------- -TIM1 | | | | -TIM2 | --------------- DELAY ---------------------- -TIM3 | --------------- Timer Interrupt ------------ -TIM4 | --------------- STOPWATCH ------------------ -TIM5 | | | | -TIM6 | | | | -TIM7 | | | | -TIM8 | | | | -------+-----------+-----------+-----------+---------- -*/ - -//------------------------ -// DMA Channels Used -//------------------------ -/* Channel 1 - */ -/* Channel 2 - */ -/* Channel 3 - */ -/* Channel 4 - */ -/* Channel 5 - */ -/* Channel 6 - */ -/* Channel 7 - */ -/* Channel 8 - */ -/* Channel 9 - */ -/* Channel 10 - */ -/* Channel 11 - */ -/* Channel 12 - */ - -//------------------------ -// BOOTLOADER_SETTINGS -//------------------------ -#define FUNC_ID 3 -#define HW_VERSION 21 -#define BOOTLOADER_VERSION 0 -#define MEM_SIZE 0x20000 //128K -#define SIZE_OF_DESCRIPTION 100 -#define START_OF_USER_CODE (uint32_t)0x08002000 -#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_WRITABLA TRUE -#define MAX_DEL_RETRYS 3 - - -// ***************************************************************** -// System Settings - -#define PIOS_MASTER_CLOCK 72000000ul -#define PIOS_PERIPHERAL_CLOCK (PIOS_MASTER_CLOCK / 2) - -#if defined(USE_BOOTLOADER) - #define PIOS_NVIC_VECTTAB_FLASH (START_OF_USER_CODE) -#else - #define PIOS_NVIC_VECTTAB_FLASH ((uint32_t)0x08000000) -#endif - -// ***************************************************************** -// Interrupt Priorities - -#define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS -#define PIOS_IRQ_PRIO_MID 8 // higher than RTOS -#define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc... -#define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc... - -// ***************************************************************** -// PIOS_LED - -#define PIOS_LED_LED1_GPIO_PORT GPIOA // USB Activity LED -#define PIOS_LED_LED1_GPIO_PIN GPIO_Pin_3 -#define PIOS_LED_LED1_GPIO_CLK RCC_APB2Periph_GPIOA - -#define PIOS_LED_LED2_GPIO_PORT GPIOB // LINK LED -#define PIOS_LED_LED2_GPIO_PIN GPIO_Pin_5 -#define PIOS_LED_LED2_GPIO_CLK RCC_APB2Periph_GPIOB - -#define PIOS_LED_LED3_GPIO_PORT GPIOB // RX LED -#define PIOS_LED_LED3_GPIO_PIN GPIO_Pin_6 -#define PIOS_LED_LED3_GPIO_CLK RCC_APB2Periph_GPIOB - -#define PIOS_LED_LED4_GPIO_PORT GPIOB // TX LED -#define PIOS_LED_LED4_GPIO_PIN GPIO_Pin_7 -#define PIOS_LED_LED4_GPIO_CLK RCC_APB2Periph_GPIOB - -#define PIOS_LED_NUM 4 -#define PIOS_LED_PORTS { PIOS_LED_LED1_GPIO_PORT, PIOS_LED_LED2_GPIO_PORT, PIOS_LED_LED3_GPIO_PORT, PIOS_LED_LED4_GPIO_PORT } -#define PIOS_LED_PINS { PIOS_LED_LED1_GPIO_PIN, PIOS_LED_LED2_GPIO_PIN, PIOS_LED_LED3_GPIO_PIN, PIOS_LED_LED4_GPIO_PIN } -#define PIOS_LED_CLKS { PIOS_LED_LED1_GPIO_CLK, PIOS_LED_LED2_GPIO_CLK, PIOS_LED_LED3_GPIO_CLK, PIOS_LED_LED4_GPIO_CLK } - -#define USB_LED_ON PIOS_LED_On(LED1) -#define USB_LED_OFF PIOS_LED_Off(LED1) -#define USB_LED_TOGGLE PIOS_LED_Toggle(LED1) - -#define LINK_LED_ON PIOS_LED_On(LED2) -#define LINK_LED_OFF PIOS_LED_Off(LED2) -#define LINK_LED_TOGGLE PIOS_LED_Toggle(LED2) - -#define RX_LED_ON PIOS_LED_On(LED3) -#define RX_LED_OFF PIOS_LED_Off(LED3) -#define RX_LED_TOGGLE PIOS_LED_Toggle(LED3) - -#define TX_LED_ON PIOS_LED_On(LED4) -#define TX_LED_OFF PIOS_LED_Off(LED4) -#define TX_LED_TOGGLE PIOS_LED_Toggle(LED4) - -// ***************************************************************** -// Delay Timer - -#define PIOS_DELAY_TIMER TIM2 -#define PIOS_DELAY_TIMER_RCC_FUNC RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE) - -// ***************************************************************** -// Timer interrupt - -#define TIMER_INT_TIMER TIM3 -#define TIMER_INT_FUNC TIM3_IRQHandler -#define TIMER_INT_PRIORITY 2 - -// ***************************************************************** -// Stop watch timer - -#define STOPWATCH_TIMER TIM4 - -// ***************************************************************** -// SPI -// -// See also pios_board.c - -#define PIOS_SPI_PORT 0 - -// ***************************************************************** -// PIOS_USART - -#define PIOS_USART_RX_BUFFER_SIZE 512 -#define PIOS_USART_TX_BUFFER_SIZE 512 - -#define PIOS_COM_SERIAL 0 -//#define PIOS_COM_DEBUG PIOS_COM_SERIAL // comment this out if you don't want debug text sent out on the serial port - -#define PIOS_USART_BAUDRATE 57600 -//#define PIOS_USART_BAUDRATE 115200 - -#if defined(PIOS_INCLUDE_USB_HID) - #define PIOS_COM_TELEM_USB 1 -#endif - -#if defined(PIOS_COM_DEBUG) - #define DEBUG_PRINTF(...) PIOS_COM_SendFormattedString(PIOS_COM_DEBUG, __VA_ARGS__) -// #define DEBUG_PRINTF(...) PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, __VA_ARGS__) -#else - #define DEBUG_PRINTF(...) -#endif - -// ***************************************************************** -// ADC - -// PIOS_ADC_PinGet(0) = Temperature Sensor (On-board) -// PIOS_ADC_PinGet(1) = PSU Voltage - -#define PIOS_ADC_OVERSAMPLING_RATE 2 - -#define PIOS_ADC_USE_TEMP_SENSOR 1 -#define PIOS_ADC_TEMP_SENSOR_ADC ADC1 -#define PIOS_ADC_TEMP_SENSOR_ADC_CHANNEL 16 // Temperature sensor channel -//#define PIOS_ADC_TEMP_SENSOR_ADC_CHANNEL 17 // VREF channel - -#define PIOS_ADC_PIN1_GPIO_PORT GPIOB // Port B (PSU Voltage) -#define PIOS_ADC_PIN1_GPIO_PIN GPIO_Pin_1 // PB1 .. ADC12_IN9 -#define PIOS_ADC_PIN1_GPIO_CHANNEL ADC_Channel_9 -#define PIOS_ADC_PIN1_ADC ADC2 -#define PIOS_ADC_PIN1_ADC_NUMBER 1 - -#define PIOS_ADC_NUM_PINS 1 - -#define PIOS_ADC_PORTS { PIOS_ADC_PIN1_GPIO_PORT } -#define PIOS_ADC_PINS { PIOS_ADC_PIN1_GPIO_PIN } -#define PIOS_ADC_CHANNELS { PIOS_ADC_PIN1_GPIO_CHANNEL } -#define PIOS_ADC_MAPPING { PIOS_ADC_PIN1_ADC } -#define PIOS_ADC_CHANNEL_MAPPING { PIOS_ADC_PIN1_ADC_NUMBER } - -#define PIOS_ADC_NUM_CHANNELS (PIOS_ADC_NUM_PINS + PIOS_ADC_USE_TEMP_SENSOR) -#define PIOS_ADC_NUM_ADC_CHANNELS 2 -#define PIOS_ADC_USE_ADC2 1 -#define PIOS_ADC_CLOCK_FUNCTION RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2, ENABLE) -//#define PIOS_ADC_ADCCLK RCC_PCLK2_Div2 // ADC clock = PCLK2/2 -//#define PIOS_ADC_ADCCLK RCC_PCLK2_Div4 // ADC clock = PCLK2/4 -//#define PIOS_ADC_ADCCLK RCC_PCLK2_Div6 // ADC clock = PCLK2/6 -#define PIOS_ADC_ADCCLK RCC_PCLK2_Div8 // ADC clock = PCLK2/8 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_1Cycles5 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_7Cycles5 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_13Cycles5 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_28Cycles5 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_41Cycles5 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_55Cycles5 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_71Cycles5 -#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_239Cycles5 - /* Sample time: */ - /* With an ADCCLK = 14 MHz and a sampling time of 293.5 cycles: */ - /* Tconv = 239.5 + 12.5 = 252 cycles = 18�s */ - /* (1 / (ADCCLK / CYCLES)) = Sample Time (�S) */ -#define PIOS_ADC_IRQ_PRIO 3 - -// ***************************************************************** -// GPIO output pins - -// GPIO_Mode_Out_OD Open Drain Output -// GPIO_Mode_Out_PP Push-Pull Output -// GPIO_Mode_AF_OD Open Drain Output Alternate-Function -// GPIO_Mode_AF_PP Push-Pull Output Alternate-Function - -// Serial port RTS line -#define PIOS_GPIO_OUT_0_PORT GPIOB -#define PIOS_GPIO_OUT_0_PIN GPIO_Pin_15 -#define PIOS_GPIO_OUT_0_GPIO_CLK RCC_APB2Periph_GPIOB - -// RF module chip-select line -#define PIOS_GPIO_OUT_1_PORT GPIOA -#define PIOS_GPIO_OUT_1_PIN GPIO_Pin_4 -#define PIOS_GPIO_OUT_1_GPIO_CLK RCC_APB2Periph_GPIOA - -// EEPROM chip-select line -#define PIOS_GPIO_OUT_2_PORT GPIOA -#define PIOS_GPIO_OUT_2_PIN GPIO_Pin_1 -#define PIOS_GPIO_OUT_2_GPIO_CLK RCC_APB2Periph_GPIOA -/* -// SPI-1 SCK line -#define PIOS_GPIO_OUT_3_PORT GPIOA -#define PIOS_GPIO_OUT_3_PIN GPIO_Pin_5 -#define PIOS_GPIO_OUT_3_GPIO_CLK RCC_APB2Periph_GPIOA - -// SPI-1 MOSI line -#define PIOS_GPIO_OUT_4_PORT GPIOA -#define PIOS_GPIO_OUT_4_PIN GPIO_Pin_7 -#define PIOS_GPIO_OUT_4_GPIO_CLK RCC_APB2Periph_GPIOA -*/ -#define PIOS_GPIO_NUM 3 -#define PIOS_GPIO_PORTS { PIOS_GPIO_OUT_0_PORT, PIOS_GPIO_OUT_1_PORT, PIOS_GPIO_OUT_2_PORT, } -#define PIOS_GPIO_PINS { PIOS_GPIO_OUT_0_PIN, PIOS_GPIO_OUT_1_PIN, PIOS_GPIO_OUT_2_PIN, } -#define PIOS_GPIO_CLKS { PIOS_GPIO_OUT_0_GPIO_CLK, PIOS_GPIO_OUT_1_GPIO_CLK, PIOS_GPIO_OUT_2_GPIO_CLK } - -#define SERIAL_RTS_ENABLE PIOS_GPIO_Enable(0) -#define SERIAL_RTS_SET PIOS_GPIO_Off(0) -#define SERIAL_RTS_CLEAR PIOS_GPIO_On(0) - -#define RF_CS_ENABLE PIOS_GPIO_Enable(1) -#define RF_CS_HIGH PIOS_GPIO_Off(1) -#define RF_CS_LOW PIOS_GPIO_On(1) - -#define EE_CS_ENABLE PIOS_GPIO_Enable(2) -#define EE_CS_HIGH PIOS_GPIO_Off(2) -#define EE_CS_LOW PIOS_GPIO_On(2) -/* -#define SPI1_SCK_ENABLE PIOS_GPIO_Enable(3) -#define SPI1_SCK_HIGH PIOS_GPIO_Off(3) -#define SPI1_SCK_LOW PIOS_GPIO_On(3) - -#define SPI1_MOSI_ENABLE PIOS_GPIO_Enable(4) -#define SPI1_MOSI_HIGH PIOS_GPIO_Off(4) -#define SPI1_MOSI_LOW PIOS_GPIO_On(4) -*/ -// ***************************************************************** -// GPIO input pins - -// GPIO_Mode_AIN Analog Input -// GPIO_Mode_IN_FLOATING Input Floating -// GPIO_Mode_IPD Input Pull-Down -// GPIO_Mode_IPU Input Pull-up - -// API mode line -#define GPIO_IN_0_PORT GPIOB -#define GPIO_IN_0_PIN GPIO_Pin_13 -#define GPIO_IN_0_MODE GPIO_Mode_IPU - -// Serial port CTS line -#define GPIO_IN_1_PORT GPIOB -#define GPIO_IN_1_PIN GPIO_Pin_14 -#define GPIO_IN_1_MODE GPIO_Mode_IPU - -// VBUS sense line -#define GPIO_IN_2_PORT GPIOA -#define GPIO_IN_2_PIN GPIO_Pin_8 -#define GPIO_IN_2_MODE GPIO_Mode_IN_FLOATING - -// 868MHz jumper option -#define GPIO_IN_3_PORT GPIOB -#define GPIO_IN_3_PIN GPIO_Pin_8 -#define GPIO_IN_3_MODE GPIO_Mode_IPU - -// 915MHz jumper option -#define GPIO_IN_4_PORT GPIOB -#define GPIO_IN_4_PIN GPIO_Pin_9 -#define GPIO_IN_4_MODE GPIO_Mode_IPU - -// RF INT line -#define GPIO_IN_5_PORT GPIOA -#define GPIO_IN_5_PIN GPIO_Pin_2 -#define GPIO_IN_5_MODE GPIO_Mode_IN_FLOATING - -// RF misc line -#define GPIO_IN_6_PORT GPIOB -#define GPIO_IN_6_PIN GPIO_Pin_0 -#define GPIO_IN_6_MODE GPIO_Mode_IN_FLOATING - -#define GPIO_IN_NUM 7 -#define GPIO_IN_PORTS { GPIO_IN_0_PORT, GPIO_IN_1_PORT, GPIO_IN_2_PORT, GPIO_IN_3_PORT, GPIO_IN_4_PORT, GPIO_IN_5_PORT, GPIO_IN_6_PORT } -#define GPIO_IN_PINS { GPIO_IN_0_PIN, GPIO_IN_1_PIN, GPIO_IN_2_PIN, GPIO_IN_3_PIN, GPIO_IN_4_PIN, GPIO_IN_5_PIN, GPIO_IN_6_PIN } -#define GPIO_IN_MODES { GPIO_IN_0_MODE, GPIO_IN_1_MODE, GPIO_IN_2_MODE, GPIO_IN_3_MODE, GPIO_IN_4_MODE, GPIO_IN_5_MODE, GPIO_IN_6_MODE } - -#define API_MODE_PIN 0 -#define SERIAL_CTS_PIN 1 -#define VBUS_SENSE_PIN 2 -#define _868MHz_PIN 3 -#define _915MHz_PIN 4 -#define RF_INT_PIN 5 -#define RF_MISC_PIN 6 - -// ***************************************************************** -// USB - -#if defined(PIOS_INCLUDE_USB_HID) - #define PIOS_USB_ENABLED 1 - #define PIOS_USB_DETECT_GPIO_PORT GPIO_IN_2_PORT - #define PIOS_USB_DETECT_GPIO_PIN GPIO_IN_2_PIN - #define PIOS_USB_DETECT_EXTI_LINE EXTI_Line4 - #define PIOS_IRQ_USB_PRIORITY 8 -#endif - -// ***************************************************************** -// RFM22 - -//#define RFM22_EXT_INT_USE - -#define RFM22_PIOS_SPI PIOS_SPI_PORT // SPIx - -#if defined(RFM22_EXT_INT_USE) - #define RFM22_EXT_INT_PORT_SOURCE GPIO_PortSourceGPIOA - #define RFM22_EXT_INT_PIN_SOURCE GPIO_PinSource2 - - #define RFM22_EXT_INT_LINE EXTI_Line2 - #define RFM22_EXT_INT_IRQn EXTI2_IRQn - #define RFM22_EXT_INT_FUNC EXTI2_IRQHandler - - #define RFM22_EXT_INT_PRIORITY 1 -#endif - -// ***************************************************************** - -#endif /* PIOS_BOARD_H */ diff --git a/flight/Bootloaders/PipXtreme/op_dfu.c b/flight/Bootloaders/PipXtreme/op_dfu.c index 4b2bd37fb..8cee79cd9 100644 --- a/flight/Bootloaders/PipXtreme/op_dfu.c +++ b/flight/Bootloaders/PipXtreme/op_dfu.c @@ -317,6 +317,8 @@ void processComand(uint8_t *xReceive_Buffer) { Buffer[11] = devicesTable[Data0 - 1].FW_Crc >> 16; Buffer[12] = devicesTable[Data0 - 1].FW_Crc >> 8; Buffer[13] = devicesTable[Data0 - 1].FW_Crc; + Buffer[14] = devicesTable[Data0 - 1].devID>>8; + Buffer[15] = devicesTable[Data0 - 1].devID; } sendData(Buffer + 1, 63); //PIOS_COM_SendBuffer(PIOS_COM_TELEM_USB, Buffer + 1, 63);//FIX+1 diff --git a/flight/OpenPilot/Makefile b/flight/OpenPilot/Makefile index 89fe6fd44..456a99204 100644 --- a/flight/OpenPilot/Makefile +++ b/flight/OpenPilot/Makefile @@ -491,7 +491,7 @@ LDFLAGS += $(MATH_LIB) LDFLAGS += -lc -lgcc # Set linker-script name depending on selected submodel name -LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_stm32f10x_$(BOOT_MODEL).ld +LDFLAGS +=-T$(LINKERSCRIPTPATH)/link_$(BOARD)_$(BOOT_MODEL).ld # --------------------------------------------------------------------------- # Options for OpenOCD flash-programming diff --git a/flight/PiOS/Boards/pios_board.h b/flight/PiOS/Boards/pios_board.h index fdbacdab3..09b4cd81a 100644 --- a/flight/PiOS/Boards/pios_board.h +++ b/flight/PiOS/Boards/pios_board.h @@ -5,6 +5,8 @@ #include "STM32103CB_AHRS.h" #elif USE_STM3210E_OP #include "STM3210E_OP.h" +#elif USE_STM32103CB_PIPXTREME +#include "STM32103CB_PIPXTREME.h" #endif #endif /* PIOS_BOARD_H_ */ diff --git a/flight/PiOS/STM32F10x/link_stm32f10x_MD_BL.ld b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_MD_BL.ld similarity index 100% rename from flight/PiOS/STM32F10x/link_stm32f10x_MD_BL.ld rename to flight/PiOS/STM32F10x/link_STM32103CB_AHRS_MD_BL.ld diff --git a/flight/PiOS/STM32F10x/link_stm32f10x_MD_NB.ld b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_MD_NB.ld similarity index 100% rename from flight/PiOS/STM32F10x/link_stm32f10x_MD_NB.ld rename to flight/PiOS/STM32F10x/link_STM32103CB_AHRS_MD_NB.ld diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_MD_BL.ld b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_MD_BL.ld new file mode 100644 index 000000000..f4a0f11a3 --- /dev/null +++ b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_MD_BL.ld @@ -0,0 +1,54 @@ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x08004000, LENGTH = 112K + 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 = . ; +} \ No newline at end of file diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_MD_NB.ld b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_MD_NB.ld new file mode 100644 index 000000000..0c0931a87 --- /dev/null +++ b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_MD_NB.ld @@ -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 = . ; +} \ No newline at end of file diff --git a/flight/PiOS/STM32F10x/link_stm32f10x_HD_BL.ld b/flight/PiOS/STM32F10x/link_STM3210E_OP_HD_BL.ld similarity index 100% rename from flight/PiOS/STM32F10x/link_stm32f10x_HD_BL.ld rename to flight/PiOS/STM32F10x/link_STM3210E_OP_HD_BL.ld diff --git a/flight/PiOS/STM32F10x/link_stm32f10x_HD_NB.ld b/flight/PiOS/STM32F10x/link_STM3210E_OP_HD_NB.ld similarity index 100% rename from flight/PiOS/STM32F10x/link_stm32f10x_HD_NB.ld rename to flight/PiOS/STM32F10x/link_STM3210E_OP_HD_NB.ld diff --git a/flight/PipXtreme/Makefile b/flight/PipXtreme/Makefile index 2ea6093aa..776fcbdf3 100644 --- a/flight/PipXtreme/Makefile +++ b/flight/PipXtreme/Makefile @@ -86,6 +86,7 @@ FLIGHTLIB = ../Libraries FLIGHTLIBINC = $(FLIGHTLIB)/inc PIOSSTM32F10X = $(PIOS)/STM32F10x PIOSCOMMON = $(PIOS)/Common +PIOSBOARDS = $(PIOS)/Boards APPLIBDIR = $(PIOSSTM32F10X)/Libraries STMLIBDIR = $(APPLIBDIR) STMSPDDIR = $(STMLIBDIR)/STM32F10x_StdPeriph_Driver @@ -218,6 +219,7 @@ EXTRAINCDIRS += $(PIOSINC) EXTRAINCDIRS += $(FLIGHTLIBINC) EXTRAINCDIRS += $(PIOSSTM32F10X) EXTRAINCDIRS += $(PIOSCOMMON) +EXTRAINCDIRS += $(PIOSBOARDS) EXTRAINCDIRS += $(STMSPDINCDIR) ifeq ($(USE_USB), YES) EXTRAINCDIRS += $(STMUSBINCDIR) @@ -350,7 +352,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_$(BOARD)_$(BOOT_MODEL).ld # --------------------------------------------------------------------------- # Options for OpenOCD flash-programming diff --git a/flight/PipXtreme/inc/pios_board.h b/flight/PipXtreme/inc/pios_board.h deleted file mode 100644 index 8c2d05bb9..000000000 --- a/flight/PipXtreme/inc/pios_board.h +++ /dev/null @@ -1,384 +0,0 @@ - /** - ****************************************************************************** - * - * @file pios_board.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Defines board hardware for the OpenPilot Version 1.1 hardware. - * @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_BOARD_H -#define PIOS_BOARD_H - -// ***************************************************************** -// Timers and Channels Used - -/* -Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4 -------+-----------+-----------+-----------+---------- -TIM1 | | | | -TIM2 | --------------- DELAY ---------------------- -TIM3 | --------------- Timer Interrupt ------------ -TIM4 | --------------- STOPWATCH ------------------ -TIM5 | | | | -TIM6 | | | | -TIM7 | | | | -TIM8 | | | | -------+-----------+-----------+-----------+---------- -*/ - -//------------------------ -// DMA Channels Used -//------------------------ -/* Channel 1 - */ -/* Channel 2 - */ -/* Channel 3 - */ -/* Channel 4 - */ -/* Channel 5 - */ -/* Channel 6 - */ -/* Channel 7 - */ -/* Channel 8 - */ -/* Channel 9 - */ -/* Channel 10 - */ -/* Channel 11 - */ -/* Channel 12 - */ - -//------------------------ -// BOOTLOADER_SETTINGS -//------------------------ -#define FUNC_ID 3 -#define HW_VERSION 21 -#define BOOTLOADER_VERSION 0 -#define MEM_SIZE 0x20000 //128K -#define SIZE_OF_DESCRIPTION 100 -#define START_OF_USER_CODE (uint32_t)0x08002000 -#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_WRITABLA TRUE -#define MAX_DEL_RETRYS 3 - - -// ***************************************************************** -// System Settings - -#define PIOS_MASTER_CLOCK 72000000ul -#define PIOS_PERIPHERAL_CLOCK (PIOS_MASTER_CLOCK / 2) - -#if defined(USE_BOOTLOADER) - #define PIOS_NVIC_VECTTAB_FLASH (START_OF_USER_CODE) -#else - #define PIOS_NVIC_VECTTAB_FLASH ((uint32_t)0x08000000) -#endif - -// ***************************************************************** -// Interrupt Priorities - -#define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS -#define PIOS_IRQ_PRIO_MID 8 // higher than RTOS -#define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc... -#define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc... - -// ***************************************************************** -// PIOS_LED - -#define PIOS_LED_LED1_GPIO_PORT GPIOA // USB Activity LED -#define PIOS_LED_LED1_GPIO_PIN GPIO_Pin_3 -#define PIOS_LED_LED1_GPIO_CLK RCC_APB2Periph_GPIOA - -#define PIOS_LED_LED2_GPIO_PORT GPIOB // LINK LED -#define PIOS_LED_LED2_GPIO_PIN GPIO_Pin_5 -#define PIOS_LED_LED2_GPIO_CLK RCC_APB2Periph_GPIOB - -#define PIOS_LED_LED3_GPIO_PORT GPIOB // RX LED -#define PIOS_LED_LED3_GPIO_PIN GPIO_Pin_6 -#define PIOS_LED_LED3_GPIO_CLK RCC_APB2Periph_GPIOB - -#define PIOS_LED_LED4_GPIO_PORT GPIOB // TX LED -#define PIOS_LED_LED4_GPIO_PIN GPIO_Pin_7 -#define PIOS_LED_LED4_GPIO_CLK RCC_APB2Periph_GPIOB - -#define PIOS_LED_NUM 4 -#define PIOS_LED_PORTS { PIOS_LED_LED1_GPIO_PORT, PIOS_LED_LED2_GPIO_PORT, PIOS_LED_LED3_GPIO_PORT, PIOS_LED_LED4_GPIO_PORT } -#define PIOS_LED_PINS { PIOS_LED_LED1_GPIO_PIN, PIOS_LED_LED2_GPIO_PIN, PIOS_LED_LED3_GPIO_PIN, PIOS_LED_LED4_GPIO_PIN } -#define PIOS_LED_CLKS { PIOS_LED_LED1_GPIO_CLK, PIOS_LED_LED2_GPIO_CLK, PIOS_LED_LED3_GPIO_CLK, PIOS_LED_LED4_GPIO_CLK } - -#define USB_LED_ON PIOS_LED_On(LED1) -#define USB_LED_OFF PIOS_LED_Off(LED1) -#define USB_LED_TOGGLE PIOS_LED_Toggle(LED1) - -#define LINK_LED_ON PIOS_LED_On(LED2) -#define LINK_LED_OFF PIOS_LED_Off(LED2) -#define LINK_LED_TOGGLE PIOS_LED_Toggle(LED2) - -#define RX_LED_ON PIOS_LED_On(LED3) -#define RX_LED_OFF PIOS_LED_Off(LED3) -#define RX_LED_TOGGLE PIOS_LED_Toggle(LED3) - -#define TX_LED_ON PIOS_LED_On(LED4) -#define TX_LED_OFF PIOS_LED_Off(LED4) -#define TX_LED_TOGGLE PIOS_LED_Toggle(LED4) - -// ***************************************************************** -// Delay Timer - -#define PIOS_DELAY_TIMER TIM2 -#define PIOS_DELAY_TIMER_RCC_FUNC RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE) - -// ***************************************************************** -// Timer interrupt - -#define TIMER_INT_TIMER TIM3 -#define TIMER_INT_FUNC TIM3_IRQHandler -#define TIMER_INT_PRIORITY 2 - -// ***************************************************************** -// Stop watch timer - -#define STOPWATCH_TIMER TIM4 - -// ***************************************************************** -// SPI -// -// See also pios_board.c - -#define PIOS_SPI_PORT 0 - -// ***************************************************************** -// PIOS_USART - -#define PIOS_USART_RX_BUFFER_SIZE 512 -#define PIOS_USART_TX_BUFFER_SIZE 512 - -#define PIOS_COM_SERIAL 0 -//#define PIOS_COM_DEBUG PIOS_COM_SERIAL // comment this out if you don't want debug text sent out on the serial port - -#define PIOS_USART_BAUDRATE 57600 -//#define PIOS_USART_BAUDRATE 115200 - -#if defined(PIOS_INCLUDE_USB_HID) - #define PIOS_COM_TELEM_USB 1 -#endif - -#if defined(PIOS_COM_DEBUG) - #define DEBUG_PRINTF(...) PIOS_COM_SendFormattedString(PIOS_COM_DEBUG, __VA_ARGS__) -// #define DEBUG_PRINTF(...) PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, __VA_ARGS__) -#else - #define DEBUG_PRINTF(...) -#endif - -// ***************************************************************** -// ADC - -// PIOS_ADC_PinGet(0) = Temperature Sensor (On-board) -// PIOS_ADC_PinGet(1) = PSU Voltage - -#define PIOS_ADC_OVERSAMPLING_RATE 2 - -#define PIOS_ADC_USE_TEMP_SENSOR 1 -#define PIOS_ADC_TEMP_SENSOR_ADC ADC1 -#define PIOS_ADC_TEMP_SENSOR_ADC_CHANNEL 16 // Temperature sensor channel -//#define PIOS_ADC_TEMP_SENSOR_ADC_CHANNEL 17 // VREF channel - -#define PIOS_ADC_PIN1_GPIO_PORT GPIOB // Port B (PSU Voltage) -#define PIOS_ADC_PIN1_GPIO_PIN GPIO_Pin_1 // PB1 .. ADC12_IN9 -#define PIOS_ADC_PIN1_GPIO_CHANNEL ADC_Channel_9 -#define PIOS_ADC_PIN1_ADC ADC2 -#define PIOS_ADC_PIN1_ADC_NUMBER 1 - -#define PIOS_ADC_NUM_PINS 1 - -#define PIOS_ADC_PORTS { PIOS_ADC_PIN1_GPIO_PORT } -#define PIOS_ADC_PINS { PIOS_ADC_PIN1_GPIO_PIN } -#define PIOS_ADC_CHANNELS { PIOS_ADC_PIN1_GPIO_CHANNEL } -#define PIOS_ADC_MAPPING { PIOS_ADC_PIN1_ADC } -#define PIOS_ADC_CHANNEL_MAPPING { PIOS_ADC_PIN1_ADC_NUMBER } - -#define PIOS_ADC_NUM_CHANNELS (PIOS_ADC_NUM_PINS + PIOS_ADC_USE_TEMP_SENSOR) -#define PIOS_ADC_NUM_ADC_CHANNELS 2 -#define PIOS_ADC_USE_ADC2 1 -#define PIOS_ADC_CLOCK_FUNCTION RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2, ENABLE) -//#define PIOS_ADC_ADCCLK RCC_PCLK2_Div2 // ADC clock = PCLK2/2 -//#define PIOS_ADC_ADCCLK RCC_PCLK2_Div4 // ADC clock = PCLK2/4 -//#define PIOS_ADC_ADCCLK RCC_PCLK2_Div6 // ADC clock = PCLK2/6 -#define PIOS_ADC_ADCCLK RCC_PCLK2_Div8 // ADC clock = PCLK2/8 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_1Cycles5 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_7Cycles5 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_13Cycles5 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_28Cycles5 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_41Cycles5 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_55Cycles5 -//#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_71Cycles5 -#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_239Cycles5 - /* Sample time: */ - /* With an ADCCLK = 14 MHz and a sampling time of 293.5 cycles: */ - /* Tconv = 239.5 + 12.5 = 252 cycles = 18�s */ - /* (1 / (ADCCLK / CYCLES)) = Sample Time (�S) */ -#define PIOS_ADC_IRQ_PRIO 3 - -// ***************************************************************** -// GPIO output pins - -// GPIO_Mode_Out_OD Open Drain Output -// GPIO_Mode_Out_PP Push-Pull Output -// GPIO_Mode_AF_OD Open Drain Output Alternate-Function -// GPIO_Mode_AF_PP Push-Pull Output Alternate-Function - -// Serial port RTS line -#define PIOS_GPIO_OUT_0_PORT GPIOB -#define PIOS_GPIO_OUT_0_PIN GPIO_Pin_15 -#define PIOS_GPIO_OUT_0_GPIO_CLK RCC_APB2Periph_GPIOB - -// RF module chip-select line -#define PIOS_GPIO_OUT_1_PORT GPIOA -#define PIOS_GPIO_OUT_1_PIN GPIO_Pin_4 -#define PIOS_GPIO_OUT_1_GPIO_CLK RCC_APB2Periph_GPIOA - -// EEPROM chip-select line -#define PIOS_GPIO_OUT_2_PORT GPIOA -#define PIOS_GPIO_OUT_2_PIN GPIO_Pin_1 -#define PIOS_GPIO_OUT_2_GPIO_CLK RCC_APB2Periph_GPIOA -/* -// SPI-1 SCK line -#define PIOS_GPIO_OUT_3_PORT GPIOA -#define PIOS_GPIO_OUT_3_PIN GPIO_Pin_5 -#define PIOS_GPIO_OUT_3_GPIO_CLK RCC_APB2Periph_GPIOA - -// SPI-1 MOSI line -#define PIOS_GPIO_OUT_4_PORT GPIOA -#define PIOS_GPIO_OUT_4_PIN GPIO_Pin_7 -#define PIOS_GPIO_OUT_4_GPIO_CLK RCC_APB2Periph_GPIOA -*/ -#define PIOS_GPIO_NUM 3 -#define PIOS_GPIO_PORTS { PIOS_GPIO_OUT_0_PORT, PIOS_GPIO_OUT_1_PORT, PIOS_GPIO_OUT_2_PORT, } -#define PIOS_GPIO_PINS { PIOS_GPIO_OUT_0_PIN, PIOS_GPIO_OUT_1_PIN, PIOS_GPIO_OUT_2_PIN, } -#define PIOS_GPIO_CLKS { PIOS_GPIO_OUT_0_GPIO_CLK, PIOS_GPIO_OUT_1_GPIO_CLK, PIOS_GPIO_OUT_2_GPIO_CLK } - -#define SERIAL_RTS_ENABLE PIOS_GPIO_Enable(0) -#define SERIAL_RTS_SET PIOS_GPIO_Off(0) -#define SERIAL_RTS_CLEAR PIOS_GPIO_On(0) - -#define RF_CS_ENABLE PIOS_GPIO_Enable(1) -#define RF_CS_HIGH PIOS_GPIO_Off(1) -#define RF_CS_LOW PIOS_GPIO_On(1) - -#define EE_CS_ENABLE PIOS_GPIO_Enable(2) -#define EE_CS_HIGH PIOS_GPIO_Off(2) -#define EE_CS_LOW PIOS_GPIO_On(2) -/* -#define SPI1_SCK_ENABLE PIOS_GPIO_Enable(3) -#define SPI1_SCK_HIGH PIOS_GPIO_Off(3) -#define SPI1_SCK_LOW PIOS_GPIO_On(3) - -#define SPI1_MOSI_ENABLE PIOS_GPIO_Enable(4) -#define SPI1_MOSI_HIGH PIOS_GPIO_Off(4) -#define SPI1_MOSI_LOW PIOS_GPIO_On(4) -*/ -// ***************************************************************** -// GPIO input pins - -// GPIO_Mode_AIN Analog Input -// GPIO_Mode_IN_FLOATING Input Floating -// GPIO_Mode_IPD Input Pull-Down -// GPIO_Mode_IPU Input Pull-up - -// API mode line -#define GPIO_IN_0_PORT GPIOB -#define GPIO_IN_0_PIN GPIO_Pin_13 -#define GPIO_IN_0_MODE GPIO_Mode_IPU - -// Serial port CTS line -#define GPIO_IN_1_PORT GPIOB -#define GPIO_IN_1_PIN GPIO_Pin_14 -#define GPIO_IN_1_MODE GPIO_Mode_IPU - -// VBUS sense line -#define GPIO_IN_2_PORT GPIOA -#define GPIO_IN_2_PIN GPIO_Pin_8 -#define GPIO_IN_2_MODE GPIO_Mode_IN_FLOATING - -// 868MHz jumper option -#define GPIO_IN_3_PORT GPIOB -#define GPIO_IN_3_PIN GPIO_Pin_8 -#define GPIO_IN_3_MODE GPIO_Mode_IPU - -// 915MHz jumper option -#define GPIO_IN_4_PORT GPIOB -#define GPIO_IN_4_PIN GPIO_Pin_9 -#define GPIO_IN_4_MODE GPIO_Mode_IPU - -// RF INT line -#define GPIO_IN_5_PORT GPIOA -#define GPIO_IN_5_PIN GPIO_Pin_2 -#define GPIO_IN_5_MODE GPIO_Mode_IN_FLOATING - -// RF misc line -#define GPIO_IN_6_PORT GPIOB -#define GPIO_IN_6_PIN GPIO_Pin_0 -#define GPIO_IN_6_MODE GPIO_Mode_IN_FLOATING - -#define GPIO_IN_NUM 7 -#define GPIO_IN_PORTS { GPIO_IN_0_PORT, GPIO_IN_1_PORT, GPIO_IN_2_PORT, GPIO_IN_3_PORT, GPIO_IN_4_PORT, GPIO_IN_5_PORT, GPIO_IN_6_PORT } -#define GPIO_IN_PINS { GPIO_IN_0_PIN, GPIO_IN_1_PIN, GPIO_IN_2_PIN, GPIO_IN_3_PIN, GPIO_IN_4_PIN, GPIO_IN_5_PIN, GPIO_IN_6_PIN } -#define GPIO_IN_MODES { GPIO_IN_0_MODE, GPIO_IN_1_MODE, GPIO_IN_2_MODE, GPIO_IN_3_MODE, GPIO_IN_4_MODE, GPIO_IN_5_MODE, GPIO_IN_6_MODE } - -#define API_MODE_PIN 0 -#define SERIAL_CTS_PIN 1 -#define VBUS_SENSE_PIN 2 -#define _868MHz_PIN 3 -#define _915MHz_PIN 4 -#define RF_INT_PIN 5 -#define RF_MISC_PIN 6 - -// ***************************************************************** -// USB - -#if defined(PIOS_INCLUDE_USB_HID) - #define PIOS_USB_ENABLED 1 - #define PIOS_USB_DETECT_GPIO_PORT GPIO_IN_2_PORT - #define PIOS_USB_DETECT_GPIO_PIN GPIO_IN_2_PIN - #define PIOS_USB_DETECT_EXTI_LINE EXTI_Line4 - #define PIOS_IRQ_USB_PRIORITY 8 -#endif - -// ***************************************************************** -// RFM22 - -//#define RFM22_EXT_INT_USE - -#define RFM22_PIOS_SPI PIOS_SPI_PORT // SPIx - -#if defined(RFM22_EXT_INT_USE) - #define RFM22_EXT_INT_PORT_SOURCE GPIO_PortSourceGPIOA - #define RFM22_EXT_INT_PIN_SOURCE GPIO_PinSource2 - - #define RFM22_EXT_INT_LINE EXTI_Line2 - #define RFM22_EXT_INT_IRQn EXTI2_IRQn - #define RFM22_EXT_INT_FUNC EXTI2_IRQHandler - - #define RFM22_EXT_INT_PRIORITY 1 -#endif - -// ***************************************************************** - -#endif /* PIOS_BOARD_H */