From 08da1a06719af5c0e3f912bfb02888a8db8af389 Mon Sep 17 00:00:00 2001 From: Colton Smith <47944858+colton-smith@users.noreply.github.com> Date: Sun, 1 Mar 2020 16:17:16 -0500 Subject: [PATCH 01/11] Add raspbian dockerfile from compV --- Pidaq/docker/Dockerfile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Pidaq/docker/Dockerfile diff --git a/Pidaq/docker/Dockerfile b/Pidaq/docker/Dockerfile new file mode 100644 index 0000000..88b1df4 --- /dev/null +++ b/Pidaq/docker/Dockerfile @@ -0,0 +1,31 @@ +FROM raspbian/stretch:latest + +LABEL build-date="2020-03-01" \ + name="Raspi + Clang for xcompiling" + +RUN sudo apt update -y && \ + sudo apt upgrade -y + +RUN sudo apt-get install -y \ + git \ + make \ + curl \ + xz-utils \ + libstdc++6-4.6-dev + +RUN cd ~ && \ + wget http://releases.llvm.org/9.0.0/clang+llvm-9.0.0-armv7a-linux-gnueabihf.tar.xz && \ + tar -xvf clang+llvm-9.0.0-armv7a-linux-gnueabihf.tar.xz && \ + rm clang+llvm-9.0.0-armv7a-linux-gnueabihf.tar.xz && \ + mv clang+llvm-9.0.0-armv7a-linux-gnueabihf clang_9.0.0 && \ + sudo mv clang_9.0.0 /usr/local && \ + echo 'export PATH=/usr/local/clang_9.0.0/bin:$PATH' >> ~/.bashrc && \ + echo 'export LD_LIBRARY_PATH=/usr/local/clang_9.0.0/lib:$LD_LIBRARY_PATH' >> ~/.bashrc && \ + . ~/.bashrc && \ + clang++ --version + +COPY helloTest.sh /usr/local/bin + +RUN sed -i.bak 's/\r$//' /usr/local/bin/helloTest.sh && \ + chmod +x /usr/local/bin/helloTest.sh + From 579a9f2553b9e2a963fc66fd96bf53713d6ef42e Mon Sep 17 00:00:00 2001 From: Colton Smith <47944858+colton-smith@users.noreply.github.com> Date: Sun, 1 Mar 2020 16:18:04 -0500 Subject: [PATCH 02/11] Add script+cpp file for testing xcompile in docker --- Pidaq/docker/helloTest.sh | 8 ++++++++ Pidaq/docker/test_main.cpp | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100644 Pidaq/docker/helloTest.sh create mode 100644 Pidaq/docker/test_main.cpp diff --git a/Pidaq/docker/helloTest.sh b/Pidaq/docker/helloTest.sh new file mode 100644 index 0000000..2a4a1e0 --- /dev/null +++ b/Pidaq/docker/helloTest.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Custom aliases +# Test C++ Compilation +. ~/.bashrc +cd ~ +clang++ /home/data/docker/test_main.cpp +./a.out + diff --git a/Pidaq/docker/test_main.cpp b/Pidaq/docker/test_main.cpp new file mode 100644 index 0000000..a84e0de --- /dev/null +++ b/Pidaq/docker/test_main.cpp @@ -0,0 +1,9 @@ +// Raspi cross compiling test program +#include + +int main() +{ + std::cout << "---Hello Paradigm!!!---"; + + return 0; +} \ No newline at end of file From 4c56ebc4cbb0685d15126a874c6d0b61a6e7a4c4 Mon Sep 17 00:00:00 2001 From: Colton Smith <47944858+colton-smith@users.noreply.github.com> Date: Sun, 1 Mar 2020 16:18:27 -0500 Subject: [PATCH 03/11] Add pi development+docker readmes --- Pidaq/README.md | 20 ++++++++++++++++---- Pidaq/docker/README.md | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 Pidaq/docker/README.md diff --git a/Pidaq/README.md b/Pidaq/README.md index cbbed3a..c41d7ea 100644 --- a/Pidaq/README.md +++ b/Pidaq/README.md @@ -1,8 +1,20 @@ # Pidaq (Rasp Pi Data Aquisitor) 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) -*** -## Examples + +# Development +We will be using docker to cross compile c++ for the raspberry pi -Includes relevant examples -*** +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 tasks less than 1 hour. + +## Taskrunner Setup Code for VsCode +* Install vscode extension "Tasks" by actboy 168 + +* Open testing-software/Pidaq folder with vscode + +* 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 ` + +* Try the task buttons in blue taskbar at bottom of vscode window: + * `echoTest` should print Hello taskrunner good. + * `buildPiImage` should build docker image `pidaq:v1` + * `compileRunPiHelloWorld` should print "---Hello Paradigm!!!---" diff --git a/Pidaq/docker/README.md b/Pidaq/docker/README.md new file mode 100644 index 0000000..bb5c4c3 --- /dev/null +++ b/Pidaq/docker/README.md @@ -0,0 +1,33 @@ +# Raspbian Docker Setup +**Developed by Mark Duffett for CompV Software** + +Building and running the raspbian docker container: + +* Docker build +``` +docker build -t pidaq:v1 . +``` + +* Docker Run (open to bash prompt) +``` +docker run -it -v path-to-PIDAQ-dir:/home/data pidaq:v1 /bin/bash +``` + +* Docker Run (launch script) +``` +docker run -it -v path-to-PIDAQ-dir:/home/data --entrypoint helloTest.sh pidaq:v1 +``` + +*Where path-to-PIDAQ-dir = `/c/Hyperloop/testing-software/Pidaq on my machine* + +## General Docker Commands +* `docker --version` // Check docker version/ ensure docker is installed +* `docker image ls` // list docker images + +## Remote Pi SSH Setup +* `sudo systemctl enable ssh` +* `sudo systemctl start ssh` +* `ifconfig` // to get IP address of raspi + +Default: user=pi, password=raspberry + From de6bc0744262f143f2e468711eec213821aebc38 Mon Sep 17 00:00:00 2001 From: Colton Smith <47944858+colton-smith@users.noreply.github.com> Date: Sun, 1 Mar 2020 16:33:09 -0500 Subject: [PATCH 04/11] Add settings+extensions to node gitignore --- Node/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Node/.gitignore b/Node/.gitignore index 89cc49c..0bcfe0f 100644 --- a/Node/.gitignore +++ b/Node/.gitignore @@ -3,3 +3,5 @@ .vscode/c_cpp_properties.json .vscode/launch.json .vscode/ipch +.vscode/settings.json +.vscode/extensions.json From 9e1c9ff308ded77b5996ba4bad420e15c2ebfa55 Mon Sep 17 00:00:00 2001 From: Colton Smith <47944858+colton-smith@users.noreply.github.com> Date: Sun, 1 Mar 2020 16:34:00 -0500 Subject: [PATCH 05/11] Negate the gitignore of tasks.json in pi folder --- Pidaq/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 Pidaq/.gitignore diff --git a/Pidaq/.gitignore b/Pidaq/.gitignore new file mode 100644 index 0000000..af66f34 --- /dev/null +++ b/Pidaq/.gitignore @@ -0,0 +1 @@ +!important vscode/tasks.json From 4604dd21a64d676594bf5234711c19a3904a3045 Mon Sep 17 00:00:00 2001 From: Colton Smith <47944858+colton-smith@users.noreply.github.com> Date: Sun, 1 Mar 2020 18:50:30 -0500 Subject: [PATCH 06/11] Add CMD to dockerfile so run defaults to shell --- Pidaq/docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Pidaq/docker/Dockerfile b/Pidaq/docker/Dockerfile index 88b1df4..b75ed86 100644 --- a/Pidaq/docker/Dockerfile +++ b/Pidaq/docker/Dockerfile @@ -29,3 +29,4 @@ COPY helloTest.sh /usr/local/bin RUN sed -i.bak 's/\r$//' /usr/local/bin/helloTest.sh && \ chmod +x /usr/local/bin/helloTest.sh +CMD /bin/bash \ No newline at end of file From 49936655ea79b5d77eba6891107fdc1f96922b5a Mon Sep 17 00:00:00 2001 From: Colton Smith <47944858+colton-smith@users.noreply.github.com> Date: Mon, 2 Mar 2020 22:34:49 -0500 Subject: [PATCH 07/11] Fix typo in pidaq root readme, tasks->takes --- Pidaq/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pidaq/README.md b/Pidaq/README.md index c41d7ea..fabf860 100644 --- a/Pidaq/README.md +++ b/Pidaq/README.md @@ -5,7 +5,7 @@ This directory contains all of the code that will run on the raspberry pi. The p # Development We will be using docker to cross compile c++ for the raspberry pi -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 tasks less than 1 hour. +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. ## Taskrunner Setup Code for VsCode * Install vscode extension "Tasks" by actboy 168 From db2b8a4f7749f231e028e9e6830cc826c001803a Mon Sep 17 00:00:00 2001 From: Colton Smith <47944858+colton-smith@users.noreply.github.com> Date: Tue, 3 Mar 2020 18:06:27 -0500 Subject: [PATCH 08/11] Fix typo in gitignore --- Pidaq/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pidaq/.gitignore b/Pidaq/.gitignore index af66f34..f5bcdd2 100644 --- a/Pidaq/.gitignore +++ b/Pidaq/.gitignore @@ -1 +1 @@ -!important vscode/tasks.json +important .vscode/tasks.json From 9480e0e2cd6903bc92b664dbad4ab178224eeb75 Mon Sep 17 00:00:00 2001 From: Colton Smith <47944858+colton-smith@users.noreply.github.com> Date: Tue, 3 Mar 2020 19:10:11 -0500 Subject: [PATCH 09/11] Add ! back to .gitignore --- Pidaq/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pidaq/.gitignore b/Pidaq/.gitignore index f5bcdd2..003a995 100644 --- a/Pidaq/.gitignore +++ b/Pidaq/.gitignore @@ -1 +1 @@ -important .vscode/tasks.json +!important .vscode/tasks.json From 3463481479143f350662e2162366c5effcbbaae8 Mon Sep 17 00:00:00 2001 From: Colton Smith <47944858+colton-smith@users.noreply.github.com> Date: Sat, 7 Mar 2020 18:14:43 -0500 Subject: [PATCH 10/11] gitignore contents of .vscode instead of folder --- .gitignore | 4 +++- Pidaq/.vscode/tasks.json | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Pidaq/.vscode/tasks.json diff --git a/.gitignore b/.gitignore index 722d5e7..eb1c802 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -.vscode +.vscode/* +!important .vscode/tasks.json + diff --git a/Pidaq/.vscode/tasks.json b/Pidaq/.vscode/tasks.json new file mode 100644 index 0000000..1230b11 --- /dev/null +++ b/Pidaq/.vscode/tasks.json @@ -0,0 +1,34 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "echoTest", + "type": "shell", + "command": "echo 'Hello taskrunner test good.'", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "buildPiImage", + "type": "shell", + "command": "docker build -t pidaq:v1 docker/.", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "compileRunPiHelloWorld", + "type": "shell", + "command": "docker run -it -v /c/Hyperloop/testing-software/Pidaq:/home/data --entrypoint helloTest.sh pidaq:v1", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file From 38d9a53558d7cfbace7f521f93d2251cd66ff79f Mon Sep 17 00:00:00 2001 From: Colton Smith <47944858+colton-smith@users.noreply.github.com> Date: Sat, 7 Mar 2020 18:16:00 -0500 Subject: [PATCH 11/11] Handled gitignore at higher level, emptied lowlevel --- Pidaq/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pidaq/.gitignore b/Pidaq/.gitignore index 003a995..8b13789 100644 --- a/Pidaq/.gitignore +++ b/Pidaq/.gitignore @@ -1 +1 @@ -!important .vscode/tasks.json +