working on flasher

master
polymurph 2 years ago
parent 0a29c368cb
commit ad4e8d408f

@ -0,0 +1,28 @@
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!')

@ -28,11 +28,18 @@ def getTargetDeviceList():
def build(TARGET_DEVICE):
# TODO: ask Kerem what he wanted to to with "CSL_TO_USE"
#CSL_TO_USE = 1
print('building project with cmake...')
print(bcolors.OKGREEN)
os.system('cmake -S . -B '+ buildDirectory + ' -DCSL_USED=' + TARGET_DEVICE)
print(bcolors.ENDC)
print('...done!')
print('Compiling Project with Make...')
os.chdir(buildDirectory)
print(bcolors.OKGREEN)
os.system('make -j4')
print(bcolors.ENDC)
print('...done!')
'''
def flash(TARGET_DEVICE):
@ -93,6 +100,16 @@ if sys.argv[1] in ('-clean', '-c', '-db'):
print('build cleaned!')
sys.exit()
if sys.argv[1] in ('-dox', '-doxygen', '-gd'):
print('TODO: Implement doxygen generation')
sys.exit()
if sys.argv[1] in ('-opendox', '-od'):
print('TODO: Implement open doxygen in browser')
sys.exit()
###########################################################################################################################
# check if requested target device is supported by KED
if sys.argv[1] not in targetDevList:
print('debug: targt not valid')
@ -107,5 +124,5 @@ if not os.path.exists(buildDirectory):
CSL_TO_USE = sys.argv[1]
build(CSL_TO_USE)
flash(CSL_TO_USE)
flasher.flash(CSL_TO_USE,buildDirectory)

Loading…
Cancel
Save