Commit Graph

107 Commits

Author SHA1 Message Date
Che-yu Wu
ef09835e19 ec: Add annotation feature to the stack analyzer.
Get stack analyzer supported to read annotation file and do basic
annotation on the callgraph.

The basic annotation includes:
1. Add missing calls to the callgraph
2. Ignore functions on the callgraph

BUG=chromium:648840
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
     make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \
         --objdump=arm-none-eabi-objdump \
         --addr2line=arm-none-eabi-addr2line \
         --export_taskinfo=./build/elm/util/export_taskinfo.so \
         --section=RW \
         --annotation=./extra/stack_analyzer/example_annotation.yaml \
         ./build/elm/RW/ec.RW.elf
     make BOARD=elm SECTION=RW \
         ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \
         analyzestack

Change-Id: I4cc7c34f422655708a7312db3f6b4416e1af917f
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/614825
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-08-21 23:48:14 -07:00
Che-yu Wu
64ecddfd86 ec: Add a task information library for the stack analyzer.
Add a shared library to export task information.
Modified the stack analyzer to get information from the shared library.
Show allocated stack sizes of tasks in the stack analyzer.

To get the all task information (including the allocated stack size),
A shared library is added and compiled with the board to export all
configurations of the tasklist.

BUG=chromium:648840
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
     make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \
         --objdump=arm-none-eabi-objdump \
         --addr2line=arm-none-eabi-addr2line \
         --export_taskinfo=./build/elm/util/export_taskinfo.so \
         --section=RW \
         ./build/elm/RW/ec.RW.elf
     make BOARD=${BOARD} SECTION=${SECTION} analyzestack

Change-Id: I72f01424142bb0a99c6776a55735557308e2cab6
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/611693
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-08-15 00:25:20 -07:00
Che-yu Wu
1bf7abdc20 ec: Add analysis tool for firmware stack usage.
Add a static analysis tool for firmware stack usage.
Add an new Makefile rule to analyze the stack usages of firmwares.

Details about the tool can be found in extra/stack_analyzer/README.md.

BUG=chromium:648840
BRANCH=none
TEST=extra/stack_analyzer/stack_analyzer_unittest.py
     make BOARD=elm && make BOARD=elm build/elm/RW/ec.RW.taskinfo && \
         extra/stack_analyzer/stack_analyzer.py \
         --objdump=arm-none-eabi-objdump \
         --addr2line=arm-none-eabi-addr2line \
         ./build/elm/RW/ec.RW.elf ./build/elm/RW/ec.RW.taskinfo
     make BOARD=${BOARD} SECTION=${SECTION} analyzestack

Change-Id: Ifb1b5f5ad6be8f8b125b14d6ee03e25cb385895b
Signed-off-by: Che-yu Wu <cheyuw@google.com>
Reviewed-on: https://chromium-review.googlesource.com/576411
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-08-14 05:54:35 -07:00
Patrick Georgi
1a67ac2ad6 Allow core code to request its cross compiler
Instead of having to pass in both the board and the arch used there
(which might be complicated in the light of different ECs with different
arches), allow passing in the board and a set of cross compilers.

