47
47
gpiofile = ""
48
48
tim_inst_list = [] # TIMx instance
49
49
usb_inst = {"usb" : "" , "otg_fs" : "" , "otg_hs" : "" }
50
+ mcu_family = ""
50
51
51
52
# format
52
53
# Peripheral
60
61
# mcu file parsing
61
62
def parse_IP_file ():
62
63
global gpiofile
64
+ global mcu_family
63
65
tim_regex = r"^(TIM\d+)$"
64
66
usb_regex = r"^(USB(?!PD|_HOST|_DEVICE).*)$"
65
67
gpiofile = ""
@@ -68,6 +70,9 @@ def parse_IP_file():
68
70
usb_inst ["otg_fs" ] = ""
69
71
usb_inst ["otg_hs" ] = ""
70
72
73
+ mcu_node = xml_mcu .getElementsByTagName ("Mcu" )[0 ]
74
+ mcu_family = mcu_node .attributes ["Family" ].value
75
+
71
76
itemlist = xml_mcu .getElementsByTagName ("IP" )
72
77
for s in itemlist :
73
78
inst = re .match (tim_regex , s .attributes ["InstanceName" ].value )
@@ -1679,10 +1684,16 @@ def manage_repo():
1679
1684
1680
1685
for mcu_file in mcu_list :
1681
1686
print ("Generating files for '{}'..." .format (mcu_file .name ))
1682
- if "MP1" in mcu_file .name :
1683
- mcu_dir = "STM32MP1xx"
1684
- else :
1685
- mcu_dir = mcu_file .name [:7 ] + "xx"
1687
+
1688
+ # Open input file
1689
+ xml_mcu = parse (str (mcu_file ))
1690
+ parse_IP_file ()
1691
+ if not gpiofile :
1692
+ print ("Could not find GPIO file" )
1693
+ quit ()
1694
+ xml_gpio = parse (str (dirIP / ("GPIO-" + gpiofile + "_Modes.xml" )))
1695
+
1696
+ mcu_dir = mcu_family + "xx"
1686
1697
out_path = root_dir / "variants" / mcu_dir / mcu_file .stem
1687
1698
periph_c_filepath = out_path / periph_c_filename
1688
1699
pinvar_h_filepath = out_path / pinvar_h_filename
@@ -1705,14 +1716,6 @@ def manage_repo():
1705
1716
variant_h_filepath .unlink ()
1706
1717
variant_h_file = open (variant_h_filepath , "w" , newline = "\n " )
1707
1718
1708
- # open input file
1709
- xml_mcu = parse (str (mcu_file ))
1710
- parse_IP_file ()
1711
- if not gpiofile :
1712
- print ("Could not find GPIO file" )
1713
- quit ()
1714
- xml_gpio = parse (str (dirIP / ("GPIO-" + gpiofile + "_Modes.xml" )))
1715
-
1716
1719
parse_pins ()
1717
1720
sort_my_lists ()
1718
1721
manage_alternate ()
0 commit comments