Debian Codegraph @

scripts/generate_builtin_target_docs.py

raw symbols SCIP
1 #!/usr/bin/env python3
2
3 # Copyright (c) 2021 Chris Reed
4 # SPDX-License-Identifier: Apache-2.0
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18 from pyocd.core.soc_target import SoCTarget
19 from pyocd.target.builtin import BUILTIN_TARGETS
20
21
22 def gen_one_target(name: str, target: type[SoCTarget]) -> None:
23 print(f""" <tr><td><code>{name.lower()}</code></td>
24 <td>{target.VENDOR}</td>
25 <td>{target.__name__}</td>
26 </tr>
27 """)
28
29 def gen_targets() -> None:
30 for target_name in sorted(BUILTIN_TARGETS.keys()):
31 target = BUILTIN_TARGETS[target_name]
32 gen_one_target(target_name, target)
33
34
35 def main() -> None:
36 print("""---
37 title: Built-in targets
38 ---
39
40 <table>
41
42 <tr><th>Target Type Name</th><th>Vendor</th><th>Name</th></tr>
43 """)
44 gen_targets()
45 print("""
46 </table>
47 """)
48
49
50 if __name__ == '__main__':
51 main()
52
53