Skip to content

Commit

Permalink
feat(cubemx-imp): add sys.argv error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
gemesa committed Apr 18, 2020
1 parent 825ff1f commit be538f4
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tools/cubemx_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,23 @@ def copy_doxyfile(eclipse_path: str,


if __name__ == "__main__":

try:
eclipse_pj_path = sys.argv[1]
cubemx_pj_path = sys.argv[2]
stm32doxyfile_path = sys.argv[3]
except IndexError:
print("Please specify the input files:\n"
"python cubemx_importer.py <eclipse_project_path> <cubemx_project_path> <stm32doxyfile_path>")
sys.exit(1)

print(f'cubemximporter is running...\n'
f'--------------')

delete_src(sys.argv[1])
copy_src(sys.argv[1], sys.argv[2])
copy_doxyfile(sys.argv[1], sys.argv[3])
mod_flash_address(sys.argv[1])
delete_src(eclipse_pj_path)
copy_src(eclipse_pj_path, cubemx_pj_path)
copy_doxyfile(eclipse_pj_path, stm32doxyfile_path)
mod_flash_address(eclipse_pj_path)

# postprocess instructions
print(f'The generated source files have been overwritten. Manually added changes have been lost.\n'
Expand Down

0 comments on commit be538f4

Please sign in to comment.