The core/*/build.mk then pick the compiler that is responsible for them.
The current method works just the same: If you've already set
CROSS_COMPILE, no override happens. If you set neither CROSS_COMPILE nor
CROSS_COMPILE_$arch, the same default as before this CL is set.

BUG=none
BRANCH=none
TEST=emerge-{samus,kevin} chromeos-ec behave reasonably with adapted
ebuild

Change-Id: Icf1866f296412dd92ecfe134394224c49f7c3df5
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/549344
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2017-07-19 05:01:02 -07:00
Vadim Bendebury
61b87c56b6 g: do not invoke signer with sudo unless it is necessary
Invoking signer with sudo is required only when signing requires a USB
fob. Let's not use it in unless necessary.

BRANCH=cr50
BUG=chromium:728751
TEST=verified that Cr50 build succeeds when both using and not using
     the signing fob.

Change-Id: I8f40bd52f1752bfd88ec002f298b991faf7a2512
Reviewed-on: https://chromium-review.googlesource.com/528373
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-06-08 18:52:40 -07:00
Vadim Bendebury
d89eeb6ec8 codesigner: accept the new command line option
The upcoming "real" signer update will introduce a version which is
not backwards compatible with the existing one wrt the command line
flags: the command line flag '-b' will have to be present.

To keep the default "dummy" signer in sync let's make it accept and
ignore the '-b' command line flag.

BRANCH=none
BUG=none
TEST=verified that the updated signer and the dummy signer both work.

Change-Id: Ia8ab6d7ae01d249046f267608b5971a7a7c95e29
Signed-off-by: Vadim Bendebury <vbendeb@google.com>
Reviewed-on: https://chromium-review.googlesource.com/517678
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-05-31 21:14:30 -07:00
Dino Li
59c04665c6 reef_it8320: initial reef_it8320 board
This change is based on reef's board code and modified for it8320.

BUG=none
BRANCH=none
TEST=Run the entire faft_ec suite and passed.

Change-Id: I8977d7431eb0a97ceb4ee1dfd11a2c4433687db0
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/487792
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-05-18 02:26:10 -07:00
Sam Hurst
b5fcb6a822 pd: Make build of VIF utility less verbose
BUG=none
BRANCH=none
TEST=make -j buildall

Change-Id: I37be7abde31d20e0f4227db97e6751c2998f418b
Reviewed-on: https://chromium-review.googlesource.com/499871
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-09 14:58:30 -07:00
Sam Hurst
e13695c017 pd: Support auto generation of USB Type-C VIF
Create an app to extract relevant information
from the EC code base that's used to create Vendor
Information Files (VIFs) needed for USB Type-C
compliance testing.

BUG=chromium:701852
BRANCH=none
TEST=make -j buildall
     Compared generated VIFs to expected values

Change-Id: I600ca78b9fb5d2de78aa65a58264c6f79b36ea17
Reviewed-on: https://chromium-review.googlesource.com/455280
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-05-03 23:17:46 -07:00
Nicolas Boichat
07eccbb414 rwsig: Add support for rwsig image types
usbpd1 futility image type is deprecated and should not be used for
new designs. This adds proper support for rwsig image type.

Key and signatures are added at linker stage step (futility cannot
directly create such signed images). Thanks to VB21 header, rwsig.c
can now tell how many bytes of the RW image need to be
cryptographically verified, and ensure that the rest is blank (0xff).

BRANCH=none
BUG=chromium:690773
TEST=make BOARD=hammer; flash, RW image is verified correctly.
TEST=make runtests -j
TEST=For the rest of the tests:
     Change config option to CONFIG_RWSIG_TYPE_RWSIG
TEST=make BOARD=hammer; flash, hammer still verifies correctly.
TEST=cp build/hammer/ec.RW.bin build/hammer/ec.RW.bin.orig;
     futility sign --type rwsig --prikey build/hammer/key.vbprik2 \
        build/hammer/ec.RW.bin
     diff build/hammer/ec.RW.bin build/hammer/ec.RW.bin.orig
     => Same file
TEST=Add CONFIG_CMD_FLASH, flashwrite 0x1e000, reboot, EC does
     not verify anymore.
TEST=dump_fmap build/hammer/ec.bin shows KEY_RO and SIG_RW at
     correct locations.

Change-Id: I50ec828284c2d1eca67fa8cbddaf6f3b06606c82
Reviewed-on: https://chromium-review.googlesource.com/441546
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-02-17 04:09:37 -08:00
Aseda Aboagye
1f52e64ae6 Makefile.rules: Clean ccache cache for 'clobber'.
In the chroot, we use ccache to speed up compilation.  However, it's
possible for this cache to become corrupt which could lead to slower
builds.  In order to keep things fresh, 'make clobber' should clean up
that ccache cache as well.  This commit makes it so.

Note, this is NOT *clearing* the cache entirely.

BUG=chromium:681961
BRANCH=None
TEST=make clobber; verify that ccache is cleaned.

Change-Id: I8ccd7df4858c445485ed740843f3126af0abd33a
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/433108
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-01-27 16:44:03 -08:00
Simon Glass
70ea50153f Makefile: Suppress unwanted 'echo' output
Add a 'echo' command which can be called to generate output. If V=0 then
it is suppressed. This drops the unwanted output when V=0.

Signed-off-by: Simon Glass <sjg@chromium.org>
BUG=chromium:680243
BRANCH=none
TEST=V=0 emerge-reef chromeos-ec; See that the BUILD lines are gone

Change-Id: Ie4474024c84345d427f4d95a9ff194dc740f860f
Reviewed-on: https://chromium-review.googlesource.com/427364
Commit-Ready: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-13 15:22:28 -08:00
Simon Glass
7d40fb380d Makefile: Support three levels of verbosity
At present the EC Makefile supports two levels of verbosity:

V unset: Show an abbreviated build log (operation and file only)
V=1: Show the full build log, including all commands

However, even the abbreviated build log includes a lot of output. It is
basically a long list of filenames and is of little use during
development. It is more useful to show just warnings and errors.

Add a new setting, V=0, which provides this.

BUG=chromium:680243
BRANCH=none
TEST=emerge-reef chromeos-ec; test each of V=, V=0, V=1 and see that the
Makefile does the correct thing.
Change-Id: I85c0423c5299fa3ab624ed9f7f7b6b7f73236611
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/427363
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-01-13 15:22:26 -08:00
Moritz Fischer
8d73ccacae Makefile.rules: Allow specifying HOST_LDFLAGS for cross-compilation
Add HOST_LDFLAGS to cmd_c_to_host to allow for cross-compilation of
utils such as 'ectool'.

BRANCH=master
BUG=none
TEST=Cross compile using arm-oe-linux-gnueabi with corresponding
linkerflags and run resulting binary on armv7 device

Change-Id: Iebdfa92239eb5f245d4ad3623cbdceafd82d1675
Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Reviewed-on: https://chromium-review.googlesource.com/424855
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Martin Roth <martinroth@chromium.org>
2017-01-05 23:47:11 -08:00
Carl Hamilton
02d9c311ec Allow a subset of boards to be built with the "buildall" target.
In order to reduce build times during development, this change allows an
engineer to build a subset of all boards, writing the results for each
board into the ".failedboards" directory.

The expectation is that, while working on code that affects multiple
boards, the engineer will invoke "make build_boards BOARDS=<board-list>"
periodically to confirm that all affected boards still build.

Before pushing any code for review, however, the engineer is still expected
to run "make buildall" to ensure all boards still build and tests pass.

* Define a new make variable, BOARDS, whose default value is $(boards).
  This variable can be overridden on the make command line or via the
  environment. Its value must be non-empty.

* Use the BOARDS make variable to control which boards will be built by the
  new "build_boards" and "try_build_boards" targets.

* Refactor the "buildall" target so that it depends on "build_boards". This
  indirectly allows the boards built to be controlled via the BOARDS make
  variable.

* Here are some make command lines that were used to test the behavior of
  the change:
    make -j buildall  # Builds all boards, runs tests.
    make -j build_boards  # Builds all boards, doesn't run tests.
    make -j build_boards BOARDS="cr50 reef"  # Builds cr50 and reef boards
    make -j build_boards BOARDS=  # Fails due to empty BOARDS.

BUG=none
BRANCH=none
TEST=make -j buildall

Change-Id: I833277842e5e20d86eaa90df6457264a2f86a3fa
Reviewed-on: https://chromium-review.googlesource.com/420110
Commit-Ready: Carl Hamilton <carlh@chromium.org>
Tested-by: Carl Hamilton <carlh@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Martin Roth <martinroth@chromium.org>
2017-01-05 18:40:44 -08:00
Martin Roth
2bdc25c2e1 Update Makefile.rules with a showboards target
This prints all the boards that are part of the build.  This will be
used on coreboot's build system for running coverity.  This allows
the builds to keep in sync as platforms are added, and as anything is
added to the "skip_boards" list.

for board in $(make showboards); do
   make proj-$board CROSS_COMPILE="arm-eabi-"
done

BUG=none
BRANCH=none
TEST=make showboards shows boards, and excludes skip_boards list

Change-Id: I34d8bc95cc5c7d05b4f2ec38b16b75f9f0c72c6f
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403498
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-16 19:04:27 -08:00
Martin Roth
8feb3ab4ec makefile: Add help target
This just adds some basic output as a reminder of what targets
do what.

BUG=none
BRANCH=none
TEST=make help shows useful output

Change-Id: Ic46f153ce8ed0b39294644a01eba8e06f2abe1c6
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403497
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-16 16:47:42 -08:00
Martin Roth
c66d36761f Makefile.rules: Add targets to see file size differences
Since the ec binaries are so tight on space, it would be nice to be
able to see just how much changes are affecting the size.  This allows
users to easily do before/after comparisons.

Sample output:
build/sweetberry/RW/ec.RW.flat shrank by 44 bytes: (43828 to 43784)
build/twinkie/RO/ec.RO.flat shrank by 64 bytes: (46312 to 46248)
build/twinkie/RW/ec.RW.flat shrank by 40 bytes: (45900 to 45860)
build/wheatley/RW/ec.RW.flat shrank by 40 bytes: (102692 to 102652)
Compared 156 of 156 files.
81 files changed.
Total size change: -3100 bytes.
Average size change: -38 bytes.

BRANCH=none
BUG=none
TEST=make clobber buildall -j; make savesizes
[change some code that changes file sizes]
make clobber buildall -j ; make newsizes
[Shows size differences]

Change-Id: I48b440063eb6eb6c00900af3d0dfa075be6f9ec7
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/410860
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-11-15 17:43:21 -08:00
Daisuke Nojiri
c926d7dc7c cts: Fix back-to-back build
Currently eCTS suites share the same directory (e.g. build/stm32l476g
-eval) to put build artifacts even though some files (e.g. board.c)
compile differently suite to suite. So, if cts-i2c-stm32l476g-eval is
built, followed by cts-gpio-stm32l476g-eval, build fails or produces
incorrect binary.

This patch makes eCTS create different directories for each suite.
As a bonus, we can now builds eCTS suites in parallel.

BUG=chromium:654549
BRANCH=none
TEST=make buildall -j (with uncommitted change)

Change-Id: I4abedc917787be5f79b97e0e50d0d08e01bd5f9d
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/398281
2016-10-14 16:05:49 -07:00
Bill Richardson
f2dba9d779 g: Add support for hardware dcrypto
BUG=chrome-os-partner:54101
BRANCH=none
CQ-DEPEND=CL:*287736
TEST=make buildall; try on Cr50 hardware

All TCG tests passed before and after this CL.

Change-Id: I65e31792b2912d588868cc298a01b0142ac7dadc
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/386258
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-09-16 19:56:34 -07:00
Vadim Bendebury
834207c485 cr50: provide build mode for signing with fob
We don't really have the ability to build the latest signer yet, but
this should not stop us from being able to build a properly signed
image using the ec makefiles.

As a stopgap measure the suggestion is to keep the latest signer
binary in ~/bin/codesigner in chroot, then with this patch applied
invoking make with CR50_DEV=1 will cause the proper sighner used and
proper signing procedure followed.

The signed targets need to be built in series to avoid concurrent use
of the signer fob, an addition dependency is being added to enforce
that.

BRANCH=none
BUG=chrome-os-partner:55557
TEST=ran make as follows:
   CR50_DEV=1 make BOARD=cr50
   touched the fob when requested, uploaded the generated
   build/cr50/ec.bin on a kevin-tpm2 using usb_updater, and observed
   it boot properly with the new version.

Change-Id: Ia9494bdc60b4bd3b8e5e09cbcbd8b27409c739d2
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/376885
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-09-07 00:16:56 -07:00
Daisuke Nojiri
b6e7520da4 cts: Build CTS suites in buildall
We need to (at least) build CTS for all boards & suites supported by CTS.
This will prevent our investment from accidentally being broken.

BUG=chromium:627252
BRANCH=none
TEST=make buildall builds CTS suites

Change-Id: Ib7bceaafd5e27ce9285b9d1bf35339bf6b04ba72
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/359947
2016-07-12 22:34:58 -07:00
Shawn Nematbakhsh
58c0727901 build: Skip cr50 board in make buildall if private folder not present
BUG=chromium:621993
BRANCH=None
TEST=`make buildall -j` from public checkout succeeds. Also verify cr50
still built from private checkout.

Change-Id: I982806e282146aab76154b51c366226d3d1aed14
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/354540
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-06-21 17:14:33 -07:00
Shawn Nematbakhsh
9ffc6915c9 make: Fix npcx compile error due to missing ecst binary
Add an explicit dependency on utils-build (includes ecst) to prevent
ec_elf_to_flat from running before ecst is built during parallel make.

BUG=chrome-os-partner:52777
BRANCH=None
TEST=Modify Makefile.rules to add 5sec sleep in $(build-utils) rule,
verify that `make BOARD=kevin clean && make BOARD=kevin -j` still
succeeds.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ia443f8b880cbd4451d41302817e176201f7870dc
Reviewed-on: https://chromium-review.googlesource.com/350162
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-06-08 19:18:09 -07:00
Dino Li
32bf8ecb77 board: rename it8380dev to it83xx_evb
Unified board name for IT83-series.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST="make BOARD=it83xx_evb -j" and "make buildall -j"

Change-Id: Ic96d0132fb31fcc8715d0dd810f8bd340035a640
Reviewed-on: https://chromium-review.googlesource.com/341843
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-03 22:00:49 -07:00
Vadim Bendebury
2fb8d2772c make: allow to see boards failed when making 'buildall'
It is quite annoying to see an error reported by buildall, but not
knowing what board(s) actually failed to build.

Create file for each board being built, put build progress information
in it, and remove it if the board build succeeded. Then, once the
build is completed see the failed boards in .failedboards/, if any,
and the states they failed at.

BRANCH=none
BUG=none
TEST=verified that the directory is empty after a successful buildall
     run, and has files named after failed boards in case of build
     failures.

Change-Id: I67eb1671cadf58d9f8feccebfcc860524f33c2a0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/338883
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-04-14 17:28:25 -07:00
Vadim Bendebury
b6f3e288c1 cr50: use the correct signer invocation options
The new signer command line option should be used by some boards, not
all of them. Add it for cr50 for now.

BRANCH=none
BUG=none
TEST=verified that --cros is added to the command line when cr50 blobs
      are signed, and that the signed blob boots fine on b1.

Change-Id: Ibc38cc6233b57838129ae7d554921c1bae0e6b8c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/329595
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-27 03:25:52 -08:00
Vadim Bendebury
c17c447a25 cr50: provide plumbing for prod mode RO signing
Creating bootloader for the chip involves signing the image with an
'air gap' - some physical presence action is required. We don't want
this to be required when the builder is building cr50 for test
purposes.

The solution is to keep using the dummy private key when building by
default, and invoking make differently when building an image which
would be accepted by the hardware.

Setting CR50_RO_KEY variable in the environment or in the make command
line will cause the signer use the value of this variable as the name
of the file containing the key to use for signing the RO image.

Should this file be a public key, the signer will stop and look for a
fob containing the matching private key, and will stream the RO image
through the fob for signing.

Using the fob requires that the signer runs under sudo, but we do not
want the generated files to belong to root, some more code is added to
change the generated files' ownership to user running the make.

BRANCH=none
BUG=chrome-os-partner:49950
TEST=ran the following tests:
 - verified that the build still succeeds by default.

 - invoked make as follows:

   CR50_RO_KEY=cr50_rom0-dev-blsign.pem.pub  make BOARD=cr50

  observed the signer stop to wait for the user to interact with the
  USB fob and proceed. Made sure that the generated image runs
  successfully on the evaluation board.

 - verified that 'make BOARD=cr50 clean' still works (i.e. none of the
   generated files is owned by root).

Change-Id: I733ec6386c1dfd838d83d22fb589fa64e5eeaced
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/326484
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-08 12:09:06 -08:00
Vadim Bendebury
432ea75d92 cr50: add ability to include two identical RW sections in the EC image
A typical EC image includes two similar in their functionality
subsections, RO and RW. CR50 has a small RO subsection, all it does -
detects a proper RW image to run and starts it up. To provide for
reliable firmware updates, the CR50 image needs to include two RW
sections, while the code is running from one RW subsection, the other
one can be upgraded.

This patch adds the ability to generate two identical RW sections,
mapped half flash size apart, and include them into the resulting EC
image.

To keep things simple the previously existing RW section's name is not
being changed, while the new (identical) RW section is named RW_B.

Two configuration options need to be defined to enable building of the
new image type: CONFIG_RW_B to enable the feature and
CONFIG_RW_B_MEM_OFF to define where RW_B should be mapped into the
flash.

A new rule added to Makefile.rules allows to generate a different lds
file from the same source (core/cortex-m/ec.lds.S) by defining a
compile time variable to pick a different base address for the
rewritable section, when RW_B is built.

BRANCH=none
BUG=chromium:43025
TEST=as follows:
    - make buildall -j still succeeds
    - verified that regular CR50 image starts successfully

    - modified chip/g/loader/main.c to launch RW_B first, re-built and
      re-run the image, observed on the console:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
  cr50 bootloader, 20151118_11218@80881, no USB, full crypto
  Valid image found at 0x00084000, jumping

  --- UART initialized after reboot ---
  [Reset cause: power-on]
  [Image: unknown, cr50_v1.1.4160-4c8a789-dirty 2015-12-07 18:54:27 vbendeb@eskimo.mtv.corp.google.com]
  [0.001148 Inits done]
  This FPGA image has no USB support
  Console is enabled; type HELP for help.
  > [0.002212 task 2 waiting for events...]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    (note that the image base address is 0x840000, which is RW_B).

Change-Id: Ia2f90d5e5b7a9f252ea3ecf3ff5babfad8a97444
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/316703
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-12-09 06:36:22 -08:00
Aseda Aboagye
397dbec3d6 console: Add support for using EC-3PO console.
This commit introduces a new CONFIG_* option.  To utilise the
experimental console, simply define the following config option in the
board's board.h file.

     #define CONFIG_EXPERIMENTAL_CONSOLE

This is a temporary option which allows the EC console to be work with
the EC-3PO interactive console interface.  When this option is enabled,
the EC expects commands to packed in a particular format.  This is for
command integrity and allows the interpreter to perform automatic
command retrying in the event that a character is dropped from the sent
command.

It also removes a lot of the console editing methods since they are now
being served by EC-3PO.

Once the EC-3PO interpreter is pulled into servod, we can enable this
feature by default and the config option can go away.

BUG=chrome-os-partner:46054
BRANCH=None
TEST=make -j buildall tests
TEST=Enable CONFIG_EXPERIMENTAL_CONSOLE on GLaDOS; Flash EC and verify
that console works via the EC-3PO interactive console interface.
TEST=Build and flash on GLaDOS and verify normal console operation on
standard EC UART.

CQ-DEPEND=CL:308615

Change-Id: I5e66eb94e31299b27ce029b7f7ce6ba0a7fb6816
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/309991
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-11 12:58:34 -08:00
Vadim Bendebury
62691cac03 cr50: make customized RO work
This patch completes introduction of building of proper RO and RW
images for cr50.

A few small mods were required:

- both RO and RW images have to be signed, using the same dedicated
  signer, but with different keys, dev_key.pem is not needed any more.

- the RW image offset is not at the half of available flash, a chip
  specific value of 16K is used instead.

   The suggested new image layout is as follows:

   +----------------------------------------+
   |       1KB RO signature header.         |
   +----------------------------------------+
   -                                        -
   |       15KB RO image.                   |
   -                                        -
   +========================================+
   |       1KB RW-A signature header.       |
   +----------------------------------------+
   -                                        -
   -                                        -
   |       239K RW-A image.                 |
   -                                        -
   -                                        -
   +========================================+
   -                                        -
   |       16 KB NVRAM, shared              |
   -                                        -
   +========================================+
   |       1KB RW-B signature header.       |
   +----------------------------------------+
   -                                        -
   -                                        -
   |       239K RW-B image.                 |
   -                                        -
   -                                        -
   +========================================+

BRANCH=none
BUG=chrome-os-partner:43025

TEST=The combined image (build/cr50/ec.hex) is successfully loaded and
     started by the spiflash utility from the latest FPGA tarball.
     Corrupting a byte in the generated image in the RW section causes
     failure to verify.

Change-Id: I41a05168b0d4e9f88efa1003f261b6dd03972a24
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/311422
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-11-10 06:54:43 -08:00
Bill Richardson
58540e90a5 Cause "make buildall -j" to yell about failures.
When building with -j, it's easy to miss errors. If you don't
have your shell configured to warn you about nonzero exit, you
may not even notice that "make buildall -j" failed. To make it
more obvious, we'll do one level of recursion for that target.
That will ensure that the last line of output is always a
pass/fail message.

BUG=none
BRANCH=none
TEST=make buildall -j   (with and without errors)

Before this CL, a successful "make buildall -j" ends with this:

  MV      ec.bin
  OBJCOPY ec.hex
  LD      RW/ec.RW.elf
  NM      RO/ec.RO.smap
  OBJCOPY RO/ec.RO.flat
  NM      RW/ec.RW.smap
  OBJCOPY RW/ec.RW.flat
  CAT     ec.obj
  OBJCOPY ec.bin
  COPY_RW ec.bin
  MV      ec.bin
  buildall completed successfully!
  (cr) ((fa7baa6...))  ~/trunk/src/platform/ec $

while a failing one looks like this:

  MV      ec.bin
  OBJCOPY ec.hex
  LD      RW/ec.RW.elf
  NM      RO/ec.RO.smap
  OBJCOPY RO/ec.RO.flat
  NM      RW/ec.RW.smap
  OBJCOPY RW/ec.RW.flat
  CAT     ec.obj
  OBJCOPY ec.bin
  COPY_RW ec.bin
  MV      ec.bin
  (cr) ((fa7baa6...))  ~/trunk/src/platform/ec $

Did you see the difference? I suspect some people miss it.

With this CL, a failing "make buildall -j" looks like this:

    NM      RW/ec.RW.smap
    OBJCOPY RW/ec.RW.flat
    CAT     ec.obj
    OBJCOPY ec.bin
    NM      RW/chip/mec1322/lfw/ec_lfw-lfw.smap
    OBJCOPY RW/chip/mec1322/lfw/ec_lfw-lfw.flat
    COPY_RW ec.bin
    MV      ec.bin
    COPY_RW ec.bin
    MV      ec.bin
    OBJCOPY ec.bin
    COPY_RW ec.bin
    MV      ec.bin
  make[1]: Leaving directory '/mnt/host/source/src/platform/ec'
  Makefile.rules:93: recipe for target 'buildall' failed
  make: *** [buildall] Error 2
  (cr) (stopit)  ~/trunk/src/platform/ec $

Change-Id: Id9b47d2869f61e8e3e44b3c618399ca9223f0a71
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/303811
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2015-10-01 20:45:55 -07:00
Vadim Bendebury
5ed966769d cr50: upgrade signer to latest and greatest
This patch brings in the enhanced signer utility published along with
FPGA version 20150925_21715, and the image.cc file updated to fix the
bug where it was not picking up the initialized data segment from the
elf file.

The new signed image header format, among other things, describes
memory areas as read-only and read-execute, which allows the bootrom
to configure the MMU appropriately.

Makefiles had to be modified to reflect the fact that the signed image
now depends on .elf, not on .raw, and that building the signer
requires more source files. Note that some signer features are not yet
being utilized (like processing xml files describing fuses or
retrieving keys from gnubby), the source are kept for completeness.

BRANCH=none
BUG=chrome-os-partner:43791
TEST=build the cr50 image and boot in on the FPGA board using the
     spiflash utility outside chroot. Observe the target starting the
     console session.

Change-Id: Ib59b8ebbeb98a8146d4d997e1f78178c4fbc031a
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/303070
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2015-09-29 19:38:22 -07:00
Bill Richardson
094a81f5de cleanup: Handle signed RW images a bit cleaner
For signed EC RW images (CONFIG_RWSIG), there's no point in
embedding the public key or signature into the image itself since
it will just be replaced by the signer (either as the next step
in the build process, or after the fact for MP releases). This
takes that out and just points to where the pubkey and signature
will be placed.

BUG=none
BRANCH=none
TEST=make buildall

I also checked the signatures with

  futility show -t build/*/ec.bin

