stm32f4discovery: use openocd for flashing
This commit is contained in:
parent
319f1b25ae
commit
bea0171754
@ -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-m4
|
CPU_USAGE = -mcpu=cortex-m4
|
||||||
@ -35,11 +35,12 @@ export CFLAGS += -ggdb -g3 -std=gnu99 -Os -Wall -Wstrict-prototypes $(CPU_USAGE)
|
|||||||
export CFLAGS += -ffunction-sections -fdata-sections -fno-builtin
|
export CFLAGS += -ffunction-sections -fdata-sections -fno-builtin
|
||||||
export ASFLAGS += -ggdb -g3 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian
|
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 -mthumb-interwork -nostartfiles
|
export LINKFLAGS += -g3 -ggdb -std=gnu99 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -static -lgcc -mthumb -mthumb-interwork -nostartfiles
|
||||||
|
# $(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 0x8000000
|
|
||||||
export DEBUGGER_FLAGS = $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(BINDIR)/$(APPLICATION).elf
|
|
||||||
export TERMFLAGS += -p "$(PORT)"
|
export TERMFLAGS += -p "$(PORT)"
|
||||||
|
export FFLAGS = $(HEXFILE)
|
||||||
|
export DEBUGGER_FLAGS = $(RIOTBOARD)/$(BOARD)/dist/gdb.cfg $(ELFFILE)
|
||||||
|
|
||||||
# unwanted (CXXUWFLAGS) and extra (CXXEXFLAGS) flags for c++
|
# unwanted (CXXUWFLAGS) and extra (CXXEXFLAGS) flags for c++
|
||||||
export CXXUWFLAGS +=
|
export CXXUWFLAGS +=
|
||||||
|
|||||||
17
boards/stm32f4discovery/dist/debug.sh
vendored
17
boards/stm32f4discovery/dist/debug.sh
vendored
@ -1,4 +1,19 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo "Debugging $1"
|
openocd -f "board/stm32f4discovery.cfg" \
|
||||||
|
-c "tcl_port 6333" \
|
||||||
|
-c "telnet_port 4444" \
|
||||||
|
-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=$1 $2
|
arm-none-eabi-gdb -tui -command=$1 $2
|
||||||
|
|
||||||
|
kill ${OCD_PID}
|
||||||
|
|||||||
16
boards/stm32f4discovery/dist/flash.sh
vendored
Executable file
16
boards/stm32f4discovery/dist/flash.sh
vendored
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
openocd -f "board/stm32f4discovery.cfg" \
|
||||||
|
-c 'tcl_port 0' \
|
||||||
|
-c 'gdb_port 0' \
|
||||||
|
-c 'telnet_port 0' \
|
||||||
|
-c "init" \
|
||||||
|
-c "targets" \
|
||||||
|
-c "reset" \
|
||||||
|
-c "halt" \
|
||||||
|
-c "flash protect 0 0 11 off" \
|
||||||
|
-c "flash erase_address 0x08000000 0x100000" \
|
||||||
|
-c "flash write_image erase $1 0 ihex" \
|
||||||
|
-c "verify_image $1" \
|
||||||
|
-c "reset run"\
|
||||||
|
-c "shutdown"
|
||||||
1
boards/stm32f4discovery/dist/gdb.cfg
vendored
Normal file
1
boards/stm32f4discovery/dist/gdb.cfg
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
target extended-remote :3333
|
||||||
1
boards/stm32f4discovery/dist/gdb.conf
vendored
1
boards/stm32f4discovery/dist/gdb.conf
vendored
@ -1 +0,0 @@
|
|||||||
tar extended-remote :4242
|
|
||||||
9
boards/stm32f4discovery/dist/reset.sh
vendored
Executable file
9
boards/stm32f4discovery/dist/reset.sh
vendored
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
openocd -f "board/stm32f4discovery.cfg" \
|
||||||
|
-c 'tcl_port 0' \
|
||||||
|
-c 'gdb_port 0' \
|
||||||
|
-c 'telnet_port 0' \
|
||||||
|
-c "init" \
|
||||||
|
-c "reset run" \
|
||||||
|
-c "shutdown"
|
||||||
Loading…
x
Reference in New Issue
Block a user