mirror of https://github.com/ARMmbed/mbed-os.git
STM32_gen_PeripheralPins.py v1.4
Minor updates: - remove QSPI BK2 - beautifier edition - use STM_MODE_ANALOG_ADC_CONTROL for L4 familypull/9646/head
parent
be2eb9b6ed
commit
9563254658
|
@ -26,7 +26,7 @@ import textwrap
|
|||
from xml.dom.minidom import parse, Node
|
||||
from argparse import RawTextHelpFormatter
|
||||
|
||||
GENPINMAP_VERSION = "1.3"
|
||||
GENPINMAP_VERSION = "1.4"
|
||||
|
||||
ADD_DEVICE_IF = 0
|
||||
ADD_QSPI_FEATURE = 1
|
||||
|
@ -93,6 +93,8 @@ TIM_MST_LIST = { # Timer used for us ticker is hardcoded in this script
|
|||
"NUCLEO_L496ZG":"TIM5",
|
||||
"NUCLEO_L496ZG_P":"TIM5",
|
||||
"NUCLEO_L433RC_P":"TIM2",
|
||||
"NUCLEO_L4R5ZI":"TIM5",
|
||||
"NUCLEO_L4R5ZI_P":"TIM5",
|
||||
|
||||
"DISCO_F051R8":"TIM1",
|
||||
"DISCO_F100RB":"TIM4",
|
||||
|
@ -114,20 +116,21 @@ TIM_MST_LIST = { # Timer used for us ticker is hardcoded in this script
|
|||
|
||||
|
||||
def find_gpio_file():
|
||||
res = 'ERROR'
|
||||
itemlist = xml_mcu.getElementsByTagName('IP')
|
||||
res = "ERROR"
|
||||
itemlist = xml_mcu.getElementsByTagName("IP")
|
||||
for s in itemlist:
|
||||
a = s.attributes['Name'].value
|
||||
a = s.attributes["Name"].value
|
||||
if "GPIO" in a:
|
||||
res = s.attributes['Version'].value
|
||||
res = s.attributes["Version"].value
|
||||
return res
|
||||
|
||||
|
||||
def get_gpio_af_num(pintofind, iptofind):
|
||||
if 'STM32F10' in mcu_file:
|
||||
if "STM32F10" in mcu_file:
|
||||
return get_gpio_af_numF1(pintofind, iptofind)
|
||||
# DBG print ('pin to find ' + pintofind)
|
||||
i = 0
|
||||
mygpioaf = 'NOTFOUND'
|
||||
mygpioaf = ""
|
||||
for n in xml_gpio.documentElement.childNodes:
|
||||
i += 1
|
||||
j = 0
|
||||
|
@ -156,17 +159,20 @@ def get_gpio_af_num(pintofind, iptofind):
|
|||
if myc.nodeType == Node.ELEMENT_NODE:
|
||||
# myc = node of ALTERNATE
|
||||
for mygpioaflist in myc.childNodes:
|
||||
mygpioaf += ' ' + mygpioaflist.data
|
||||
if mygpioaflist.data not in mygpioaf:
|
||||
if mygpioaf != "":
|
||||
mygpioaf += " "
|
||||
mygpioaf += mygpioaflist.data
|
||||
# print (mygpioaf)
|
||||
if mygpioaf == 'NOTFOUND':
|
||||
print ('GPIO AF not found in ' + gpiofile + ' for ' + pintofind + ' and the IP ' + iptofind)
|
||||
#quit()
|
||||
return mygpioaf.replace('NOTFOUND ', '')
|
||||
if mygpioaf == "":
|
||||
mygpioaf = "GPIO_AF_NONE"
|
||||
return mygpioaf
|
||||
|
||||
|
||||
def get_gpio_af_numF1(pintofind, iptofind):
|
||||
# print ('pin to find ' + pintofind + ' ip to find ' + iptofind)
|
||||
i = 0
|
||||
mygpioaf = 'NOTFOUND'
|
||||
mygpioaf = ""
|
||||
for n in xml_gpio.documentElement.childNodes:
|
||||
i += 1
|
||||
j = 0
|
||||
|
@ -190,25 +196,39 @@ def get_gpio_af_numF1(pintofind, iptofind):
|
|||
# print (i, j, m.attributes.items())
|
||||
for p in m.childNodes:
|
||||
# p node 'RemapBlock'
|
||||
if p.nodeType == Node.ELEMENT_NODE and p.hasChildNodes() == False:
|
||||
mygpioaf += ' AFIO_NONE'
|
||||
if (
|
||||
p.nodeType == Node.ELEMENT_NODE
|
||||
and p.hasChildNodes() is False
|
||||
):
|
||||
if mygpioaf != "":
|
||||
mygpioaf += " "
|
||||
mygpioaf += "AFIO_NONE"
|
||||
else:
|
||||
for s in p.childNodes:
|
||||
if s.nodeType == Node.ELEMENT_NODE:
|
||||
# s node 'Specific parameter'
|
||||
#DBG print (i,j,k,p.attributes.items())
|
||||
# print (i,j,k,p.attributes.items())
|
||||
for myc in s.childNodes:
|
||||
# DBG print (myc)
|
||||
if myc.nodeType == Node.ELEMENT_NODE:
|
||||
if (
|
||||
myc.nodeType
|
||||
== Node.ELEMENT_NODE
|
||||
):
|
||||
# myc = AF value
|
||||
for mygpioaflist in myc.childNodes:
|
||||
mygpioaf += ' ' + mygpioaflist.data.replace("__HAL_", "").replace("_REMAP", "")
|
||||
for (
|
||||
mygpioaflist
|
||||
) in myc.childNodes:
|
||||
if mygpioaf != "":
|
||||
mygpioaf += " "
|
||||
mygpioaf += mygpioaflist.data.replace(
|
||||
"__HAL_", ""
|
||||
).replace(
|
||||
"_REMAP", ""
|
||||
)
|
||||
# print mygpioaf
|
||||
if mygpioaf == 'NOTFOUND':
|
||||
print ('GPIO AF not found in ' + gpiofile + ' for ' + pintofind + ' and the IP ' + iptofind + ' set as AFIO_NONE')
|
||||
mygpioaf = 'AFIO_NONE'
|
||||
return mygpioaf.replace('NOTFOUND ', '')\
|
||||
.replace("AFIO_NONE", "0")\
|
||||
if mygpioaf == "":
|
||||
mygpioaf = "AFIO_NONE"
|
||||
return mygpioaf.replace("AFIO_NONE", "0")\
|
||||
.replace("AFIO_SPI1_ENABLE", "1")\
|
||||
.replace("AFIO_I2C1_ENABLE", "2")\
|
||||
.replace("AFIO_USART1_ENABLE", "3")\
|
||||
|
@ -219,19 +239,22 @@ def get_gpio_af_numF1(pintofind, iptofind):
|
|||
.replace("AFIO_TIM3_ENABLE", "9")\
|
||||
.replace("AFIO_CAN1_2", "10")
|
||||
|
||||
#function to store I/O pin
|
||||
def store_pin(pin, name):
|
||||
# store pin I/O
|
||||
p = [pin, name]
|
||||
io_list.append(p)
|
||||
|
||||
|
||||
# function to store ADC list
|
||||
def store_adc(pin, name, signal):
|
||||
adclist.append([pin, name, signal])
|
||||
|
||||
|
||||
# function to store DAC list
|
||||
def store_dac(pin, name, signal):
|
||||
daclist.append([pin, name, signal])
|
||||
|
||||
|
||||
# function to store I2C list
|
||||
def store_i2c(pin, name, signal):
|
||||
# is it SDA or SCL ?
|
||||
|
@ -240,11 +263,13 @@ def store_i2c (pin, name, signal):
|
|||
if "_SDA" in signal:
|
||||
i2csda_list.append([pin, name, signal])
|
||||
|
||||
|
||||
# function to store timers
|
||||
def store_pwm(pin, name, signal):
|
||||
if "_CH" in signal:
|
||||
pwm_list.append([pin, name, signal])
|
||||
|
||||
|
||||
# function to store Uart pins
|
||||
def store_uart(pin, name, signal):
|
||||
if "_TX" in signal:
|
||||
|
@ -256,6 +281,7 @@ def store_uart(pin, name, signal):
|
|||
if "_RTS" in signal:
|
||||
uartrts_list.append([pin, name, signal])
|
||||
|
||||
|
||||
# function to store SPI pins
|
||||
def store_spi(pin, name, signal):
|
||||
if "_MISO" in signal:
|
||||
|
@ -267,6 +293,7 @@ def store_spi(pin, name, signal):
|
|||
if "_NSS" in signal:
|
||||
spissel_list.append([pin, name, signal])
|
||||
|
||||
|
||||
# function to store CAN pins
|
||||
def store_can(pin, name, signal):
|
||||
if "_RX" in signal:
|
||||
|
@ -274,10 +301,12 @@ def store_can(pin, name, signal):
|
|||
if "_TX" in signal:
|
||||
cantd_list.append([pin, name, signal])
|
||||
|
||||
|
||||
# function to store ETH list
|
||||
def store_eth(pin, name, signal):
|
||||
eth_list.append([pin, name, signal])
|
||||
|
||||
|
||||
# function to store QSPI pins
|
||||
def store_qspi(pin, name, signal):
|
||||
if "_BK" in signal:
|
||||
|
@ -287,19 +316,25 @@ def store_qspi (pin, name, signal):
|
|||
if "_NCS" in signal:
|
||||
quadspissel_list.append([pin, name, signal])
|
||||
|
||||
|
||||
# function to store USB pins
|
||||
def store_usb(pin, name, signal):
|
||||
usb_list.append([pin, name, signal])
|
||||
|
||||
|
||||
# function to store OSC pins
|
||||
def store_osc(pin, name, signal):
|
||||
osc_list.append([pin, name, signal])
|
||||
|
||||
|
||||
# function to store SYS pins
|
||||
def store_sys(pin, name, signal):
|
||||
sys_list.append([pin, name, signal])
|
||||
|
||||
|
||||
def print_header():
|
||||
DATE_YEAR = datetime.datetime.now().year
|
||||
|
||||
s = ("""/* mbed Microcontroller Library
|
||||
*******************************************************************************
|
||||
* Copyright (c) %i, STMicroelectronics
|
||||
|
@ -353,7 +388,7 @@ def print_header():
|
|||
//
|
||||
//==============================================================================
|
||||
|
||||
""" % (datetime.datetime.now().year, os.path.basename(input_file_name)))
|
||||
""" % (DATE_YEAR, os.path.basename(input_file_name)))
|
||||
out_c_file.write( s )
|
||||
|
||||
s = ("""/* mbed Microcontroller Library
|
||||
|
@ -407,7 +442,7 @@ typedef enum {
|
|||
|
||||
typedef enum {
|
||||
|
||||
""" % (datetime.datetime.now().year, os.path.basename(input_file_name)))
|
||||
""" % (DATE_YEAR, os.path.basename(input_file_name)))
|
||||
out_h_file.write( s )
|
||||
|
||||
|
||||
|
@ -469,6 +504,7 @@ def print_all_lists():
|
|||
print_h_file(osc_list, "OSCILLATOR")
|
||||
print_h_file(sys_list, "DEBUG")
|
||||
|
||||
|
||||
def print_list_header(comment, name, l, switch):
|
||||
s = ""
|
||||
if len(l)>0:
|
||||
|
@ -497,8 +533,16 @@ def print_list_header(comment, name, l, switch):
|
|||
out_c_file.write(s)
|
||||
return len(l)
|
||||
|
||||
|
||||
def print_adc():
|
||||
s_pin_data = 'STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, '
|
||||
# Check GPIO version (alternate or not)
|
||||
s_pin_data = "STM_PIN_DATA_EXT(STM_MODE_ANALOG"
|
||||
# For STM32L47xxx/48xxx, it is necessary to configure
|
||||
# the GPIOx_ASCR register
|
||||
if re.match("STM32L4[78]+", mcu_file):
|
||||
s_pin_data += "_ADC_CONTROL"
|
||||
s_pin_data += ", GPIO_NOPULL, 0, "
|
||||
|
||||
prev_p = ''
|
||||
alt_index = 0
|
||||
for p in adclist:
|
||||
|
@ -544,6 +588,7 @@ MBED_WEAK const PinMap PinMap_ADC_Internal[] = {
|
|||
if ADD_DEVICE_IF:
|
||||
out_c_file.write( "#endif\n" )
|
||||
|
||||
|
||||
def print_dac():
|
||||
for p in daclist:
|
||||
CommentedLine = " "
|
||||
|
@ -571,12 +616,12 @@ def print_dac():
|
|||
if ADD_DEVICE_IF:
|
||||
out_c_file.write( "#endif\n" )
|
||||
|
||||
|
||||
def print_i2c(l):
|
||||
prev_p = ''
|
||||
alt_index = 0
|
||||
for p in l:
|
||||
result = get_gpio_af_num(p[1], p[2])
|
||||
if result != 'NOTFOUND':
|
||||
CommentedLine = " "
|
||||
if p[1] in PinLabel.keys():
|
||||
if "STDIO_UART" in PinLabel[p[1]]:
|
||||
|
@ -613,6 +658,7 @@ def print_i2c(l):
|
|||
if ADD_DEVICE_IF:
|
||||
out_c_file.write( "#endif\n" )
|
||||
|
||||
|
||||
def print_pwm():
|
||||
prev_p = ''
|
||||
alt_index = 0
|
||||
|
@ -621,7 +667,6 @@ def print_pwm():
|
|||
TIM_MST = TIM_MST_LIST[TargetName]
|
||||
for p in pwm_list:
|
||||
result = get_gpio_af_num(p[1], p[2])
|
||||
if result != 'NOTFOUND':
|
||||
CommentedLine = " "
|
||||
if p[1] in PinLabel.keys():
|
||||
if "STDIO_UART" in PinLabel[p[1]]:
|
||||
|
@ -665,12 +710,12 @@ def print_pwm():
|
|||
if ADD_DEVICE_IF:
|
||||
out_c_file.write( "#endif\n" )
|
||||
|
||||
|
||||
def print_uart(l):
|
||||
prev_p = ''
|
||||
alt_index = 0
|
||||
for p in l:
|
||||
result = get_gpio_af_num(p[1], p[2])
|
||||
if result != 'NOTFOUND':
|
||||
CommentedLine = " "
|
||||
if p[1] in PinLabel.keys():
|
||||
if "RCC_OSC" in PinLabel[p[1]]:
|
||||
|
@ -706,12 +751,12 @@ def print_uart(l):
|
|||
if ADD_DEVICE_IF:
|
||||
out_c_file.write( "#endif\n" )
|
||||
|
||||
|
||||
def print_spi(l):
|
||||
prev_p = ''
|
||||
alt_index = 0
|
||||
for p in l:
|
||||
result = get_gpio_af_num(p[1], p[2])
|
||||
if result != 'NOTFOUND':
|
||||
CommentedLine = " "
|
||||
if p[1] in PinLabel.keys():
|
||||
if "STDIO_UART" in PinLabel[p[1]]:
|
||||
|
@ -744,10 +789,10 @@ def print_spi(l):
|
|||
if ADD_DEVICE_IF:
|
||||
out_c_file.write( "#endif\n" )
|
||||
|
||||
|
||||
def print_can(l):
|
||||
for p in l:
|
||||
result = get_gpio_af_num(p[1], p[2])
|
||||
if result != 'NOTFOUND':
|
||||
CommentedLine = " "
|
||||
if p[1] in PinLabel.keys():
|
||||
if "STDIO_UART" in PinLabel[p[1]]:
|
||||
|
@ -778,10 +823,12 @@ def print_can(l):
|
|||
if ADD_DEVICE_IF:
|
||||
out_c_file.write( "#endif\n" )
|
||||
|
||||
|
||||
def print_qspi(l):
|
||||
for p in l:
|
||||
result = get_gpio_af_num(p[1], p[2])
|
||||
if result != 'NOTFOUND':
|
||||
if "BK2" in p[2]: # QSPI Bank 2 is not supported
|
||||
continue
|
||||
CommentedLine = " "
|
||||
if p[1] in PinLabel.keys():
|
||||
if "STDIO_UART" in PinLabel[p[1]]:
|
||||
|
@ -804,6 +851,7 @@ def print_qspi(l):
|
|||
if ADD_DEVICE_IF:
|
||||
out_c_file.write( "#endif\n" )
|
||||
|
||||
|
||||
def print_h_file(l, comment):
|
||||
if len(l) > 0:
|
||||
s = ("\n /**** %s pins ****/\n" % comment)
|
||||
|
@ -826,7 +874,8 @@ def print_h_file(l, comment):
|
|||
# out_h_file.write(s)
|
||||
|
||||
|
||||
tokenize = re.compile(r'(\d+)|(\D+)').findall
|
||||
tokenize = re.compile(r"(\d+)|(\D+)").findall
|
||||
|
||||
|
||||
def natural_sortkey(list_2_elem):
|
||||
return tuple(int(num) if num else alpha for num, alpha in tokenize(list_2_elem[0]))
|
||||
|
@ -896,31 +945,34 @@ def clean_all_lists():
|
|||
del osc_list[:]
|
||||
del sys_list[:]
|
||||
|
||||
|
||||
def parse_pins():
|
||||
# print (" * Getting pins per Ips...")
|
||||
pinregex=r'^(P[A-Z][0-9][0-5]?)'
|
||||
itemlist = xml_mcu.getElementsByTagName('Pin')
|
||||
pinregex = r"^(P[A-Z][0-9][0-5]?)"
|
||||
itemlist = xml_mcu.getElementsByTagName("Pin")
|
||||
for s in itemlist:
|
||||
m = re.match(pinregex, s.attributes['Name'].value)
|
||||
m = re.match(pinregex, s.attributes["Name"].value)
|
||||
if m:
|
||||
pin = m.group(0)[:2] + '_' + m.group(0)[2:] # pin formatted P<port>_<number>: PF_O
|
||||
name = s.attributes['Name'].value.strip() # full name: "PF0 / OSC_IN"
|
||||
if s.attributes['Type'].value == "I/O":
|
||||
pin = (
|
||||
m.group(0)[:2] + "_" + m.group(0)[2:]
|
||||
) # pin formatted P<port>_<number>: PF_O
|
||||
name = s.attributes["Name"].value.strip() # full name: "PF0 / OSC_IN"
|
||||
if s.attributes["Type"].value == "I/O":
|
||||
store_pin(pin, name)
|
||||
else:
|
||||
continue
|
||||
siglist = s.getElementsByTagName('Signal')
|
||||
siglist = s.getElementsByTagName("Signal")
|
||||
for a in siglist:
|
||||
sig = a.attributes['Name'].value.strip()
|
||||
sig = a.attributes["Name"].value.strip()
|
||||
if "ADC" in sig:
|
||||
store_adc(pin, name, sig)
|
||||
if all(["DAC" in sig, "_OUT" in sig]):
|
||||
store_dac(pin, name, sig)
|
||||
if "I2C" in sig:
|
||||
store_i2c(pin, name, sig)
|
||||
if re.match('^TIM', sig) is not None: #ignore HRTIM
|
||||
if re.match("^TIM", sig) is not None: # ignore HRTIM
|
||||
store_pwm(pin, name, sig)
|
||||
if re.match('^(LPU|US|U)ART', sig) is not None:
|
||||
if re.match("^(LPU|US|U)ART", sig) is not None:
|
||||
store_uart(pin, name, sig)
|
||||
if "SPI" in sig:
|
||||
store_spi(pin, name, sig)
|
||||
|
@ -937,9 +989,11 @@ def parse_pins():
|
|||
if "SYS_" in sig:
|
||||
store_sys(pin, name, sig)
|
||||
|
||||
|
||||
PinData = {}
|
||||
PinLabel = {}
|
||||
|
||||
|
||||
def parse_BoardFile(fileName):
|
||||
print(" * Board file: '%s'" % (fileName))
|
||||
board_file = open(board_file_name, "r")
|
||||
|
@ -1000,30 +1054,31 @@ def parse_BoardFile(fileName):
|
|||
except:
|
||||
pass
|
||||
|
||||
|
||||
# main
|
||||
print ("\nScript version %s" % GENPINMAP_VERSION)
|
||||
cur_dir = os.getcwd()
|
||||
PeripheralPins_c_filename = 'PeripheralPins.c'
|
||||
PinNames_h_filename = 'PinNames.h'
|
||||
config_filename = 'cube_path.json'
|
||||
PeripheralPins_c_filename = "PeripheralPins.c"
|
||||
PinNames_h_filename = "PinNames.h"
|
||||
config_filename = "cube_path.json"
|
||||
|
||||
try:
|
||||
config_file = open(config_filename, "r")
|
||||
except IOError:
|
||||
print("Please set your configuration in '%s' file" % config_filename)
|
||||
config_file = open(config_filename, "w")
|
||||
if sys.platform.startswith('win32'):
|
||||
if sys.platform.startswith("win32"):
|
||||
print("Platform is Windows")
|
||||
cubemxdir = 'C:\\Program Files (x86)\\STMicroelectronics\\STM32Cube\\STM32CubeMX'
|
||||
elif sys.platform.startswith('linux'):
|
||||
cubemxdir = "C:\\Program Files (x86)\\STMicroelectronics\\STM32Cube\\STM32CubeMX"
|
||||
elif sys.platform.startswith("linux"):
|
||||
print("Platform is Linux")
|
||||
cubemxdir = os.getenv("HOME")+'/STM32CubeMX'
|
||||
elif sys.platform.startswith('darwin'):
|
||||
cubemxdir = os.getenv("HOME")+"/STM32CubeMX"
|
||||
elif sys.platform.startswith("darwin"):
|
||||
print("Platform is Mac OSX")
|
||||
cubemxdir = '/Applications/STMicroelectronics/STM32CubeMX.app/Contents/Resources'
|
||||
cubemxdir = "/Applications/STMicroelectronics/STM32CubeMX.app/Contents/Resources"
|
||||
else:
|
||||
print("Platform unknown")
|
||||
cubemxdir = '<Set CubeMX install directory>'
|
||||
cubemxdir = "<Set CubeMX install directory>"
|
||||
config_file.write(json.dumps({"CUBEMX_DIRECTORY":cubemxdir}))
|
||||
config_file.close()
|
||||
exit(1)
|
||||
|
@ -1032,6 +1087,7 @@ config = json.load(config_file)
|
|||
config_file.close()
|
||||
cubemxdir = config["CUBEMX_DIRECTORY"]
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description=textwrap.dedent('''\
|
||||
Script will generate %s thanks to the xml files description available in
|
||||
|
@ -1064,23 +1120,23 @@ if not(os.path.isdir(cubemxdir)):
|
|||
print ("\n ! ! ! please check the value you set for 'CUBEMX_DIRECTORY' in '%s' file" % config_filename)
|
||||
quit()
|
||||
|
||||
cubemxdirMCU = os.path.join(cubemxdir, 'db', 'mcu')
|
||||
cubemxdirIP = os.path.join(cubemxdir, 'db', 'mcu', 'IP')
|
||||
cubemxdirBOARDS = os.path.join(cubemxdir, 'db', 'plugins', 'boardmanager', 'boards')
|
||||
cubemxdirMCU = os.path.join(cubemxdir, "db", "mcu")
|
||||
cubemxdirIP = os.path.join(cubemxdir, "db", "mcu", "IP")
|
||||
cubemxdirBOARDS = os.path.join(cubemxdir, "db", "plugins", "boardmanager", "boards")
|
||||
|
||||
version_file = os.path.join(cubemxdir, 'db', 'package.xml')
|
||||
version_file = os.path.join(cubemxdir, "db", "package.xml")
|
||||
try:
|
||||
xml_file = parse(version_file)
|
||||
PackDescription_item = xml_file.getElementsByTagName('PackDescription')
|
||||
PackDescription_item = xml_file.getElementsByTagName("PackDescription")
|
||||
for item in PackDescription_item:
|
||||
CUBEMX_DB_VERSION = item.attributes['Release'].value
|
||||
CUBEMX_DB_VERSION = item.attributes["Release"].value
|
||||
except:
|
||||
CUBEMX_DB_VERSION = "NOT_FOUND"
|
||||
print ("CubeMX DB version %s\n" % CUBEMX_DB_VERSION)
|
||||
|
||||
if args.list:
|
||||
FileCount = 0
|
||||
for f in fnmatch.filter(os.listdir(cubemxdirMCU), 'STM32*.xml'):
|
||||
for f in fnmatch.filter(os.listdir(cubemxdirMCU), "STM32*.xml"):
|
||||
print(f)
|
||||
FileCount += 1
|
||||
print
|
||||
|
@ -1131,6 +1187,15 @@ if args.target:
|
|||
print (" ! ! ! Check in " + cubemxdirBOARDS + " the correct name of this file")
|
||||
print (" ! ! ! You may use double quotes for this file if it contains special characters")
|
||||
quit()
|
||||
|
||||
# Add some hardcoded check
|
||||
if "J01_" in board_file_name:
|
||||
print ("J01_Discovery_STM32F4-DISCO-AudioPack_STM32F407V_Board not parsed")
|
||||
quit()
|
||||
if "C40_" in board_file_name:
|
||||
print ("C40_Discovery_STM32F4DISCOVERY_STM32F407VG_Board replaced by C47_Discovery_STM32F407G-DISC1_STM32F407VG_Board")
|
||||
quit()
|
||||
|
||||
parse_BoardFile(board_file_name)
|
||||
TargetName = ""
|
||||
if "Nucleo" in board_file_name:
|
||||
|
@ -1145,8 +1210,8 @@ if args.target:
|
|||
# specific case
|
||||
if "-P" in args.target:
|
||||
TargetName += "_P"
|
||||
if TargetName == "DISCO_L072":
|
||||
TargetName += "CZ_LRWAN1"
|
||||
if TargetName == "DISCO_L072C":
|
||||
TargetName += "Z_LRWAN1"
|
||||
if TargetName == "DISCO_L475V":
|
||||
TargetName += "G_IOT01A"
|
||||
else:
|
||||
|
@ -1202,11 +1267,11 @@ for mcu_file in mcu_list:
|
|||
print (" ! ! ! Check in " + cubemxdirMCU)
|
||||
quit()
|
||||
gpiofile = find_gpio_file()
|
||||
if gpiofile == 'ERROR':
|
||||
if gpiofile == "ERROR":
|
||||
print("Could not find GPIO file")
|
||||
quit()
|
||||
xml_gpio = parse(os.path.join(cubemxdirIP, 'GPIO-' + gpiofile + '_Modes.xml'))
|
||||
print (" * GPIO file: " + os.path.join(cubemxdirIP, 'GPIO-' + gpiofile + '_Modes.xml'))
|
||||
xml_gpio = parse(os.path.join(cubemxdirIP, "GPIO-" + gpiofile + "_Modes.xml"))
|
||||
print (" * GPIO file: " + os.path.join(cubemxdirIP, "GPIO-" + gpiofile + "_Modes.xml"))
|
||||
|
||||
parse_pins()
|
||||
sort_my_lists()
|
||||
|
|
Loading…
Reference in New Issue