They still look good, and the one signed image I booted (Cr50)
works as before.

Change-Id: Ib39b7c508914851f81a1bebb2450e08ef0def76c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302630
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-25 19:36:37 -07:00
Bill Richardson
5d138b379d Make builds repeatable.
We have been using the time of compilation to determine the
version string. This CL will keep doing that if the git repo has
uncommitted changes, but if the repo is clean we'll just use the
author date of the last commit. This ensures that the same source
will produce bitwise-identical builds (assuming no toolchain
changes, of course).

BUG=chrome-os-partner:45616
BRANCH=none
TEST=manual

  cd src/platform/ec
  make buildall
  mv build build.one
  make buildall
  md5sum build{,.one}/*/ec.bin | sort

Observe that successive builds produce identical binaries.

Change-Id: Ie2ef44b216586097589c9c15f12e05c87a53f991
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302140
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-09-24 12:46:28 -07:00
Bill Richardson
735e5a6ee2 Define SECTION=* and SECTION_IS_* when compiling
The linker scripts are passed through the preprocessor so that
they can distinguish between RO and RW images. This change makes
the same macros available when compiling, so that code can
contain directives like

  #ifdef SECTION_IS_RO

or

  #define FW_SIZE_(section) CONFIG_##section##_SIZE
  #define FW_SIZE(section) FW_SIZE_(section)

  int size = FW_SIZE(SECTION);

BUG=none
BRANCH=none
TEST=make buildall

Nothing uses this yet, so there's no change to the images.

Change-Id: I6e03cd07c134f4b86aeddd9d516b74bbdb95b8a8
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/301255
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-21 11:23:27 -07:00
Bill Richardson
f4b65c5d95 cleanup: Remove old vboot cruft from Makefile.rules
This removes an unused vboot recipe left over from long, long ago.

It was added with commit 8101b71 (May 2012) to enable vboot on
EC. It should have been removed with commit 45cd846 (Aug 2012),
but wasn't. It hasn't been useful since then.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I1176898064c4e714639dc63f041fb0fd85d73bab
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/301254
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-21 11:23:27 -07:00
Shawn Nematbakhsh
d58e54730c cleanup: Rename geometry constants
Rename and add geometry constants to match spec doc -
https://goo.gl/fnzTvr.

CONFIG_FLASH_BASE becomes CONFIG_PROGRAM_MEMORY_BASE
CONFIG_FLASH_MAPPED becomes CONFIG_MAPPED_STORAGE

Add CONFIG_INTERNAL_STORAGE, CONFIG_EXTERNAL_STORAGE and
CONFIG_MAPPED_STORAGE_BASE where appropriate.

This CL leaves chip/npcx in a broken state -- it's fixed in a follow-up
CL.

BRANCH=None
BUG=chrome-os-partner:23796
TEST=With entire patch series, on both Samus and Glados:
- Verify 'version' EC console command is correct
- Verify 'flashrom -p ec -r read.bin' reads back EC image
- Verify software sync correctly flashes both EC and PD RW images

Change-Id: Idb3c4ed9f7f6edd0a6d49ad11753eba713e67a80
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/297484
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-16 14:49:31 -07:00
Vadim Bendebury
9005ddd4bc cr50: add plumbing for signing CR50 RO images
The signer utility needs to be built and the flat image needs to be
signed. The signer utility is written in C++, supporting this required
adding a new make command to Makefile.rules and a build file for the
utility.

The signing now needs to be a part of generating the .flat file. To
achieve this an alternative set of rules is defined in Makfile.rules
for targets where RO image needs to be signed.

Rules for converting elf to hex have been consolidated as there is no
need to omit the --set-section-flags when it does not apply.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=as follows:
    - ran 'rm build/cr50; make BOARD=cr50'
    - observed that both build/cr50/ec.bin and
      build/cr50/RO/ec.RO.flat have the required signature header in
      the first 1024 bytes.
   - verified that the cr50 board can be booted over SPI using the
     image in build/cr50/RO/ec.RO.flat

Change-Id: Iacc22561de67fadfaf8e049bf9578cbd08cfad86
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295291
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2015-08-25 21:31:33 +00:00
Bill Richardson
263b66204c Allow for private board configurations
The public sources look for board configurations in directories
named board/$BOARD/

Sometimes it's necessary to keep sensitive projects out of the
public view for a bit.

This CL allows board configurations to also appear in directories
named private*/board/$BOARD/

