Created
July 12, 2021 16:48
-
-
Save DhruvaG2000/eccbb9ee60c014dafc366555230f326d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -xe | |
[ -z "$1"] && echo "Pass one argument: .p file" >&2 && exit 1 | |
PRU_FILE=$1 | |
PRU_FILE_BIN=$(basename ${PRU_FILE%.*}.bin) | |
SOURCE=template.pru1_1 | |
rm -rf $SOURCE.o* included_assembly.h | |
pasm -V2 -b $PRU_FILE | |
prudis $PRU_FILE_BIN | sed 's/^\(.*\)$/" \1\\n"/' > included_assembly.h | |
clpru -fe $SOURCE.o $SOURCE.c -v3 --endian=little --asm_listing --c_src_interlist --include_path=common --include_path=/usr/lib/ti/pru-software-support-package/include | |
lnkpru -o $SOURCE.out $SOURCE.o --stack_size=0x0 --heap_size=0x0 -m $SOURCE.map am57xx_pru.cmd | |
# the above prudis -> clpru step was to generate a dummy .out file. However, | |
# clpru may have screwed up some of the QB instructions. | |
# now replace the relevant section in that file with the correct binary blob | |
cp $SOURCE.out $SOURCE.out-bak | |
dd if=$PRU_FILE_BIN of=$SOURCE.out bs=1 obs=1 seek=52 conv=notrunc | |
# file is now ready to go. | |
cp $SOURCE.out /lib/firmware/am57xx-pru1_1-fw | |
echo stop > /dev/remoteproc/pruss1-core1/state 2> /dev/null || true | |
echo start > /dev/remoteproc/pruss1-core1/state |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment