summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2014-07-22 08:33:46 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-30 03:10:06 +0000
commit9797f654d935cdd75ede4ef98b762284d54a5da4 (patch)
treeee7b2521a2f9a843067d38f4c9d1c99685578d02
parenta528f892915c7a20768d49402f052f100f10501e (diff)
downloadchrome-ec-9797f654d935cdd75ede4ef98b762284d54a5da4.tar.gz
Makefile: Add support for per-board symlinks to top level
Previously if you were working on a single board you had to add BOARD= to all of your make command lines. Now if you are in a board directory you can just use "make", or "make clean", or any other top level make command. This commit also adds support for a top level "make flash" command that can be used from the board directories as well. This command uses openocd and requires that the board provides an openocd-flash.cfg file. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=none TEST=(from a few board directories) make clean; make -j (from the discovery-stm32f072 directory) make flash Change-Id: Ie09a74881371169a2c3cd9cd9922f39f4873f1a6 Reviewed-on: https://chromium-review.googlesource.com/209669 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
-rw-r--r--Makefile20
-rw-r--r--Makefile.rules6
l---------board/bds/Makefile1
l---------board/big/Makefile1
l---------[-rw-r--r--]board/discovery-stm32f072/Makefile21
-rw-r--r--board/discovery-stm32f072/openocd-flash.cfg15
l---------board/discovery/Makefile1
l---------board/falco/Makefile1
l---------board/firefly/Makefile1
l---------board/fruitpie/Makefile1
l---------board/hadoken/Makefile1
l---------board/host/Makefile1
l---------board/it8380dev/Makefile1
l---------board/keyborg/Makefile1
l---------board/link/Makefile1
l---------board/mccroskey/Makefile1
l---------board/mec1322_evb/Makefile1
l---------board/nyan/Makefile1
l---------board/peppy/Makefile1
l---------board/pit/Makefile1
l---------board/plankton/Makefile1
l---------board/rambi/Makefile1
l---------board/ryu/Makefile1
l---------board/samus/Makefile1
l---------board/samus_pd/Makefile1
l---------board/snow/Makefile1
l---------board/spring/Makefile1
l---------board/squawks/Makefile1
l---------board/twinkie/Makefile1
l---------board/veyron/Makefile1
l---------board/zinger/Makefile1
31 files changed, 69 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index 26ec921b8f..204dbdfdbf 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,24 @@
# Embedded Controller firmware build system
#
+# If we came here via a symlink we restart make and deduce the correct BOARD
+# value from the current directory.
+SYMLINK := $(shell readlink $(lastword $(MAKEFILE_LIST)))
+
+ifneq (,$(SYMLINK))
+
+.PHONY: restart
+
+restart: .DEFAULT
+ @true
+
+.DEFAULT:
+ @$(MAKE) -C $(dir $(SYMLINK)) \
+ --no-print-directory \
+ $(MAKECMDGOALS) \
+ BOARD=$(notdir $(shell pwd))
+else
+
BOARD ?= bds
PROJECT?=ec
@@ -95,3 +113,5 @@ dirs=core/$(CORE) chip/$(CHIP) board/$(BOARD) private common power test util
dirs+=$(shell find driver -type d)
include Makefile.rules
+
+endif # SYMLINK
diff --git a/Makefile.rules b/Makefile.rules
index 9319b3bddc..1b27c23500 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -194,6 +194,12 @@ $(out)/tags: $(out)/cscope.files
xrefs: $(call targ_if_prog,etags,$(out)/TAGS) \
$(call targ_if_prog,ctags,$(out)/tags)
+.PHONY: flash
+flash:
+ openocd -c "set BOARD $(BOARD)"\
+ -c "set BUILD_DIR $(out)"\
+ -f board/$(BOARD)/openocd-flash.cfg
+
.PHONY: clean
clean:
-rm -rf $(out)
diff --git a/board/bds/Makefile b/board/bds/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/bds/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/big/Makefile b/board/big/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/big/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/discovery-stm32f072/Makefile b/board/discovery-stm32f072/Makefile
index 20874220b1..94aaae2c4d 100644..120000
--- a/board/discovery-stm32f072/Makefile
+++ b/board/discovery-stm32f072/Makefile
@@ -1,20 +1 @@
-# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-#
-# Simple flashing command to reflash the discovery board using openocd
-#
-.PHONY: flash
-
-flash:
- sudo openocd -f board/stm32f0discovery.cfg \
- -c "gdb_port 0" \
- -c "tcl_port 0" \
- -c "telnet_port 0" \
- -c "init" \
- -c "reset init" \
- -c "flash write_image erase ../../build/discovery-stm32f072/ec.bin 0x08000000" \
- -c "reset halt" \
- -c "resume" \
- -c "shutdown"
+../../Makefile \ No newline at end of file
diff --git a/board/discovery-stm32f072/openocd-flash.cfg b/board/discovery-stm32f072/openocd-flash.cfg
new file mode 100644
index 0000000000..eed8d03f36
--- /dev/null
+++ b/board/discovery-stm32f072/openocd-flash.cfg
@@ -0,0 +1,15 @@
+# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+source [find board/stm32f0discovery.cfg]
+
+gdb_port 0
+tcl_port 0
+telnet_port 0
+init
+reset init
+flash write_image erase $BUILD_DIR/ec.bin 0x08000000
+reset halt
+resume
+shutdown
diff --git a/board/discovery/Makefile b/board/discovery/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/discovery/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/falco/Makefile b/board/falco/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/falco/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/firefly/Makefile b/board/firefly/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/firefly/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/fruitpie/Makefile b/board/fruitpie/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/fruitpie/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/hadoken/Makefile b/board/hadoken/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/hadoken/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/host/Makefile b/board/host/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/host/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/it8380dev/Makefile b/board/it8380dev/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/it8380dev/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/keyborg/Makefile b/board/keyborg/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/keyborg/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/link/Makefile b/board/link/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/link/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/mccroskey/Makefile b/board/mccroskey/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/mccroskey/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/mec1322_evb/Makefile b/board/mec1322_evb/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/mec1322_evb/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/nyan/Makefile b/board/nyan/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/nyan/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/peppy/Makefile b/board/peppy/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/peppy/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/pit/Makefile b/board/pit/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/pit/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/plankton/Makefile b/board/plankton/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/plankton/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/rambi/Makefile b/board/rambi/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/rambi/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/ryu/Makefile b/board/ryu/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/ryu/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/samus/Makefile b/board/samus/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/samus/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/samus_pd/Makefile b/board/samus_pd/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/samus_pd/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/snow/Makefile b/board/snow/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/snow/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/spring/Makefile b/board/spring/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/spring/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/squawks/Makefile b/board/squawks/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/squawks/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/twinkie/Makefile b/board/twinkie/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/twinkie/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/veyron/Makefile b/board/veyron/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/veyron/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/zinger/Makefile b/board/zinger/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/zinger/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file