Code Monkey home page Code Monkey logo

mojo.py's Introduction

mojo.py

This tiny script loads a given firmware.bin file to your Mojo V3 board. In the following the led demo firmware led_wave.bin is loaded.

setup steps

To use this script, execute the following preparation steps. See the usage section on how to load a firmware to to your Mojo V3 board.

clone this repo

git clone https://github.com/klassenpeter/mojo.py.git

create a virtual environment

Enter the repo and use the venv python module (-m venv) to create a virtual environment with the same name venv:

cd mojo.py
python -m venv venv

activate the virtual environment

In your linux shell use the venv activate script to enter your created virtual environment:

source ./venv/bin/activate

install the dependencies

Unfortunately there is neither a pypi package (yet), nor a requrements.txt, thus you need to install the pyserial package yourself:

pip install pyserial

done

You are done with the setup. Do not forget to deactivate the virtual environment, if you keep the terminal open:

deactivate

To load a firmware proceed with the usage section.

usage

venv

first you need to activate your python virtual environment, which you created in the setup section:

source ./venv/bin/activate

Now you should be able to use the script, try:

./mojo.py -h

you should see:

usage: mojo.py [-h] [-i BITSTREAM] [-r] [-v] [-V] [-n] [-e] [-d MOJO_TTY] [-p] [BITSTREAM]

Mojo bitstream loader v2

positional arguments:
  BITSTREAM             Bitstream file to upload to the Mojo.

optional arguments:
  -h, --help            show this help message and exit
  -i BITSTREAM, --install BITSTREAM
                        Bitstream file to upload to the Mojo
  -r, --ram             Install bitstream file only to ram
  -v, --verbose         Enable verbose output to cli.
  -V, --version         Display version number of mojo.
  -n, --no-verify       Do not verify the operation to the Mojo.
  -e, --erase           Erase flash on Mojo.
  -d MOJO_TTY, --device MOJO_TTY
                        Address of the serial port for the mojo [Default: /dev/mojo]
  -p, --progress        Display progress bar while uploading.
(venv) โžœ  mojo.py git:(further_rework)

get your firmware

To test the upload procedure, you could use a firmware that is provided by the manufacturer:

wget http://cdn.embeddedmicro.com/mojo/led_wave.bin -O ../led_wave.bin

serial port

To check which port name your Mojo V3 board is assigned to, you could do something like:

journalctl -f

Now connect your Mojo and search the log output for something like /dev/ttyUSB0 or /dev/ttyACM0. Alternatively see which /dev/tty* gets created after the insertion.

flash

Finally upload the bin file to your Mojo board:

./mojo.py -i ../led_wave.bin  -d /dev/ttyACM1 -v

have fun

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.