BUG=none
BRANCH=none
TEST=manual

First, ebuilds and "make buildall" seem to work just as before.

Second, I copied 24 of the existing boards (those without
board-specific #ifdefs in the code) into a private*/board/
directory, renamed them to something unique, and ran "make
buildall" again.

Both public and private boards compiled and passed their tests.

Change-Id: I977c23cb8e73e40677c8f329abca8bbc51fd53df
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/292428
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2015-08-11 22:41:16 +00:00
Aseda Aboagye
9008c7a4fd Makefile.rules: Fix build timestamp.
The ec_date.h file had incorrect dependencies.  $(objs) had no meaning
outside of the building the object files as it gets privately overidden
with the corresponding target objects (RO, RW, libsharedobjs).  This
caused ec_date.h to only be generated once from a clean.  This commit
fixes that by adding all of the RO and RW objects as dependencies (with
the exception of version.o).

BUG=chrome-os-partner:43373
BRANCH=None
TEST=Built ryu, checked build timestamp in build_info.  Touched a file,
rebuilt, verified that build timestamp was updated.
TEST=make -j buildall tests

Change-Id: I0ab107efc1a504b4f871ebcf595754db1d414c7a
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/289338
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Trybot-Ready: Aseda Aboagye <aaboagye@chromium.org>
2015-07-30 03:22:25 +00:00
Ian Chao
14bd917343 nuc:
Add ECST tool to modify the header used by npcx booter.

Modified drivers:
1. i2c.c: Modify for i2c_port design.
2. i2c.c: Fixed bugs when mutil-tasks use the same i2c port and pull-up issue.
3. hwtimer.c: Fixed bug whcih event expired time is behide current timer.
4. lpc.c: Add intializing host settings after pltrst is deasserted.
5. uart.c/clock.c/register.h: Fixed bug which cannot enter deep-idle
   when gpio is any-edge trigger mode.
6. task.c: Add workaround method for hard fault issue.
7. keyboard_raw.c: Modified for support CONFIG_KEYBOARD_KSO_BASE
8. lpc.c: Modified for support CONFIG_KEYBOARD_IRQ_GPIO
9. lpc.c: fixed obe interrupt bug during 8042 initialization
10.Adjust path of flat files for new Makefile rules
11.Fixed build error on lpc.c without CONFIG_KEYBOARD_IRQ_GPIO

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none

Change-Id: Icf9494174b245b4026e396be877d578f36b6f6a5
Signed-off-by: Ian Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/284036
Reviewed-by: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Shawn N <shawnn@chromium.org>
2015-07-25 01:22:32 +00:00
Aseda Aboagye
ce063e0829 build-infr: Add support for shared RO library.
This commit introduces the build infrastructure changes needed for
creating a shared RO library. (libsharedobjs).  The end goal is for the
library to contain various objects that can be shared with both the RO
and RW EC images.

Now, there are 3 make goals: ro, rw, and libsharedobjs.

In order for changes that are only specific to a single image (ie: RW
only) to be applied correctly, the object files are now built separately
for the RO, RW, shared objects library targets.

NOTE: Certain EC targets are incompatible with this model due to the
fact that only one image is present within flash at a time.

BRANCH=none
BUG=None
TEST=make -j buildall tests
TEST=make -j BOARD=cr50 xrefs
TEST=make BOARD=samus dis
TEST=Built samus EC image and compared that the final EC image was
identical to the upstream version (except for the git SHAs & version
strings).

CQ-DEPEND=CL:285934

Change-Id: I8e67f089710be9c6d7017718109262394bdad2f5
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/274079
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
2015-07-17 03:17:50 +00:00
Anton Staaf
7e29ee3b8e Ryu: Add flash_dfu makefile rule to use dfu-util
Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j

Change-Id: Ic67fa454fe61c8b3419934c98ade75099163f7f2
Reviewed-on: https://chromium-review.googlesource.com/285022
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2015-07-16 00:32:59 +00:00
Ian Chao
957638c78c nuc: Add SHI driver for arm-based platform in chip folder.
Add npcx_evb_arm board-level driver for arm-based platform.
Add header.c: for booting from NPCX5M5G A3 Booter.
Remove lfw folder due to those functionalitie have been replaced with Booter

Modified drivers for
Patch Set 1:
1. flash.c: Implement UMA lock, tri-state and selection register lock functionalities
2. hwtimer.c: Add ITIM32 for hwtimer
3. lpc.c: Add checking for LRESET
4. system.c: Modified CODERAM_ARCH functions for NPCX5M5G A3 Booter.
5. uart.c: Add support for module 2
Patch Set 2:
6. lpc.c: Modified lpc_get_pltrst_asserted() func
Patch Set 3:
7. minimize the changes for CONFIG_CODERAM_ARCH in common layer
8. comments of Patch Set1/2
Patch Set 4:
9. Modified CONFIG_RO_MEM_OFF point to ro image and keep header as a part of ec.RO.flat.
10. Fixed RO_FRID and RW_FRID issues which caused by CONFIG_CODERAM_ARCH.
Patch Set 5:
11. Modified system.c in common folder for supporting *_STORAGE_OFF.
12. Use *_STORAGE_OFF in firmware_image.lds.S to indicate flat file layout in flash.
Patch Set 6:
13. rebase to newest version
14. system.c: Modified for the newest include/system.h
Patch Set 7:
15. Merge from version 0625

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none

Change-Id: Ifd7c10b81b5781ccd75bb2558dc236486976e8ed
Signed-off-by: Ian Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/272034
Reviewed-by: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Shawn N <shawnn@chromium.org>
2015-06-26 18:57:32 +00:00
Bill Richardson
9b9b7f97a6 cleanup: Update Makefile's .PHONY targets
This puts the .PHONY declaration next to the target, so that we
don't overlook any.

BUG=none
BRANCH=none
TEST=make buildall

Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Change-Id: I944537fdc3a90691a7f2de0bff9d7f9df4898cf8
Reviewed-on: https://chromium-review.googlesource.com/278019
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-06-18 09:23:02 +00:00
Anton Staaf
2a4ac55edf Flashing: Add flash_ec rule to simplify flashing
The flash_ec rule calls the flash_ec tool, passing the inferred board
and image based on where make was run.  This means that from a board
directory you can run "make flash_ec" and an up to date image will be
flashed using flash_ec.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j
     cd board/ryu_p4p5
     make flash_ec

Change-Id: I51e2a62f4d0de427f8d36e0848941aef742e0d3d
Reviewed-on: https://chromium-review.googlesource.com/272264
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
2015-05-26 19:36:10 +00:00
Vincent Palatin
24f4e36d82 Use GCC instead of LD to trigger the linker
Invoke the linker through gcc rather than directly with ld.
This will allow us to use some more advanced features : e.g. LTO.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BUG=none
BRANCH=none
TEST=make buildall
then compare manually old and new binaries

Change-Id: I101b1edbaebd5628624a5a8c12d5c0b5fa9e2c50
Reviewed-on: https://chromium-review.googlesource.com/271290
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
2015-05-15 19:15:32 +00:00
Vadim Bendebury
1f09bd7c46 make: add generation of sorted symbol maps
Sorted symbol maps are useful when one wants to look up an address to
associate it with a function or a variable, or to estimate how much
room certain components of the image take.

This patch adds a rule and creates a dependency to make sure that
sorted maps (assigned extension .smap) are generated during builds.

BRANCH=none
BUG=none
TEST=make buildall -j
   observed 91 .elf files and 89 .smap files generated.
   the two images not triggering .smap file generation are

    build/npcx_evb/chip/npcx/lfw/ec_lfw
    build/npcx_evb/chip/npcx/spiflashfw/ec_npcxflash

  they could be added in a follow up patch if deemed necessary.

Change-Id: I196a2ffe059a83481b7a313617d516634762dc60
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/270117
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-05-11 18:38:30 +00:00
Icarus Sparry
4fce69d394 mec1322: Changed to generate ec.bin for the firmware binary.
Previously for the mec1322 chip an ec.bin file was created in the normal way
and then it was "packed" in a post-processing stage to produce ec.spi.bin.

This change allows a chip or board build.mk file to specify the rules used to
produce ec.bin, and uses this for the mec1322 to do the packing. This means
that we can use the standard "ec.bin" name, and do not need to alter other
scripts, such as the script which creates chromeos-firmwareupdate.

BUG=None
TEST=buildall -j, flash on strago and see it still works.
BRANCH=NONE

Change-Id: I3f880d64e60d14f82cb1d21c8b3f2d4ae5e0dfef
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/265544
Tested-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Kevin K Wong <kevin.k.wong@intel.com>
2015-04-15 22:58:27 +00:00