Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions CubeMX2Makefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)


Expand Down
21 changes: 14 additions & 7 deletions CubeMX2Makefile.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BUILD_DIR = build
######################################
# source
######################################
$C_SOURCES
$C_SOURCES
$ASM_SOURCES

#######################################
Expand All @@ -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
#######################################
Expand Down Expand Up @@ -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
#######################################
Expand Down
4 changes: 4 additions & 0 deletions gdbwrite.boot
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tar ext localhost:4242
monitor reset halt
load
monitor reset halt