From 328b3b5feedaa9c5e707d7679cdba79c0bbd5b66 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Wed, 18 May 2011 12:59:27 -0500 Subject: [PATCH] OP-378: Update INS bootloader to new format --- flight/Bootloaders/INS/Makefile | 63 ++++++-------- .../OpenPilotOSX.xcodeproj/project.pbxproj | 83 +++++++++++++++++++ 2 files changed, 109 insertions(+), 37 deletions(-) diff --git a/flight/Bootloaders/INS/Makefile b/flight/Bootloaders/INS/Makefile index 195680176..ca33f25b8 100644 --- a/flight/Bootloaders/INS/Makefile +++ b/flight/Bootloaders/INS/Makefile @@ -29,7 +29,6 @@ include $(TOP)/make/firmware-defs.mk # Set developer code and compile options # Set to YES for debugging DEBUG ?= NO -OVERRIDE USE_BOOTLOADER = NO # Set to YES when using Code Sourcery toolchain CODE_SOURCERY ?= YES @@ -203,9 +202,6 @@ DEBUGF = dwarf-2 CDEFS = -DSTM32F10X_$(MODEL) CDEFS += -DUSE_STDPERIPH_DRIVER CDEFS += -DUSE_$(BOARD) -ifeq ($(USE_BOOTLOADER), YES) -CDEFS += -DUSE_BOOTLOADER -endif # Place project-specific -D and/or -U options for # Assembler with preprocessor here. #ADEFS = -DUSE_IRQ_ASM_WRAPPER @@ -232,9 +228,10 @@ CSTANDARD = -std=gnu99 # Flags for C and C++ (arm-elf-gcc/arm-elf-g++) ifeq ($(DEBUG),YES) -CFLAGS = -g$(DEBUGF) +CFLAGS = endif +CFLAGS += -g$(DEBUGF) CFLAGS += -O$(OPT) ifeq ($(DEBUG),NO) CFLAGS += -fdata-sections -ffunction-sections @@ -275,7 +272,7 @@ MATH_LIB = -lm # --cref: add cross reference to map file LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections ifeq ($(DEBUG),NO) -LDFLAGS += -Wl,-static -Wl,-s +LDFLAGS += -Wl,-static endif LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS)) LDFLAGS += -lc @@ -284,41 +281,19 @@ 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)_memory.ld +LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld -# --------------------------------------------------------------------------- -# Options for OpenOCD flash-programming -# see openocd.pdf/openocd.texi for further information -# -OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf -# if OpenOCD is in the $PATH just set OPENOCDEXE=openocd -OOCD_EXE=openocd -# debug level -OOCD_CL=-d0 -# interface and board/target settings (using the OOCD target-library here) -UNAME := $(shell uname) -ifeq ($(UNAME), Darwin) - OOCD_CL+=-f ../../Project/OpenOCD/floss-jtag.ahrs.osx.cfg -f ../../Project/OpenOCD/stm32.cfg -else - OOCD_CL+=-f ../../Project/OpenOCD/floss-jtag.ahrs.cfg -f ../../Project/OpenOCD/stm32.cfg -endif -# initialize -OOCD_CL+=-c init -# show the targets -OOCD_CL+=-c targets -# commands to prepare flash-write -OOCD_CL+= -c "reset halt" -# flash erase -OOCD_CL+=-c "stm32x mass_erase 0" -# flash-write -OOCD_CL+=-c "flash write_image $(OOCD_LOADFILE)" +OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin +# Program +OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) 0x08000000 bin" # Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE)" +OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) 0x08000000 bin" # reset target OOCD_CL+=-c "reset run" # terminate OOCD after programming OOCD_CL+=-c shutdown -# --------------------------------------------------------------------------- + # Define programs and commands. @@ -359,7 +334,7 @@ endif # Program the device. ifeq ($(FLASH_TOOL),OPENOCD) # Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". -program: $(OUTDIR)/$(TARGET).elf +program: $(OUTDIR)/$(TARGET).bin @echo "Programming with OPENOCD" $(OOCD_EXE) $(OOCD_CL) endif @@ -391,12 +366,15 @@ $(eval $(call PARTIAL_COMPILE_TEMPLATE, SRC)) # Compile: create assembler files from C source files. ARM only $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) +$(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin + .PHONY: elf lss sym hex bin elf: $(OUTDIR)/$(TARGET).elf lss: $(OUTDIR)/$(TARGET).lss sym: $(OUTDIR)/$(TARGET).sym hex: $(OUTDIR)/$(TARGET).hex bin: $(OUTDIR)/$(TARGET).bin +bino: $(OUTDIR)/$(TARGET).bin.o # Display sizes of sections. $(eval $(call SIZE_TEMPLATE, $(OUTDIR)/$(TARGET).elf)) @@ -407,6 +385,16 @@ size: $(OUTDIR)/$(TARGET).elf_size docs: doxygen $(DOXYGENDIR)/doxygen.cfg +# Install: install binary file with prefix/suffix into install directory +install: $(OUTDIR)/$(TARGET).bin +ifneq ($(INSTALL_DIR),) + @echo $(MSG_INSTALLING) $(call toprel, $<) + $(V1) mkdir -p $(INSTALL_DIR) + $(V1) $(INSTALL) $< $(INSTALL_DIR)/$(INSTALL_PFX)$(TARGET)$(INSTALL_SFX).bin +else + $(error INSTALL_DIR must be specified for $@) +endif + # Target: clean project. clean: clean_list @@ -418,6 +406,7 @@ clean_list : $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).sym $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).lss + $(V1) $(REMOVE) $(OUTDIR)/$(TARGET).bin.o $(V1) $(REMOVE) $(ALLOBJ) $(V1) $(REMOVE) $(LSTFILES) $(V1) $(REMOVE) $(DEPFILES) @@ -443,4 +432,4 @@ else endif # Listing of phony targets. -.PHONY : all build clean clean_list program +.PHONY : all build clean clean_list program install diff --git a/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj b/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj index 7095dfad5..079febe25 100644 --- a/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj +++ b/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj @@ -100,6 +100,31 @@ 6589A983131DE24F006BD67C /* taskmonitor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = taskmonitor.c; sourceTree = ""; }; 6589A9DB131DEE76006BD67C /* pios_rtc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_rtc.c; sourceTree = ""; }; 6589A9E2131DF1C7006BD67C /* pios_rtc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_rtc.h; sourceTree = ""; }; + 6598854A13843E81006777AA /* ahrs_slave_test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_slave_test.c; sourceTree = ""; }; + 6598854B13843E81006777AA /* ahrs_spi_program.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_spi_program.c; sourceTree = ""; }; + 6598854C13843E81006777AA /* ahrs_spi_program_master.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_spi_program_master.c; sourceTree = ""; }; + 6598854D13843E81006777AA /* ahrs_spi_program_slave.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_spi_program_slave.c; sourceTree = ""; }; + 6598854E13843E81006777AA /* bl_fsm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bl_fsm.c; sourceTree = ""; }; + 6598855013843E81006777AA /* ahrs_spi_program.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_spi_program.h; sourceTree = ""; }; + 6598855113843E81006777AA /* ahrs_spi_program_master.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_spi_program_master.h; sourceTree = ""; }; + 6598855213843E81006777AA /* ahrs_spi_program_slave.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_spi_program_slave.h; sourceTree = ""; }; + 6598855313843E81006777AA /* bl_fsm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bl_fsm.h; sourceTree = ""; }; + 6598855413843E81006777AA /* ins_bl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ins_bl.h; sourceTree = ""; }; + 6598855513843E81006777AA /* pios_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_config.h; sourceTree = ""; }; + 6598855613843E81006777AA /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; + 6598855713843E81006777AA /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 6598855813843E81006777AA /* pios_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_board.c; sourceTree = ""; }; + 6598855A13843E91006777AA /* ahrs_timer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_timer.c; sourceTree = ""; }; + 6598855C13843E91006777AA /* ahrs_timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_timer.h; sourceTree = ""; }; + 6598855D13843E91006777AA /* ins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ins.h; sourceTree = ""; }; + 6598855E13843E91006777AA /* ins_fsm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ins_fsm.h; sourceTree = ""; }; + 6598855F13843E91006777AA /* insgps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = insgps.h; sourceTree = ""; }; + 6598856013843E91006777AA /* pios_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_config.h; sourceTree = ""; }; + 6598856113843E91006777AA /* ins.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ins.c; sourceTree = ""; }; + 6598856213843E91006777AA /* insgps13state.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = insgps13state.c; sourceTree = ""; }; + 6598856313843E91006777AA /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 6598856413843E91006777AA /* pios_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pios_board.c; sourceTree = ""; }; + 6598856513843E91006777AA /* test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = test.c; sourceTree = ""; }; 659ED317122226B60011010E /* ahrssettings.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = ahrssettings.xml; sourceTree = ""; }; 65B35D7F121C261E003EAD18 /* bin.pro */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bin.pro; sourceTree = ""; }; 65B35D80121C261E003EAD18 /* openpilotgcs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = openpilotgcs; sourceTree = ""; }; @@ -3553,6 +3578,7 @@ 657CEEB5121DBC49007A1FBE /* flight */ = { isa = PBXGroup; children = ( + 6598855913843E91006777AA /* INS */, 65FF4BB313791C3300146BE4 /* Bootloaders */, 65F93B9012EE09280047DB36 /* PipXtreme */, 65B7E6AC120DF1CD000C1123 /* AHRS */, @@ -3597,6 +3623,62 @@ path = inc; sourceTree = ""; }; + 6598854913843E81006777AA /* INS */ = { + isa = PBXGroup; + children = ( + 6598854A13843E81006777AA /* ahrs_slave_test.c */, + 6598854B13843E81006777AA /* ahrs_spi_program.c */, + 6598854C13843E81006777AA /* ahrs_spi_program_master.c */, + 6598854D13843E81006777AA /* ahrs_spi_program_slave.c */, + 6598854E13843E81006777AA /* bl_fsm.c */, + 6598854F13843E81006777AA /* inc */, + 6598855613843E81006777AA /* main.c */, + 6598855713843E81006777AA /* Makefile */, + 6598855813843E81006777AA /* pios_board.c */, + ); + path = INS; + sourceTree = ""; + }; + 6598854F13843E81006777AA /* inc */ = { + isa = PBXGroup; + children = ( + 6598855013843E81006777AA /* ahrs_spi_program.h */, + 6598855113843E81006777AA /* ahrs_spi_program_master.h */, + 6598855213843E81006777AA /* ahrs_spi_program_slave.h */, + 6598855313843E81006777AA /* bl_fsm.h */, + 6598855413843E81006777AA /* ins_bl.h */, + 6598855513843E81006777AA /* pios_config.h */, + ); + path = inc; + sourceTree = ""; + }; + 6598855913843E91006777AA /* INS */ = { + isa = PBXGroup; + children = ( + 6598855A13843E91006777AA /* ahrs_timer.c */, + 6598855B13843E91006777AA /* inc */, + 6598856113843E91006777AA /* ins.c */, + 6598856213843E91006777AA /* insgps13state.c */, + 6598856313843E91006777AA /* Makefile */, + 6598856413843E91006777AA /* pios_board.c */, + 6598856513843E91006777AA /* test.c */, + ); + name = INS; + path = ../../INS; + sourceTree = SOURCE_ROOT; + }; + 6598855B13843E91006777AA /* inc */ = { + isa = PBXGroup; + children = ( + 6598855C13843E91006777AA /* ahrs_timer.h */, + 6598855D13843E91006777AA /* ins.h */, + 6598855E13843E91006777AA /* ins_fsm.h */, + 6598855F13843E91006777AA /* insgps.h */, + 6598856013843E91006777AA /* pios_config.h */, + ); + path = inc; + sourceTree = ""; + }; 65B35D7D121C261E003EAD18 /* ground */ = { isa = PBXGroup; children = ( @@ -8292,6 +8374,7 @@ 65FF4BB313791C3300146BE4 /* Bootloaders */ = { isa = PBXGroup; children = ( + 6598854913843E81006777AA /* INS */, 65FF4BB413791C3300146BE4 /* AHRS */, 65FF4BC413791C3300146BE4 /* BootloaderUpdater */, 65FF4BCB13791C3300146BE4 /* CopterControl */,