pru: Add support for "make flash" rule
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
5793271308
commit
b32ba3727b
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# This script installs the PRU firmware on a beaglebone machine.
|
||||||
|
|
||||||
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
echo "This script must be run as root"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Install new firmware
|
||||||
|
echo "Installing firmware to /lib/firmware/"
|
||||||
|
cp out/pru0.elf /lib/firmware/am335x-pru0-fw
|
||||||
|
cp out/pru1.elf /lib/firmware/am335x-pru1-fw
|
||||||
|
sync
|
||||||
|
|
||||||
|
# Shutdown existing Klipper instance (if applicable). The goal is to
|
||||||
|
# put the GPIO pins in a safe state.
|
||||||
|
if [ -c /dev/rpmsg_pru30 ]; then
|
||||||
|
echo "Attempting to shutdown existing firmware..."
|
||||||
|
( echo "FORCE_SHUTDOWN" > /dev/rpmsg_pru30 ) 2> /dev/null || ( echo "Firmware busy! Please shutdown Klipper and then retry." && exit 1 )
|
||||||
|
sleep 1
|
||||||
|
( echo "FORCE_SHUTDOWN" > /dev/rpmsg_pru30 ) 2> /dev/null || ( echo "Firmware busy! Please shutdown Klipper and then retry." && exit 1 )
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
set +e
|
||||||
|
|
||||||
|
# Restart the PRU
|
||||||
|
echo "Restarting pru_rproc module"
|
||||||
|
rmmod -f pru_rproc
|
||||||
|
modprobe pru_rproc
|
|
@ -31,3 +31,7 @@ $(OUT)pru0.elf: $(patsubst %.c, $(OUT)src/%.o,$(pru0-y))
|
||||||
$(OUT)pru1.elf: $(OUT)klipper.elf
|
$(OUT)pru1.elf: $(OUT)klipper.elf
|
||||||
@echo " Linking $@"
|
@echo " Linking $@"
|
||||||
$(Q)$(CC) $(CFLAGS_pru1.elf) $^ -o $@
|
$(Q)$(CC) $(CFLAGS_pru1.elf) $^ -o $@
|
||||||
|
|
||||||
|
flash: $(OUT)pru0.elf $(OUT)pru1.elf
|
||||||
|
@echo " Flashing"
|
||||||
|
$(Q)sudo ./scripts/flash-pru.sh
|
||||||
|
|
Loading…
Reference in New Issue