@@ -1385,6 +1385,16 @@ def print_boards_entry():
1385
1385
return generic_list
1386
1386
1387
1387
1388
+ def print_general_clock (generic_list ):
1389
+ generic_clock_template = j2_env .get_template (generic_clock_filename )
1390
+ generic_clock_file .write (
1391
+ generic_clock_template .render (
1392
+ year = datetime .datetime .now ().year ,
1393
+ generic_list = generic_list ,
1394
+ )
1395
+ )
1396
+
1397
+
1388
1398
# List management
1389
1399
tokenize = re .compile (r"(\d+)|(\D+)" ).findall
1390
1400
@@ -1713,6 +1723,7 @@ def manage_repo():
1713
1723
variant_h_filename = "variant.h"
1714
1724
variant_cpp_filename = "variant.cpp"
1715
1725
boards_entry_filename = "boards_entry.txt"
1726
+ generic_clock_filename = "generic_clock.c"
1716
1727
repo_local_path = cur_dir / "repo"
1717
1728
cubemxdir = ""
1718
1729
gh_url = "https://github.com/STMicroelectronics/STM32_open_pin_data"
@@ -1726,7 +1737,13 @@ def manage_repo():
1726
1737
parser = argparse .ArgumentParser (
1727
1738
description = textwrap .dedent (
1728
1739
"""\
1729
- By default, generate {}, {}, {}, {} and {}
1740
+ By default, generates:
1741
+ - {},
1742
+ - {},
1743
+ - {},
1744
+ - {},
1745
+ - {}
1746
+ - {}
1730
1747
for all xml files description available in STM32CubeMX internal database.
1731
1748
Internal database path must be defined in {}.
1732
1749
It can be the one from STM32CubeMX directory if defined:
@@ -1740,6 +1757,7 @@ def manage_repo():
1740
1757
variant_cpp_filename ,
1741
1758
variant_h_filename ,
1742
1759
boards_entry_filename ,
1760
+ generic_clock_filename ,
1743
1761
config_filename ,
1744
1762
cubemxdir ,
1745
1763
gh_url ,
@@ -1766,15 +1784,10 @@ def manage_repo():
1766
1784
metavar = "xml" ,
1767
1785
help = textwrap .dedent (
1768
1786
"""\
1769
- Generate {}, {}, {} and {}
1770
- for specified mcu xml file description in database.
1787
+ Generate all files for specified mcu xml file description in database.
1771
1788
This xml file can contain non alpha characters in its name,
1772
- you should call it with double quotes""" .format (
1773
- periph_c_filename ,
1774
- pinvar_h_filename ,
1775
- variant_cpp_filename ,
1776
- variant_h_filename ,
1777
- )
1789
+ you should call it with double quotes.
1790
+ """
1778
1791
),
1779
1792
)
1780
1793
@@ -1892,6 +1905,7 @@ def manage_repo():
1892
1905
variant_cpp_filepath = out_temp_path / variant_cpp_filename
1893
1906
variant_h_filepath = out_temp_path / variant_h_filename
1894
1907
boards_entry_filepath = out_temp_path / boards_entry_filename
1908
+ generic_clock_filepath = out_temp_path / generic_clock_filename
1895
1909
out_temp_path .mkdir (parents = True , exist_ok = True )
1896
1910
1897
1911
# open output file
@@ -1900,12 +1914,13 @@ def manage_repo():
1900
1914
variant_cpp_file = open (variant_cpp_filepath , "w" , newline = "\n " )
1901
1915
variant_h_file = open (variant_h_filepath , "w" , newline = "\n " )
1902
1916
boards_entry_file = open (boards_entry_filepath , "w" , newline = "\n " )
1903
-
1917
+ generic_clock_file = open ( generic_clock_filepath , "w" , newline = " \n " )
1904
1918
parse_pins ()
1905
1919
sort_my_lists ()
1906
1920
manage_alternate ()
1907
1921
1908
1922
generic_list = print_boards_entry ()
1923
+ print_general_clock (generic_list )
1909
1924
print_peripheral ()
1910
1925
print_pinamevar ()
1911
1926
print_variant (generic_list )
@@ -1932,6 +1947,7 @@ def manage_repo():
1932
1947
variant_h_file .close ()
1933
1948
variant_cpp_file .close ()
1934
1949
boards_entry_file .close ()
1950
+ generic_clock_file .close ()
1935
1951
xml_mcu .unlink ()
1936
1952
xml_gpio .unlink ()
1937
1953
@@ -2062,7 +2078,7 @@ def manage_repo():
2062
2078
new_line_c += " || {}" .format (pre )
2063
2079
new_line_h += " && !{}" .format (pre )
2064
2080
update_file (mcu_dir / variant_cpp_filename , update_regex , new_line_c )
2065
-
2081
+ update_file ( mcu_dir / generic_clock_filename , update_regex , new_line_c )
2066
2082
update_file (mcu_dir / variant_h_filename , update_regex , new_line_h )
2067
2083
2068
2084
# Appending to board_entry file
@@ -2077,8 +2093,12 @@ def manage_repo():
2077
2093
2078
2094
# Move to variants/ folder
2079
2095
out_path = out_family_path / mcu_dir .stem
2096
+ generic_clock_filepath = out_path / generic_clock_filename
2080
2097
out_path .mkdir (parents = True , exist_ok = True )
2081
2098
for fname in mcu_dir .glob ("*.*" ):
2082
- fname .replace (out_path / fname .name )
2099
+ if fname .name == generic_clock_filename and generic_clock_filepath .exists ():
2100
+ fname .unlink ()
2101
+ else :
2102
+ fname .replace (out_path / fname .name )
2083
2103
# Clean temporary dir
2084
2104
rm_tree (tmp_dir )
0 commit comments