Skip to content

Commit 6217a79

Browse files
authored
Merge pull request #5 from ParadigmHyperloop/feature/PI/raspbian-dockerfile-taskrunner
feature/PI/raspbian-dockerfile-taskrunner
2 parents c5f4f4c + 38d9a53 commit 6217a79

File tree

9 files changed

+138
-5
lines changed

9 files changed

+138
-5
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
.vscode
1+
.vscode/*
2+
!important .vscode/tasks.json
3+

Node/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
.vscode/c_cpp_properties.json
44
.vscode/launch.json
55
.vscode/ipch
6+
.vscode/settings.json
7+
.vscode/extensions.json

Pidaq/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Pidaq/.vscode/tasks.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "echoTest",
8+
"type": "shell",
9+
"command": "echo 'Hello taskrunner test good.'",
10+
"group": {
11+
"kind": "build",
12+
"isDefault": true
13+
}
14+
},
15+
{
16+
"label": "buildPiImage",
17+
"type": "shell",
18+
"command": "docker build -t pidaq:v1 docker/.",
19+
"group": {
20+
"kind": "build",
21+
"isDefault": true
22+
}
23+
},
24+
{
25+
"label": "compileRunPiHelloWorld",
26+
"type": "shell",
27+
"command": "docker run -it -v /c/Hyperloop/testing-software/Pidaq:/home/data --entrypoint helloTest.sh pidaq:v1",
28+
"group": {
29+
"kind": "build",
30+
"isDefault": true
31+
}
32+
}
33+
]
34+
}

Pidaq/README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
# Pidaq (Rasp Pi Data Aquisitor)
22

33
This directory contains all of the code that will run on the raspberry pi. The pi will receive and parse CAN messages containing raw telemetry, apply calculations, and create a packet(s) containing either a JSON or protobuf message to send to the control laptop via ethernet (UDP)
4-
***
5-
## Examples
4+
5+
# Development
6+
We will be using docker to cross compile c++ for the raspberry pi
67

7-
Includes relevant examples
8-
***
8+
Ensure docker is installed and running on your machine. Windows 10 Home does not have proper support for docker, however MUN offers a free upgrade to windows 10 education which is fully featured. The update is easy, unintrusive, and takes less than 1 hour.
9+
10+
## Taskrunner Setup Code for VsCode
11+
* Install vscode extension "Tasks" by actboy 168
12+
13+
* Open testing-software/Pidaq folder with vscode
14+
15+
* Replace the folder path in .vscode/tasks.json line 28 command: `compile and run Pidaq HelloWorld`, with your path. replace this -> `/c/Hyperloop/testing-software/Pidaq `
16+
17+
* Try the task buttons in blue taskbar at bottom of vscode window:
18+
* `echoTest` should print Hello taskrunner good.
19+
* `buildPiImage` should build docker image `pidaq:v1`
20+
* `compileRunPiHelloWorld` should print "---Hello Paradigm!!!---"

Pidaq/docker/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM raspbian/stretch:latest
2+
3+
LABEL build-date="2020-03-01" \
4+
name="Raspi + Clang for xcompiling"
5+
6+
RUN sudo apt update -y && \
7+
sudo apt upgrade -y
8+
9+
RUN sudo apt-get install -y \
10+
git \
11+
make \
12+
curl \
13+
xz-utils \
14+
libstdc++6-4.6-dev
15+
16+
RUN cd ~ && \
17+
wget http://releases.llvm.org/9.0.0/clang+llvm-9.0.0-armv7a-linux-gnueabihf.tar.xz && \
18+
tar -xvf clang+llvm-9.0.0-armv7a-linux-gnueabihf.tar.xz && \
19+
rm clang+llvm-9.0.0-armv7a-linux-gnueabihf.tar.xz && \
20+
mv clang+llvm-9.0.0-armv7a-linux-gnueabihf clang_9.0.0 && \
21+
sudo mv clang_9.0.0 /usr/local && \
22+
echo 'export PATH=/usr/local/clang_9.0.0/bin:$PATH' >> ~/.bashrc && \
23+
echo 'export LD_LIBRARY_PATH=/usr/local/clang_9.0.0/lib:$LD_LIBRARY_PATH' >> ~/.bashrc && \
24+
. ~/.bashrc && \
25+
clang++ --version
26+
27+
COPY helloTest.sh /usr/local/bin
28+
29+
RUN sed -i.bak 's/\r$//' /usr/local/bin/helloTest.sh && \
30+
chmod +x /usr/local/bin/helloTest.sh
31+
32+
CMD /bin/bash

Pidaq/docker/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Raspbian Docker Setup
2+
**Developed by Mark Duffett for CompV Software**
3+
4+
Building and running the raspbian docker container:
5+
6+
* Docker build
7+
```
8+
docker build -t pidaq:v1 .
9+
```
10+
11+
* Docker Run (open to bash prompt)
12+
```
13+
docker run -it -v path-to-PIDAQ-dir:/home/data pidaq:v1 /bin/bash
14+
```
15+
16+
* Docker Run (launch script)
17+
```
18+
docker run -it -v path-to-PIDAQ-dir:/home/data --entrypoint helloTest.sh pidaq:v1
19+
```
20+
21+
*Where path-to-PIDAQ-dir = `/c/Hyperloop/testing-software/Pidaq on my machine*
22+
23+
## General Docker Commands
24+
* `docker --version` // Check docker version/ ensure docker is installed
25+
* `docker image ls` // list docker images
26+
27+
## Remote Pi SSH Setup
28+
* `sudo systemctl enable ssh`
29+
* `sudo systemctl start ssh`
30+
* `ifconfig` // to get IP address of raspi
31+
32+
Default: user=pi, password=raspberry
33+

Pidaq/docker/helloTest.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# Custom aliases
3+
# Test C++ Compilation
4+
. ~/.bashrc
5+
cd ~
6+
clang++ /home/data/docker/test_main.cpp
7+
./a.out
8+

Pidaq/docker/test_main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Raspi cross compiling test program
2+
#include<iostream>
3+
4+
int main()
5+
{
6+
std::cout << "---Hello Paradigm!!!---";
7+
8+
return 0;
9+
}

0 commit comments

Comments
 (0)