Merge pull request #15807 from haukepetersen/opt_jlink_versioncheckstuff

tools/jlink.sh: fix version check and allow to skip it
This commit is contained in:
Hauke Petersen 2021-01-25 14:03:06 +01:00 committed by GitHub
commit ce0d589384
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,21 +156,23 @@ test_term() {
} }
test_version() { test_version() {
JLINK_MINIMUM_VERSION="6.74" if [ -z "${JLINK_SKIP_VERSION}" ]; then
# Adding '-nogui 1' will simply return 'Unknown command line option -nogui' JLINK_MINIMUM_VERSION="6.74"
# on older versions, JLINK_VERSION will still be parsed correctly. # Adding '-nogui 1' will simply return 'Unknown command line option -nogui'
JLINK_VERSION=$(echo q | "${JLINK}" -nogui 1 2> /dev/null | grep "^DLL version*" | grep -oE "[0-9]+\.[0-9]+") # on older versions, JLINK_VERSION will still be parsed correctly.
JLINK_VERSION=$(echo q | "${JLINK}" "${JLINK_SERIAL}" -nogui 1 2> /dev/null | grep "^DLL version*" | grep -oE "[0-9]+\.[0-9]+")
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: J-Link appears not to be installed on your PATH" echo "Error: J-Link appears not to be installed on your PATH"
exit 1 exit 1
fi fi
"$RIOTTOOLS"/has_minimal_version/has_minimal_version.sh "$JLINK_VERSION" "$JLINK_MINIMUM_VERSION" 2> /dev/null "$RIOTTOOLS"/has_minimal_version/has_minimal_version.sh "$JLINK_VERSION" "$JLINK_MINIMUM_VERSION" 2> /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: J-Link V$JLINK_MINIMUM_VERSION is required, but V${JLINK_VERSION} is installed" echo "Error: J-Link V$JLINK_MINIMUM_VERSION is required, but V${JLINK_VERSION} is installed"
exit 1 exit 1
fi
fi fi
} }
@ -180,8 +182,8 @@ test_version() {
do_flash() { do_flash() {
BINFILE=$1 BINFILE=$1
test_config test_config
test_version
test_serial test_serial
test_version
test_binfile test_binfile
# clear any existing contents in burn file # clear any existing contents in burn file
/bin/echo -n "" > ${BINDIR}/burn.seg /bin/echo -n "" > ${BINDIR}/burn.seg
@ -210,8 +212,8 @@ do_flash() {
do_debug() { do_debug() {
ELFFILE=$1 ELFFILE=$1
test_config test_config
test_version
test_serial test_serial
test_version
test_elffile test_elffile
test_ports test_ports
test_tui test_tui
@ -235,9 +237,9 @@ do_debug() {
do_debugserver() { do_debugserver() {
test_config test_config
test_serial
test_version test_version
test_ports test_ports
test_serial
# start the J-Link GDB server # start the J-Link GDB server
sh -c "${JLINK_SERVER} ${JLINK_SERIAL_SERVER} \ sh -c "${JLINK_SERVER} ${JLINK_SERIAL_SERVER} \
-nogui \ -nogui \
@ -250,8 +252,8 @@ do_debugserver() {
do_reset() { do_reset() {
test_config test_config
test_version
test_serial test_serial
test_version
# reset the board # reset the board
sh -c "${JLINK} ${JLINK_SERIAL} \ sh -c "${JLINK} ${JLINK_SERIAL} \
-nogui 1 \ -nogui 1 \
@ -265,8 +267,8 @@ do_reset() {
do_term() { do_term() {
test_config test_config
test_version
test_serial test_serial
test_version
test_term test_term
# temporary file that save the J-Link Commander pid # temporary file that save the J-Link Commander pid