Skip to content

Commit 46cdb37

Browse files
authored
Merge pull request #26 from WyliodrinEmbeddedIoT/microbit2_flashing_script
microbit_v2: fixed openocd flashing script
2 parents 7062d74 + b8e7d9e commit 46cdb37

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

boards/microbit_v2-bootloader/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ OPENOCD_OPTIONS=-f openocd.cfg
1515
# Upload the kernel over JTAG
1616
.PHONY: flash
1717
flash: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).bin
18-
$(OPENOCD) $(OPENOCD_OPTIONS) -c "program $<; verify_image $<; reset; shutdown;"
18+
$(OPENOCD) $(OPENOCD_OPTIONS) -c "program $<; verify_image $<; reset halt; shutdown;"
1919

2020
.PHONY: flash
2121
flash-debug: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/debug/$(PLATFORM).bin
22-
$(OPENOCD) $(OPENOCD_OPTIONS) -c "program $<; verify_image $<; reset; shutdown;"
22+
$(OPENOCD) $(OPENOCD_OPTIONS) -c "program $<; verify_image $<; reset halt; shutdown;"

boards/microbit_v2-bootloader/openocd.cfg

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ source [find interface/cmsis-dap.cfg]
22
transport select swd
33
source [find target/nrf52.cfg]
44

5-
set WORKAREASIZE 0x40000
6-
7-
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $WORKAREASIZE -work-area-backup 0
8-
9-
flash bank $_CHIPNAME.flash nrf51 0x00000000 0 1 1 $_TARGETNAME
10-
flash bank $_CHIPNAME.uicr nrf51 0x10001000 0 1 1 $_TARGETNAME
11-
5+
# necessary to be backward compatible with openocd 0.10
6+
if { [flash list] == "" } {
7+
set WORKAREASIZE 0x40000
8+
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $WORKAREASIZE -work-area-backup 0
9+
10+
flash bank $_CHIPNAME.flash nrf51 0x00000000 0 1 1 $_TARGETNAME
11+
flash bank $_CHIPNAME.uicr nrf51 0x10001000 0 1 1 $_TARGETNAME
12+
}

0 commit comments

Comments
 (0)