feat(build): Explicit missing keymap node error

* Explicit error if zmk,keymap not set
* Document keymap error

---------

Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
This commit is contained in:
ReFil 2024-03-18 16:54:47 +00:00 committed by GitHub
parent a77288f527
commit 388ad71385
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -31,6 +31,12 @@ static uint8_t _zmk_keymap_layer_default = 0;
#define DT_DRV_COMPAT zmk_keymap
#if !DT_NODE_EXISTS(DT_DRV_INST(0))
#error "Keymap node not found, check a keymap is available and is has compatible = "zmk,keymap" set"
#endif
#define TRANSFORMED_LAYER(node) \
{ LISTIFY(DT_PROP_LEN(node, bindings), ZMK_KEYMAP_EXTRACT_BINDING, (, ), node) }

View File

@ -40,6 +40,10 @@ West build errors usually indicate syntax problems in the `<keyboard>.keymap` fi
If you are reviewing these errors in the GitHub Actions tab, they can be found in the `West Build` step of the build process.
:::
#### Keymap error
If you get an error stating `Keymap node not found, check a keymap is available and is has compatible = "zmk,keymap" set` this is an indication that the build process cannot find the keymap. Double check that the `<keyboard>.keymap` file is present and has been discovered by the build process. This can be checked by looking for a line in the build log stating `-- Using keymap file: /path/to/keymap/file/<keyboard>.keymap`. Inside the keymap file ensure the keymap node has `compatible = zmk,keymap` and it's not misspelled. For more information see the [Keymap](features/keymaps.mdx) and [Config](config/index.md) documentation.
#### devicetree error
A `devicetree error` followed by a reference to the line number on `<keyboard>.keymap` refers to an issue at the exact line position in that file. For example, below error message indicates a missing `;` at line 109 of the `cradio.keymap` file: