Skip to content

Commit

Permalink
Update zap-templates documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple committed Mar 26, 2021
1 parent 089c803 commit 2acf545
Showing 1 changed file with 49 additions and 8 deletions.
57 changes: 49 additions & 8 deletions src/app/zap-templates/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,67 @@
# ZAP generation templates

## What is this repo?
### What is this repo?

This directory contains generation templates for ZAP, ZCL Advanced Platform.

**IMPORTANT**: Changes to templates will affect all examples.

# Useful command for CHIP
### How to configure an application

Run ZAP with UI to configure endpoints and clusters

```
cd ./third_party/zap/repo/
node src-script/zap-start.js --logToStdout --gen ../../../src/app/zap-templates/app/templates.json
./scripts/tools/zap/configure.sh
```

Generate files in headless mode
### How to generate files for all applications

When any of the `.zapt` templates has been changed, all examples applications
needs to be updated. You can regenerate all files with:

```
./scripts/tools/zap_regen_all.py
```

### How to generate files for a single application

By default generated files are located into a `gen/` folder next to the
application `zap` file that has been created during the application
configuration.

The `gen/` folder content is the output of the templates listed into
`app-templates.json`.

#### To generate the application `gen/` folder the command is:

```
./scripts/tools/zap/generate.py <path to application *.zap file>
```

For example, to generate `examples/lighting-app/lighting-common/gen/` folder the
command is:

```
./scripts/tools/zap/generate.py examples/lighting-app/lighting-common/lighting-app.zap
```

### How to generate files for a single application using custom templates

An application may use some custom templates to generate additional files.

In this case the file listing the templates needs to be passed as an argument to
`generate.py`.

To generate the application additional files, the command is:

```
./scripts/tools/zap/generate.py <path to *.zap file> -t <path to templates.json file>
```

For example, to generate `chip-tool` additiona files the command is:

```
cd ./third_party/zap/repo/
node src-script/zap-generate.js -z ../../../../src/app/zap-templates/zcl/zcl.json -g ../../../src/app/zap-templates/app-templates.json -i <path to *.zap file> -o <Path to /gen/ folder>
node src-script/zap-generate.js -z ../../../../src/app/zap-templates/zcl/zcl.json -g ../../../src/app/zap-templates/chip-templates.json -i <path to *.zap file> -o ../../../
./scripts/tools/zap/generate.py examples/chip-tool/chip-tool.zap -t examples/chip-tool/templates/templates.json
```

For more information please see the documentation under `docs/` in
Expand Down

0 comments on commit 2acf545

Please sign in to comment.