Skip to content

Commit

Permalink
docker init (#24)
Browse files Browse the repository at this point in the history
* docker init

* fix compose
  • Loading branch information
jr1221 authored Apr 11, 2024
1 parent 0853182 commit 1d55496
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 114 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
run-build:
runs-on: ubuntu-latest
container:
image: nwdepatie/ner-gcc-arm:latest
image: ghcr.io/northeastern-electric-racing/embedded-base:main
timeout-minutes: 10
steps:
- name: Checkout code
Expand All @@ -17,4 +17,4 @@ jobs:
if ! make; then
echo "The application has failed to build."
exit 1 # This will cause the workflow to fail
fi
fi
51 changes: 0 additions & 51 deletions Dockerfile

This file was deleted.

64 changes: 3 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,15 @@
# Iroh
> FreeRTOS Application to control the charging of the accumulator
FreeRTOS Application to control the charging of the accumulator

## Setting up Docker Environment
> For initial installation, visit here: https://nerdocs.atlassian.net/wiki/spaces/NER/pages/108888108/Setting+Up+STM32+Dev+Env
```
# TLDR:
# Pull Container:
docker pull nwdepatie/ner-gcc-arm
docker compose pull
# Run Container
# macOS:
docker run --rm -it --privileged -v "$PWD:/home/app" nwdepatie/ner-gcc-arm:latest bash
# Windows:
docker run --rm -it --privileged -v "%cd%:/home/app" nwdepatie/ner-gcc-arm:latest bash
# or
docker run --rm -it --privileged -v "$(PWD):/home/app" nwdepatie/ner-gcc-arm:latest bash
# Linux:
sudo docker run --rm -it --privileged -v "$PWD:/home/app" nwdepatie/ner-gcc-arm:latest bash
```
## Container Tools and Utilities
> This container is packed with tools that can be utilized by developers to give them more insight into their developed software, we've used bash aliases to make the commands more compact for ease of use
```
## Tools / Utils
# to build project
make all
# to run Renode emulation
emulate
start
# Actual command is:
# renode cerberus.resc
# to open a serial port with Rasberry Pi Probe (make sure /dev/tty0/ACM0 exists first)
serial
# Actual command is:
# minicom -b 115200 -o -D /dev/ttyACM0
# to flash STM board with Raspberry Pi Probe (WIP)
flash
# Actual command is:
# openocd -f interface/cmsis-dap.cfg -f target/stm32f4x.cfg -c "adapter speed 5000" -c "program ./build/Iroh.elf verify reset exit"
docker compose run --rm ner-gcc-arm
```
### Mounting Hardware to Docker Container in Windows
> Very specific use case but nonetheless needed, also documented in the above confluence page, on macOS and Linux this happens by default when running privileged docker container

**We now have a Python script to automatically mount hardware! Run:** `python3 mount.py`

For manually mounting, follow the process below:
```
# Connect probe and open two terminals
# Terminal 1:
wsl -d ubuntu
# Terminal 2
usbipd wsl list
usbipd wsl attach --distribution=ubuntu --busid=<BUSID> # Terminal might need to be elevated to admin privileges for this
# Close the other wsl window, the device should be mounted to any WSL instance
# Start docker container
```
## Building Docker Container
> Typically this isn't needed unless making local changes to Dockerfile, please default to the first method via pulling the docker container
```
# if need to rebuild image
sudo docker image prune -a
sudo docker build -f ./Dockerfile -t ner-gcc-arm .
```
8 changes: 8 additions & 0 deletions art
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/###### /####### /###### /## /##
|_ ##_/| ##__ ## /##__ ##| ## | ##
| ## | ## \ ##| ## \ ##| ## | ##
| ## | #######/| ## | ##| ########
| ## | ##__ ##| ## | ##| ##__ ##
| ## | ## \ ##| ## | ##| ## | ##
/######| ## | ##| ######/| ## | ##
|______/|__/ |__/ \______/ |__/ |__/
22 changes: 22 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: iroh

services:
ner-gcc-arm:
image: ghcr.io/northeastern-electric-racing/embedded-base:main
build: .
# network_mode: host
privileged: true
volumes:
- type: bind
source: .
target: /home/app
tty: true
#expose:
# - "3240"
environment:
- DEBUG_PORT=/dev/ttyACM0
- STM_TARGET_NAME=stm32g4
# - USBIP_PORT=1-1.4
devices:
- "/dev/ttyACM0:/dev/ttyACM0"

0 comments on commit 1d55496

Please sign in to comment.