import sys import os import subprocess def eraseFirmware(TARGET_DEVICE): if sys.platform == 'linux': print('TODO') if sys.platform == 'win32': subprocess.Popen("STM32_Programmer_CLI.exe -c port=SWD -fwdelete") def downloadFirmware(TARGET_DEVICE): print('TODO') def flash(TARGET_DEVICE, buildDirectory): # find out what platform the build is done (e.g. linux, win32, etc.) if sys.platform == 'linux': os.system('st-flash write' + TARGET_DEVICE + '.bin 0x08000000') sys.exit() if sys.platform == 'win32': # https://www.youtube.com/watch?v=AcrbUOhApd0 os.chdir('C:\\Program Files\\STMicroelectronics\\STM32Cube\\STM32CubeProgrammer\\bin') #subprocess.Popen("STM32_Programmer_CLI.exe") subprocess.Popen("STM32_Programmer_CLI.exe") os.chdir(buildDirectory) sys.exit() print('this platform is not supported by KED!')