From 2f0060456b3cb75e04cf89547bfb031ad8dc1af3 Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Tue, 17 Dec 2013 17:15:01 +0100 Subject: [PATCH] [flash modes] change some mode names and luftboot unused by default --- conf/Makefile.stm32 | 14 ++++---- conf/Makefile.stm32-upload | 37 +++++++++++---------- conf/airframes/CDW/DualBoardApFbw.xml | 1 - conf/airframes/examples/separate_fbw_ap.xml | 2 -- conf/boards/apogee_0.99.makefile | 7 ++-- conf/boards/apogee_1.0.makefile | 7 ++-- conf/boards/lia_1.1.makefile | 2 +- conf/boards/lisa_l_1.0.makefile | 1 - conf/boards/lisa_l_1.1.makefile | 1 - conf/boards/lisa_m_1.0.makefile | 3 -- conf/boards/lisa_m_2.0.makefile | 2 +- conf/control_panel_example.xml | 33 ------------------ conf/flash_modes.xml | 32 ++++++++++++++++++ sw/supervision/pc_control_panel.ml | 9 +++-- 14 files changed, 72 insertions(+), 79 deletions(-) create mode 100644 conf/flash_modes.xml diff --git a/conf/Makefile.stm32 b/conf/Makefile.stm32 index ba400c1769..e2658e9e2f 100644 --- a/conf/Makefile.stm32 +++ b/conf/Makefile.stm32 @@ -68,15 +68,15 @@ else OOCD_BOARD = $($(TARGET).OOCD_BOARD) endif -# default: assume the luftboot bootloader is used -# if luftboot is not used define NO_LUFTBOOT to a value != 0 -OOCD_START_SECTOR = 4 -ASSUMING_LUFTBOOT = "yes" -ifdef NO_LUFTBOOT -$(shell echo luftboot: $(NO_LUFTBOOT)) -ifneq ($(NO_LUFTBOOT),0) +# default: assume the luftboot bootloader is not used +# if luftboot is used define HAS_LUFTBOOT to a value != 0 OOCD_START_SECTOR = 0 ASSUMING_LUFTBOOT = "no" +ifdef HAS_LUFTBOOT +$(shell echo luftboot: $(HAS_LUFTBOOT)) +ifneq ($(HAS_LUFTBOOT),0) +OOCD_START_SECTOR = 4 +ASSUMING_LUFTBOOT = "yes" endif endif diff --git a/conf/Makefile.stm32-upload b/conf/Makefile.stm32-upload index d19b0e6f36..012157448a 100644 --- a/conf/Makefile.stm32-upload +++ b/conf/Makefile.stm32-upload @@ -27,14 +27,6 @@ # check which flash mode is configured # ifeq ($(FLASH_MODE),DFU) -ifeq ($(DFU_UTIL),y) -# -# DFU flash mode using dfu-util -DFU_ADDR ?= 0x08000000 -upload: $(OBJDIR)/$(TARGET).bin - @echo "Using dfu-util at $(DFU_ADDR)" - $(Q)dfu-util -d 0483:df11 -c 1 -i 0 -a 0 -s $(DFU_ADDR) -D $^ -else # # DFU flash mode paparazzi stm32_mem ifdef DFU_ADDR @@ -46,7 +38,15 @@ endif upload: $(OBJDIR)/$(TARGET).bin @echo "Using stm32 mem dfu loader" $(PYTHON) $(PAPARAZZI_SRC)/sw/tools/dfu/stm32_mem.py $(DFU_PRODUCT_CMD) $(DFU_ADDR_CMD) $^ -endif + + +else ifeq ($(FLASH_MODE),DFU-UTIL) +# +# DFU flash mode using dfu-util +DFU_ADDR ?= 0x08000000 +upload: $(OBJDIR)/$(TARGET).bin + @echo "Using dfu-util at $(DFU_ADDR)" + $(Q)dfu-util -d 0483:df11 -c 1 -i 0 -a 0 -s $(DFU_ADDR) -D $^ # # serial flash mode @@ -88,15 +88,9 @@ upload: $(OBJDIR)/$(TARGET).elf $< endif # -# SWD flash mode +# SWD flash mode (with Black Magic Probe) else ifeq ($(FLASH_MODE),SWD) # only works if BMP_PORT is defined -ifeq ($(STLINK),y) -STLINK_ADDR ?= 0x08000000 -upload: $(OBJDIR)/$(TARGET).bin - @echo "Using ST-LINK with SWD at $(STLINK_ADDR)" - $(Q)st-flash write $^ $(STLINK_ADDR) -else BMP_PORT ?= /dev/ttyACM0 BMP_UPLOAD_SCRIPT ?= $(PAPARAZZI_SRC)/sw/tools/flash_scripts/bmp_swd_flash.scr upload: $(OBJDIR)/$(TARGET).elf @@ -108,7 +102,16 @@ upload: $(OBJDIR)/$(TARGET).elf -ex 'target extended-remote $(BMP_PORT)' \ -x $(BMP_UPLOAD_SCRIPT) \ $< -endif + +# +# SWD flash mode (with STLINK) +else ifeq ($(FLASH_MODE),STLINK) +STLINK_ADDR ?= 0x08000000 +upload: $(OBJDIR)/$(TARGET).bin + @echo "Using ST-LINK with SWD at $(STLINK_ADDR)" + $(Q)st-flash write $^ $(STLINK_ADDR) + +else # # no known flash mode else diff --git a/conf/airframes/CDW/DualBoardApFbw.xml b/conf/airframes/CDW/DualBoardApFbw.xml index 8a6369ae3c..9b5d1a1bd9 100644 --- a/conf/airframes/CDW/DualBoardApFbw.xml +++ b/conf/airframes/CDW/DualBoardApFbw.xml @@ -276,7 +276,6 @@ - diff --git a/conf/airframes/examples/separate_fbw_ap.xml b/conf/airframes/examples/separate_fbw_ap.xml index be66561fd3..c87ff57ee6 100644 --- a/conf/airframes/examples/separate_fbw_ap.xml +++ b/conf/airframes/examples/separate_fbw_ap.xml @@ -234,7 +234,6 @@ - @@ -264,7 +263,6 @@ - diff --git a/conf/boards/apogee_0.99.makefile b/conf/boards/apogee_0.99.makefile index 48cb8646b8..2678e462a4 100644 --- a/conf/boards/apogee_0.99.makefile +++ b/conf/boards/apogee_0.99.makefile @@ -18,11 +18,8 @@ $(TARGET).LDSCRIPT=$(SRC_ARCH)/apogee.ld HARD_FLOAT=yes # default flash mode is via usb dfu bootloader -# possibilities: DFU, SWD -FLASH_MODE ?= DFU -STLINK ?= y -DFU_UTIL ?= y -NO_LUFTBOOT ?= 1 +# possibilities: DFU-UTIL, SWD, STLINK +FLASH_MODE ?= DFU-UTIL # # default LED configuration diff --git a/conf/boards/apogee_1.0.makefile b/conf/boards/apogee_1.0.makefile index c00f2fe68e..ed3adf0f4b 100644 --- a/conf/boards/apogee_1.0.makefile +++ b/conf/boards/apogee_1.0.makefile @@ -18,11 +18,8 @@ $(TARGET).LDSCRIPT=$(SRC_ARCH)/apogee.ld HARD_FLOAT=yes # default flash mode is via usb dfu bootloader -# possibilities: DFU, SWD -FLASH_MODE ?= DFU -STLINK ?= y -DFU_UTIL ?= y -NO_LUFTBOOT ?= 1 +# possibilities: DFU-UTIL, SWD, STLINK +FLASH_MODE ?= DFU-UTIL # # default LED configuration diff --git a/conf/boards/lia_1.1.makefile b/conf/boards/lia_1.1.makefile index a401b071fd..dee7b43d91 100644 --- a/conf/boards/lia_1.1.makefile +++ b/conf/boards/lia_1.1.makefile @@ -24,7 +24,7 @@ FLASH_MODE = DFU #FLASH_MODE = SERIAL endif -ifndef NO_LUFTBOOT +ifdef HAS_LUFTBOOT $(TARGET).CFLAGS+=-DLUFTBOOT $(TARGET).LDFLAGS+=-Wl,-Ttext=0x8002000 endif diff --git a/conf/boards/lisa_l_1.0.makefile b/conf/boards/lisa_l_1.0.makefile index e1c335df1d..5b7aea61ec 100644 --- a/conf/boards/lisa_l_1.0.makefile +++ b/conf/boards/lisa_l_1.0.makefile @@ -9,7 +9,6 @@ BOARD=lisa_l BOARD_VERSION=1.0 BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\" $(TARGET).LDSCRIPT=$(SRC_ARCH)/lisa-l.ld -NO_LUFTBOOT=1 # ----------------------------------------------------------------------- ifeq ($(BOARD_PROCESSOR),'omap') diff --git a/conf/boards/lisa_l_1.1.makefile b/conf/boards/lisa_l_1.1.makefile index 28832c4334..8dc046d22c 100644 --- a/conf/boards/lisa_l_1.1.makefile +++ b/conf/boards/lisa_l_1.1.makefile @@ -12,7 +12,6 @@ BOARD=lisa_l BOARD_VERSION=1.0 BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\" $(TARGET).LDSCRIPT=$(SRC_ARCH)/lisa-l.ld -NO_LUFTBOOT=1 # ----------------------------------------------------------------------- ifeq ($(BOARD_PROCESSOR),'omap') diff --git a/conf/boards/lisa_m_1.0.makefile b/conf/boards/lisa_m_1.0.makefile index de6245ef31..dc6681fab6 100644 --- a/conf/boards/lisa_m_1.0.makefile +++ b/conf/boards/lisa_m_1.0.makefile @@ -8,9 +8,6 @@ BOARD=lisa_m BOARD_VERSION=1.0 BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\" -ifndef NO_LUFTBOOT -NO_LUFTBOOT=1 -endif ARCH=stm32 $(TARGET).ARCHDIR = $(ARCH) diff --git a/conf/boards/lisa_m_2.0.makefile b/conf/boards/lisa_m_2.0.makefile index 52b1ce8667..fb654de825 100644 --- a/conf/boards/lisa_m_2.0.makefile +++ b/conf/boards/lisa_m_2.0.makefile @@ -22,7 +22,7 @@ $(TARGET).LDSCRIPT=$(SRC_ARCH)/lisa-m.ld # other possibilities: JTAG, SWD, SERIAL FLASH_MODE ?= DFU -ifndef NO_LUFTBOOT +ifdef HAS_LUFTBOOT $(TARGET).CFLAGS+=-DLUFTBOOT $(TARGET).LDFLAGS+=-Wl,-Ttext=0x8002000 endif diff --git a/conf/control_panel_example.xml b/conf/control_panel_example.xml index 4fb578f591..0fff6d19eb 100644 --- a/conf/control_panel_example.xml +++ b/conf/control_panel_example.xml @@ -11,39 +11,6 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
diff --git a/conf/flash_modes.xml b/conf/flash_modes.xml new file mode 100644 index 0000000000..c3d24c60af --- /dev/null +++ b/conf/flash_modes.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/supervision/pc_control_panel.ml b/sw/supervision/pc_control_panel.ml index 39071925a1..fb2a1c3228 100644 --- a/sw/supervision/pc_control_panel.ml +++ b/sw/supervision/pc_control_panel.ml @@ -55,10 +55,15 @@ let sessions = (Xml.children s); h +let flash_modes_xml_file = Utils.conf_dir // "flash_modes.xml" +let flash_mode_xml = ExtXml.parse_file flash_modes_xml_file let flash_modes = let modes = Hashtbl.create 7 in (* table mode -> options *) let boards = Hashtbl.create 7 in (* table board -> modes *) - let s = ExtXml.child ~select:(fun x -> Xml.attrib x "name" = "flash_modes") control_panel_xml "section" in + let fm_common = Xml.children flash_mode_xml in (* common modes in dedicated file *) + let fm_custom = try + Xml.children (ExtXml.child ~select:(fun x -> Xml.attrib x "name" = "flash_modes") control_panel_xml "section") with + _ -> [] in (* custom mode can be added to personal control_panel.xml file *) List.iter (fun m -> let mode = Xml.attrib m "name" in (* list of boards *) @@ -76,7 +81,7 @@ let flash_modes = (* add the new mode with together with the old ones *) Hashtbl.replace boards b ([mode] @ _modes) ) board_list; - ) (Xml.children s); + ) (fm_common @ fm_custom); modes, boards