diff --git a/conf/Makefile.stm32 b/conf/Makefile.stm32 index d465d4e1e4..0e8417a659 100644 --- a/conf/Makefile.stm32 +++ b/conf/Makefile.stm32 @@ -107,7 +107,7 @@ AOBJ = $(ASRC:%.S=$(OBJDIR)/%.o) # if not, use the default STM32f103re_flash.ld ifndef LDSCRIPT ifndef $(TARGET).LDSCRIPT -LDSCRIPT = $(SRC_ARCH)/stm32f103re_flash.ld +LDSCRIPT = $(SRC_ARCH)/stm32default.ld else LDSCRIPT = $($(TARGET).LDSCRIPT) endif diff --git a/conf/airframes/Poine/beth.xml b/conf/airframes/Poine/beth.xml index abd5e75a47..9a409fe3ad 100644 --- a/conf/airframes/Poine/beth.xml +++ b/conf/airframes/Poine/beth.xml @@ -105,8 +105,7 @@ main_stm32.ARCHDIR = stm32 main_stm32.CFLAGS += -I$(SRC_LISA) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -I$(SRC_LISA_ARCH) -DPERIPHERALS_AUTO_INIT main_stm32.CFLAGS += -DBOARD_CONFIG=\"boards/lisa_l_1.0.h\" main_stm32.srcs = $(SRC_BETH)/main_stm32.c \ - $(SRC_ARCH)/stm32_exceptions.c \ - $(SRC_ARCH)/stm32_vector_table.c + $(SRC_ARCH)/stm32_exceptions.c main_stm32.CFLAGS += -DUSE_LED main_stm32.srcs += $(SRC_ARCH)/led_hw.c main_stm32.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=1 @@ -177,8 +176,7 @@ main_coders.CFLAGS += -DBOARD_CONFIG=\"boards/beth.h\" main_coders.CFLAGS += -I$(SRC_LISA) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -DPERIPHERALS_AUTO_INIT main_coders.srcs = $(SRC_BETH)/main_coders.c \ - $(SRC_ARCH)/stm32_exceptions.c \ - $(SRC_ARCH)/stm32_vector_table.c + $(SRC_ARCH)/stm32_exceptions.c main_coders.CFLAGS += -DUSE_LED main_coders.srcs += $(SRC_ARCH)/led_hw.c main_coders.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=7 diff --git a/conf/autopilot/lisa_passthrough.makefile b/conf/autopilot/lisa_passthrough.makefile index e4e7b33704..a6fd421a4b 100644 --- a/conf/autopilot/lisa_passthrough.makefile +++ b/conf/autopilot/lisa_passthrough.makefile @@ -24,8 +24,7 @@ stm_passthrough.CFLAGS += -I$(SRC_FIRMWARE) -I$(SRC_LISA) -I$(SRC_LISA_ARCH) -I$ stm_passthrough.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) stm_passthrough.CFLAGS += -DPERIPHERALS_AUTO_INIT stm_passthrough.srcs = $(SRC_LISA)/lisa_stm_passthrough_main.c \ - $(SRC_ARCH)/stm32_exceptions.c \ - $(SRC_ARCH)/stm32_vector_table.c + $(SRC_ARCH)/stm32_exceptions.c # Leds stm_passthrough.CFLAGS += -DUSE_LED diff --git a/conf/autopilot/lisa_test_progs.makefile b/conf/autopilot/lisa_test_progs.makefile index 31199813a3..ef1197d219 100644 --- a/conf/autopilot/lisa_test_progs.makefile +++ b/conf/autopilot/lisa_test_progs.makefile @@ -67,8 +67,7 @@ COMMON_TEST_CFLAGS = -I$(SRC_FIRMWARE) -I$(ARCH) -DPERIPHERALS_AUTO_INIT COMMON_TEST_CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) COMMON_TEST_SRCS = $(SRC_AIRBORNE)/mcu.c \ $(SRC_ARCH)/mcu_arch.c \ - $(SRC_ARCH)/stm32_exceptions.c \ - $(SRC_ARCH)/stm32_vector_table.c + $(SRC_ARCH)/stm32_exceptions.c COMMON_TEST_CFLAGS += -DUSE_SYS_TIME ifneq ($(SYS_TIME_LED),none) COMMON_TEST_CFLAGS += -DSYS_TIME_LED=$(SYS_TIME_LED) diff --git a/conf/autopilot/rotorcraft.makefile b/conf/autopilot/rotorcraft.makefile index 78b4e56751..a3b94f3106 100644 --- a/conf/autopilot/rotorcraft.makefile +++ b/conf/autopilot/rotorcraft.makefile @@ -62,7 +62,6 @@ ifeq ($(ARCH), lpc21) ap.srcs += $(SRC_ARCH)/armVIC.c else ifeq ($(ARCH), stm32) ap.srcs += $(SRC_ARCH)/stm32_exceptions.c -ap.srcs += $(SRC_ARCH)/stm32_vector_table.c endif # diff --git a/conf/autopilot/setup.makefile b/conf/autopilot/setup.makefile index 6a95864cde..984e4e49c4 100644 --- a/conf/autopilot/setup.makefile +++ b/conf/autopilot/setup.makefile @@ -26,8 +26,7 @@ tunnel.CFLAGS += -I$(SRC_LISA) -I$(ARCH) -DPERIPHERALS_AUTO_INIT tunnel.srcs += mcu.c \ $(SRC_ARCH)/mcu_arch.c \ $(SRC_LISA)/tunnel_hw.c \ - $(SRC_ARCH)/stm32_exceptions.c \ - $(SRC_ARCH)/stm32_vector_table.c + $(SRC_ARCH)/stm32_exceptions.c tunnel.CFLAGS += -DUSE_LED tunnel.srcs += $(SRC_ARCH)/led_hw.c ifneq ($(SYS_TIME_LED),none) diff --git a/conf/autopilot/subsystems/fixedwing/autopilot.makefile b/conf/autopilot/subsystems/fixedwing/autopilot.makefile index 3a398196d5..0654acc824 100644 --- a/conf/autopilot/subsystems/fixedwing/autopilot.makefile +++ b/conf/autopilot/subsystems/fixedwing/autopilot.makefile @@ -101,7 +101,6 @@ ifeq ($(ARCH), lpc21) ns_srcs += $(SRC_ARCH)/armVIC.c else ifeq ($(ARCH), stm32) ns_srcs += $(SRC_ARCH)/stm32_exceptions.c - ns_srcs += $(SRC_ARCH)/stm32_vector_table.c # ns_CFLAGS += -DPERIPHERALS_AUTO_INIT endif diff --git a/conf/boards/lisa_m_1.0.makefile b/conf/boards/lisa_m_1.0.makefile index c10f49f2cd..1180566401 100644 --- a/conf/boards/lisa_m_1.0.makefile +++ b/conf/boards/lisa_m_1.0.makefile @@ -13,6 +13,7 @@ $(TARGET).ARCHDIR = $(ARCH) # not needed? $(TARGET).OOCD_INTERFACE=flossjtag #$(TARGET).OOCD_INTERFACE=jtagkey-tiny +$(TARGET).LDSCRIPT=$(SRC_ARCH)/lisa-m.ld # ----------------------------------------------------------------------- diff --git a/sw/airborne/arch/stm32/stm32_vector_table.h b/sw/airborne/arch/stm32/lisa-l.ld similarity index 60% rename from sw/airborne/arch/stm32/stm32_vector_table.h rename to sw/airborne/arch/stm32/lisa-l.ld index 8287ae74ca..b790e1ef17 100644 --- a/sw/airborne/arch/stm32/stm32_vector_table.h +++ b/sw/airborne/arch/stm32/lisa-l.ld @@ -1,7 +1,7 @@ /* - * $Id$ - * - * Copyright (C) 2010 Antoine Drouin + * Hey Emacs, this is a -*- makefile -*- + * + * Copyright (C) 2012 Piotr Esden-Tempski * * This file is part of Paparazzi. * @@ -18,11 +18,19 @@ * You should have received a copy of the GNU General Public License * along with Paparazzi; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * Boston, MA 02111-1307, USA. */ -#ifndef STM32_VECTOR_TABLE_H -#define STM32_VECTOR_TABLE_H +/* Linker script for Lisa-L (STM32F103RET6, 512K flash, 64K RAM). */ +/* Define memory regions. */ +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K + /* Leaving 2k of space at the end of rom for stored settings */ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 510K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32f1.ld -#endif /* STM32_VECTOR_TABLE_H */ diff --git a/sw/airborne/arch/stm32/lisa-m.ld b/sw/airborne/arch/stm32/lisa-m.ld new file mode 100644 index 0000000000..a3382b17f6 --- /dev/null +++ b/sw/airborne/arch/stm32/lisa-m.ld @@ -0,0 +1,36 @@ +/* + * Hey Emacs, this is a -*- makefile -*- + * + * Copyright (C) 2012 Piotr Esden-Tempski + * + * This file is part of Paparazzi. + * + * Paparazzi 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 2, or (at your option) + * any later version. + * + * Paparazzi 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 Paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* Linker script for Lisa-M (STM32F105RCT6, 256K flash, 64K RAM). */ + +/* Define memory regions. */ +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K + /* Leaving 2k of space at the end of rom for stored settings */ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 254K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32f1.ld + diff --git a/sw/airborne/arch/stm32/mcu_periph/sys_time_arch.c b/sw/airborne/arch/stm32/mcu_periph/sys_time_arch.c index 7a5efa51f8..58c7165821 100644 --- a/sw/airborne/arch/stm32/mcu_periph/sys_time_arch.c +++ b/sw/airborne/arch/stm32/mcu_periph/sys_time_arch.c @@ -28,7 +28,6 @@ #include "mcu_periph/sys_time.h" -#include "stm32_vector_table.h" #ifdef SYS_TIME_LED #include "led.h" #endif diff --git a/sw/airborne/arch/stm32/stm32_vector_table.c b/sw/airborne/arch/stm32/stm32_vector_table.c deleted file mode 100644 index a3f0ca529e..0000000000 --- a/sw/airborne/arch/stm32/stm32_vector_table.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2010 The Paparazzi Team - * - * This file is part of Paparazzi. - * - * Paparazzi 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 2, or (at your option) - * any later version. - * - * Paparazzi 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 Paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "stm32_vector_table.h" - -#include - -#include "stm32_exceptions.h" - -#ifdef USE_SYS_TIME -#include "mcu_periph/sys_time.h" -#define SYS_TICK_IRQ_HANDLER sys_tick_irq_handler -#else -#define SYS_TICK_IRQ_HANDLER null_handler -#endif - -#if defined USE_UART1 || OVERRIDE_UART1_IRQ_HANDLER -#include "mcu_periph/uart.h" -#define USART1_IRQ_HANDLER usart1_irq_handler -#else -#define USART1_IRQ_HANDLER null_handler -#endif - -#if defined USE_UART2 || OVERRIDE_UART2_IRQ_HANDLER -#include "mcu_periph/uart.h" -#define USART2_IRQ_HANDLER usart2_irq_handler -#else -#define USART2_IRQ_HANDLER null_handler -#endif - -#if defined USE_UART3 || OVERRIDE_UART3_IRQ_HANDLER -#include "mcu_periph/uart.h" -#define USART3_IRQ_HANDLER usart3_irq_handler -#else -#define USART3_IRQ_HANDLER null_handler -#endif - -#if defined USE_UART5 || OVERRIDE_UART5_IRQ_HANDLER -#include "mcu_periph/uart.h" -#define USART5_IRQ_HANDLER usart5_irq_handler -#else -#define USART5_IRQ_HANDLER null_handler -#endif - - -#ifdef USE_I2C1 -#include "mcu_periph/i2c_arch.h" -#define I2C1_EV_IRQ_HANDLER i2c1_ev_irq_handler -#define I2C1_ER_IRQ_HANDLER i2c1_er_irq_handler -#else -#define I2C1_EV_IRQ_HANDLER null_handler -#define I2C1_ER_IRQ_HANDLER null_handler -#endif - -#ifdef USE_I2C2 -#include "mcu_periph/i2c_arch.h" -#define I2C2_EV_IRQ_HANDLER i2c2_ev_irq_handler -#define I2C2_ER_IRQ_HANDLER i2c2_er_irq_handler -#else -#define I2C2_EV_IRQ_HANDLER null_handler -#define I2C2_ER_IRQ_HANDLER null_handler -#endif - -#ifdef USE_SPI1_IRQ -extern void spi1_irq_handler(void); -#define SPI1_IRQ_HANDLER spi1_irq_handler -#else -#define SPI1_IRQ_HANDLER null_handler -#endif - -#ifdef USE_SPI2_IRQ -extern void spi2_irq_handler(void); -#define SPI2_IRQ_HANDLER spi2_irq_handler -#else -#define SPI2_IRQ_HANDLER null_handler -#endif - -#ifdef USE_EXTI0_IRQ -extern void exti0_irq_handler(void); -#define EXTI0_IRQ_HANDLER exti0_irq_handler -#else -#define EXTI0_IRQ_HANDLER null_handler -#endif - -#ifdef USE_EXTI2_IRQ -extern void exti2_irq_handler(void); -#define EXTI2_IRQ_HANDLER exti2_irq_handler -#else -#define EXTI2_IRQ_HANDLER null_handler -#endif - -#ifdef USE_EXTI3_IRQ -extern void exti3_irq_handler(void); -#define EXTI3_IRQ_HANDLER exti3_irq_handler -#else -#define EXTI3_IRQ_HANDLER null_handler -#endif - -#ifdef USE_EXTI4_IRQ -extern void exti4_irq_handler(void); -#define EXTI4_IRQ_HANDLER exti4_irq_handler -#else -#define EXTI4_IRQ_HANDLER null_handler -#endif - -#ifdef USE_EXTI9_5_IRQ -extern void exti9_5_irq_handler(void); -#define EXTI9_5_IRQ_HANDLER exti9_5_irq_handler -#else -#define EXTI9_5_IRQ_HANDLER null_handler -#endif - -#ifdef USE_EXTI15_10_IRQ -extern void exti15_10_irq_handler(void); -#define EXTI15_10_IRQ_HANDLER exti15_10_irq_handler -#else -#define EXTI15_10_IRQ_HANDLER null_handler -#endif - - -#ifdef USE_DMA1_C2_IRQ -extern void dma1_c2_irq_handler(void); -#define DMA1_C2_IRQ_HANDLER dma1_c2_irq_handler -#else -#define DMA1_C2_IRQ_HANDLER null_handler -#endif - -#ifdef USE_DMA1_C4_IRQ -extern void dma1_c4_irq_handler(void); -#define DMA1_C4_IRQ_HANDLER dma1_c4_irq_handler -#else -#define DMA1_C4_IRQ_HANDLER null_handler -#endif - -#ifdef USE_ADC1_2_IRQ_HANDLER -extern void adc1_2_irq_handler(void); -#define ADC1_2_IRQ_HANDLER adc1_2_irq_handler -#else -#define ADC1_2_IRQ_HANDLER null_handler -#endif - -#ifdef USE_TIM2_IRQ -extern void tim2_irq_handler(void); -#define TIM2_IRQ_HANDLER tim2_irq_handler -#else -#define TIM2_IRQ_HANDLER null_handler -#endif - -#ifdef USE_TIM6_IRQ -extern void tim6_irq_handler(void); -#define TIM6_IRQ_HANDLER tim6_irq_handler -#else -#define TIM6_IRQ_HANDLER null_handler -#endif - -#ifdef USE_USB_HP_CAN1_TX_IRQ -extern void usb_hp_can1_tx_irq_handler(void); -#define USB_HP_CAN1_TX_IRQ_HANDLER usb_hp_can1_tx_irq_handler -#else -#define USB_HP_CAN1_TX_IRQ_HANDLER null_handler -#endif - -#ifdef USE_USB_LP_CAN1_RX0_IRQ -extern void usb_lp_can1_rx0_irq_handler(void); -#define USB_LP_CAN1_RX0_IRQ_HANDLER usb_lp_can1_rx0_irq_handler -#else -#define USB_LP_CAN1_RX0_IRQ_HANDLER null_handler -#endif - -/* addresses defined in the linker script */ -extern unsigned long _etext; /* end addr of .text section */ -extern unsigned long _sidata; /* init values for .data section */ -extern unsigned long _sdata; /* start addr of .data section */ -extern unsigned long _edata; /* end addr of .data section */ -extern unsigned long _sbss; /* start addr of .bss section */ -extern unsigned long _ebss; /* end addr of .bss section */ -extern void _estack; /* stack pointer init value */ - -void reset_handler_stage1(void) __attribute__((__interrupt__)); -void reset_handler_stage2(void); -void null_handler(void); - -/* interrupt vector */ -__attribute__ ((section(".isr_vector"))) -void (* const vector_table[])(void) = { - &_estack, /* stack pointer init value*/ - reset_handler_stage1, /* pc init value */ - nmi_exception, - hard_fault_exception, - mem_manage_exception, - bus_fault_exception, - usage_fault_exception, - 0, 0, 0, 0, /* reserved */ - null_handler, /* svc_handler */ - null_handler, /* debug_monitor */ - 0, /* reserved */ - null_handler, /* pend_svc */ - SYS_TICK_IRQ_HANDLER, /* sys_tick_handler, */ - null_handler, /* wwdg_irq_handler */ - null_handler, /* pvd_irq_handler */ - null_handler, /* tamper_irq_handler */ - null_handler, /* rtc_irq_handler */ - null_handler, /* flash_irq_handler */ - null_handler, /* rcc_irq_handler */ - EXTI0_IRQ_HANDLER, /* exti0_irq_handler */ - null_handler, /* exti1_irq_handler */ - EXTI2_IRQ_HANDLER, /* exti2_irq_handler */ - EXTI3_IRQ_HANDLER, /* exti3_irq_handler */ - EXTI4_IRQ_HANDLER, /* exti4_irq_handler */ - null_handler, /* dma1_channel1_irq_handler */ - DMA1_C2_IRQ_HANDLER, /* dma1_channel2_irq_handler */ - null_handler, /* dma1_channel3_irq_handler */ - DMA1_C4_IRQ_HANDLER, /* dma1_channel4_irq_handler */ - null_handler, /* dma1_channel5_irq_handler */ - null_handler, /* dma1_channel6_irq_handler */ - null_handler, /* dma1_channel7_irq_handler */ - ADC1_2_IRQ_HANDLER, /* adc1_2_irq_handler */ - USB_HP_CAN1_TX_IRQ_HANDLER, /* usb_hp_can_tx_irq_handler */ - USB_LP_CAN1_RX0_IRQ_HANDLER, /* usb_lp_can_rx0_irq_handler */ - null_handler, /* can_rx1_irq_handler */ - null_handler, /* can_sce_irq_handler */ - EXTI9_5_IRQ_HANDLER, /* exti9_5_irq_handler */ - null_handler, /* tim1_brk_irq_handler */ - null_handler, /* tim1_up_irq_handler */ - null_handler, /* tim1_trg_com_irq_handler */ - null_handler, /* tim1_cc_irq_handler */ - TIM2_IRQ_HANDLER, /* tim2_irq_handler */ - null_handler, /* tim3_irq_handler */ - null_handler, /* tim4_irq_handler */ - I2C1_EV_IRQ_HANDLER, /* i2c1_ev_irq_handler */ - I2C1_ER_IRQ_HANDLER, /* i2c1_er_irq_handler */ - I2C2_EV_IRQ_HANDLER, /* i2c2_ev_irq_handler */ - I2C2_ER_IRQ_HANDLER, /* i2c2_er_irq_handler */ - SPI1_IRQ_HANDLER, /* spi1_irq_handler */ - SPI2_IRQ_HANDLER, /* spi2_irq_handler */ - USART1_IRQ_HANDLER, /* usart1_irq_handler */ - USART2_IRQ_HANDLER, /* usart2_irq_handler */ - USART3_IRQ_HANDLER, /* usart3_irq_handler */ - EXTI15_10_IRQ_HANDLER, /* exti15_10_irq_handler */ - null_handler, /* rtc_alarm_irq_handler */ - null_handler, /* usb_wake_up_irq_handler */ - null_handler, /* tim8_brk_irq_handler */ - null_handler, /* tim8_up_irq_handler */ - null_handler, /* tim8_trg_com_irq_handler */ - null_handler, /* tim8_cc_irq_handler */ - null_handler, /* adc3_irq_handler */ - null_handler, /* fsmc_irq_handler */ - null_handler, /* sdio_irq_handler */ - null_handler, /* tim5_irq_handler */ - null_handler, /* spi3_irq_handler */ - null_handler, /* uart4_irq_handler */ - USART5_IRQ_HANDLER, /* uart5_irq_handler */ - TIM6_IRQ_HANDLER, /* tim6_irq_handler */ - null_handler, /* tim7_irq_handler */ - null_handler, /* dma2_channel1_irq_handler */ - null_handler, /* dma2_channel2_irq_handler */ - null_handler, /* dma2_channel3_irq_handler */ - null_handler, /* dma2_channel4_5_irq_handler */ -}; - -/* Get's called directly after mcu reset */ -void reset_handler_stage1(void){ - /* set stack align */ - SCB->CCR = SCB->CCR | SCB_CCR_STKALIGN; - - reset_handler_stage2(); -} - -//extern int main(int argc, char** argv); -extern void main( void); - -void reset_handler_stage2(void){ - unsigned long *pul_src, *pul_dest; - - /* Copy the data segment initializers from flash to SRAM */ - pul_src = &_sidata; - for(pul_dest = &_sdata; pul_dest < &_edata; ){ - *(pul_dest++) = *(pul_src++); - } - /* Zero fill the bss segment. */ - for(pul_dest = &_sbss; pul_dest < &_ebss; ){ - *(pul_dest++) = 0; - } - - /* Call the application's entry point.*/ - main(); -} - -void null_handler(void){ -} - -/* FIXME: look deeper into what that is doing - * - */ - -void assert_param(void); - -void assert_param(void){ - -} - diff --git a/sw/airborne/arch/stm32/stm32default.ld b/sw/airborne/arch/stm32/stm32default.ld new file mode 100644 index 0000000000..c35bc1d255 --- /dev/null +++ b/sw/airborne/arch/stm32/stm32default.ld @@ -0,0 +1,37 @@ +/* + * Hey Emacs, this is a -*- makefile -*- + * + * Copyright (C) 2012 Piotr Esden-Tempski + * + * This file is part of Paparazzi. + * + * Paparazzi 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 2, or (at your option) + * any later version. + * + * Paparazzi 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 Paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* Linker script for "default" stm32 architecture */ +/* Assuming the least mean denominator to be 128K flash and 20K ram. */ + +/* Define memory regions. */ +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K + /* Leaving 1k of space at the end of rom for stored settings */ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 127K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32f1.ld + diff --git a/sw/airborne/arch/stm32/stm32f103rb_flash.ld b/sw/airborne/arch/stm32/stm32f103rb_flash.ld deleted file mode 100644 index 6d8fd3c2cb..0000000000 --- a/sw/airborne/arch/stm32/stm32f103rb_flash.ld +++ /dev/null @@ -1,201 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2010 Antoine Drouin - * - * This file is part of Paparazzi. - * - * Paparazzi 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 2, or (at your option) - * any later version. - * - * Paparazzi 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 Paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* Memory Spaces Definitions */ -MEMORY -{ - RAM (xrw): ORIGIN = 0x20000000, LENGTH = 20K - /* last page (1k) flash for persistent settings */ - FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 127K - FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0 -} - -ENTRY(reset_handler_stage1); - -/* User mode stack top */ -_estack = 0x20005000; - -/* Stack size and address definitions */ -__Stack_Size = 0x1000 ; - -PROVIDE ( _Stack_Size = __Stack_Size ) ; - -__Stack_Init = _estack - __Stack_Size ; - -PROVIDE ( _Stack_Init = __Stack_Init ) ; - -/* Enforce a linker error if there is not enough space left in ram for the stack */ -_Minimum_Stack_Size = 0x800 ; - -/* Check valid alignment for VTOR */ -ASSERT(ORIGIN(FLASH) == ALIGN(ORIGIN(FLASH), 0x80), "Start of memory region flash not aligned for startup vector table"); - -/* Sections Definitions */ - -SECTIONS -{ - /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */ - .isr_vector : - { - . = ALIGN(4); - KEEP(*(.isr_vector)) /* Startup code */ - . = ALIGN(4); - } >FLASH - - /* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */ - .flashtext : - { - . = ALIGN(4); - *(.flashtext) /* Startup code */ - . = ALIGN(4); - } >FLASH - - - /* the program code is stored in the .text section, which goes to Flash */ - .text : - { - . = ALIGN(4); - - *(.text) /* remaining code */ - *(.text.*) /* remaining code */ - *(.rodata) /* read-only data (constants) */ - *(.rodata*) - *(.glue_7) - *(.glue_7t) - - . = ALIGN(4); - _etext = .; - /* This is used by the startup in order to initialize the .data secion */ - _sidata = _etext; - } >FLASH - - - - /* This is the initialized data section - The program executes knowing that the data is in the RAM - but the loader puts the initial values in the FLASH (inidata). - It is one task of the startup to copy the initial values from FLASH to RAM. */ - .data : AT ( _sidata ) - { - . = ALIGN(4); - /* This is used by the startup in order to initialize the .data secion */ - _sdata = . ; - - *(.data) - *(.data.*) - - . = ALIGN(4); - /* This is used by the startup in order to initialize the .data secion */ - _edata = . ; - } >RAM - - - - /* This is the uninitialized data section */ - .bss : - { - . = ALIGN(4); - /* This is used by the startup in order to initialize the .bss secion */ - _sbss = .; - - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - /* *(.bss) */ - *(COMMON) - - . = ALIGN(4); - /* This is used by the startup in order to initialize the .bss secion */ - _ebss = . ; - } >RAM - - PROVIDE ( end = _ebss ); - PROVIDE ( _end = _ebss ); - - /* This is the user stack section - This is just to check that there is enough RAM left for the User mode stack - It should generate an error if it's full. - */ - ._usrstack : - { - . = ALIGN(4); - _susrstack = . ; - . = . + _Minimum_Stack_Size ; - . = ALIGN(4); - _eusrstack = . ; - } >RAM - - .b1text : - { - *(.b1text) /* remaining code */ - *(.b1rodata) /* read-only data (constants) */ - *(.b1rodata*) - } >FLASHB1 - - __exidx_start = .; - .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } - __exidx_end = .; - - /* after that it's only debugging information. */ - - /* remove the debugging information from the standard libraries */ - /DISCARD/ : - { - libc.a ( * ) - libm.a ( * ) - libgcc.a ( * ) - } - - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0.*/ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } -} diff --git a/sw/airborne/arch/stm32/stm32f103re_flash.ld b/sw/airborne/arch/stm32/stm32f103re_flash.ld deleted file mode 100644 index dac26babe4..0000000000 --- a/sw/airborne/arch/stm32/stm32f103re_flash.ld +++ /dev/null @@ -1,201 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2010 Antoine Drouin - * - * This file is part of Paparazzi. - * - * Paparazzi 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 2, or (at your option) - * any later version. - * - * Paparazzi 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 Paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* Memory Spaces Definitions */ -MEMORY -{ - RAM (xrw): ORIGIN = 0x20000000, LENGTH = 64K - /* last page (2k) flash for persistent settings */ - FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 510K - FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0 -} - -ENTRY(reset_handler_stage1); - -/* User mode stack top */ -_estack = 0x20010000; - -/* Stack size and address definitions */ -__Stack_Size = 0x1000 ; - -PROVIDE ( _Stack_Size = __Stack_Size ) ; - -__Stack_Init = _estack - __Stack_Size ; - -PROVIDE ( _Stack_Init = __Stack_Init ) ; - -/* Enforce a linker error if there is not enough space left in ram for the stack */ -_Minimum_Stack_Size = 0x800 ; - -/* Check valid alignment for VTOR */ -ASSERT(ORIGIN(FLASH) == ALIGN(ORIGIN(FLASH), 0x80), "Start of memory region flash not aligned for startup vector table"); - -/* Sections Definitions */ - -SECTIONS -{ - /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */ - .isr_vector : - { - . = ALIGN(4); - KEEP(*(.isr_vector)) /* Startup code */ - . = ALIGN(4); - } >FLASH - - /* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */ - .flashtext : - { - . = ALIGN(4); - *(.flashtext) /* Startup code */ - . = ALIGN(4); - } >FLASH - - - /* the program code is stored in the .text section, which goes to Flash */ - .text : - { - . = ALIGN(4); - - *(.text) /* remaining code */ - *(.text.*) /* remaining code */ - *(.rodata) /* read-only data (constants) */ - *(.rodata*) - *(.glue_7) - *(.glue_7t) - - . = ALIGN(4); - _etext = .; - /* This is used by the startup in order to initialize the .data secion */ - _sidata = _etext; - } >FLASH - - - - /* This is the initialized data section - The program executes knowing that the data is in the RAM - but the loader puts the initial values in the FLASH (inidata). - It is one task of the startup to copy the initial values from FLASH to RAM. */ - .data : AT ( _sidata ) - { - . = ALIGN(4); - /* This is used by the startup in order to initialize the .data secion */ - _sdata = . ; - - *(.data) - *(.data.*) - - . = ALIGN(4); - /* This is used by the startup in order to initialize the .data secion */ - _edata = . ; - } >RAM - - - - /* This is the uninitialized data section */ - .bss : - { - . = ALIGN(4); - /* This is used by the startup in order to initialize the .bss secion */ - _sbss = .; - - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - /* *(.bss) */ - *(COMMON) - - . = ALIGN(4); - /* This is used by the startup in order to initialize the .bss secion */ - _ebss = . ; - } >RAM - - PROVIDE ( end = _ebss ); - PROVIDE ( _end = _ebss ); - - /* This is the user stack section - This is just to check that there is enough RAM left for the User mode stack - It should generate an error if it's full. - */ - ._usrstack : - { - . = ALIGN(4); - _susrstack = . ; - . = . + _Minimum_Stack_Size ; - . = ALIGN(4); - _eusrstack = . ; - } >RAM - - .b1text : - { - *(.b1text) /* remaining code */ - *(.b1rodata) /* read-only data (constants) */ - *(.b1rodata*) - } >FLASHB1 - - __exidx_start = .; - .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } - __exidx_end = .; - - /* after that it's only debugging information. */ - - /* remove the debugging information from the standard libraries */ - /DISCARD/ : - { - libc.a ( * ) - libm.a ( * ) - libgcc.a ( * ) - } - - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0.*/ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } -} diff --git a/sw/airborne/arch/stm32/subsystems/imu/imu_crista_arch.c b/sw/airborne/arch/stm32/subsystems/imu/imu_crista_arch.c index e66305f7cf..b180d8b3d0 100644 --- a/sw/airborne/arch/stm32/subsystems/imu/imu_crista_arch.c +++ b/sw/airborne/arch/stm32/subsystems/imu/imu_crista_arch.c @@ -29,8 +29,6 @@ #include #include -#include "stm32_vector_table.h" - static volatile uint8_t channel; static uint8_t buf_in[4]; static uint8_t buf_out[4];