From 6e406c0232f2d31ad912bb3c04bc75b51eacbbf3 Mon Sep 17 00:00:00 2001 From: Stacey Sheldon Date: Mon, 23 May 2011 17:27:04 -0400 Subject: [PATCH] build: remove all remaining use of -DUSE_BOOTLOADER The USE_BOOTLOADER compile flag was only being used to determine where the ISR vector table was located. Provide this explicitly from the linker since it knows exactly where it is putting the ISR vector table. --- flight/AHRS/Makefile | 1 - flight/Bootloaders/BootloaderUpdater/Makefile | 1 - flight/CopterControl/Makefile | 1 - flight/INS/Makefile | 1 - flight/OpenPilot/Makefile | 1 - flight/PiOS/Boards/STM32103CB_AHRS.h | 5 ----- flight/PiOS/Boards/STM32103CB_CC_Rev1.h | 5 ----- flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h | 6 ------ flight/PiOS/Boards/STM3210E_INS.h | 5 ----- flight/PiOS/Boards/STM3210E_OP.h | 5 ----- flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld | 1 + flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld | 1 + .../PiOS/STM32F10x/link_STM32103CB_CC_Rev1_BL_sections.ld | 1 + flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_sections.ld | 1 + .../PiOS/STM32F10x/link_STM32103CB_PIPXTREME_BL_sections.ld | 1 + flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_sections.ld | 1 + flight/PiOS/STM32F10x/link_STM3210E_INS_BL_sections.ld | 1 + flight/PiOS/STM32F10x/link_STM3210E_INS_sections.ld | 1 + flight/PiOS/STM32F10x/link_STM3210E_OP_BL_sections.ld | 1 + flight/PiOS/STM32F10x/link_STM3210E_OP_sections.ld | 1 + flight/PiOS/STM32F10x/pios_sys.c | 3 ++- flight/PipXtreme/Makefile | 1 - 22 files changed, 12 insertions(+), 33 deletions(-) diff --git a/flight/AHRS/Makefile b/flight/AHRS/Makefile index 3043b8937..903d6901f 100644 --- a/flight/AHRS/Makefile +++ b/flight/AHRS/Makefile @@ -215,7 +215,6 @@ CDEFS = -DSTM32F10X_$(MODEL) CDEFS += -DUSE_STDPERIPH_DRIVER CDEFS += -DUSE_$(BOARD) CDEFS += -DIN_AHRS -CDEFS += -DUSE_BOOTLOADER # Place project-specific -D and/or -U options for # Assembler with preprocessor here. diff --git a/flight/Bootloaders/BootloaderUpdater/Makefile b/flight/Bootloaders/BootloaderUpdater/Makefile index 39cc48d71..1488bec8e 100644 --- a/flight/Bootloaders/BootloaderUpdater/Makefile +++ b/flight/Bootloaders/BootloaderUpdater/Makefile @@ -216,7 +216,6 @@ endif ifeq ($(ENABLE_AUX_UART), YES) CDEFS += -DPIOS_ENABLE_AUX_UART endif -CDEFS += -DUSE_BOOTLOADER # Place project-specific -D and/or -U options for # Assembler with preprocessor here. diff --git a/flight/CopterControl/Makefile b/flight/CopterControl/Makefile index 592aa77f0..b56e40fe3 100644 --- a/flight/CopterControl/Makefile +++ b/flight/CopterControl/Makefile @@ -373,7 +373,6 @@ endif ifeq ($(ENABLE_AUX_UART), YES) CDEFS += -DPIOS_ENABLE_AUX_UART endif -CDEFS += -DUSE_BOOTLOADER ifeq ($(ERASE_FLASH), YES) CDEFS += -DERASE_FLASH endif diff --git a/flight/INS/Makefile b/flight/INS/Makefile index be2406a80..1af2a912a 100644 --- a/flight/INS/Makefile +++ b/flight/INS/Makefile @@ -217,7 +217,6 @@ CDEFS = -DSTM32F10X_$(MODEL) CDEFS += -DUSE_STDPERIPH_DRIVER CDEFS += -DUSE_$(BOARD) CDEFS += -DIN_INS -CDEFS += -DUSE_BOOTLOADER # Place project-specific -D and/or -U options for # Assembler with preprocessor here. diff --git a/flight/OpenPilot/Makefile b/flight/OpenPilot/Makefile index dab172003..5022ab101 100644 --- a/flight/OpenPilot/Makefile +++ b/flight/OpenPilot/Makefile @@ -361,7 +361,6 @@ endif ifeq ($(ENABLE_AUX_UART), YES) CDEFS += -DPIOS_ENABLE_AUX_UART endif -CDEFS += -DUSE_BOOTLOADER ifeq ($(USE_SPEKTRUM), YES) CDEFS += -DUSE_SPEKTRUM diff --git a/flight/PiOS/Boards/STM32103CB_AHRS.h b/flight/PiOS/Boards/STM32103CB_AHRS.h index 8262f9730..a1c4907b0 100644 --- a/flight/PiOS/Boards/STM32103CB_AHRS.h +++ b/flight/PiOS/Boards/STM32103CB_AHRS.h @@ -107,11 +107,6 @@ TIM8 | | | | //------------------------- #define PIOS_MASTER_CLOCK 72000000 #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 diff --git a/flight/PiOS/Boards/STM32103CB_CC_Rev1.h b/flight/PiOS/Boards/STM32103CB_CC_Rev1.h index 09405bfa3..fcc868090 100644 --- a/flight/PiOS/Boards/STM32103CB_CC_Rev1.h +++ b/flight/PiOS/Boards/STM32103CB_CC_Rev1.h @@ -117,11 +117,6 @@ TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1 //------------------------- #define PIOS_MASTER_CLOCK 72000000 #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 diff --git a/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h b/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h index a4792a717..6811bfad5 100644 --- a/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h +++ b/flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h @@ -81,12 +81,6 @@ TIM4 | STOPWATCH | #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 diff --git a/flight/PiOS/Boards/STM3210E_INS.h b/flight/PiOS/Boards/STM3210E_INS.h index 22c94837b..5efb04a36 100644 --- a/flight/PiOS/Boards/STM3210E_INS.h +++ b/flight/PiOS/Boards/STM3210E_INS.h @@ -176,11 +176,6 @@ extern uint32_t pios_com_aux_id; //------------------------- #define PIOS_MASTER_CLOCK 72000000 #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 diff --git a/flight/PiOS/Boards/STM3210E_OP.h b/flight/PiOS/Boards/STM3210E_OP.h index 48653179c..b987ab600 100644 --- a/flight/PiOS/Boards/STM3210E_OP.h +++ b/flight/PiOS/Boards/STM3210E_OP.h @@ -203,11 +203,6 @@ extern uint32_t pios_com_spektrum_id; //------------------------- #define PIOS_MASTER_CLOCK 72000000 #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 diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld index 4f3c77d4c..d411c3e4f 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_BL_sections.ld @@ -5,6 +5,7 @@ SECTIONS { .text : { + PROVIDE (pios_isr_vector_table_base = .); KEEP(*(.isr_vector .isr_vector.*)) *(.text .text.* .gnu.linkonce.t.*) *(.glue_7t) *(.glue_7) diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld index 82a8ae7f4..13290908a 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_AHRS_sections.ld @@ -11,6 +11,7 @@ SECTIONS .text : { + PROVIDE (pios_isr_vector_table_base = .); KEEP(*(.isr_vector .isr_vector.*)) *(.text .text.* .gnu.linkonce.t.*) *(.glue_7t) *(.glue_7) diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_BL_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_BL_sections.ld index 13cd35df6..c16bd7af9 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_BL_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_BL_sections.ld @@ -10,6 +10,7 @@ SECTIONS { .text : { + PROVIDE (pios_isr_vector_table_base = .); KEEP(*(.isr_vector .isr_vector.*)) *(.text .text.* .gnu.linkonce.t.*) *(.glue_7t) *(.glue_7) diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_sections.ld index 6e46c43c5..2df4dd6c8 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_sections.ld @@ -16,6 +16,7 @@ SECTIONS .text : { + PROVIDE (pios_isr_vector_table_base = .); KEEP(*(.isr_vector .isr_vector.*)) *(.text .text.* .gnu.linkonce.t.*) *(.glue_7t) *(.glue_7) diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_BL_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_BL_sections.ld index 4b35cd71b..69eaadb8c 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_BL_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_BL_sections.ld @@ -10,6 +10,7 @@ SECTIONS { .text : { + PROVIDE (pios_isr_vector_table_base = .); KEEP(*(.isr_vector .isr_vector.*)) *(.text .text.* .gnu.linkonce.t.*) *(.glue_7t) *(.glue_7) diff --git a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_sections.ld b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_sections.ld index dc09e6f1c..fc51c7c43 100644 --- a/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM32103CB_PIPXTREME_sections.ld @@ -16,6 +16,7 @@ SECTIONS .text : { + PROVIDE (pios_isr_vector_table_base = .); KEEP(*(.isr_vector .isr_vector.*)) *(.text .text.* .gnu.linkonce.t.*) *(.glue_7t) *(.glue_7) diff --git a/flight/PiOS/STM32F10x/link_STM3210E_INS_BL_sections.ld b/flight/PiOS/STM32F10x/link_STM3210E_INS_BL_sections.ld index 33f06f700..1b3c11e34 100644 --- a/flight/PiOS/STM32F10x/link_STM3210E_INS_BL_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM3210E_INS_BL_sections.ld @@ -193,6 +193,7 @@ SECTIONS /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */ .isr_vector : { + PROVIDE (pios_isr_vector_table_base = .); KEEP(*(.isr_vector)) /* Startup code */ . = ALIGN(4); } > BL_FLASH diff --git a/flight/PiOS/STM32F10x/link_STM3210E_INS_sections.ld b/flight/PiOS/STM32F10x/link_STM3210E_INS_sections.ld index 4ed00bb76..2635737a8 100644 --- a/flight/PiOS/STM32F10x/link_STM3210E_INS_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM3210E_INS_sections.ld @@ -198,6 +198,7 @@ SECTIONS /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */ .isr_vector : { + PROVIDE (pios_isr_vector_table_base = .); KEEP(*(.isr_vector)) /* Startup code */ . = ALIGN(4); } > FLASH diff --git a/flight/PiOS/STM32F10x/link_STM3210E_OP_BL_sections.ld b/flight/PiOS/STM32F10x/link_STM3210E_OP_BL_sections.ld index 607866a0e..fa01b6c41 100644 --- a/flight/PiOS/STM32F10x/link_STM3210E_OP_BL_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM3210E_OP_BL_sections.ld @@ -166,6 +166,7 @@ SECTIONS /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */ .isr_vector : { + PROVIDE (pios_isr_vector_table_base = .); KEEP(*(.isr_vector)) /* Startup code */ . = ALIGN(4); } > BL_FLASH diff --git a/flight/PiOS/STM32F10x/link_STM3210E_OP_sections.ld b/flight/PiOS/STM32F10x/link_STM3210E_OP_sections.ld index 2292a40e2..cdee04df3 100644 --- a/flight/PiOS/STM32F10x/link_STM3210E_OP_sections.ld +++ b/flight/PiOS/STM32F10x/link_STM3210E_OP_sections.ld @@ -172,6 +172,7 @@ SECTIONS /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */ .isr_vector : { + PROVIDE (pios_isr_vector_table_base = .); KEEP(*(.isr_vector)) /* Startup code */ . = ALIGN(4); } >FLASH diff --git a/flight/PiOS/STM32F10x/pios_sys.c b/flight/PiOS/STM32F10x/pios_sys.c index 2170c7811..26e748171 100644 --- a/flight/PiOS/STM32F10x/pios_sys.c +++ b/flight/PiOS/STM32F10x/pios_sys.c @@ -186,7 +186,8 @@ int32_t PIOS_SYS_SerialNumberGet(char *str) void NVIC_Configuration(void) { /* Set the Vector Table base address as specified in .ld file */ - NVIC_SetVectorTable(PIOS_NVIC_VECTTAB_FLASH, 0x0); + extern void pios_isr_vector_table_base; + NVIC_SetVectorTable((uint32_t)&pios_isr_vector_table_base, 0x0); /* 4 bits for Interrupt priorities so no sub priorities */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); diff --git a/flight/PipXtreme/Makefile b/flight/PipXtreme/Makefile index 456963842..62ea87d73 100644 --- a/flight/PipXtreme/Makefile +++ b/flight/PipXtreme/Makefile @@ -247,7 +247,6 @@ DEBUGF = dwarf-2 CDEFS = -DSTM32F10X_$(MODEL) CDEFS += -DUSE_STDPERIPH_DRIVER CDEFS += -DUSE_$(BOARD) -CDEFS += -DUSE_BOOTLOADER # Place project-specific -D and/or -U options for # Assembler with preprocessor here.