From 89031af4fdb06263ac11bb7cbd9827c73f211d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 29 Apr 2019 15:40:37 +0200 Subject: [PATCH] [ion] device/usb: add comment on how to turn dfu.bin into dfu.o --- ion/src/device/shared/usb/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ion/src/device/shared/usb/Makefile b/ion/src/device/shared/usb/Makefile index ba324e3d5..d4f52d3e0 100644 --- a/ion/src/device/shared/usb/Makefile +++ b/ion/src/device/shared/usb/Makefile @@ -76,6 +76,14 @@ dfu_src += $(addprefix ion/src/device/shared/drivers/, \ $(BUILD_DIR)/ion/src/device/shared/usb/dfu.elf: LDSCRIPT = ion/src/device/$(MODEL)/usb/dfu.ld $(BUILD_DIR)/ion/src/device/shared/usb/dfu.elf: $(call object_for,$(usb_src) $(dfu_src)) +# In order to link the dfu bootloader inside the epsilon firmware, we need to +# turn the dfu binary (dfu.bin) into an elf object. +# By default, 'objcpy' generates a section 'data' and two symbols to the +# start and the end of the binary input respectively named: +# - '_binary_[file name]_[file extension]_start' +# - '_binary_[file name]_[file extension]_end'. +# For our purpose, dfu.o can go in rodata section and we rename the start and +# end of binary symbols: _dfu_bootloader_flash_[start/end] $(BUILD_DIR)/ion/src/device/shared/usb/dfu.o: $(BUILD_DIR)/ion/src/device/shared/usb/dfu.bin @echo "OBJCOPY $@" $(Q) cd $(dir $<) ; $(OBJCOPY) -I binary -O elf32-littlearm -B arm --rename-section .data=.rodata --redefine-sym _binary_dfu_bin_start=_dfu_bootloader_flash_start --redefine-sym _binary_dfu_bin_end=_dfu_bootloader_flash_end $(notdir $<) $(notdir $@)