Skip to content
Snippets Groups Projects
Unverified Commit 963d06c7 authored by Alexandre Abadie's avatar Alexandre Abadie Committed by GitHub
Browse files

Merge pull request #10528 from cladmi/pr/make/jlink/flashfile_from_cli

jlink: get flash and debug files from cli
parents 003c04bd 5fcc1210
No related branches found
No related tags found
No related merge requests found
......@@ -18,23 +18,25 @@
#
# The script supports the following actions:
#
# flash: flash a given hex file to the target.
# hexfile is expected in ihex format and is pointed to
# by BINFILE environment variable
# flash: flash <binfile>
#
# flash given binary format file to the target.
#
# options:
# BINFILE: path to the binary file that is flashed
# <binfile>: path to the binary file that is flashed
#
# debug: debug <elffile>
#
# debug: starts JLink as GDB server in the background and
# starts JLink as GDB server in the background and
# connects to the server with the GDB client specified by
# the board (DBG environment variable)
#
# options:
# <elffile>: path to the ELF file to debug
# GDB_PORT: port opened for GDB connections
# TELNET_PORT: port opened for telnet connections
# DBG: debugger client command, default: 'gdb -q'
# TUI: if TUI!=null, the -tui option will be used
# ELFFILE: path to the ELF file to debug
#
# debug-server: starts JLink as GDB server, but does not connect to
# to it with any frontend. This might be useful when using
......@@ -88,10 +90,10 @@ test_config() {
fi
}
test_hexfile() {
if [ ! -f "${HEXFILE}" ]; then
echo "Error: Unable to locate HEXFILE"
echo " (${HEXFILE})"
test_binfile() {
if [ ! -f "${BINFILE}" ]; then
echo "Error: Unable to locate BINFILE"
echo " (${BINFILE})"
exit 1
fi
}
......@@ -145,16 +147,17 @@ test_term() {
# now comes the actual actions
#
do_flash() {
BINFILE=$1
test_config
test_serial
test_hexfile
test_binfile
# clear any existing contents in burn file
/bin/echo -n "" > ${BINDIR}/burn.seg
# create temporary burn file
if [ ! -z "${JLINK_PRE_FLASH}" ]; then
printf "${JLINK_PRE_FLASH}\n" >> ${BINDIR}/burn.seg
fi
echo "loadbin ${HEXFILE} ${FLASH_ADDR}" >> ${BINDIR}/burn.seg
echo "loadbin ${BINFILE} ${FLASH_ADDR}" >> ${BINDIR}/burn.seg
if [ ! -z "${JLINK_POST_FLASH}" ]; then
printf "${JLINK_POST_FLASH}\n" >> ${BINDIR}/burn.seg
fi
......@@ -169,6 +172,7 @@ do_flash() {
}
do_debug() {
ELFFILE=$1
test_config
test_serial
test_elffile
......@@ -275,5 +279,7 @@ case "${ACTION}" in
;;
*)
echo "Usage: $0 {flash|debug|debug-server|reset}"
echo " flash <binfile>"
echo " debug <elffile>"
;;
esac
......@@ -5,7 +5,7 @@ export RESET = $(RIOTTOOLS)/jlink/jlink.sh
HEXFILE = $(BINFILE)
export FFLAGS ?= flash
export DEBUGGER_FLAGS ?= debug
export FFLAGS ?= flash $(HEXFILE)
export DEBUGGER_FLAGS ?= debug $(ELFFILE)
export DEBUGSERVER_FLAGS ?= debug-server
export RESET_FLAGS ?= reset
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment