openocd: Allow non ARM download and debug
RISC-V does not allow 'reset halt'.
New CFG_RESET variable is set to 'reset halt' for ARM compatibility.
Value will be set to something else for RISC-V.
New variable GDB allows to run non ARM gdb. Default value still points
to arm-non-eabi-gdb.
#
. $CORE_PATH/hw/scripts/common.sh
+CFG_RESET="reset halt"
+GDB=arm-none-eabi-gdb
+
#
# FILE_NAME must contain the name of the file to load
# FLASH_OFFSET must contain the offset in flash where to place it
@@ -26,7 +29,7 @@ openocd_load () {
echo "$EXTRA_JTAG_CMD" > $OCD_CMD_FILE
echo "init" >> $OCD_CMD_FILE
- echo "reset halt" >> $OCD_CMD_FILE
+ echo "$CFG_RESET" >> $OCD_CMD_FILE
echo "$CFG_POST_INIT" >> $OCD_CMD_FILE
echo "flash write_image erase $FILE_NAME $FLASH_OFFSET" >> $OCD_CMD_FILE
@@ -106,9 +109,9 @@ openocd_debug () {
if [ $WINDOWS -eq 1 ]; then
FILE_NAME=`echo $FILE_NAME | sed 's/\//\\\\/g'`
- $COMSPEC /C "start $COMSPEC /C arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME"
+ $COMSPEC /C "start $COMSPEC /C $GDB -x $GDB_CMD_FILE $FILE_NAME"
else
- arm-none-eabi-gdb -x $GDB_CMD_FILE $FILE_NAME
+ $GDB -x $GDB_CMD_FILE $FILE_NAME
rm $GDB_CMD_FILE
fi
else
