Skip to content

Commit

Permalink
updated docker instructions (bitcraze#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
knmcguire committed Jul 19, 2021
1 parent b2fcdf0 commit 569a1b0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 29 deletions.
49 changes: 27 additions & 22 deletions docs/getting-started/docker-gap8.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,31 @@ title: Docker Gap8
page_id: docker-gap8
---

# Docker Gap8

Prebuild the docker image while in the same directory as the docker file.

*Note: Depending on your operating system and docker installation you might need to perform the following commands with `sudo`. For more information see the [docker documentation](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user)*.
## Prerequisites

```
export GAP_SDK_VERSION=3.8.1
```
If you want to permanently use that version, we recommend that you put it inside your `.bashrc`. For example by appending it
```
echo 'export GAP_SDK_VERSION=3.8.1' >> ~/.bashrc
```
* Ubuntu 18.04 or 20.04
* Install Docker ([installation instructions](https://docs.docker.com/engine/install/ubuntu/))
* Configure Docker to work without Sudo (non-root) with [these instructions](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user).

## Pull the docker image

_Note: if you would like to also build docker images for SDK version 3.4, 3.5, 3.6 or 3.7, just replace the previous version number. The build process will checkout the right version of the SDK_
There is a [prebuild docker image on docker hub](https://github.com/bitcraze/docker-aideck) for the GAP8 chip on the AIdeck.

Pull the latest image on your machine
```
docker build --tag gapsdk:${GAP_SDK_VERSION} --build-arg GAP_SDK_VERSION=$GAP_SDK_VERSION .
docker pull bitcraze/aideck
```

Open up the container to install the auto tiler
## Configure with Autotiler

The autotiler is necessary for the Facedetection and Mnist example. As the autotiler is licensed by [Greenwaves-technologies](https://greenwaves-technologies.com/), this needs to be implemented seperately.

Open up the container to install the autotiler

```
docker run --rm -it gapsdk:${GAP_SDK_VERSION} /bin/bash
docker run --rm -it bitcraze/aideck /bin/bash
```

Then in the container write:
Expand All @@ -36,21 +38,20 @@ make autotiler
```
This will install the autotiler, which requires you to register your email and get a special URL token to download and install the autotiler.

In a separate terminal on your local machine, commit the changes to the image by first looking up the container ID status:
In a second **separate** terminal on your local machine, commit the changes to the image by first looking up the container ID status:
```
docker ps
```

Copy and past the container ID and replace the <container id> on the line here below, then run it in the separate terminal (also adapt the SDK version if you did before)
```
export GAP_SDK_VERSION=3.8.1
docker commit <container id> gapsdk:${GAP_SDK_VERSION}
docker commit <container id> bitcraze/aideck
```

This will save the install of the autotiler on your image. You can close the container in the other terminal with 'exit'
This will save the install of the autotiler on your image. You can close the container in the other terminal with 'exit'. Remember that this needs to be done everytime you pull a new image of the bitcraze/aideck docker image

### Running an Example
On your host navigate to the `make`-file you want to execute. For example
## Running an Example
On your host navigate to the Makefile you want to execute. For example

```
cd <path/to/AIdeck_examples/Repository>/GAP8/image_processing_examples/image_manipulations
Expand All @@ -59,11 +60,15 @@ cd <path/to/AIdeck_examples/Repository>/GAP8/image_processing_examples/image_man
The following docker commands will build and run the program on RAM (this will disappear after restarting of the AI-deck). Make sure to replace the /dev/ttyUSB0 with the actual path of your debugger (which can be found by `dmesg` on Ubuntu). Also make sure that the right .cfg file is selected that fits your debugger.

```
docker run --rm -it -v $PWD:/module/data/ --device /dev/ttyUSB0 --privileged -P gapsdk:${GAP_SDK_VERSION} /bin/bash -c 'export GAPY_OPENOCD_CABLE=interface/ftdi/olimex-arm-usb-tiny-h.cfg; source /gap_sdk/configs/ai_deck.sh; cd /module/data/; make clean all run'
docker run --rm -it -v $PWD:/module/data/ --device /dev/ttyUSB0 --privileged -P bitcraze/aideck /bin/bash -c 'export GAPY_OPENOCD_CABLE=interface/ftdi/olimex-arm-usb-tiny-h.cfg; source /gap_sdk/configs/ai_deck.sh; cd /module/data/; make clean all run'
```

The following docker commands will build and flash the program on the GAP8 (this will NOT disappear after restart of the AI-deck).

```
docker run --rm -it -v $PWD:/module/data/ --device /dev/ttyUSB0 --privileged -P gapsdk:${GAP_SDK_VERSION} /bin/bash -c 'export GAPY_OPENOCD_CABLE=interface/ftdi/olimex-arm-usb-tiny-h.cfg; source /gap_sdk/configs/ai_deck.sh; cd /module/data/; make clean all image flash'
docker run --rm -it -v $PWD:/module/data/ --device /dev/ttyUSB0 --privileged -P bitcraze/aideck /bin/bash -c 'export GAPY_OPENOCD_CABLE=interface/ftdi/olimex-arm-usb-tiny-h.cfg; source /gap_sdk/configs/ai_deck.sh; cd /module/data/; make clean all image flash'
```

# Versions

Currently this is only available for version **3.8.1** of the [GAP sdk](https://github.com/GreenWaves-Technologies/gap_sdk). If you would like to try out earlier versions, you will need to build the docker image yourselve locally. The docker image for the gap8 can be found in the [docker-aideck repository](https://github.com/bitcraze/docker-aideck).
19 changes: 12 additions & 7 deletions docs/nina-instructions/docker-nina.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,31 @@ page_id: docker-nina
---


# Docker Nina
## Prerequisites

## Build the docker image
Build the docker image while in the same directory as the Dockerfile.
* Ubuntu 18.04 or 20.04
* Install Docker ([installation instructions](https://docs.docker.com/engine/install/ubuntu/))
* Configure Docker to work without Sudo (non-root) with [these instructions](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user)

*Note: Depending on your operating system and docker installation you might need to perform the following commands with `sudo`. For more information see the [docker documentation](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user)*.
## Pull the docker image

> Working directory: AIdeck_examples/docker/nina/
There is a [prebuild docker image on docker hub](https://github.com/bitcraze/docker-aideck-nina) for the NINA -wifi module on the AIdeck.

Pull the latest image on your machine
```
docker build --tag espidf:3.3.1 .
docker pull bitcraze/aideck-nina
```

## Flash using docker

First check with `dmesg` (for ubuntu) on which port the programmer is on, and write it down (should look like /dev/ttyUSB0 or another number)

Then use the following line of code in the terminal (make sure to change the --device if your programmer is on another port) and build the firmware (with the menuconfig) and flash the Nina module.

> Working directory: AIdeck_examples/NINA/firmware
```
docker run --rm -it -v $PWD:/module/ --device /dev/ttyUSB0 --privileged -P espidf:3.3.1 /bin/bash -c "make clean; make menuconfig; make all; /openocd-esp32/bin/openocd -f interface/ftdi/olimex-arm-usb-tiny-h.cfg -f board/esp-wroom-32.cfg -c 'program_esp32 build/partitions_singleapp.bin 0x8000 verify' -c 'program_esp32 build/bootloader/bootloader.bin 0x1000 verify' -c 'program_esp32 build/ai-deck-jpeg-streamer-demo.bin 0x10000 verify reset exit'"
docker run --rm -it -v $PWD:/module/ --device /dev/ttyUSB0 --privileged -P bitcraze/aideck-nina /bin/bash -c "make clean; make menuconfig; make all; /openocd-esp32/bin/openocd -f interface/ftdi/olimex-arm-usb-tiny-h.cfg -f board/esp-wroom-32.cfg -c 'program_esp32 build/partitions_singleapp.bin 0x8000 verify' -c 'program_esp32 build/bootloader/bootloader.bin 0x1000 verify' -c 'program_esp32 build/ai-deck-jpeg-streamer-demo.bin 0x10000 verify reset exit'"
```

How to configure the Nina wifi credentials, see [the NINA flashing](/docs/test-functions/wifi-streamer.md) at *enter your credentials* instructions

0 comments on commit 569a1b0

Please sign in to comment.