diff --git a/scripts/device/elf2dfu.py b/scripts/device/elf2dfu.py index 1a2326d76..2e5fcd31f 100644 --- a/scripts/device/elf2dfu.py +++ b/scripts/device/elf2dfu.py @@ -11,8 +11,8 @@ import argparse # arm-none-eabi-objdump -h -w file.elf # arm-none-eabi-objcopy -O binary -j .data file.elf file.bin -def loadable_sections(elf_file): - objdump_section_headers_pattern = re.compile("^\s+\d+\s+(\.[\w\.]+)\s+([0-9a-f]+)\s+([0-9a-f]+)\s+([0-9a-f]+)\s+([0-9a-f]+).*LOAD", flags=re.MULTILINE) +def loadable_sections(elf_file, section_name_appendix = ""): + objdump_section_headers_pattern = re.compile("^\s+\d+\s+(\.[\w\.]+"+section_name_appendix+")\s+([0-9a-f]+)\s+([0-9a-f]+)\s+([0-9a-f]+)\s+([0-9a-f]+).*LOAD", flags=re.MULTILINE) objdump_output = subprocess.check_output(["arm-none-eabi-objdump", "-h", "-w", elf_file]) sections = [] for (name, size, vma, lma, offset) in re.findall(objdump_section_headers_pattern, objdump_output): @@ -39,23 +39,30 @@ def generate_dfu_file(targets, usb_vid_pid, dfu_file): data += struct.pack('