@@ -1337,6 +1337,16 @@ def print_boards_entry():
1337
1337
return generic_list
1338
1338
1339
1339
1340
+ def print_general_clock (generic_list ):
1341
+ generic_clock_template = j2_env .get_template (generic_clock_filename )
1342
+ generic_clock_file .write (
1343
+ generic_clock_template .render (
1344
+ year = datetime .datetime .now ().year ,
1345
+ generic_list = generic_list ,
1346
+ )
1347
+ )
1348
+
1349
+
1340
1350
# List management
1341
1351
tokenize = re .compile (r"(\d+)|(\D+)" ).findall
1342
1352
@@ -1665,6 +1675,7 @@ def manage_repo():
1665
1675
variant_h_filename = "variant.h"
1666
1676
variant_cpp_filename = "variant.cpp"
1667
1677
boards_entry_filename = "boards_entry.txt"
1678
+ generic_clock_filename = "generic_clock.c"
1668
1679
repo_local_path = cur_dir / "repo"
1669
1680
cubemxdir = ""
1670
1681
gh_url = "https://github.com/STMicroelectronics/STM32_open_pin_data"
@@ -1678,7 +1689,13 @@ def manage_repo():
1678
1689
parser = argparse .ArgumentParser (
1679
1690
description = textwrap .dedent (
1680
1691
"""\
1681
- By default, generate {}, {}, {}, {} and {}
1692
+ By default, generates:
1693
+ - {},
1694
+ - {},
1695
+ - {},
1696
+ - {},
1697
+ - {}
1698
+ - {}
1682
1699
for all xml files description available in STM32CubeMX internal database.
1683
1700
Internal database path must be defined in {}.
1684
1701
It can be the one from STM32CubeMX directory if defined:
@@ -1692,6 +1709,7 @@ def manage_repo():
1692
1709
variant_cpp_filename ,
1693
1710
variant_h_filename ,
1694
1711
boards_entry_filename ,
1712
+ generic_clock_filename ,
1695
1713
config_filename ,
1696
1714
cubemxdir ,
1697
1715
gh_url ,
@@ -1718,15 +1736,10 @@ def manage_repo():
1718
1736
metavar = "xml" ,
1719
1737
help = textwrap .dedent (
1720
1738
"""\
1721
- Generate {}, {}, {} and {}
1722
- for specified mcu xml file description in database.
1739
+ Generate all files for specified mcu xml file description in database.
1723
1740
This xml file can contain non alpha characters in its name,
1724
- you should call it with double quotes""" .format (
1725
- periph_c_filename ,
1726
- pinvar_h_filename ,
1727
- variant_cpp_filename ,
1728
- variant_h_filename ,
1729
- )
1741
+ you should call it with double quotes.
1742
+ """
1730
1743
),
1731
1744
)
1732
1745
@@ -1844,6 +1857,7 @@ def manage_repo():
1844
1857
variant_cpp_filepath = out_temp_path / variant_cpp_filename
1845
1858
variant_h_filepath = out_temp_path / variant_h_filename
1846
1859
boards_entry_filepath = out_temp_path / boards_entry_filename
1860
+ generic_clock_filepath = out_temp_path / generic_clock_filename
1847
1861
out_temp_path .mkdir (parents = True , exist_ok = True )
1848
1862
1849
1863
# open output file
@@ -1852,12 +1866,13 @@ def manage_repo():
1852
1866
variant_cpp_file = open (variant_cpp_filepath , "w" , newline = "\n " )
1853
1867
variant_h_file = open (variant_h_filepath , "w" , newline = "\n " )
1854
1868
boards_entry_file = open (boards_entry_filepath , "w" , newline = "\n " )
1855
-
1869
+ generic_clock_file = open ( generic_clock_filepath , "w" , newline = " \n " )
1856
1870
parse_pins ()
1857
1871
sort_my_lists ()
1858
1872
manage_alternate ()
1859
1873
1860
1874
generic_list = print_boards_entry ()
1875
+ print_general_clock (generic_list )
1861
1876
print_peripheral ()
1862
1877
print_pinamevar ()
1863
1878
print_variant (generic_list )
@@ -1884,6 +1899,7 @@ def manage_repo():
1884
1899
variant_h_file .close ()
1885
1900
variant_cpp_file .close ()
1886
1901
boards_entry_file .close ()
1902
+ generic_clock_file .close ()
1887
1903
xml_mcu .unlink ()
1888
1904
xml_gpio .unlink ()
1889
1905
@@ -2014,7 +2030,7 @@ def manage_repo():
2014
2030
new_line_c += " || {}" .format (pre )
2015
2031
new_line_h += " && !{}" .format (pre )
2016
2032
update_file (mcu_dir / variant_cpp_filename , update_regex , new_line_c )
2017
-
2033
+ update_file ( mcu_dir / generic_clock_filename , update_regex , new_line_c )
2018
2034
update_file (mcu_dir / variant_h_filename , update_regex , new_line_h )
2019
2035
2020
2036
# Appending to board_entry file
@@ -2029,8 +2045,12 @@ def manage_repo():
2029
2045
2030
2046
# Move to variants/ folder
2031
2047
out_path = out_family_path / mcu_dir .stem
2048
+ generic_clock_filepath = out_path / generic_clock_filename
2032
2049
out_path .mkdir (parents = True , exist_ok = True )
2033
2050
for fname in mcu_dir .glob ("*.*" ):
2034
- fname .replace (out_path / fname .name )
2051
+ if fname .name == generic_clock_filename and generic_clock_filepath .exists ():
2052
+ fname .unlink ()
2053
+ else :
2054
+ fname .replace (out_path / fname .name )
2035
2055
# Clean temporary dir
2036
2056
rm_tree (tmp_dir )
0 commit comments