From 9973fda23bee81a8f1188a958d1cb4cf89e8adfb Mon Sep 17 00:00:00 2001 From: Stacey Sheldon Date: Tue, 24 May 2011 00:08:03 -0400 Subject: [PATCH] build: define bootloader and firmware bank spans The board-info.mk files now define the start and size of the bootloader and the firmware banks. --- flight/AHRS/Makefile | 4 ++-- flight/Bootloaders/AHRS/Makefile | 8 +++++--- flight/Bootloaders/CopterControl/Makefile | 8 +++++--- flight/Bootloaders/OpenPilot/Makefile | 8 +++++--- flight/Bootloaders/PipXtreme/Makefile | 10 ++++++---- flight/CopterControl/Makefile | 4 ++-- flight/OpenPilot/Makefile | 4 ++-- flight/PiOS/Common/pios_board_info.c | 8 ++++---- flight/PipXtreme/Makefile | 4 ++-- make/boards/ahrs/board-info.mk | 9 +++++++-- make/boards/coptercontrol/board-info.mk | 9 +++++++-- make/boards/openpilot/board-info.mk | 9 +++++++-- make/boards/pipxtreme/board-info.mk | 13 ++++++++++--- 13 files changed, 64 insertions(+), 34 deletions(-) diff --git a/flight/AHRS/Makefile b/flight/AHRS/Makefile index 903d6901f..c203fdd59 100644 --- a/flight/AHRS/Makefile +++ b/flight/AHRS/Makefile @@ -292,9 +292,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin # Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin" +OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" # Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin" +OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" # reset target OOCD_CL+=-c "reset run" # terminate OOCD after programming diff --git a/flight/Bootloaders/AHRS/Makefile b/flight/Bootloaders/AHRS/Makefile index 10f184f96..1df91a1ab 100644 --- a/flight/Bootloaders/AHRS/Makefile +++ b/flight/Bootloaders/AHRS/Makefile @@ -204,7 +204,9 @@ BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE) BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION) -BLONLY_CDEFS += -DSTART_OF_USER_CODE=$(START_OF_FW_CODE) +BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE) +BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE) +BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE) # Place project-specific -D and/or -U options for # Assembler with preprocessor here. @@ -291,9 +293,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin # Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin" +OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" # Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin" +OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" # reset target OOCD_CL+=-c "reset run" # terminate OOCD after programming diff --git a/flight/Bootloaders/CopterControl/Makefile b/flight/Bootloaders/CopterControl/Makefile index fe83ceb66..413749cca 100644 --- a/flight/Bootloaders/CopterControl/Makefile +++ b/flight/Bootloaders/CopterControl/Makefile @@ -257,7 +257,9 @@ BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE) BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION) -BLONLY_CDEFS += -DSTART_OF_USER_CODE=$(START_OF_FW_CODE) +BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE) +BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE) +BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE) # Place project-specific -D and/or -U options for # Assembler with preprocessor here. @@ -343,9 +345,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin # Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin" +OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" # Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin" +OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" # reset target OOCD_CL+=-c "reset run" # terminate OOCD after programming diff --git a/flight/Bootloaders/OpenPilot/Makefile b/flight/Bootloaders/OpenPilot/Makefile index 23b3ffa8b..1167693b3 100644 --- a/flight/Bootloaders/OpenPilot/Makefile +++ b/flight/Bootloaders/OpenPilot/Makefile @@ -260,7 +260,9 @@ BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE) BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION) -BLONLY_CDEFS += -DSTART_OF_USER_CODE=$(START_OF_FW_CODE) +BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE) +BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE) +BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE) # Place project-specific -D and/or -U options for # Assembler with preprocessor here. @@ -346,9 +348,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin # Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin" +OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" # Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin" +OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" # reset target OOCD_CL+=-c "reset run" # terminate OOCD after programming diff --git a/flight/Bootloaders/PipXtreme/Makefile b/flight/Bootloaders/PipXtreme/Makefile index dd4a1ce43..c91713cd9 100644 --- a/flight/Bootloaders/PipXtreme/Makefile +++ b/flight/Bootloaders/PipXtreme/Makefile @@ -255,8 +255,10 @@ endif BLONLY_CDEFS += -DBOARD_TYPE=$(BOARD_TYPE) BLONLY_CDEFS += -DBOARD_REVISION=$(BOARD_REVISION) BLONLY_CDEFS += -DHW_TYPE=$(HW_TYPE) -BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION)C -BLONLY_CDEFS += -DSTART_OF_USER_CODE=$(START_OF_FW_CODE) +BLONLY_CDEFS += -DBOOTLOADER_VERSION=$(BOOTLOADER_VERSION) +BLONLY_CDEFS += -DFW_BANK_BASE=$(FW_BANK_BASE) +BLONLY_CDEFS += -DFW_BANK_SIZE=$(FW_BANK_SIZE) +BLONLY_CDEFS += -DFW_DESC_SIZE=$(FW_DESC_SIZE) # Place project-specific -D and/or -U options for # Assembler with preprocessor here. @@ -342,9 +344,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin # Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin" +OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" # Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_BL_CODE) bin" +OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" # reset target OOCD_CL+=-c "reset run" # terminate OOCD after programming diff --git a/flight/CopterControl/Makefile b/flight/CopterControl/Makefile index b56e40fe3..942bc45a9 100644 --- a/flight/CopterControl/Makefile +++ b/flight/CopterControl/Makefile @@ -468,9 +468,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin # Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin" +OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" # Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin" +OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" # reset target OOCD_CL+=-c "reset run" # terminate OOCD after programming diff --git a/flight/OpenPilot/Makefile b/flight/OpenPilot/Makefile index 5022ab101..c14a4381c 100644 --- a/flight/OpenPilot/Makefile +++ b/flight/OpenPilot/Makefile @@ -444,9 +444,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin # Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin" +OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" # Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin" +OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" # reset target OOCD_CL+=-c "reset run" # terminate OOCD after programming diff --git a/flight/PiOS/Common/pios_board_info.c b/flight/PiOS/Common/pios_board_info.c index db9e72f9e..f94ac1f96 100644 --- a/flight/PiOS/Common/pios_board_info.c +++ b/flight/PiOS/Common/pios_board_info.c @@ -9,8 +9,8 @@ const struct pios_board_info __attribute__((__used__)) __attribute__((__section_ .board_rev = BOARD_REVISION, .bl_rev = BOOTLOADER_VERSION, .hw_type = HW_TYPE, - .fw_base = START_OF_USER_CODE, - .fw_size = SIZE_OF_CODE, - .desc_base = START_OF_USER_CODE + SIZE_OF_CODE, - .desc_size = SIZE_OF_DESCRIPTION, + .fw_base = FW_BANK_BASE, + .fw_size = FW_BANK_SIZE - FW_DESC_SIZE, + .desc_base = FW_BANK_BASE + FW_BANK_SIZE - FW_DESC_SIZE, + .desc_size = FW_DESC_SIZE, }; diff --git a/flight/PipXtreme/Makefile b/flight/PipXtreme/Makefile index 62ea87d73..57dbfb8f0 100644 --- a/flight/PipXtreme/Makefile +++ b/flight/PipXtreme/Makefile @@ -331,9 +331,9 @@ LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin # Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin" +OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" # Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(START_OF_FW_CODE) bin" +OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" # reset target OOCD_CL+=-c "reset run" # terminate OOCD after programming diff --git a/make/boards/ahrs/board-info.mk b/make/boards/ahrs/board-info.mk index 049e27b63..2103357ba 100644 --- a/make/boards/ahrs/board-info.mk +++ b/make/boards/ahrs/board-info.mk @@ -9,5 +9,10 @@ BOARD := STM32103CB_AHRS MODEL := MD MODEL_SUFFIX := -START_OF_BL_CODE := 0x08000000 -START_OF_FW_CODE := 0x08002000 +# Note: These must match the values in link_$(BOARD)_memory.ld +BL_BANK_BASE := 0x08000000 # Start of bootloader flash +BL_BANK_SIZE := 0x00002000 # Should include BD_INFO region +FW_BANK_BASE := 0x08002000 # Start of firmware flash +FW_BANK_SIZE := 0x0001E000 # Should include FW_DESC_SIZE + +FW_DESC_SIZE := 0x00000064 diff --git a/make/boards/coptercontrol/board-info.mk b/make/boards/coptercontrol/board-info.mk index 9968b2eec..8d3f5d196 100644 --- a/make/boards/coptercontrol/board-info.mk +++ b/make/boards/coptercontrol/board-info.mk @@ -9,5 +9,10 @@ BOARD := STM32103CB_CC_Rev1 MODEL := MD MODEL_SUFFIX := _CC -START_OF_BL_CODE := 0x08000000 -START_OF_FW_CODE := 0x08003000 +# Note: These must match the values in link_$(BOARD)_memory.ld +BL_BANK_BASE := 0x08000000 # Start of bootloader flash +BL_BANK_SIZE := 0x00003000 # Should include BD_INFO region +FW_BANK_BASE := 0x08003000 # Start of firmware flash +FW_BANK_SIZE := 0x0001D000 # Should include FW_DESC_SIZE + +FW_DESC_SIZE := 0x00000064 diff --git a/make/boards/openpilot/board-info.mk b/make/boards/openpilot/board-info.mk index 271083c89..f1e35505c 100644 --- a/make/boards/openpilot/board-info.mk +++ b/make/boards/openpilot/board-info.mk @@ -9,5 +9,10 @@ BOARD := STM3210E_OP MODEL := HD MODEL_SUFFIX := _OP -START_OF_BL_CODE := 0x08000000 -START_OF_FW_CODE := 0x08005000 +# Note: These must match the values in link_$(BOARD)_memory.ld +BL_BANK_BASE := 0x08000000 # Start of bootloader flash +BL_BANK_SIZE := 0x00005000 # Should include BD_INFO region +FW_BANK_BASE := 0x08005000 # Start of firmware flash +FW_BANK_SIZE := 0x0007B000 # Should include FW_DESC_SIZE + +FW_DESC_SIZE := 0x00000064 diff --git a/make/boards/pipxtreme/board-info.mk b/make/boards/pipxtreme/board-info.mk index a2912ac37..f9635109e 100644 --- a/make/boards/pipxtreme/board-info.mk +++ b/make/boards/pipxtreme/board-info.mk @@ -1,7 +1,7 @@ BOARD_TYPE := 0x03 BOARD_REVISION := 0x01 BOOTLOADER_VERSION := 0x00 -HW_TYPE := 0x00 +HW_TYPE := 0x01 MCU := cortex-m3 CHIP := STM32F103CBT @@ -9,5 +9,12 @@ BOARD := STM32103CB_PIPXTREME MODEL := MD MODEL_SUFFIX := -START_OF_BL_CODE := 0x08000000 -START_OF_FW_CODE := 0x08003000 +# Note: These must match the values in link_$(BOARD)_memory.ld +BL_BANK_BASE := 0x08000000 # Start of bootloader flash +BL_BANK_SIZE := 0x00003000 # Should include BD_INFO region +FW_BANK_BASE := 0x08003000 # Start of firmware flash +FW_BANK_SIZE := 0x0001CC00 # Should include FW_DESC_SIZE +EE_BANK_BASE := 0x0801FC00 # EEPROM storage area +EE_BANK_SIZE := 0x00000400 # Size of EEPROM storage area + +FW_DESC_SIZE := 0x00000064