dist: jlink: flash mcu based on serial number
This commit is contained in:
parent
05b19681b8
commit
6ce6bb6468
25
dist/tools/jlink/jlink.sh
vendored
25
dist/tools/jlink/jlink.sh
vendored
@ -9,6 +9,7 @@
|
|||||||
# JLINK: JLink command name, default: "JLinkExe"
|
# JLINK: JLink command name, default: "JLinkExe"
|
||||||
# JLINK_SERVER: JLink GCB server command name, default: "JLinkGDBDerver"
|
# JLINK_SERVER: JLink GCB server command name, default: "JLinkGDBDerver"
|
||||||
# JLINK_DEVICE: Device identifier used by JLink
|
# JLINK_DEVICE: Device identifier used by JLink
|
||||||
|
# JLINK_SERIAL: Device serial used by JLink
|
||||||
# JLINK_IF: Interface used by JLink, default: "SWD"
|
# JLINK_IF: Interface used by JLink, default: "SWD"
|
||||||
# JLINK_SPEED: Interface clock speed to use (in kHz), default "2000"
|
# JLINK_SPEED: Interface clock speed to use (in kHz), default "2000"
|
||||||
# JLINK_FLASH_ADDR: Starting address of the target's flash memory, default: "0"
|
# JLINK_FLASH_ADDR: Starting address of the target's flash memory, default: "0"
|
||||||
@ -63,7 +64,6 @@ _FLASH_ADDR=0
|
|||||||
# a couple of tests for certain configuration options
|
# a couple of tests for certain configuration options
|
||||||
#
|
#
|
||||||
test_config() {
|
test_config() {
|
||||||
|
|
||||||
if [ -z "${HEXFILE}" ]; then
|
if [ -z "${HEXFILE}" ]; then
|
||||||
echo "no hexfile"
|
echo "no hexfile"
|
||||||
else
|
else
|
||||||
@ -122,11 +122,19 @@ test_tui() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_serial() {
|
||||||
|
if [ -n "${JLINK_SERIAL}" ]; then
|
||||||
|
JLINK_SERIAL_SERVER="-select usb='${JLINK_SERIAL}'"
|
||||||
|
JLINK_SERIAL="-SelectEmuBySN '${JLINK_SERIAL}'"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# now comes the actual actions
|
# now comes the actual actions
|
||||||
#
|
#
|
||||||
do_flash() {
|
do_flash() {
|
||||||
test_config
|
test_config
|
||||||
|
test_serial
|
||||||
test_hexfile
|
test_hexfile
|
||||||
# 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
|
||||||
@ -140,7 +148,8 @@ do_flash() {
|
|||||||
fi
|
fi
|
||||||
cat ${RIOTBASE}/dist/tools/jlink/reset.seg >> ${BINDIR}/burn.seg
|
cat ${RIOTBASE}/dist/tools/jlink/reset.seg >> ${BINDIR}/burn.seg
|
||||||
# flash device
|
# flash device
|
||||||
sh -c "${JLINK} -device '${JLINK_DEVICE}' \
|
sh -c "${JLINK} ${JLINK_SERIAL} \
|
||||||
|
-device '${JLINK_DEVICE}' \
|
||||||
-speed '${JLINK_SPEED}' \
|
-speed '${JLINK_SPEED}' \
|
||||||
-if '${JLINK_IF}' \
|
-if '${JLINK_IF}' \
|
||||||
-commandfile '${BINDIR}/burn.seg'"
|
-commandfile '${BINDIR}/burn.seg'"
|
||||||
@ -148,11 +157,13 @@ do_flash() {
|
|||||||
|
|
||||||
do_debug() {
|
do_debug() {
|
||||||
test_config
|
test_config
|
||||||
|
test_serial
|
||||||
test_elffile
|
test_elffile
|
||||||
test_ports
|
test_ports
|
||||||
test_tui
|
test_tui
|
||||||
# start the JLink GDB server
|
# start the JLink GDB server
|
||||||
sh -c "${JLINK_SERVER} -device '${JLINK_DEVICE}' \
|
sh -c "${JLINK_SERVER} ${JLINK_SERIAL_SERVER} \
|
||||||
|
-device '${JLINK_DEVICE}' \
|
||||||
-speed '${JLINK_SPEED}' \
|
-speed '${JLINK_SPEED}' \
|
||||||
-if '${JLINK_IF}' \
|
-if '${JLINK_IF}' \
|
||||||
-port '${GDB_PORT}' \
|
-port '${GDB_PORT}' \
|
||||||
@ -168,8 +179,10 @@ do_debug() {
|
|||||||
do_debugserver() {
|
do_debugserver() {
|
||||||
test_ports
|
test_ports
|
||||||
test_config
|
test_config
|
||||||
|
test_serial
|
||||||
# start the JLink GDB server
|
# start the JLink GDB server
|
||||||
sh -c "${JLINK_SERVER} -device '${JLINK_DEVICE}' \
|
sh -c "${JLINK_SERVER} ${JLINK_SERIAL_SERVER} \
|
||||||
|
-device '${JLINK_DEVICE}' \
|
||||||
-speed '${JLINK_SPEED}' \
|
-speed '${JLINK_SPEED}' \
|
||||||
-if '${JLINK_IF}' \
|
-if '${JLINK_IF}' \
|
||||||
-port '${GDB_PORT}' \
|
-port '${GDB_PORT}' \
|
||||||
@ -178,8 +191,10 @@ do_debugserver() {
|
|||||||
|
|
||||||
do_reset() {
|
do_reset() {
|
||||||
test_config
|
test_config
|
||||||
|
test_serial
|
||||||
# reset the board
|
# reset the board
|
||||||
sh -c "${JLINK} -device '${JLINK_DEVICE}' \
|
sh -c "${JLINK} ${JLINK_SERIAL} \
|
||||||
|
-device '${JLINK_DEVICE}' \
|
||||||
-speed '${JLINK_SPEED}' \
|
-speed '${JLINK_SPEED}' \
|
||||||
-if '${JLINK_IF}' \
|
-if '${JLINK_IF}' \
|
||||||
-commandfile '${RIOTBASE}/dist/tools/jlink/reset.seg'"
|
-commandfile '${RIOTBASE}/dist/tools/jlink/reset.seg'"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user