diff --git a/CubeMX2Makefile.py b/CubeMX2Makefile.py index d4a84dd..6a265f3 100755 --- a/CubeMX2Makefile.py +++ b/CubeMX2Makefile.py @@ -30,7 +30,7 @@ } def main(): - + if len(sys.argv) != 2: sys.stderr.write("\nSTM32CubeMX project to Makefile V1.9\n") sys.stderr.write("-==================================-\n") @@ -127,8 +127,8 @@ def main(): if path_tok == relpath_split[0]: s['inc_subst'] += path_tok else: - s['inc_subst'] += '/' + path_tok - + s['inc_subst'] += '/' + path_tok + # .cproject file try: tree = xml.etree.ElementTree.parse(ac6_cproject_path) @@ -196,7 +196,14 @@ def main(): sys.exit(C2M_ERR_IO) sys.stdout.write("Makefile created: {}\n".format(makefile_path)) - + + # Copy gdbwrite.boot + gdb_file_path_from = os.path.join(app_folder_path, 'gdbwrite.boot') + gdb_file_path_to = os.path.join(proj_folder_path, 'gdbwrite.boot') + shutil.copy(gdb_file_path_from, gdb_file_path_to) + + sys.stdout.write("gdbwrite.boot created: {}\n".format(gdb_file_path_to)) + sys.exit(C2M_ERR_SUCCESS) diff --git a/CubeMX2Makefile.tpl b/CubeMX2Makefile.tpl index 712c1a3..d3dcdfc 100644 --- a/CubeMX2Makefile.tpl +++ b/CubeMX2Makefile.tpl @@ -24,7 +24,7 @@ BUILD_DIR = build ###################################### # source ###################################### -$C_SOURCES +$C_SOURCES $ASM_SOURCES ####################################### @@ -35,9 +35,10 @@ AS = arm-none-eabi-gcc -x assembler-with-cpp CP = arm-none-eabi-objcopy AR = arm-none-eabi-ar SZ = arm-none-eabi-size +GDB = arm-none-eabi-gdb HEX = $$(CP) -O ihex BIN = $$(CP) -O binary -S - + ####################################### # CFLAGS ####################################### @@ -91,19 +92,25 @@ $$(BUILD_DIR)/$$(TARGET).elf: $$(OBJECTS) Makefile $$(BUILD_DIR)/%.hex: $$(BUILD_DIR)/%.elf | $$(BUILD_DIR) $$(HEX) $$< $$@ - + $$(BUILD_DIR)/%.bin: $$(BUILD_DIR)/%.elf | $$(BUILD_DIR) - $$(BIN) $$< $$@ - + $$(BIN) $$< $$@ + $$(BUILD_DIR): - mkdir -p $$@ + mkdir -p $$@ + +####################################### +# firmware download using st-util +####################################### +gdbwrite: + $$(GDB) -x gdbwrite.boot $$(BUILD_DIR)/$$(TARGET).elf ####################################### # clean up ####################################### clean: -rm -fR .dep $$(BUILD_DIR) - + ####################################### # dependencies ####################################### diff --git a/gdbwrite.boot b/gdbwrite.boot new file mode 100644 index 0000000..85679a9 --- /dev/null +++ b/gdbwrite.boot @@ -0,0 +1,4 @@ +tar ext localhost:4242 +monitor reset halt +load +monitor reset halt