File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,6 +105,20 @@ test_elffile() {
105105 fi
106106}
107107
108+ test_binfile () {
109+ if [ ! -f " ${BINFILE} " ]; then
110+ echo " Error: Unable to locate BINFILE"
111+ echo " (${BINFILE} )"
112+ exit 1
113+ fi
114+ if [ -z " ${FLASH_ADDR} " ]; then
115+ echo " Error: FLASH_ADDR not defined"
116+ exit 1
117+ else
118+ echo " Flashing at ${FLASH_ADDR} "
119+ fi
120+ }
121+
108122test_ports () {
109123 if [ -z " ${GDB_PORT} " ]; then
110124 GDB_PORT=${_GDB_PORT}
@@ -186,6 +200,36 @@ do_flash_elf() {
186200 echo ' Done flashing'
187201}
188202
203+ do_flash_bin () {
204+ test_config
205+ test_binfile
206+ if [ -n " ${PRE_FLASH_CHECK_SCRIPT} " ]; then
207+ sh -c " ${PRE_FLASH_CHECK_SCRIPT} '${HEXFILE} '"
208+ RETVAL=$?
209+ if [ $RETVAL -ne 0 ]; then
210+ echo " pre-flash checks failed, status=$RETVAL "
211+ exit $RETVAL
212+ fi
213+ fi
214+ # flash device
215+ sh -c " ${OPENOCD} -f '${OPENOCD_CONFIG} ' \
216+ ${OPENOCD_EXTRA_INIT} \
217+ -c 'tcl_port 0' \
218+ -c 'telnet_port 0' \
219+ -c 'gdb_port 0' \
220+ -c 'init' \
221+ -c 'targets' \
222+ -c 'reset halt' \
223+ ${OPENOCD_PRE_FLASH_CMDS} \
224+ -c 'program \" ${BINFILE} \" \" ${FLASH_ADDR} \" ' \
225+ -c 'reset halt' \
226+ ${OPENOCD_PRE_VERIFY_CMDS} \
227+ -c 'verify_image \" ${BINFILE} \" \" ${FLASH_ADDR} \" bin' \
228+ -c 'reset run' \
229+ -c 'shutdown'" &&
230+ echo ' Done flashing'
231+ }
232+
189233do_debug () {
190234 test_config
191235 test_elffile
@@ -263,6 +307,10 @@ case "${ACTION}" in
263307 echo " ### Flashing Target ###"
264308 do_flash_elf " $@ "
265309 ;;
310+ flash-bin)
311+ echo " ### Flashing Target ###"
312+ do_flash_bin " $@ "
313+ ;;
266314 debug)
267315 echo " ### Starting Debugging ###"
268316 do_debug " $@ "
You can’t perform that action at this time.
0 commit comments