Skip to content
Open
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: 10 additions & 5 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 V2.0\n")
sys.stderr.write("-==================================-\n")
Expand Down Expand Up @@ -126,8 +126,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 @@ -183,7 +183,7 @@ def main():
sys.stderr.write("Unable to find link specs. Error: {}\n".format(str(e)))
sys.exit(C2M_ERR_PROJECT_FILE)
specs_subst = specs

makefile_str = makefile_template.substitute(
TARGET = proj_name,
MCU = cflags_subst,
Expand All @@ -197,6 +197,11 @@ def main():
LDSCRIPT = ld_script_subst,
SPECS = specs_subst)

# Fix \\(\\(weak\\)\\) and \\(\\(packed\\)\\)
# oroginal recepie http://wiki.sgmk-ssam.ch/wiki/STM32_dev
makefile_str = makefile_str.replace('\\(\\(weak\\)\\)','((weak))')
makefile_str = makefile_str.replace('\\(\\(packed\\)\\)', '((packed))')

makefile_path = os.path.join(proj_folder_path, 'Makefile')
try:
with open(makefile_path, 'wb') as f:
Expand All @@ -206,7 +211,7 @@ def main():
sys.exit(C2M_ERR_IO)

sys.stdout.write("Makefile created: {}\n".format(makefile_path))

sys.exit(C2M_ERR_SUCCESS)


Expand Down