Skip to content

Commit

Permalink
Reword Linux setup tutorial (#7)
Browse files Browse the repository at this point in the history
Retitles the docker setup guide to be more clear and adds additional
information needed when running on a linux host.
  • Loading branch information
naknut authored Jul 1, 2024
1 parent d07b761 commit 3799daf
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ $ docker build . --tag swift-matter-examples-builder
$ python3 -m pip install esptool --user

# Find your attached microcontroller
# On macOS it usually attaches on /dev/cu.usbserial-10
$ ls /dev/cu.usbserial-*
/dev/cu.usbserial-10

# On Linux it usually attaches on /dev/ttyUSB0
$ ls /dev/ttyUSB*
/dev/ttyUSB0
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ $ docker build . --tag swift-matter-examples-builder
$ python3 -m pip install esptool --user

# Find your attached microcontroller
# On macOS it usually attaches on /dev/cu.usbserial-10
$ ls /dev/cu.usbserial-*
/dev/cu.usbserial-10

# On Linux it usually attaches on /dev/ttyUSB0
$ ls /dev/ttyUSB*
/dev/ttyUSB0

# Run the serial server
$ esp_rfc2217_server.py -v -p 4000 /dev/cu.usbserial-10
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ $ docker build . --tag swift-matter-examples-builder
$ python3 -m pip install esptool --user

# Find your attached microcontroller
# On macOS it usually attaches on /dev/cu.usbserial-10
$ ls /dev/cu.usbserial-*
/dev/cu.usbserial-10

# On Linux it usually attaches on /dev/ttyUSB0
$ ls /dev/ttyUSB*
/dev/ttyUSB0

# Run the serial server
$ esp_rfc2217_server.py -v -p 4000 /dev/cu.usbserial-10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@Image(source: "arrow.down.circle.png", alt: "FIXME-ALT")

@TutorialReference(tutorial: "doc:Setup-MacOS")
@TutorialReference(tutorial: "doc:Setup-Linux")
@TutorialReference(tutorial: "doc:Setup-Docker")
}

@Chapter(name: "Run the examples") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@Tutorial(time: 30) {
@Intro(title: "Get started on Linux with Docker") {
Install the tools needed to build an ESP Matter accessory on Linux using a Docker container.
@Intro(title: "Get started on a Linux Docker container") {
Install the tools needed to build an ESP Matter accessory in a Docker container.
}

@Section(title: "Build the Docker image and tools") {
Expand All @@ -18,23 +18,23 @@

The `Dockerfile` in swift-matter-examples has all of the steps needed for a working build environment, many of which are the same steps described in the <doc:Setup-MacOS> tutorial.

@Code(name: "Setup.shell", file: "setup-linux-00.sh")
@Code(name: "Setup.shell", file: "setup-docker-00.sh")
}

@Step {
Use `docker build` to build and tag the image.

Building the image may take a significant amount of time to download and build all the required dependencies.

@Code(name: "Setup.shell", file: "setup-linux-01.sh", previousFile: "setup-linux-00.sh")
@Code(name: "Setup.shell", file: "setup-docker-01.sh", previousFile: "setup-docker-00.sh")
}

@Step {
Install `esptool`, see [Using Remote Serial Port](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/tools/idf-docker-image.html#using-remote-serial-port) for installation instructions.

The `esptool` package contains `esp_rfc2217_server`, a program needed to flash the microcontroller from a docker container.

@Code(name: "Setup.shell", file: "setup-linux-02.sh", previousFile: "setup-linux-01.sh")
@Code(name: "Setup.shell", file: "setup-docker-02.sh", previousFile: "setup-docker-01.sh")
}
}
}
Expand All @@ -46,25 +46,25 @@

@Steps {
@Step {
Find your attached microcontroller; on a macOS host computer the microcontroller should appear as a special file with the format **`/dev/cu.usbserial-X...`**.
Find your attached microcontroller; the microcontroller should appear as a special file with the format **`/dev/cu.usbserial-...`** on macOS and **`/dev/ttyUSB...`** on Linux.

Ensure your microcontroller is connected over USB before looking for the device.

@Code(name: "Setup.shell", file: "setup-linux-03.sh", previousFile: "setup-linux-02.sh")
@Code(name: "Setup.shell", file: "setup-docker-03.sh", previousFile: "setup-docker-02.sh")
}

@Step {
Run `esp_rfc2217_server` on your host machine to proxy the microcontroller serial connection to docker, see [Using Remote Serial Port](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/tools/idf-docker-image.html#using-remote-serial-port) for instructions.

@Code(name: "Setup.shell", file: "setup-linux-04.sh", previousFile: "setup-linux-03.sh")
@Code(name: "Setup.shell", file: "setup-docker-04.sh", previousFile: "setup-docker-03.sh")
}

@Step {
In a new shell, launch the docker container from the previously built image.

> Important: Be sure to run the container from the root directory of swift-matter-examples.

@Code(name: "Setup.shell", file: "setup-linux-05.sh", previousFile: "setup-linux-04.sh")
@Code(name: "Setup.shell", file: "setup-docker-05.sh", previousFile: "setup-docker-04.sh")
}
}
}
Expand Down

0 comments on commit 3799daf

Please sign in to comment.