Merge pull request #14594 from jeromecoutant/PR_GEN_MCU

STM32_gen_PeripheralPins.py : TargetName correction
pull/13791/head
Martin Kojtal 2021-05-03 09:55:48 +02:00 committed by GitHub
commit 99cf33c202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 14 deletions

View File

@ -83,6 +83,7 @@ DUAL_PAD = False
MCU_USERNAME= "" MCU_USERNAME= ""
TIM_MST = "" TIM_MST = ""
ALTERNATE_DEFINITION = 0 ALTERNATE_DEFINITION = 0
TARGET_NAME = ""
TIM_DUALCORE_LIST = { # Timer used for us ticker is hardcoded in this script TIM_DUALCORE_LIST = { # Timer used for us ticker is hardcoded in this script
"H745":"TIM2", "H745":"TIM2",
@ -461,7 +462,7 @@ def print_header():
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
""" % (date_year, os.path.basename(input_file_name), TargetName)) """ % (date_year, os.path.basename(input_file_name), TARGET_NAME))
out_h_file.write(line_to_write) out_h_file.write(line_to_write)
if DUAL_PAD: if DUAL_PAD:
@ -1689,21 +1690,20 @@ if args.target:
sys.exit(0) sys.exit(0)
parse_board_file(board_file_name) parse_board_file(board_file_name)
TargetName = ""
if "Nucleo" in board_file_name: if "Nucleo" in board_file_name:
TargetName += "NUCLEO_" TARGET_NAME += "NUCLEO_"
elif "Discovery" in board_file_name: elif "Discovery" in board_file_name:
TargetName += "DISCO_" TARGET_NAME += "DISCO_"
elif "Evaluation" in board_file_name: elif "Evaluation" in board_file_name:
TargetName += "EVAL_" TARGET_NAME += "EVAL_"
m = re.search(r'STM32([MFLGWH][\w]*)_Board', board_file_name) m = re.search(r'STM32([MFLGWH][\w]*)_Board', board_file_name)
if m: if m:
TargetName += "%s" % m.group(1) TARGET_NAME += "%s" % m.group(1)
# specific case # specific case
if "-P" in board_file_name: if "-P" in board_file_name:
TargetName += "_P" TARGET_NAME += "_P"
elif "-Q" in board_file_name: elif "-Q" in board_file_name:
TargetName += "_Q" TARGET_NAME += "_Q"
target_rename = { # manual renaming for some boards target_rename = { # manual renaming for some boards
"DISCO_L072C": "DISCO_L072CZ_LRWAN1", "DISCO_L072C": "DISCO_L072CZ_LRWAN1",
@ -1724,11 +1724,11 @@ if args.target:
"DISCO_H747XIH": "DISCO_H747I" "DISCO_H747XIH": "DISCO_H747I"
} }
if TargetName in target_rename: if TARGET_NAME in target_rename:
TargetName = target_rename[TargetName] TARGET_NAME = target_rename[TARGET_NAME]
if "DISC1" in board_file_name: if "DISC1" in board_file_name:
TargetName += "_DISC1" TARGET_NAME += "_DISC1"
else: else:
sys.exit(1) sys.exit(1)
@ -1736,7 +1736,6 @@ if args.target:
# Parse the user's custom board .ioc file # Parse the user's custom board .ioc file
if args.custom: if args.custom:
parse_board_file(args.custom) parse_board_file(args.custom)
TargetName = ""
for mcu_file in mcu_list: for mcu_file in mcu_list:
TargetNameList = [] TargetNameList = []
@ -1823,9 +1822,9 @@ for mcu_file in mcu_list:
else: else:
if EachTargetName == MCU_USERNAME: if EachTargetName == MCU_USERNAME:
if FLAT_DIRECTORY == 0: if FLAT_DIRECTORY == 0:
out_path = os.path.join(cur_dir, 'targets_custom', 'TARGET_STM', 'TARGET_%s' % TARGET_FAMILY, 'TARGET_%s' % TARGET_SUBFAMILY, 'TARGET_%s' % TargetName) out_path = os.path.join(cur_dir, 'targets_custom', 'TARGET_STM', 'TARGET_%s' % TARGET_FAMILY, 'TARGET_%s' % TARGET_SUBFAMILY, 'TARGET_%s' % TARGET_NAME)
else: else:
out_path = os.path.join(cur_dir, 'targets_custom', 'TARGET_STM', 'TARGET_%s' % TargetName) out_path = os.path.join(cur_dir, 'targets_custom', 'TARGET_STM', 'TARGET_%s' % TARGET_NAME)
else: else:
continue continue