Commit 83be3621 authored by David Mondou's avatar David Mondou
Browse files

Removed 300 references. Add clear_swd function

parent b2d9adbf
......@@ -85,7 +85,7 @@ convert_bin_to_hex_files ()
#Check to see if nrf52 is protected
test_nrf52_protected() {
echo "Checking BMD300 lock status"
echo "Checking BMD lock status"
openocd -f interface/imx-native.cfg -c \
"transport select swd; source [find target/nrf52.cfg]" -c init \
-c "dap apreg 1 0x0c" -c exit 2> junk
......@@ -93,10 +93,10 @@ test_nrf52_protected() {
rm junk
if [ $APPROTECTSTATUS = "0x00000001" ]
then
echo "BMD300 NOT PROTECTED"
echo "BMD NOT PROTECTED"
return 1
else
echo "BMD 300 PROTECTED"
echo "BMD PROTECTED"
return 0
fi
}
......@@ -109,7 +109,7 @@ test_nrf52_for_protection ()
-c "transport select swd; source [find target/nrf52.cfg]" \
-c init \
-c "dap apreg 1 0x04 0x01; \
echo Unlocking\ BMD-300...; \
echo Unlocking\ BMD...; \
sleep 30000; \
dap apreg 1 0x08; \
dap apreg 1 0x00 0x01; \
......@@ -127,6 +127,23 @@ test_nrf52_for_protection ()
fi
}
# blow out swd lines to ensure SWD is in a good state
clear_swd ()
{
echo 78 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio78/direction
for i in `seq 1 9`;
do
echo 1 > /sys/class/gpio/gpio78/value
usleep 100000
echo 0 > /sys/class/gpio/gpio78/value
usleep 100000
done
echo 78 > /sys/class/gpio/unexport
}
# Check for at least one option
if [ $# -eq 0 ]; then
print_usage
......@@ -173,8 +190,9 @@ if [ "${cmds}" == "" ]; then
fi
test_nrf52_for_protection
clear_swd
echo "writing files ${HEX_FILES[@]} to BMD 300 . . . ."
echo "writing files ${HEX_FILES[@]} to BMD . . . ."
#execute openocd command
eval openocd -f interface/imx-native.cfg \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment