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.
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.
git clone https://github.com/klassenpeter/mojo.py.git
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
In your linux shell use the venv activate
script to
enter your created virtual environment:
source ./venv/bin/activate
Unfortunately there is neither a pypi package (yet), nor a requrements.txt, thus
you need to install the pyserial
package yourself:
pip install pyserial
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.
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)
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
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.
Finally upload the bin file to your Mojo board:
./mojo.py -i ../led_wave.bin -d /dev/ttyACM1 -v