On 06/01/2010 10:03 PM, Øyvind Harboe wrote:
On Tue, Jun 1, 2010 at 9:36 PM, Spencer Oliver<s...@spen-soft.co.uk> wrote:
On 01/06/2010 13:22, gcembed wrote:
Here is the modified patch
Gaëtan
On 06/01/2010 02:01 PM, freddie_cho...@op.pl wrote:
"gcembed"<gcem...@gmail.com> napisał(a):
Hello,
I have added a new command for stm32x : mass_erase_unlock
This function combine "stm32x unlock 0" + reset to apply unlock +
"stm32x mass_erase 0"
Any reason not to implement this as a target tcl script?
Good point.
I'll hold off merging this one.
Hello,
I have tried to use existing command and "mww" function to unlock,
erase, flash and verify stm32. I spent nearly one day to do that without
modify sources (it's easier for me to use existing tools that create a
patch, format it, send it to list and discuss about it which could take
lot of time). I also do searches on Internet.
If someone has a working script, I will test it.
I have tested a lot of combination but none of these work.
The problem is that it works one time of two. The first time I want to
flash, it fails when I want to mass_erase (error : Device protected),
the next time I run the script, it works. I tried to reset the device
with "reset", "jtag_reset" or "mww 0xE000ED0C 0x05FA0004" but same
result. I also tried to shutdown OpenOCD between unlock and mass_erase,
same result. I attach the Makefile. It is a little messy but it contains
all that I tried.
Best regards,
Gaëtan
NAME = pblcd01_02
OUTDIR = bin
SOURCES = main.c stm32f10x_vector.c stm32f10x_it.c backlight.c hx8312a.c
serial.c
#serial.c
STLIB_PATH = stm32f10x_stdperiph-v330
STLIB_SOURCES = $(shell ls $(STLIB_PATH)/src/_*.c)
SCRIPTFILE = stm32f103vc.cmd
ARMPREFIX = /opt/cross/stm32/bin
CC = $(ARMPREFIX)/arm-eabi-gcc
LD = $(ARMPREFIX)/arm-eabi-ld -v
AR = $(ARMPREFIX)/arm-eabi-ar
AS = $(ARMPREFIX)/arm-eabi-as
CP = $(ARMPREFIX)/arm-eabi-objcopy
OD = $(ARMPREFIX)/arm-eabi-objdump
GDB = $(ARMPREFIX)/arm-eabi-gdbtui
CFLAGS = -I./include -I$(STLIB_PATH)/inc -c -fno-common -O3 -g -Wall
-mcpu=cortex-m3 -mthumb
AFLAGS = -ahls -mapcs-32 -o crt.o
LFLAGS = -T$(SCRIPTFILE) -nostartfiles -Map $(OUTDIR)/$(NAME).map
CPFLAGS = -Obinary
ODFLAGS = -S
# ---------------------------------------------------------------------------
# Options for OpenOCD flash-programming
# see openocd.pdf/openocd.texi for further information
#
OOCD_LOADFILE+=$(OUTDIR)/$(NAME).bin
OOCD_EXE=openocd
OOCD_CL=-d0
OOCD_CL+=-f /opt/cross/stm32/projects/stm32.cfg -f
/opt/cross/stm32/projects/jlink-segger.cfg
OOCD_CL+=-c init
OOCD_CL+=-c "jtag_khz 1000"
OOCD_CL+=-c "reset_config trst_and_srst"
OOCD_CL+=-c "halt"
OOCD_CL_UNLOCK=-c "mdw 0x40022010 1"
OOCD_CL_UNLOCK+=-c "stm32x unlock 0"
OOCD_CL_UNLOCK+=-c "mdw 0x40022010 1"
OOCD_CL_UNLOCK+=-c "mww 0x40022004 0x45670123"
OOCD_CL_UNLOCK+=-c "mww 0x40022004 0xCDEF89AB"
OOCD_CL_UNLOCK+=-c "mdw 0x40022010 1"
OOCD_CL_UNLOCK+=-c "sleep 200"
#OOCD_CL_UNLOCK+=-c "jtag_reset 1 1"
#OOCD_CL_UNLOCK+=-c "sleep 200"
#OOCD_CL_UNLOCK+=-c "jtag_reset 0 0"
#OOCD_CL_UNLOCK+=-c "sleep 200"
OOCD_CL_UNLOCK+=-c "mww 0xE000ED0C 0x05FA0007"
OOCD_CL_UNLOCK+=-c "shutdown"
OOCD_CL_FLASH=-c "reset halt"
OOCD_CL_FLASH+=-c "flash probe 0"
OOCD_CL_FLASH+=-c "stm32x unlock 0"
#OOCD_CL_FLASH+=-c "mdw 0x40022010 1"
#OOCD_CL_FLASH+=-c "mww 0x40022004 0x45670123"
#OOCD_CL_FLASH+=-c "mww 0x40022004 0xCDEF89AB"
#OOCD_CL_FLASH+=-c "mdw 0x40022010 1"
#OOCD_CL_FLASH+=-c "stm32x lock 0"
#OOCD_CL_FLASH+=-c "sleep 500"
#OOCD_CL_FLASH+=-c "jtag_reset 1 1"
#OOCD_CL_FLASH+=-c "sleep 500"
#OOCD_CL_FLASH+=-c "jtag_reset 0 0"
#OOCD_CL_FLASH+=-c "sleep 500"
#OOCD_CL_FLASH+=-c "reset halt"
OOCD_CL_FLASH+=-c "flash protect 0 0 last off"
OOCD_CL_FLASH+=-c "stm32x mass_erase 0"
#OOCD_CL_FLASH+=-c "flash erase_sector 0 0 last"
OOCD_CL_FLASH+=-c "flash write_bank 0 $(OOCD_LOADFILE) 0x0"
OOCD_CL_FLASH+=-c "flash protect 0 0 last on"
OOCD_CL_FLASH+=-c "verify_image $(OOCD_LOADFILE) 0x0"
OOCD_CL_FLASH+=-c "shutdown"
#OOCD_CL_RUN+=-c "mww 0xE000ED0C 0x5FA00007"
#OOCD_CL_RUN+=-c "poll"
OOCD_CL_RUN+=-c "reset run"
OOCD_CL_RUN+=-c "sleep 500"
OOCD_CL_RUN+=-c "shutdown"
OOCD_CL_RST+=-c "reset halt"
OOCD_CL_RST+=-c "jtag_reset 1 1"
OOCD_CL_RST+=-c "sleep 500"
OOCD_CL_RST+=-c "jtag_reset 0 0"
OOCD_CL_RST+=-c "sleep 500"
OOCD_CL_RST+=-c "reset halt"
OOCD_CL_RST+=-c "shutdown"
OOCD_CL_RST1+=-c "jtag_reset 1 1"
OOCD_CL_RST1+=-c "sleep 500"
OOCD_CL_RST0+=-c "jtag_reset 0 0"
OOCD_CL_RST0+=-c "sleep 500"
OOCD_CL_RST0+=-c "reset run"
OOCD_DEBUG+=-c "gdb_port 3333"
OOCD_DEBUG+=-c "telnet_port 4444"
#OOCD_DEBUG+=-c "mdw 0x40022010 1"
#OOCD_DEBUG+=-c "mww 0x40022004 0x45670123"
#OOCD_DEBUG+=-c "mww 0x40022004 0xCDEF89AB"
#OOCD_DEBUG+=-c "mdw 0x40022010 1"
#OOCD_DEBUG+=-c "reset halt"
# ---------------------------------------------------------------------------
OBJECTS=$(SOURCES:.c=.o)
OBJECTS+=$(STLIB_SOURCES:.c=.o)
EXECUTABLE=$(OUTDIR)/$(NAME).elf
all: $(SOURCES) $(EXECUTABLE)
@ echo "...copying"
$(CP) $(CPFLAGS) $(EXECUTABLE) $(OUTDIR)/$(NAME).bin
$(OD) $(ODFLAGS) $(EXECUTABLE) > $(OUTDIR)/$(NAME).list
$(EXECUTABLE): $(OBJECTS)
@echo "..linking"
$(LD) $(OBJECTS) $(LFLAGS) -o $@
.c.o:
@echo ".compile"
$(CC) $< $ $(CFLAGS) -o $@
program: all
@echo "...flashing"
# $(OOCD_EXE) $(OOCD_CL) $(OOCD_CL_RST)
# $(OOCD_EXE) $(OOCD_CL) $(OOCD_CL_UNLOCK)
# $(OOCD_EXE) $(OOCD_CL) $(OOCD_CL_UNLOCK)
# $(OOCD_EXE) $(OOCD_CL) $(OOCD_CL_RST)
# $(OOCD_EXE) $(OOCD_CL) $(OOCD_CL_RST)
$(OOCD_EXE) $(OOCD_CL) $(OOCD_CL_FLASH)
$(OOCD_EXE) $(OOCD_CL) $(OOCD_CL_RUN)
debug0:
-killall -q openocd
# $(OOCD_EXE) $(OOCD_CL) $(OOCD_CL_UNLOCK) &>/dev/tty6
$(OOCD_EXE) $(OOCD_CL) $(OOCD_DEBUG)
debug1:
$(GDB) --eval-command="target remote localhost:3333" "$(EXECUTABLE)"
-killall openocd
rst1:
$(OOCD_EXE) $(OOCD_CL) $(OOCD_CL_RST1)
rst0:
$(OOCD_EXE) $(OOCD_CL) $(OOCD_CL_RST0)
clean:
-rm -f $(OUTDIR)/$(NAME).list $(EXECUTABLE) $(OUTDIR)/$(NAME).map
$(OUTDIR)/$(NAME).bin $(OBJECTS)
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development