Skip to content

Instantly share code, notes, and snippets.

@RickKimball
Created March 11, 2019 19:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save RickKimball/e347a3c47e5ab1ed7170243e3a98722b to your computer and use it in GitHub Desktop.
compile PRU_gpioToggle and load it into pru using remoteproc
#! /bin/bash
##############################################################################
#
# Copyright (C) 2016 Zubeen Tolani <ZeekHuge - zeekhuge@gmail.com>
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the
# distribution
#
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#############################################################################
set -x
# The script builds the pru_blinky project and configures the pinmuxing for $HEADER$PIN_NUM
#If changing these variables, make sure the given pin can be muxed to the given pru.
HEADER=P8_
#PIN_NUMBER=45 # PRU1_OUT0
#PIN_NUMBER=43 # PRU1_OUT2
#PRU_CORE should be either 0 or 1
#PRU_CORE=1
PRU_CORE=0
PIN_NUMBER=11 # PRU0_OUT15
export PIN_MASK="1<<15"
echo "*******************************************************"
echo "This must be compiled on the BEAGLEBONE BLACK itself"
echo "It was tested on 4.14 kernel version"
echo "******NOTE: use a resistor >470 ohms to connect to the LED, I have alredy made this mistake."
#echo "To continue, press any key:"
#read
echo "-Building project"
cd PRU_gpioToggle
make clean
make
echo "-Placing the firmware"
cp gen/*.out /lib/firmware/am335x-pru$PRU_CORE-fw
echo "-Configuring pinmux"
config-pin -a $HEADER$PIN_NUMBER pruout
config-pin -q $HEADER$PIN_NUMBER
echo "-Rebooting"
if [ $PRU_CORE -eq 0 ]
then
echo "Rebooting pru-core 0"
echo "stop" >/sys/class/remoteproc/remoteproc1/state
echo "start" >/sys/class/remoteproc/remoteproc1/state
else
echo "Rebooting pru-core 1"
echo "stop" >/sys/class/remoteproc/remoteproc2/state
echo "start" >/sys/class/remoteproc/remoteproc2/state
fi
echo "Done. Blinky must be up on pin $HEADER$PIN_NUMBER"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment