Skip to content

Commit

Permalink
Use custom board file with correct flash memory size
Browse files Browse the repository at this point in the history
  • Loading branch information
deshipu committed Apr 21, 2017
1 parent d628d96 commit 1f887e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ OBJCOPY = arm-none-eabi-objcopy
OBJDUMP = arm-none-eabi-objdump
SIZE = arm-none-eabi-size

OPENOCD_BOARD_DIR=/usr/share/openocd/scripts/board

CFLAGS = -Wall -g -std=c99 -Os
CFLAGS += -mlittle-endian -mcpu=cortex-m0 -march=armv6-m -mthumb
CFLAGS += -ffunction-sections -fdata-sections
Expand All @@ -29,7 +27,7 @@ $(PROJ_NAME).elf: $(SOURCES)
$(SIZE) $(PROJ_NAME).elf

program: $(PROJ_NAME).bin
openocd -f $(OPENOCD_BOARD_DIR)/stm32f0discovery.cfg -f stm32f0-openocd.cfg -c "stm_flash $(PROJ_NAME).bin" -c shutdown
openocd -f stm32f0motor.cfg -f stm32f0-openocd.cfg -c "stm_flash $(PROJ_NAME).bin" -c shutdown

clean:
rm -f *.o
Expand Down
6 changes: 3 additions & 3 deletions stm32f0-openocd.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ proc stm_flash {IMGFILE} {
}

proc stm_erase {} {
reset halt
reset halt
sleep 100
stm32x unlock 0
sleep 100
stm32f1x mass_erase 0
sleep 100
stm32f1x mass_erase 0
sleep 100
}

8 changes: 8 additions & 0 deletions stm32f0motor.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source [find interface/stlink-v2.cfg]

transport select hla_swd

set WORKAREASIZE 0x1000
source [find target/stm32f0x.cfg]

reset_config srst_only

0 comments on commit 1f887e2

Please sign in to comment.