|
|
|
@ -5,9 +5,28 @@ import sys
|
|
|
|
|
import os
|
|
|
|
|
import shutil
|
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
import flasher
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# FUTURE ACTIONS
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# TODO: KeY 14_02_2023 -> Automatically generate project, if empty.
|
|
|
|
|
# TODO: KeY 14_02_2023 -> Give the possibility to generate different example projects.
|
|
|
|
|
####################################################################################################
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# MODIFICATIONS
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# KeY 14_02_2023 : Some comments for code separation added :
|
|
|
|
|
# FUTURE ACTIONS, MODIFICATIONS, FUNCTIONS and MAIN EXECUTION Delimiters
|
|
|
|
|
#
|
|
|
|
|
# KeY 14_02_2023 : Modified some Print's for user guidance and apearance changes
|
|
|
|
|
# KeY 14_02_2023 : Gave a response to CSL_TO_USE question from Edwin
|
|
|
|
|
####################################################################################################
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# FUNCTIONS
|
|
|
|
|
####################################################################################################
|
|
|
|
|
class bcolors:
|
|
|
|
|
HEADER = '\033[95m'
|
|
|
|
|
OKBLUE = '\033[94m'
|
|
|
|
@ -19,7 +38,6 @@ class bcolors:
|
|
|
|
|
BOLD = '\033[1m'
|
|
|
|
|
UNDERLINE = '\033[4m'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getTargetDeviceList():
|
|
|
|
|
os.chdir(os.path.join(os.getcwd(), 'csl'))
|
|
|
|
|
# get top level folder names in csl which represent all available target devices
|
|
|
|
@ -27,7 +45,11 @@ def getTargetDeviceList():
|
|
|
|
|
|
|
|
|
|
def build(TARGET_DEVICE):
|
|
|
|
|
# TODO: ask Kerem what he wanted to to with "CSL_TO_USE"
|
|
|
|
|
#CSL_TO_USE = 1
|
|
|
|
|
# KeY 14_02_2023 RESPONSE:
|
|
|
|
|
# CSL_TO_USE is the "folder name" given to CMAKE
|
|
|
|
|
# so that CMAKE gets the correct "file path" under the csl directory.
|
|
|
|
|
# Like so: csl/<CSL_TO_USE> | Real example: csl/stm32f042
|
|
|
|
|
|
|
|
|
|
print('building project with cmake...')
|
|
|
|
|
print(bcolors.OKGREEN)
|
|
|
|
|
os.system('cmake -S . -B '+ buildDirectory + ' -DCSL_USED=' + TARGET_DEVICE)
|
|
|
|
@ -55,10 +77,11 @@ def flash(TARGET_DEVICE):
|
|
|
|
|
|
|
|
|
|
print('this platform is not supported by KED!')
|
|
|
|
|
'''
|
|
|
|
|
####################################################################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###########################################################################################################################
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
# MAIN EXECUTION
|
|
|
|
|
####################################################################################################
|
|
|
|
|
scriptDirectory = os.getcwd()
|
|
|
|
|
projectDirectory = os.path.join(scriptDirectory, '..')
|
|
|
|
|
buildDirectory = os.path.join(projectDirectory, 'ked_build')
|
|
|
|
@ -70,7 +93,7 @@ os.chdir(scriptDirectory)
|
|
|
|
|
# exit if no argument was passed
|
|
|
|
|
argvLen = len(sys.argv)
|
|
|
|
|
if argvLen < 2:
|
|
|
|
|
print('target device missing as argument!')
|
|
|
|
|
print('Target Device missing as argument!')
|
|
|
|
|
sys.exit()
|
|
|
|
|
|
|
|
|
|
# obtain list of all available targets in KED
|
|
|
|
@ -88,10 +111,14 @@ if sys.argv[1] in ('-rm', '-rmb'):
|
|
|
|
|
sys.exit()
|
|
|
|
|
|
|
|
|
|
# user requests listing of all available target devices
|
|
|
|
|
# KeY 14_02_2023 : Could not help my self wiht some pimping
|
|
|
|
|
if sys.argv[1] in ('-ls', '-lt', '-lst', '-lsd'):
|
|
|
|
|
print('listing all availabel targets...')
|
|
|
|
|
print('----------------------------')
|
|
|
|
|
print('| Available Traget Devices |')
|
|
|
|
|
print('----------------------------')
|
|
|
|
|
|
|
|
|
|
for targetDev in targetDevList:
|
|
|
|
|
print(targetDev)
|
|
|
|
|
print(" - " + targetDev)
|
|
|
|
|
sys.exit()
|
|
|
|
|
|
|
|
|
|
# user requests to clean project by erasing build
|
|
|
|
@ -110,11 +137,12 @@ 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
|
|
|
|
|
# KeY : 14_02_2023 : Jsut changed the text a little bit and gave some guidance to the user.
|
|
|
|
|
if sys.argv[1] not in targetDevList:
|
|
|
|
|
print('debug: targt not valid')
|
|
|
|
|
print('debug: Invalid Target Device')
|
|
|
|
|
print(' |-> To list the availabe target devices pass -ls as argument')
|
|
|
|
|
print(' |-> python ked.py -ls')
|
|
|
|
|
sys.exit()
|
|
|
|
|
|
|
|
|
|
print('building for target device ['+ bcolors.OKGREEN + sys.argv[1] + bcolors.ENDC + ']...')
|
|
|
|
|