Skip to content

Commit

Permalink
Merge pull request #15807 from haukepetersen/opt_jlink_versioncheckstuff
Browse files Browse the repository at this point in the history
tools/jlink.sh: fix version check and allow to skip it
  • Loading branch information
haukepetersen authored Jan 25, 2021
2 parents 87cd41a + 82ae3eb commit ce0d589
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions dist/tools/jlink/jlink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,23 @@ test_term() {
}

test_version() {
JLINK_MINIMUM_VERSION="6.74"
# Adding '-nogui 1' will simply return 'Unknown command line option -nogui'
# on older versions, JLINK_VERSION will still be parsed correctly.
JLINK_VERSION=$(echo q | "${JLINK}" -nogui 1 2> /dev/null | grep "^DLL version*" | grep -oE "[0-9]+\.[0-9]+")
if [ -z "${JLINK_SKIP_VERSION}" ]; then
JLINK_MINIMUM_VERSION="6.74"
# Adding '-nogui 1' will simply return 'Unknown command line option -nogui'
# 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
echo "Error: J-Link appears not to be installed on your PATH"
exit 1
fi
if [ $? -ne 0 ]; then
echo "Error: J-Link appears not to be installed on your PATH"
exit 1
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
echo "Error: J-Link V$JLINK_MINIMUM_VERSION is required, but V${JLINK_VERSION} is installed"
exit 1
if [ $? -ne 0 ]; then
echo "Error: J-Link V$JLINK_MINIMUM_VERSION is required, but V${JLINK_VERSION} is installed"
exit 1
fi
fi
}

Expand All @@ -180,8 +182,8 @@ test_version() {
do_flash() {
BINFILE=$1
test_config
test_version
test_serial
test_version
test_binfile
# clear any existing contents in burn file
/bin/echo -n "" > ${BINDIR}/burn.seg
Expand Down Expand Up @@ -210,8 +212,8 @@ do_flash() {
do_debug() {
ELFFILE=$1
test_config
test_version
test_serial
test_version
test_elffile
test_ports
test_tui
Expand All @@ -235,9 +237,9 @@ do_debug() {

do_debugserver() {
test_config
test_serial
test_version
test_ports
test_serial
# start the J-Link GDB server
sh -c "${JLINK_SERVER} ${JLINK_SERIAL_SERVER} \
-nogui \
Expand All @@ -250,8 +252,8 @@ do_debugserver() {

do_reset() {
test_config
test_version
test_serial
test_version
# reset the board
sh -c "${JLINK} ${JLINK_SERIAL} \
-nogui 1 \
Expand All @@ -265,8 +267,8 @@ do_reset() {

do_term() {
test_config
test_version
test_serial
test_version
test_term

# temporary file that save the J-Link Commander pid
Expand Down

0 comments on commit ce0d589

Please sign in to comment.