@@ -1393,6 +1393,16 @@ def print_boards_entry():
1393
1393
return generic_list
1394
1394
1395
1395
1396
+ def print_general_clock (generic_list ):
1397
+ generic_clock_template = j2_env .get_template (generic_clock_filename )
1398
+ generic_clock_file .write (
1399
+ generic_clock_template .render (
1400
+ year = datetime .datetime .now ().year ,
1401
+ generic_list = generic_list ,
1402
+ )
1403
+ )
1404
+
1405
+
1396
1406
# List management
1397
1407
tokenize = re .compile (r"(\d+)|(\D+)" ).findall
1398
1408
@@ -1721,6 +1731,7 @@ def manage_repo():
1721
1731
variant_h_filename = "variant.h"
1722
1732
variant_cpp_filename = "variant.cpp"
1723
1733
boards_entry_filename = "boards_entry.txt"
1734
+ generic_clock_filename = "generic_clock.c"
1724
1735
repo_local_path = cur_dir / "repo"
1725
1736
cubemxdir = ""
1726
1737
gh_url = "https://github.com/STMicroelectronics/STM32_open_pin_data"
@@ -1734,7 +1745,13 @@ def manage_repo():
1734
1745
parser = argparse .ArgumentParser (
1735
1746
description = textwrap .dedent (
1736
1747
"""\
1737
- By default, generate {}, {}, {}, {} and {}
1748
+ By default, generates:
1749
+ - {},
1750
+ - {},
1751
+ - {},
1752
+ - {},
1753
+ - {}
1754
+ - {}
1738
1755
for all xml files description available in STM32CubeMX internal database.
1739
1756
Internal database path must be defined in {}.
1740
1757
It can be the one from STM32CubeMX directory if defined:
@@ -1748,6 +1765,7 @@ def manage_repo():
1748
1765
variant_cpp_filename ,
1749
1766
variant_h_filename ,
1750
1767
boards_entry_filename ,
1768
+ generic_clock_filename ,
1751
1769
config_filename ,
1752
1770
cubemxdir ,
1753
1771
gh_url ,
@@ -1774,15 +1792,10 @@ def manage_repo():
1774
1792
metavar = "xml" ,
1775
1793
help = textwrap .dedent (
1776
1794
"""\
1777
- Generate {}, {}, {} and {}
1778
- for specified mcu xml file description in database.
1795
+ Generate all files for specified mcu xml file description in database.
1779
1796
This xml file can contain non alpha characters in its name,
1780
- you should call it with double quotes""" .format (
1781
- periph_c_filename ,
1782
- pinvar_h_filename ,
1783
- variant_cpp_filename ,
1784
- variant_h_filename ,
1785
- )
1797
+ you should call it with double quotes.
1798
+ """
1786
1799
),
1787
1800
)
1788
1801
@@ -1902,6 +1915,7 @@ def manage_repo():
1902
1915
variant_cpp_filepath = out_temp_path / variant_cpp_filename
1903
1916
variant_h_filepath = out_temp_path / variant_h_filename
1904
1917
boards_entry_filepath = out_temp_path / boards_entry_filename
1918
+ generic_clock_filepath = out_temp_path / generic_clock_filename
1905
1919
out_temp_path .mkdir (parents = True , exist_ok = True )
1906
1920
1907
1921
# open output file
@@ -1910,12 +1924,13 @@ def manage_repo():
1910
1924
variant_cpp_file = open (variant_cpp_filepath , "w" , newline = "\n " )
1911
1925
variant_h_file = open (variant_h_filepath , "w" , newline = "\n " )
1912
1926
boards_entry_file = open (boards_entry_filepath , "w" , newline = "\n " )
1913
-
1927
+ generic_clock_file = open ( generic_clock_filepath , "w" , newline = " \n " )
1914
1928
parse_pins ()
1915
1929
sort_my_lists ()
1916
1930
manage_alternate ()
1917
1931
1918
1932
generic_list = print_boards_entry ()
1933
+ print_general_clock (generic_list )
1919
1934
print_peripheral ()
1920
1935
print_pinamevar ()
1921
1936
print_variant (generic_list )
@@ -1942,6 +1957,7 @@ def manage_repo():
1942
1957
variant_h_file .close ()
1943
1958
variant_cpp_file .close ()
1944
1959
boards_entry_file .close ()
1960
+ generic_clock_file .close ()
1945
1961
xml_mcu .unlink ()
1946
1962
xml_gpio .unlink ()
1947
1963
@@ -2089,7 +2105,7 @@ def manage_repo():
2089
2105
new_line_c += " || {}" .format (pre )
2090
2106
new_line_h += " && !{}" .format (pre )
2091
2107
update_file (mcu_dir / variant_cpp_filename , update_regex , new_line_c )
2092
-
2108
+ update_file ( mcu_dir / generic_clock_filename , update_regex , new_line_c )
2093
2109
update_file (mcu_dir / variant_h_filename , update_regex , new_line_h )
2094
2110
2095
2111
# Appending to board_entry file
@@ -2104,8 +2120,12 @@ def manage_repo():
2104
2120
2105
2121
# Move to variants/ folder
2106
2122
out_path = out_family_path / mcu_dir .stem
2123
+ generic_clock_filepath = out_path / generic_clock_filename
2107
2124
out_path .mkdir (parents = True , exist_ok = True )
2108
2125
for fname in mcu_dir .glob ("*.*" ):
2109
- fname .replace (out_path / fname .name )
2126
+ if fname .name == generic_clock_filename and generic_clock_filepath .exists ():
2127
+ fname .unlink ()
2128
+ else :
2129
+ fname .replace (out_path / fname .name )
2110
2130
# Clean temporary dir
2111
2131
rm_tree (tmp_dir )
0 commit comments