GithubHelp home page GithubHelp logo

iot_assignment_3's Introduction

IOT Assignment 3

In this assignment I managed to cross-compile a simple C program using Docker buildx (on Windows) and run it on the Pynq-Z2.

The first step was to create a new Docker buildx builder using the following commands. This isn't strictly necessary but it is recommended so you always have the default builder to fall back on.

docker buildx create --name pynqbuilder
docker buildx use pynqbuilder

Using DockerHub

Then it was time to build using buildx and push the images to a registry. I tried to use the Github registry for this but I couldn't get this to work so decided to use Dockerhub instead (it turns out using de Github registry is actually just as easy, the process is described in the next section). First you must login to Dockerhub, then the command goes as follows:

docker login
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t brentgg/iot_assignment_3:latest --push .

This can also be seen in the image below. I misspelled iot_assigment_3 so now the Dockerhub repository is missing a 't', pay no attention to that.

docker buildx build

Now the Dockerhub repository contains three versions of the same image, one for every architecture specified in the buildx build command. At this point we can move on to the Pynq where Docker has to be installed. This can be done like so:

sudo apt-get update
sudo apt-get install -y docker.io

And check the install using

docker -v

Lastly we can pull and run the image like so:

sudo docker pull brentgg/io_assignment_3:latest
sudo docker run brentgg/io_assignment_3

At which point "Hello World" will be printed to the console, without a newline... on purpose. This can be seen in the image below.

running the image on the Pynq

Using GitHub

To use the Github registry you must first login to it using Docker.

docker login ghcr.io -u brentgg -p TOKEN

Then building using buildx is the same except the path has ghcr.io/ in front of it:

docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t ghcr.io/brentgg/iot_assignment_3:latest --push .

docker buildx build and push to ghcr instead of dockerhub

Don't forget to install Docker:

sudo apt-get update
sudo apt-get install -y docker.io

And check the install using

docker -v

The process of pulling and running this image on the Pynq is once again the same but with a different path. It must be noted that I had to change the visibility of the image to public to be able to pull it on the Pynq, even though I was logged into ghcr.

sudo docker pull ghcr.io/brentgg/iot_assignment_3:latest
sudo docker run ghcr.io/brentgg/io_assignment_3

running the ghcr image on the Pynq

iot_assignment_3's People

Contributors

brentgg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.