Skip to content

Commit

Permalink
init compose (#148)
Browse files Browse the repository at this point in the history
* init compose

* Add in art

* remove mount.py
  • Loading branch information
jr1221 authored Apr 9, 2024
1 parent c3a646a commit 5186cc7
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 147 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:docker-compose
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.

66 changes: 4 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,16 @@
# Cerberus
> FreeRTOS Application that runs on MPU22A
FreeRTOS Application that runs on MPU22A

## Setting up Docker Environment
> For initial installation, visit here: https://nerdocs.atlassian.net/wiki/spaces/NER/pages/108888108/Setting+Up+STM32+Dev+Env
> For initial installation and more info, 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/cerberus.elf verify reset exit"
```
### 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:
docker compose run --rm ner-gcc-arm
```
# 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 .
```
6 changes: 6 additions & 0 deletions art
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
_________ ___
\_ ___ \ __________\_ |__ ___________ __ __ ______
/ \ \/_/ __ \_ __ \ __ \_/ __ \_ __ \ | \/ ___/
\ \___\ ___/| | \/ \_\ \ ___/| | \/ | /\___ \
\______ /\___ >__| |___ /\___ >__| |____//____ >
\/ \/ \/ \/ \/
22 changes: 22 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: cerberus

services:
ner-gcc-arm:
image: ghcr.io/northeastern-electric-racing/embedded-base:docker-compose
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=stm32f4
- USBIP_PORT=1-1.3
devices:
- "/dev/ttyACM0:/dev/ttyACM0"

32 changes: 0 additions & 32 deletions mount.py

This file was deleted.

0 comments on commit 5186cc7

Please sign in to comment.