Made separate build and flash page with updated content

This commit is contained in:
Kevin 2020-08-29 15:51:08 -07:00
parent ec6215f38e
commit 35dc46bfbb
4 changed files with 113 additions and 57 deletions

88
docs/docs/dev-build.md Normal file
View File

@ -0,0 +1,88 @@
---
id: dev-build-flash
title: Building and Flashing
sidebar_label: Building and Flashing
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
export const OsTabs = (props) => (<Tabs
groupId="operating-systems"
defaultValue="debian"
values={[
{label: 'Debian/Ubuntu', value: 'debian'},
{label: 'Raspberry OS', value: 'raspberryos'},
{label: 'Fedora', value: 'fedora'},
{label: 'Windows', value: 'win'},
{label: 'macOS', value: 'mac'},
]
}>{props.children}</Tabs>);
## Building
From here on, building and flashing ZMK should all be done from the `app/` subdirectory of the ZMK checkout:
```sh
cd app
```
To build for your particular keyboard, the behaviour varies slightly depending on if you are building for a keyboard with
an onboard MCU, or one that uses an MCU board addon.
### Keyboard (Shield) + MCU Board
ZMK treats keyboards that take an MCU addon board as [shields](https://docs.zephyrproject.org/2.3.0/guides/porting/shields.html), and treats the smaller MCU board as the true [board](https://docs.zephyrproject.org/2.3.0/guides/porting/board_porting.html)
Given the following:
- MCU Board: Proton-C
- Keyboard PCB: kyria_left
- Keymap: default
You can build ZMK with the following:
```sh
west build -b proton_c -- -DSHIELD=kyria_left -DKEYMAP=default
```
### Keyboard With Onboard MCU
Keyboards with onboard MCU chips are simply treated as the [board](https://docs.zephyrproject.org/2.3.0/guides/porting/board_porting.html) as far as Zephyr™ is concerned.
Given the following:
- Keyboard: Planck (rev6)
- Keymap: default
you can build ZMK with the following:
```sh
west build -b planck_rev6 -- -DKEYMAP=default
```
### Pristine Building
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:
```sh
west build -p -b proton_c -- -DSHIELD=kyria_left -DKEYMAP=default
```
## Flashing
Once built, the previously supplied parameters will be remembered so you can run the following to flash your
board with it in bootloader mode:
```
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`.
:::note
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 you will have to
1. Build the left side with the `build` command provided above
2. Flash `zmk.uf2` to the left side
3. Replace DSHIELD with the right side (for the above example, this would be `kyria_right`) and build again
4. Flash `zmk.uf2` the right side
:::

View File

@ -51,7 +51,7 @@ After flashing the updated ZMK image, the board should expose a USB CDC ACM devi
defaultValue="linux"
values={[
{label: 'Linux', value: 'linux'},
{label: 'Windows', value: 'windows'},
{label: 'Windows', value: 'win'},
]}>
<TabItem value="linux">
@ -60,7 +60,7 @@ On Linux, this should be a device like `/dev/ttyACM0` and you can connect with `
sudo tio /dev/ttyACM0
```
</TabItem>
<TabItem value="windows">
<TabItem value="win">
On Windows, you can use the Arduino IDE which contains a built-in Serial Monitor. Download and install it from [their website](https://www.arduino.cc/en/main/software), then connect your board and under Tools select "Serial Monitor".

View File

@ -181,7 +181,7 @@ brew install cmake ninja python3 ccache dtc git wget
## Setup
### West Build Command
### West Installation
`west` is the [Zephyr™ meta-tool](https://docs.zephyrproject.org/2.3.0/guides/west/index.html) used to configure and build Zephyr™ applications.
@ -192,14 +192,32 @@ pip3 install --user -U west
```
:::danger pip user packages
If you haven't done so yet, you may need to add the Python Pip user package directory to your `PATH`, e.g.:
If you haven't done so yet, you may need to add the Python Pip user package directory to your `PATH` otherwise your computer will not be able to find the `west` command.
:::
```
<Tabs
defaultValue="linux"
values={[
{label: 'Linux', value: 'linux'},
{label: 'Windows', value: 'win'},
]}>
<TabItem value = 'linux'>
Run the following commands:
```sh
echo 'export PATH=~/.local/bin:"$PATH"' >> ~/.bashrc
source ~/.bashrc
```
:::
</TabItem>
<TabItem value = 'win'>
1. Go to the Start Menu and type "environment variables" to find and open the "Edit the system environment variables" option.
2. Click "Environment Variables...", and select the "Path" variable under System variables.
3. Click "Edit..." and then "New" to add the directory where your west.exe is located. By default this should be something like `C:\Python38\Scripts`.
</TabItem>
</Tabs>
### Toolchain Installation
@ -428,54 +446,3 @@ cat ~/.zephyrrc >> ~/.zshrc
</TabItem>
</Tabs>
## Build
From here on, building and flashing ZMK should all be done from the `app/` subdirectory of the ZMK checkout:
```sh
cd app
```
To build for your particular keyboard, the behaviour varies slightly depending on if you are building for a keyboard with
an onboard MCU, or one that uses a MCU board addon.
### Keyboard (Shield) + MCU Board
ZMK treats keyboards that take a MCU addon board as [shields](https://docs.zephyrproject.org/2.3.0/guides/porting/shields.html), and treats the smaller MCU board as the true [board](https://docs.zephyrproject.org/2.3.0/guides/porting/board_porting.html)
Given the following:
- MCU Board: Proton-C
- Keyboard PCB: kyria_left
- Keymap: default
You can build ZMK with the following:
```sh
west build -b proton_c -- -DSHIELD=kyria_left -DKEYMAP=default
```
### Keyboard With Onboard MCU
Keyboards with onboard MCU chips are simply treated as the [board](https://docs.zephyrproject.org/2.3.0/guides/porting/board_porting.html) as far as Zephyr™ is concerned.
Given the following:
- Keyboard: Planck (rev6)
- Keymap: default
you can build ZMK with the following:
```sh
west build -b planck_rev6 -- -DKEYMAP=default
```
## Flashing
Once built, the previously supplied parameters will be remember, so you can simply run the following to flash your
board, with it in bootloader mode:
```
west flash
```

View File

@ -18,6 +18,7 @@ module.exports = {
Development: [
"dev-clean-room",
"dev-setup",
"dev-build-flash",
"dev-boards-shields-keymaps",
"dev-posix-board",
"dev-tests",