InfiniTime/doc/usingDevcontainers.md

56 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

2021-07-26 15:43:48 +00:00
# VS Code Dev Container
2021-07-25 20:12:34 +00:00
This is a docker-based interactive development environment using VS Code and Docker Dev Containers removing the need to install any tools locally\*
2021-07-25 20:12:34 +00:00
## Requirements
2021-07-26 15:43:48 +00:00
- VS Code
2021-07-25 20:12:34 +00:00
- [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension
- Docker
- OpenOCD - For debugging
## Using
### Code editing, and building.
2021-07-26 15:43:48 +00:00
1. Clone InfiniTime and update submodules
2. Launch VS Code
3. Open InfiniTime directory,
4. Allow VS Code to open folder with devcontainer.
2021-07-25 20:12:34 +00:00
After this the environment will be built if you do not currently have a container setup, it will install all the necessary tools and extra VSCode extensions.
2021-07-25 20:12:34 +00:00
2021-07-26 15:43:48 +00:00
In order to build InfiniTime we need to run the initial submodule init and CMake commands.
2021-07-25 20:12:34 +00:00
#### Manually
2021-07-25 20:12:34 +00:00
You can use the VS Code terminal to run the CMake commands as outlined in the [build instructions](https://github.com/InfiniTimeOrg/InfiniTime/blob/main/doc/buildAndProgram.md)
2021-07-25 20:12:34 +00:00
#### Script
2021-07-26 15:43:48 +00:00
The dev environment comes with some scripts to make this easier, They are located in /opt/.
2021-07-25 20:12:34 +00:00
There are also VS Code tasks provided should you desire to use those.
2021-07-25 20:12:34 +00:00
2021-07-26 01:14:23 +00:00
The task "update submodules" will update the git submodules
2021-07-25 20:12:34 +00:00
### Build
You can use the build.sh script located in /opt/
2021-07-26 15:43:48 +00:00
CMake is also configured and controls for the CMake plugin are available in VS Code
2021-07-25 20:12:34 +00:00
### Debugging
2021-07-26 15:43:48 +00:00
Docker on windows does not support passing USB devices to the underlying WSL2 subsystem, To get around this we use OpenOCD in server mode running on the host.
2021-07-25 20:12:34 +00:00
`openocd -f <yourinterface> -f <nrf52.cfg target file>`
This will launch OpenOCD in server mode and attach it to the MCU.
2021-07-25 20:12:34 +00:00
2021-07-26 15:43:48 +00:00
The default launch.json file expects OpenOCD to be listening on port 3333, edit if needed
2021-07-25 20:12:34 +00:00
## Current Issues
Currently WSL2 Has some real performance issues with IO on a windows host. Accessing files on the virtualized filesystem is much faster. Using VS Codes "clone in container" feature of the Remote - Containers will get around this. After the container is built you will need to update the submodules and follow the build instructions like normal