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 @@ ...@@ -18,23 +18,25 @@
# #
# The script supports the following actions: # The script supports the following actions:
# #
# flash: flash a given hex file to the target. # flash: flash <binfile>
# hexfile is expected in ihex format and is pointed to #
# by BINFILE environment variable # flash given binary format file to the target.
# #
# options: # 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 # connects to the server with the GDB client specified by
# the board (DBG environment variable) # the board (DBG environment variable)
# #
# options: # options:
# <elffile>: path to the ELF file to debug
# GDB_PORT: port opened for GDB connections # GDB_PORT: port opened for GDB connections
# TELNET_PORT: port opened for telnet connections # TELNET_PORT: port opened for telnet connections
# DBG: debugger client command, default: 'gdb -q' # DBG: debugger client command, default: 'gdb -q'
# TUI: if TUI!=null, the -tui option will be used # 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 # debug-server: starts JLink as GDB server, but does not connect to
# to it with any frontend. This might be useful when using # to it with any frontend. This might be useful when using
...@@ -88,10 +90,10 @@ test_config() { ...@@ -88,10 +90,10 @@ test_config() {
fi fi
} }
test_hexfile() { test_binfile() {
if [ ! -f "${HEXFILE}" ]; then if [ ! -f "${BINFILE}" ]; then
echo "Error: Unable to locate HEXFILE" echo "Error: Unable to locate BINFILE"
echo " (${HEXFILE})" echo " (${BINFILE})"
exit 1 exit 1
fi fi
} }
...@@ -145,16 +147,17 @@ test_term() { ...@@ -145,16 +147,17 @@ test_term() {
# now comes the actual actions # now comes the actual actions
# #
do_flash() { do_flash() {
BINFILE=$1
test_config test_config
test_serial test_serial
test_hexfile 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
# create temporary burn file # create temporary burn file
if [ ! -z "${JLINK_PRE_FLASH}" ]; then if [ ! -z "${JLINK_PRE_FLASH}" ]; then
printf "${JLINK_PRE_FLASH}\n" >> ${BINDIR}/burn.seg printf "${JLINK_PRE_FLASH}\n" >> ${BINDIR}/burn.seg
fi fi
echo "loadbin ${HEXFILE} ${FLASH_ADDR}" >> ${BINDIR}/burn.seg echo "loadbin ${BINFILE} ${FLASH_ADDR}" >> ${BINDIR}/burn.seg
if [ ! -z "${JLINK_POST_FLASH}" ]; then if [ ! -z "${JLINK_POST_FLASH}" ]; then
printf "${JLINK_POST_FLASH}\n" >> ${BINDIR}/burn.seg printf "${JLINK_POST_FLASH}\n" >> ${BINDIR}/burn.seg
fi fi
...@@ -169,6 +172,7 @@ do_flash() { ...@@ -169,6 +172,7 @@ do_flash() {
} }
do_debug() { do_debug() {
ELFFILE=$1
test_config test_config
test_serial test_serial
test_elffile test_elffile
...@@ -275,5 +279,7 @@ case "${ACTION}" in ...@@ -275,5 +279,7 @@ case "${ACTION}" in
;; ;;
*) *)
echo "Usage: $0 {flash|debug|debug-server|reset}" echo "Usage: $0 {flash|debug|debug-server|reset}"
echo " flash <binfile>"
echo " debug <elffile>"
;; ;;
esac esac
...@@ -5,7 +5,7 @@ export RESET = $(RIOTTOOLS)/jlink/jlink.sh ...@@ -5,7 +5,7 @@ export RESET = $(RIOTTOOLS)/jlink/jlink.sh
HEXFILE = $(BINFILE) HEXFILE = $(BINFILE)
export FFLAGS ?= flash export FFLAGS ?= flash $(HEXFILE)
export DEBUGGER_FLAGS ?= debug export DEBUGGER_FLAGS ?= debug $(ELFFILE)
export DEBUGSERVER_FLAGS ?= debug-server export DEBUGSERVER_FLAGS ?= debug-server
export RESET_FLAGS ?= reset 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