Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compose file for MSB compose. #3

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 4 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,15 @@
# Cerberus
> FreeRTOS Application that collects mechanical data across the car
# MSB-FW
Our FreeRTOS Application for Distributed Sensing

## 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/cerberus.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 .
```
7 changes: 7 additions & 0 deletions art
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
___ ___ _____ ____ _____ __ __
| | |/ ___/| \ | || |__| |
| _ _ ( \_ | o ) _____ | __|| | | |
| \_/ |\__ || || || |_ | | | |
| | |/ \ || O ||_____|| _] | ` ' |
| | |\ || | | | \ /
|___|___| \___||_____| |__| \_/\_/
22 changes: 22 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: msb-fw

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=stm32f4
# - USBIP_PORT=1-1.4
devices:
- "/dev/ttyACM0:/dev/ttyACM0"

Loading