|
1 | | -The generator will put transformed SVD data into the `raw` folder. |
2 | | -This is not used for anything later on, but serves for debugging purposes. |
| 1 | +# Metapac peripherals |
| 2 | +This directory contains the register and type definitions for peripheral IPs that are included in NXP chipsets. |
| 3 | + |
| 4 | +NXP does not give us the internal name of these peripheral IPs. (for example: Synopsis USB-OTG rev. 2) |
| 5 | +It's up to us to create some sort of consistency there. |
| 6 | + |
| 7 | +These files are manually curated and considered to be the 'source of truth' when generating the metapac Rust source code. |
| 8 | +Even though they are assembled by hand, they are derived from the SVD files provided by the vendor. |
| 9 | + |
| 10 | +This derivation ideally happens through chiptool transforms, but manual changes to these files are also allowed. |
| 11 | +When adding manual changes, please note them with appropriate comments in the YAML files. |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +## Updating |
| 16 | +The generator when using the `extract` command will put transformed SVD data into the `raw` folder. |
| 17 | +Anything in this folder is not used directly, but can be used by you as a start to define metapac peripherals and chips. |
| 18 | + |
3 | 19 | This is per device: |
4 | 20 |
|
5 | | -- A YAML per peripheral, directly from the SVD |
6 | | -- A `_debug_ir.yaml` that represents the non-metapac version of the pac. It's the result of running the SVD through the transforms. |
7 | | - This is a good source when porting over a pac to the metapac. |
| 21 | +- A YAML per peripheral, with transforms applied and namespaces stripped. These files are suitable to base your metapac peripheral definition files on. |
| 22 | +- Everything in the `raw/original` folder, which are the same files but without the namespaces stripped. These files are the direct output of the transforms, and thus useful when developing the transforms. |
8 | 23 | - `_addresses.json`: A list of all peripherals and their addresses, taken from the SVD. Handy for adding it to the metadata. |
9 | 24 | - `_interrupts.json`: A list of all interrupts and their numbers, taken from the SVD. Handy for adding it to the metadata. |
10 | 25 |
|
11 | | -The other folders contain the manually curated YAMLs of the peripherals. |
12 | | -The exact names are not prescribed. NXP doesn't give us names, so it's up to us to create some sort of consistency there. |
13 | | -The metadata points to those YAMLs. |
| 26 | +Thus the workflow to add or change a peripheral is as follows: (change MCXA577 to your chipset) |
| 27 | +* Run `cargo run -p generator -- extract MCXA577` |
| 28 | +* Open `/data/metadata/peripherals/raw/MCXA577/<peripheral>.yaml` |
| 29 | +* Check if it is correct, if not change the transforms in `/data/transforms` and re-run `extract` until it is. |
| 30 | +* Copy the file over, and check the changes compared to what was already committed when relevant. |
| 31 | +* It is also allowed to change the file by hand at this point, but please use comments to denote what and why you changed (and why you didn't use a transform). |
| 32 | +* Generate the new nxp-pac code by running `cargo run -p generator -- generate MCXA577` |
| 33 | +* Check the code changes and commit both the nxp-pac code and the metadata definitions. |
0 commit comments