Skip to content

klassenpeter/mojo.py

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

File uploader for the mojo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%