|
1 | 1 | Extending |
2 | 2 | ========= |
3 | 3 |
|
4 | | -1. Add support for the new tool: |
| 4 | +.. note:: |
5 | 5 |
|
6 | | -.. code-block:: python |
| 6 | + All <TOOL> classes inherit from project.py. |
| 7 | + |
| 8 | +This is a guide on how to add support for a new TOOL. |
| 9 | + |
| 10 | +Add support for the new tool |
| 11 | +---------------------------- |
| 12 | + |
| 13 | +.. code-block:: bash |
7 | 14 |
|
8 | 15 | pyfpga/templates/<NEWTOOL>.jinja |
9 | 16 | pyfpga/templates/<NEWTOOL>-prog.jinja |
10 | 17 | pyfpga/<NEWTOOL>.py |
| 18 | + pyfpga/factory.py # UPDATE |
| 19 | + pyfpga/helpers/prj2bit.py # UPDATE |
11 | 20 |
|
12 | | -2. Include the new tool on Factory: |
| 21 | +Add tests and a tool mock-up |
| 22 | +---------------------------- |
13 | 23 |
|
14 | | -.. code-block:: python |
| 24 | +.. code-block:: bash |
15 | 25 |
|
16 | | - pyfpga/factory.py |
| 26 | + tests/test_tools.py # UPDATE |
| 27 | + tests/support.py # UPDATE if exceptions are needed |
| 28 | + tests/mocks/<NEWCOMMAND> |
17 | 29 |
|
18 | | -3. Add tests and a tool mock-up: |
| 30 | +Add examples |
| 31 | +------------ |
19 | 32 |
|
20 | | -.. code-block:: python |
| 33 | +.. code-block:: bash |
21 | 34 |
|
22 | | - tests/test_tools.py |
23 | | - tests/mocks/<NEWTOOL_EXECUTABLE> |
| 35 | + examples/sources/cons/<NEWBOARD>/timing.<EXT> |
| 36 | + examples/sources/cons/<NEWBOARD>/clk.<EXT> |
| 37 | + examples/sources/cons/<NEWBOARD>/led.<EXT> |
| 38 | + examples/projects/<NEWTOOL>.py |
| 39 | + examples/projects/regress.sh # UPDATE |
| 40 | + examples/helpers/<NEWTOOL>.sh |
| 41 | + examples/hooks/<NEWTOOL>.py # OPTIONAL |
24 | 42 |
|
25 | | -4. Updated the project's documentation: |
| 43 | +Verify the code |
| 44 | +--------------- |
26 | 45 |
|
27 | | -.. code-block:: python |
| 46 | +Run it at the root of the repo. |
28 | 47 |
|
29 | | - README.md |
30 | | - docs |
| 48 | +.. code-block:: bash |
31 | 49 |
|
32 | | -5. [OPTIONAL] Add examples: |
| 50 | + make docs |
| 51 | + make lint |
| 52 | + make test |
33 | 53 |
|
34 | | -.. code-block:: python |
| 54 | +.. tip:: |
35 | 55 |
|
36 | | - examples/sources/cons/<NEWBOARD>/timing.<EXT> |
37 | | - examples/sources/cons/<NEWBOARD>/clk.<EXT> |
38 | | - examples/sources/cons/<NEWBOARD>/led.<EXT> |
39 | | - examples/projects/<NEWTOOL>.py |
40 | | - examples/hooks/<NEWTOOL>.py |
| 56 | + You can simply run ``make`` to perform all the operations. |
| 57 | + Running ``make clean`` will remove all the generated files. |
| 58 | + |
| 59 | +Verify the functionality |
| 60 | +------------------------ |
| 61 | + |
| 62 | +.. code-block:: bash |
| 63 | +
|
| 64 | + cd examples/projects/ |
| 65 | + bash regress.sh <NEWTOOL> |
| 66 | + cd ../../tests/ |
| 67 | + python3 support.py --tool <NEWTOOL> |
| 68 | +
|
| 69 | +Updated the documentation |
| 70 | +------------------------- |
| 71 | + |
| 72 | +.. code-block:: bash |
| 73 | +
|
| 74 | + README.md |
| 75 | + docs/intro.rst |
| 76 | + docs/tools.rst |
0 commit comments