mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
d63672798e
These bits configure some early boot options and may be necessary to use on certain boards to ensure a robust boot sequence.
25 lines
833 B
Bash
Executable File
25 lines
833 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Anti brick check script for Freescale Kinetis MCUs.
|
|
#
|
|
# This script is supposed to be called from RIOTs
|
|
# unified OpenOCD script (dist/tools/openocd/openocd.sh).
|
|
#
|
|
# @author Jonas Remmert <j.remmert@phytec.de>
|
|
# @author Johann Fischer <j.fischer@phytec.de>
|
|
|
|
ELFFILE=$1
|
|
ACTUAL_FCFIELD=$(arm-none-eabi-objdump -j.fcfield -s "${ELFFILE}" | awk '/^ 0400 / {print $2 $3 $4 $5}')
|
|
# Allow any FOPT flags configuration (".." in the pattern)
|
|
EXPECTED_FCFIELD="^fffffffffffffffffffffffffe..ffff$"
|
|
|
|
if ! printf '%s' "${ACTUAL_FCFIELD}" | grep -q "${EXPECTED_FCFIELD}" ; then
|
|
echo "Danger of bricking the device during flash!"
|
|
echo "Flash configuration field of ${ELFFILE}:"
|
|
arm-none-eabi-objdump -j.fcfield -s "${ELFFILE}"
|
|
echo "Abort flash procedure!"
|
|
exit 1
|
|
fi
|
|
echo "${ELFFILE} is fine."
|
|
exit 0
|