When building for a new board and/or shield after having built one previously, you may need to enable the pristine build option. This option removes all existing files in the build directory and regenerates them, and can be enabled by adding either --pristine or -p to the command:
When building for a new board and/or shield after having built one previously, you may need to enable the pristine build option. This option removes all existing files in the build directory before regenerating them, and can be enabled by adding either --pristine or -p to the command:
```sh
```sh
west build -p -b proton_c -- -DSHIELD=kyria_left
west build -p -b proton_c -- -DSHIELD=kyria_left
```
```
### Split Keyboards
### Building For Split Keyboards
:::note
:::note
For split keyboards, you will have to build and flash each side separately the first time you install ZMK.
For split keyboards, you will have to build and flash each side separately the first time you install ZMK.
:::
:::
By default, the `build` command outputs a single .uf2 file named `zmk.uf2` so building left and then right immediately after will overwrite your left firmware. In addition, you will need to pristine build each side to ensure the correct files are used. To avoid having to pristine build each time and separate the left and right build files, we recommend setting up separate build directories for each half. You can do this by first building left into `build\left`:
By default, the `build` command outputs a single .uf2 file named `zmk.uf2` so building left and then right immediately after will overwrite your left firmware. In addition, you will need to pristine build each side to ensure the correct files are used. To avoid having to pristine build every time and separate the left and right build files, we recommend setting up separate build directories for each half. You can do this by using the `-d` parameter and first building left into `build/left`:
```
```
west build -d build/left -b nice_nano -- -DSHIELD=kyria_left
west build -d build/left -b nice_nano -- -DSHIELD=kyria_left
```
```
and then building right into `build\right`:
and then building right into `build/right`:
```
```
west build -d build/right -b nice_nano -- -DSHIELD=kyria_right
west build -d build/right -b nice_nano -- -DSHIELD=kyria_right
```
```
This produces `left` and `right` subfolders under the `build` directory and two separate .uf2 files. For future work on a specific half, use the `-d` parameter again to ensure you are building into the correct location.
## Flashing
## Flashing
@ -92,5 +93,5 @@ board with it in bootloader mode:
west flash
west flash
```
```
For boards that have drag and drop .uf2 flashing capability, the .uf2 file to flash can be found in `build\zephyr` and is by default named `zmk.uf2`.
For boards that have drag and drop .uf2 flashing capability, the .uf2 file to flash can be found in `build\zephyr`(or `build\left|right\zephyr` if you followed the instructions for splits) and is by default named `zmk.uf2`.