Skip to content
Snippets Groups Projects
Commit a944d29e authored by Hauke Petersen's avatar Hauke Petersen
Browse files

board/stm32f0discovery: switched to OpenOCD

switched flashing and debug scripts to use OpenOCD
parent 6715bccf
No related branches found
No related tags found
No related merge requests found
...@@ -24,9 +24,9 @@ export LINK = $(PREFIX)gcc ...@@ -24,9 +24,9 @@ export LINK = $(PREFIX)gcc
export SIZE = $(PREFIX)size export SIZE = $(PREFIX)size
export OBJCOPY = $(PREFIX)objcopy export OBJCOPY = $(PREFIX)objcopy
export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm
export FLASHER = st-flash export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh
export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh
export DEBUGSERVER = st-util export RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh
# define build specific options # define build specific options
CPU_USAGE = -mcpu=cortex-m0 CPU_USAGE = -mcpu=cortex-m0
...@@ -37,9 +37,7 @@ export ASFLAGS += -ggdb -g3 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian ...@@ -37,9 +37,7 @@ export ASFLAGS += -ggdb -g3 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian
export LINKFLAGS += -g3 -ggdb -std=gnu99 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -static -lgcc -mthumb -mno-thumb-interwork -nostartfiles export LINKFLAGS += -g3 -ggdb -std=gnu99 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -static -lgcc -mthumb -mno-thumb-interwork -nostartfiles
# $(LINKERSCRIPT) is specified in cpu/Makefile.include # $(LINKERSCRIPT) is specified in cpu/Makefile.include
export LINKFLAGS += -T$(LINKERSCRIPT) export LINKFLAGS += -T$(LINKERSCRIPT)
export OFLAGS = -O binary export OFLAGS = -O ihex
export FFLAGS = write bin/$(BOARD)/$(APPLICATION).hex 0x08000000
export DEBUGGER_FLAGS = $(RIOTBOARD)/$(BOARD)/dist/gdb.conf bin/$(BOARD)/$(APPLICATION).elf
export TERMFLAGS += -p "$(PORT)" export TERMFLAGS += -p "$(PORT)"
# unwanted (CXXUWFLAGS) and extra (CXXEXFLAGS) flags for c++ # unwanted (CXXUWFLAGS) and extra (CXXEXFLAGS) flags for c++
......
#!/bin/sh #!/bin/sh
echo "Debugging $1" # check if GDB_PORT is already defined
arm-none-eabi-gdb -tui -command=$1 $2 if [ -z ${GDB_PORT} ]; then
# set to gdb standard port
GDB_PORT=3333
fi
echo "Listening for GDB connection on port ${GDB_PORT}"
openocd -f "board/stm32f0discovery.cfg" \
-c "tcl_port 6333" \
-c "telnet_port 4444" \
-c "gdb_port ${GDB_PORT}" \
-c "init" \
-c "targets" \
-c "reset halt" \
-l /dev/null &
# save pid to terminate afterwards
OCD_PID=$?
# needed for openocd to set up
sleep 2
arm-none-eabi-gdb -tui -command="${RIOTBOARD}/${BOARD}/dist/gdb.cfg" ${ELFFILE}
kill ${OCD_PID}
#!/bin/sh
openocd -f "board/stm32f0discovery.cfg" \
-c 'tcl_port 0' \
-c 'gdb_port 0' \
-c 'telnet_port 0' \
-c "init" \
-c "targets" \
-c "reset halt" \
-c "flash write_image erase ${HEXFILE} 0" \
-c "verify_image ${HEXFILE}" \
-c "reset run"\
-c "shutdown"
target extended-remote :3333
tar extended-remote :4242
#!/bin/sh
openocd -f "board/stm32f0discovery.cfg" \
-c 'tcl_port 0' \
-c 'gdb_port 0' \
-c 'telnet_port 0' \
-c "init" \
-c "reset run" \
-c "shutdown"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment