circuitpython/teensy/add-memzip.sh
Dave Hylands d80ee8bbfd Added memzip filesystem support for teensy
You can now append a zipfile (containining uncomressed python sources)
to the micropython.hex file.

Use MEMZIP_DIR=directory when you call make, or set that in your
environment to include a different tree of source files.

Added sample /boot.py, /src/main.py, /test.py and /src/test.py files.

Added run command so that you can execute scripts from REPL (until import is implemented).

Added build directory to .gitignore
2014-01-11 16:16:20 -08:00

28 lines
663 B
Bash
Executable File

#!/bin/bash
if [ "$#" != 3 ]; then
echo "Usage: add-memzip.sh input.hex output.hex file-directory"
exit 1
fi
#set -x
input_hex=$1
output_hex=$2
memzip_src_dir=$3
input_bin=${input_hex}.bin
output_bin=${output_hex}.bin
zip_file=${output_hex}.zip
zip_base=$(basename ${zip_file})
zip_dir=$(dirname ${zip_file})
abs_zip_dir=$(realpath ${zip_dir})
rm -f ${zip_file}
(cd ${memzip_src_dir}; zip -0 -r -D ${abs_zip_dir}/${zip_base} .)
objcopy -I ihex -O binary ${input_hex} ${input_bin}
cat ${input_bin} ${zip_file} > ${output_bin}
objcopy -I binary -O ihex ${output_bin} ${output_hex}
echo "Added ${memzip_src_dir} to ${input_hex} creating ${output_hex}"