Skip to content

Commit

Permalink
Refactor common openocd flash script.
Browse files Browse the repository at this point in the history
  • Loading branch information
blakesmith committed Jul 8, 2018
1 parent cc8824f commit fa88dc0
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 60 deletions.
8 changes: 0 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ clock_stm32:
--strip=never \
//clock:clock

clock_stm32_flash:
bazel run \
--crosstool_top=@stm32//tools/arm_compiler:toolchain \
--cpu=armeabi-v7a-m4 \
--define TARGET=stm32f411 \
//clock/scripts:discovery_flash


clock_stm32_breakout:
bazel run \
--crosstool_top=@stm32//tools/arm_compiler:toolchain \
Expand Down
29 changes: 5 additions & 24 deletions clock/scripts/BUILD
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
sh_binary(
name = "discovery_flash",
srcs = [
"discovery_flash.sh"
],
data = [
"//clock:clock_flash_artifact"
],
args = [
"/usr/share/openocd/scripts/board/stm32f4discovery.cfg",
"$(location //clock:clock_flash_artifact)"
]
)
load("//tools/scripts:openocd.bzl", "openocd_flash")

sh_binary(
openocd_flash(
name = "breakout_flash",
srcs = [
"breakout_flash.sh"
],
data = [
"//clock:clock_flash_artifact"
],
args = [
"/usr/share/openocd/scripts/target/stm32l1.cfg",
"$(location //clock:clock_flash_artifact)"
]
artifact = "//clock:clock_flash_artifact",
target = "/usr/share/openocd/scripts/target/stm32l1.cfg"
)

13 changes: 0 additions & 13 deletions clock/scripts/discovery_flash.sh

This file was deleted.

15 changes: 0 additions & 15 deletions clock/scripts/flash_breadboard.sh

This file was deleted.

1 change: 1 addition & 0 deletions tools/scripts/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exports_files(["openocd_flash.sh"])
14 changes: 14 additions & 0 deletions tools/scripts/openocd.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def openocd_flash(name, artifact, target):
native.sh_binary(
name = "{}".format(name),
srcs = [
"//tools/scripts:openocd_flash.sh"
],
data = [
artifact
],
args = [
target,
"$(location {})".format(artifact)
]
)
File renamed without changes.

0 comments on commit fa88dc0

Please sign in to comment.