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 () ...@@ -85,7 +85,7 @@ convert_bin_to_hex_files ()
#Check to see if nrf52 is protected #Check to see if nrf52 is protected
test_nrf52_protected() { test_nrf52_protected() {
echo "Checking BMD300 lock status" echo "Checking BMD lock status"
openocd -f interface/imx-native.cfg -c \ openocd -f interface/imx-native.cfg -c \
"transport select swd; source [find target/nrf52.cfg]" -c init \ "transport select swd; source [find target/nrf52.cfg]" -c init \
-c "dap apreg 1 0x0c" -c exit 2> junk -c "dap apreg 1 0x0c" -c exit 2> junk
...@@ -93,10 +93,10 @@ test_nrf52_protected() { ...@@ -93,10 +93,10 @@ test_nrf52_protected() {
rm junk rm junk
if [ $APPROTECTSTATUS = "0x00000001" ] if [ $APPROTECTSTATUS = "0x00000001" ]
then then
echo "BMD300 NOT PROTECTED" echo "BMD NOT PROTECTED"
return 1 return 1
else else
echo "BMD 300 PROTECTED" echo "BMD PROTECTED"
return 0 return 0
fi fi
} }
...@@ -109,7 +109,7 @@ test_nrf52_for_protection () ...@@ -109,7 +109,7 @@ test_nrf52_for_protection ()
-c "transport select swd; source [find target/nrf52.cfg]" \ -c "transport select swd; source [find target/nrf52.cfg]" \
-c init \ -c init \
-c "dap apreg 1 0x04 0x01; \ -c "dap apreg 1 0x04 0x01; \
echo Unlocking\ BMD-300...; \ echo Unlocking\ BMD...; \
sleep 30000; \ sleep 30000; \
dap apreg 1 0x08; \ dap apreg 1 0x08; \
dap apreg 1 0x00 0x01; \ dap apreg 1 0x00 0x01; \
...@@ -127,6 +127,23 @@ test_nrf52_for_protection () ...@@ -127,6 +127,23 @@ test_nrf52_for_protection ()
fi 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 # Check for at least one option
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
print_usage print_usage
...@@ -173,8 +190,9 @@ if [ "${cmds}" == "" ]; then ...@@ -173,8 +190,9 @@ if [ "${cmds}" == "" ]; then
fi fi
test_nrf52_for_protection test_nrf52_for_protection
clear_swd
echo "writing files ${HEX_FILES[@]} to BMD 300 . . . ." echo "writing files ${HEX_FILES[@]} to BMD . . . ."
#execute openocd command #execute openocd command
eval openocd -f interface/imx-native.cfg \ 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