Skip to content

Commit

Permalink
Fixing flash
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed Mar 19, 2019
1 parent ee1dcb7 commit d9f05c5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"type": "shell",
"windows": {
"command":
" c:\\openocd\\bin\\openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -f scripts/flash.ocd "
" c:\\openocd\\bin\\openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -f scripts/flash-boot.ocd "
},
"osx": {
"command":
Expand All @@ -97,7 +97,7 @@
"type": "shell",
"windows": {
"command":
" c:\\openocd\\bin\\openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -f scripts/flash.ocd "
" c:\\openocd\\bin\\openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -f scripts/flash-app.ocd "
},
"osx": {
"command":
Expand Down
9 changes: 5 additions & 4 deletions scripts/flash.ocd → scripts/flash-app.ocd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is an OpenOCD script that connects to the STM32 Blue Pill and flashes the ROM.
# Used by tasks.json for "Load bluepill_boot" and "Load bluepill_my_sensor" commands.
# This is an OpenOCD script that connects to the STM32 Blue Pill and flashes the Application ROM.
# Used by tasks.json for "Load bluepill_my_sensor" command.
# Used only for Windows, not used for macOS. On macOS we use "newt load".
# openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -f scripts/flash.ocd
# openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -f scripts/flash-app.ocd

# Disable all openocd messages.
debug_level 0
Expand All @@ -20,10 +20,11 @@ reset halt
flash banks
flash list

# TODO: Check flash address
echo "Flashing the Blue Pill..."
flash write_image erase unlock bin/targets/bluepill_my_sensor/app/apps/my_sensor_app/my_sensor_app.img 0x08000000
flash verify_bank 0 bin/targets/bluepill_my_sensor/app/apps/my_sensor_app/my_sensor_app.img 0

# Restart the device.
echo "Restarting the Blue Pill..."
reset run
reset halt
29 changes: 29 additions & 0 deletions scripts/flash-boot.ocd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This is an OpenOCD script that connects to the STM32 Blue Pill and flashes the Bootloader ROM.
# Used by tasks.json for "Load bluepill_boot" command.
# Used only for Windows, not used for macOS. On macOS we use "newt load".
# openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -f scripts/flash-boot.ocd

# Disable all openocd messages.
debug_level 0

# Connect to the device.
init

# Enable ARM semihosting to show debug console output in OpenOCD console.
arm semihosting enable

echo "NOTE: Trash this window before flashing the Blue Pill again"

echo "Stopping the Blue Pill..."
reset halt

flash banks
flash list

echo "Flashing the Blue Pill..."
flash write_image erase unlock bin/targets/bluepill_boot/app/apps/boot/boot.elf.bin 0x08000000
flash verify_bank 0 bin/targets/bluepill_boot/app/apps/boot/boot.elf.bin 0

# Restart the device.
echo "Restarting the Blue Pill..."
reset halt

0 comments on commit d9f05c5

Please sign in to comment.