Commit Graph

63 Commits

Author SHA1 Message Date
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
Bill Richardson
b4496c4443 Use futility to sign the USB-PD chargers
This replaces a special-purpose python script with futility, to
sign the firmware for those boards that require a signed RW image
instead of using software sync.

Currently, the only boards that do that use a signature scheme
that is somewhat opaque (refer to commit b5a439241f in the
vboot_reference repo for details). Futility calls that scheme
"--type usbpd1".

BUG=chromium:231574
BRANCH=ToT
CQ-DEPEND=CL:*212135
TEST=manual

To test, I obtained a reworked zinger that could be connected to
servo. I first flashed it with a dev-key-signed RO+RW image built
prior to this CL, then I applied this change, built a new image
(with a minor change to the startup message), and updated only
the RW half from Samus using

  ectool --name=cros_pd flashpd 0 1 /mnt/stateful_partition/ec.RW.bin

Watching the zinger console when plugging and unplugging, I
confirmed that the RO firmware was still the original and the
verified-by-RO RW firmware was the new version.

Note: I also had to build a custom AP kernel without the cros_pd
driver, to prevent interference with the manual update.

Change-Id: I22d8e75c85dab7701af8fe98287f14ebe77dbbd4
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/264508
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2015-04-08 19:12:03 +00:00
Bill Richardson
dd9c1447ac cr50: enable signed RW images
This signs the RW firmware (with a non-secret key). The RO
firmware will verify the RW firmware and jump to it if it's good.

Note that this isn't the final solution, just the beginning.

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

Build and install it. You'll see something like this:

--- UART initialized after reboot ---
[Reset cause: reset-pin hard]
[Image: RO, cr50_v1.1.2929-27e1b82-dirty 2015-02-24 14:36:29 wfrichar@wfrichar-glaptop]
[0.000444 Verifying RW image...]
[0.423742 RW image verified]
[0.423946 Jumping to image RW[0.428492 UART initialized after sysjump]
[Image: RW, cr50_v1.1.2929-27e1b82-dirty 2015-02-24 14:36:29 wfrichar@wfrichar-glaptop]
[0.428931 Inits done]
Console is enabled; type HELP for help.
>
> sysinfo
Reset flags: 0x00000c02 (reset-pin sysjump hard)
Copy:   RW
Jumped: yes
Flags:  unlocked
>

Change-Id: Icafa554baca135ff1f80cbce4dad5f980e7fc122
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/253081
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-02-25 08:44:58 +00:00
Bill Richardson
8a94ea4fbd Add USE_GIT_DATE=1 to make args to build repeatable images
Up until now, every image includes the time of compilation in the
build information. This makes it impossible to verify that a
particular image came from a particular source code snapshot.

With this change, specifying USE_GIT_DATE=1 to the make command
will use the author date of HEAD as the timestamp. That means
that successive builds from the same source will produce
bitwise-identical output (assuming the same toolchain, of
course).

BUG=none
BRANCH=none
TEST=manual

Do this twice:

  \rm -rf build
  make BOARD=cr50 USE_GIT_DATE=1
  md5sum build/cr50/ec.bin

The md5sum should be the same for both runs.

Change-Id: If64307101a453cb13c62fa003f1bf432f4998273
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/252751
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-02-25 03:33:18 +00:00
Vic Yang
accd0da789 Remove ryu_p1 board
P1 boards are not used anymore. We haven't built ryu_p1 EC for a while.
Let's get rid of it.

BRANCH=None
BUG=chrome-os-partner:35138
TEST=make buildall

Change-Id: Ie0c0b91ce0af99a0975050935af920503ca7383a
Signed-off-by: Vic Yang <victoryang@google.com>
Reviewed-on: https://chromium-review.googlesource.com/252340
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-02-24 03:07:59 +00:00
Bill Richardson
c955bd846d cr50: Add ec.hex to hex: build target
When the default build target creates .hex files, emit
the complete ec.hex output as well as the RO and RW halves.

BUG=none
BRANCH=none
TEST=make BOARD=cr50

Change-Id: Ia87bbace29d89695ef6a9c090c895ca10f14d919
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/251014
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-02-20 03:00:00 +00:00
Ian Chao
4ee50837a0 nuc: Add all IC specific drivers of NPCX5M5G
Add npcx_evb in board folder for testing
Add shared-spi arch support in common layer.

Modified drivers for
1. Fan.c: console command “pwmduty”.
2. Pwm.c: for the issue when set duty to 0.
3. System.c: for hw reset only during system reset.
4. Flash.c: Fixed access denied bug of the flash driver for host command.
5. Comments from Patch Set 1
6. Comments from Patch Set 3 (except sha256.c)
7. Add openocd and flash_ec support for npcx_evb
8. Add little FW and spi-flash upload FW in chip folder
9. Add optional make rules for PROJECT_EXTRA
10.Replace CONFIG_SHRSPI_ARCH with CONFIG_CODERAM_ARCH and remove changes
   in common layer sources for shared-spi arch. (except sysjump)
11.Find the root cause of JTAG issue and use workaround method
   with SUPPORT_JTAG in clock.c
12 Execute hibernate in low power RAM for better power consumption
13 Add workaround method for version console command
14 Modified coding style issues by checkpatch.pl tool

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

Change-Id: I5e383420642de1643e2bead837a55c8c58481786
Signed-off-by: Ian Chao <mlchao@nuvoton.com>
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/233742
2015-01-14 03:16:10 +00:00
Todd Broch
faf09e2905 Stop building ryu_p1 board.
Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=none
BUG=chrome-os-partner:35138
TEST='make buildall' no longer builds ryu_p1

Change-Id: I53b5b9a1967ac53faabbe2ee8268328d7a5c3ae7
Reviewed-on: https://chromium-review.googlesource.com/238810
Reviewed-by: Vic Yang <victoryang@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
2015-01-07 08:45:30 +00:00
Gwendal Grignou
91ca05cf3a ryu_sh_loader: Add board directory for load image
Ryu sensor hub has asymectric RO/RW images. The first one is very limited
(not i2c master, no sensor drivers, gesture recognition).

Image size is alter to offer more space for the RW firmware image,
compiled with ryu_sh board.

To write RO image and basic RW image:
flashrom -V -p ec:type=sh,block=0x800 --fast-verify -w /tmp/ryu_sh_loader/ec.bin
To write the expected RW image:
flashrom -V -p ec:type=sh,block=0x800 --fast-verify -w -i EC_RW:/tmp/ryu_sh/ec.bin

BRANCH=ToT
BUG=chrome-os-partner:33908
CQ-DEPEND=CL:231970,CL:233233
TEST=load on Ryu, confirmed limited operation.

Change-Id: Ib976e2b048935adfb9b2b072c071db5be2bc1c09
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231984
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-12-15 22:46:21 +00:00
Gwendal Grignou
0777ebaef6 Makefile: remove burn_my_ec
burn_my_ec is an utility that flash an image embedded in its code.
We can not compile it as part of ec-[dev]utils, because we have
devices that firmware should be build as part of chrome-ec package.
Remove burn_my_ec, barely used.

Split the makefile to build just the host utility when requested.

BRANCH=ToT
BUG=chrome-os-partner:32025,chromium:408713
TEST=Check that files are stil built when needed and
not when utils-host is invoked.

Change-Id: I3fabe16067d57c74ae36b05138f4c6fd2483c7c4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/233347
2014-12-15 03:51:17 +00:00
Vincent Palatin
902a07b5c8 Add RW firmware signature verification for common runtime
For accessories without software-sync mechanism, add the option to do a
RSA-based signature verification of the Read-Write firmware.

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

BRANCH=samus
BUG=chrome-os-partner:31192
TEST=enable the configuration on Fruitpie and see the RW firmware
validated and jump to. Tried with good and bad RW images.

Change-Id: I3c886c2cbe17ca9543e19bf8599061c3f9751d4f
Reviewed-on: https://chromium-review.googlesource.com/229594
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
2014-12-01 20:30:46 +00:00
Gwendal Grignou
042dcf8c8a ec: Add lds dependencies to the dependency list.
With this change, when we modify some config file related
to space, the lds is recompiled properly.

TEST=Check that when chip/stm32/configXX.h is modified,
ec.RO.lds is recompiled.
BRANCH=ToT
BUG=None

Change-Id: I0a49065e59f00dd37d945d9593126ab9fd1598b5
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/230908
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-20 08:38:20 +00:00
Vincent Palatin
b63b0d70f5 rsa: add support for 4096 and 8192 bit keys
Allow to use larger RSA keys by setting CONFIG_RSA_KEY_SIZE to 4096 or
8192 rather than using the default 2048-bit size.

It's mainly for benchmarking purpose right now as we don't have the RAM
to store the 3x key size buffer and the flash space for the public key
structure.

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

BRANCH=samus
BUG=none
TEST=build Zinger with CONFIG_RSA_KEY_SIZE equals to 4096 and run it.

Change-Id: I9839121bf158d0a30dde1e48d875f345191bfec2
Reviewed-on: https://chromium-review.googlesource.com/228925
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-11-15 06:00:02 +00:00
icarus sparry
27367a07c9 Strago: Automated build to generate ec.spi.bin.
Add another variable PROJECT_EXTRA which chips and boards can use to
add additional prerequisites to the default all target

Add rules for creating ec.spi.bin to package the ec firmware for
strago

BUG=None
BRANCH=None
TEST=Tested on Braswell Ref Design Board

Signed-off-by: Divya Jyothi <divya.jyothi@intel.com>
Signed-off-by: icarus sparry <icarus.w.sparry@intel.com>

Change-Id: I4fb9f1275dc5bc2987b6abf5d45b0baf363c0d7a
Reviewed-on: https://chromium-review.googlesource.com/226305
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Icarus W Sparry <icarus.w.sparry@intel.com>
Commit-Queue: Icarus W Sparry <icarus.w.sparry@intel.com>
Tested-by: Icarus W Sparry <icarus.w.sparry@intel.com>
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
2014-11-12 23:08:17 +00:00
Anton Staaf
8513e23df1 USB: Remove special case for iVersion string descriptor
Previously the version string was special cased in the USB stack
because the build system prevented the inclusion of ec_version.h in
any file other than common/version.c.  This lead to common/version.c
being the only place that the USB version string could be computed
and thus the special case of filling in the version string descriptor
at run time.  This made the USB stack more complex, and lead to the
common/version.c file including usb.h, which is actually STM32
specific.

Now, the portion of ec_version.h that is deterministic is only
updated when something in the tree actually changes (by way of a
conditional in the makefile), and ec_version.h no longer has to
depend on all object files (other than the special version.o).
This allows anyone to include ec_version.h as needed.  In particular,
each board that wants to define a USB version string can directly
include ec_version.h and do so.

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

BRANCH=None
BUG=None
TEST=make buildall -j
     touch files and verify rebuilds happen correctly

Change-Id: Ic84d0b9da90f82ebb4630fb550ec841071e25a49
Reviewed-on: https://chromium-review.googlesource.com/227211
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2014-11-04 21:34:39 +00:00
Bill Richardson
86c7e2e90a Add initial support for cr50 SoC
The serial console works. Nothing else is implemented yet.

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

To build,

  make BOARD=cr50 hex

Testing the result requires a development board. I have one. It
works with HW revision m3.dist_20140918_094011

Change-Id: I718d93572d315d13e96ef6f296c3c2796e928e66
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/226268
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-10-31 22:32:50 +00:00
Vincent Palatin
beaddbf1a3 zinger: check RW firmware signature
The Zinger RW is now signed with 2048-bit RSA key (using SHA-256 as
digest).
This CL implements the verification mechanism.

note: the RSA key used for signing must be provided as a .pem file.
The path to .pem file must be provided in the PEM environment variable.
By default, it's using the dev key stored in zinger_dev_key.pem.

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

BRANCH=samus
BUG=chrome-os-partner:28336
TEST=on Zinger, run with properly signed RW firmware and corrupted
firmware and check the serial traces.

Change-Id: Ia58482458904a3ed72d6b0e95996cae86a0ead83
Reviewed-on: https://chromium-review.googlesource.com/220178
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-10-02 23:18:25 +00:00
Anton Staaf
9de6cdf9fd Flashing: Force board into reset for flashing
This ensures that nothing previously flashed to the baord can
interfere with the flashing operation (by wedging the MCU or
putting it into a state that the falshing code can't handle).

This also adds a dependency on ec.bin to the flash
target, ensuring that the firmware image is up to date
when flashing.

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

BRANCH=none
TEST=make buildall -j

Change-Id: I8cdfa6f5c84ed84d6b6e6b30d6683a23087f2c63
Reviewed-on: https://chromium-review.googlesource.com/215991
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2014-09-09 20:59:46 +00:00
Anton Staaf
9797f654d9 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>
2014-07-30 03:10:06 +00:00
Anton Staaf
2a7ea56782 build: Move libs after source or object files
When not using gold as the linker the ordering of libraries
with respect to objects and source files is important.
Previously the build placed -l libraries before source and
objects on the gcc command line.  This doesn't work with
the default ld linker because since none of the symbols in
the libraries are yet required they are thrown out before
their uses are found in the objects and source.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: Ic9f83ba6138d6592d3b6e28de6fb0688e664f480
Reviewed-on: https://chromium-review.googlesource.com/202469
Tested-by: Anton Staaf <robotboy@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Anton Staaf <robotboy@google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-06-04 21:01:16 +00:00
Vic Yang
876fe28e6f Show success message after 'make buildall'
'make buildall' spews out a long long long message, and when an error
occurs, it's sometimes hard to spot the error message. By adding a
explicit success message after a successful run, one can just look for
that success message to determine if it failed.

BUG=None
TEST=Build and see success message.
TEST=Introduce an error, build, and check there is no success message.
BRANCH=None

Change-Id: Ia5468342ad2eb5378c3e10774ed81c5c91f002a2
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200618
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-05-21 04:18:23 +00:00
Vincent Palatin
0f01a40c86 test: build target test only when the full runtime is available
For targets not using the common runtime functions, the current test
content does not make much sense and fails to build properly :
de-activate the tests build in that case.

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

BRANCH=none
BUG=chrome-os-partner:28480
TEST=USE=usbpd emerge-samus chromeos-ec

Change-Id: Ic6477861b5a86916f29a9f6bb70ed0def3661886
Reviewed-on: https://chromium-review.googlesource.com/197883
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-02 17:14:32 +00:00
Randall Spangler
a13edcc038 Add OWNERS files
These are not currently checked by gerrit, but will be at some point
in the not-too-distant future.

The board/ directory gets additional owners to make it easier for
partner eng to make changes in ToT.

BUG=chrome-os-partner:27404
BRANCH=none
TEST=none (since gerrit doesn't check owners yet)

Change-Id: Ie21b9530fcc6d708ab987d9de80676f91faa72b9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191947
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-04-02 19:58:53 +00:00
Vic (Chun-Ju) Yang
798df2a6d0 Add presubmit check for unit test
This enforces that "make buildall" runs at least once after the last
file change.

TEST=Try to upload without running "make buildall"
TEST=Change a file without re-running "make buildall", and try to
upload.
BUG=None
BRANCH=None

Change-Id: Ia4abb3c0e17cf4d559975574f398d74c7986c89f
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185116
Reviewed-by: Dave Parker <dparker@chromium.org>
2014-02-06 19:27:18 +00:00
Vic (Chun-Ju) Yang
8084d57c89 Add vim filetype tag for Makefile.rules
Vim cannot tell the file type of Makefile.rules by itself. Adding this
tag to save myself from the nightmare of reading the file without syntax
highlighting.

BUG=None
TEST=Open the file with vim and emacs. Both get the correct file type.
BRANCH=None

Change-Id: Ibcc920c0fb7c9575427b29a90b9973ecf3420b3c
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/184791
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>
2014-02-05 03:20:57 +00:00
Vincent Palatin
4cf4fcf1cb ite: Add initial support for ITE IT8380 chip
Initial support for the ITE IT8380 chip with the following peripherals :
- 8250-like UART module.
- HW timer (with a 128-us tick period).
- GPIO with pins initialization and edge interrupt support.
other functions are stubbed.
- Clock : basic fixed frequency setup only.
It also add the dev board configuration as a test vehicle.

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

BRANCH=none
BUG=chrome-os-partner:23575
TEST=make BOARD=it8380dev
on IT8380 dev board, use the EC serial console, use gettime from
console.

Change-Id: Id4bf37d1beb21d1a4bee404c9a0bc500025fe787
Reviewed-on: https://chromium-review.googlesource.com/175481
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Alec Berg <alecaberg@chromium.org>
Tested-by: Alec Berg <alecaberg@chromium.org>
2014-01-08 02:24:23 +00:00
Vic (Chun-Ju) Yang
56dd81e39c Merge make_all.sh to Makefile
By merging make_all.sh to Makefile, parallel make can be made faster.
Previously, if one does 'util/make_all.sh -j32', most of the time is
spent on waiting for linking. Now that we invoke sub-make, linking an
executable doesn't block the next board.

With '-j32', the new 'make buildall' takes about 7 seconds, while the
original 'util/make_all.sh' takes about 27 seconds.

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

Change-Id: I7c2f0d1e928a9b60a8a9070bdcb71b00a3d534cd
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181091
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-12-27 07:50:56 +00:00
Vincent Palatin
4b59746600 util: declare all host utils source dependencies in build.mk
Instead of hardcoding the common files for host utils in the generic
rules, let's declare them in the build.mk file using the same system as
the Linux kernel build.

if a binary "foo" declared in "host-util-bin" or "build-util-bin" has a
matching "foo-objs" variable, it will be build from all objects declared
in "foo-objs" else it uses directly "foo.o" (single source file).

This is preparatory to add new "build" tools sharing common sources.

note: the dependencies on the utils are a bit less fine-grained as a
result of this change, but given the low number of tools, that should be
acceptable.

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

BRANCH=none
BUG=none
TEST=./util/make_all.sh

Change-Id: Ieffce7ca6f5b685ffb7d1f4626b99aff07b61443
Reviewed-on: https://chromium-review.googlesource.com/176174
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-11-14 17:52:39 +00:00
Bill Richardson
9fd4258f36 Replace Makefile 'tags' target with 'xrefs', clean it up
This adds a 'xrefs' target to create various cross-reference files from the
EC sources. In particular, it generates these files in the target build
directory:

  cscope.files    - for the cscope browsing tool
  TAGS            - for emacs
  tags            - for vi

It parses the dependency files generated by a build, so that only those
source files actually used to create the EC binary are scanned.

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

Inside the chroot:

  make BOARD=link xrefs
  ls -l build/link/cscope.files

If you install the ctags and etags programs in the chroot, you should also
see build/$BOARD/tags or build/$BOARD/TAGS, respectively. If those programs
don't exist, those steps will be silently skipped.

Note: You can install ctags with "sudo emerge ctags". AFAICT, installing
etags requires the entire emacs suite, so it's probably simpler to just copy
the etags binary from your build host into the chroot's /opt/bin/

If you don't have ctags or etags in the chroot, you can still run

  make BOARD=link CROSS_COMPILE= xrefs

outside the chroot, provided you've built the EC image first.

Change-Id: I8e16ef19b0f4e79aba887c308e58982fef8fa21f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175224
2013-10-31 18:43:46 +00:00
Vic Yang
e589e87b48 Remove QEMU tests
QEMU tests served us well, but it has been more and more difficult to
maintain as we now have more chips and use more functionality from each
EC chip. With emulator tests in place to test common code and hardware
test to test per-chip/per-board drivers, it's time to remove QEMU tests
to simplify our code base.

QEMU tests that are covered by other emulator tests are removed
completely; tests that are not covered are left alone for now to
preserve the test logic.

BUG=chrome-os-partner:18343
TEST=util/make_all.sh
BRANCH=None

Change-Id: I5a4dd2f5ac42f7f66f86fdce0b62dbd2c65bf66a
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174669
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-10-29 03:55:35 +00:00
Randall Spangler
8cf03ac056 Move source files to driver/ and power/ subdirs
The common/ subdir was getting cluttered.  Move drivers for external
components to a new driver/ tree, and move what used to be called
chipset_*.c to a new power/ directory.

This does not move/rename header files or CONFIG options.  That will
be done in subsequent steps, since moving and modifying .c files in
the same CL is harder to review.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all boards; pass unit tests

Change-Id: I67a3003dc8564783a320335cf0e9620a21982d5e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/173601
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-10-23 20:07:25 +00:00
Vic Yang
935d761a39 Move .lcov_lock to /tmp/ec-lcov-lock
flock leaves the lock file and git complains about it. Let's move the
lock file to /tmp/ec-lcov-lock.

BUG=chrome-os-partner:19235
TEST=make coverage and check .lcov_lock is in /tmp
BRANCH=None

Change-Id: Id6d68af327b53aa1c0c7ae9186149126d8a5cc37
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62858
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-22 14:35:41 -07:00
Vic Yang
aaac3935d2 Make target for test coverage report generation
By 'make coverage', lcov is used to generate test coverage report in
HTML format stored in coverage_rpt folder.

BUG=chrome-os-partner:19235
TEST=Generate a report.
BRANCH=None

Change-Id: I44142eaaeb897cf09179764781120370920144cd
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58203
2013-06-16 20:14:01 -07:00
Vic Yang
0a45fa1708 Pthread-based emulator for unit testing
This is the first version of pthread-based RTOS emulator. With this, we
will be able to test high-level modules entirely on the host machine.

BUG=chrome-os-partner:19325
TEST='make runtests' and see tests passing.
BRANCH=None

Change-Id: I1f5fcd76aa84bdb46c7d35c5e60ae5d92fd3a319
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49954
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-07 09:09:50 -07:00
Vic Yang
24c8610c7f Put a copy of test binaries under build/${BOARD}
This puts a copy of test binaries at build/${BOARD}/test-*.bin. This way
it is easier for us to get all test binaries.

BUG=chrome-os-partner:19057
TEST='make tests' and check build/${BOARD}/test-*.bin
BRANCH=None

Change-Id: I8394cea6bee95f00fc01d725d2494ca5e222f47d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49608
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-30 16:59:45 -07:00
Vic Yang
dff3b9f2c0 Make test-list a per-board parameter
Some tests are not applicable to all boards. This change makes test-list
a per-board parameter so a test can be enabled/disabled for individual
boards. Also disable all the tests that don't compile now.

BUG=chrome-os-partner:18598
TEST=make tests for all boards
BRANCH=None

Change-Id: Id2d18e23856f5c64dbdc7c6ca5949f8ad61b5cc0
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49452
2013-04-29 03:47:50 -07:00
Bill Richardson
f5a154b161 Add 'clobber' target to Makefile to clean everything.
BUG=none
BRANCH=none
TEST=manual

  make BOARD=link
  make BOARD=snow
  make clobber

Change-Id: I862ec0d0240e48828091259dee7e8aef62544d47
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49370
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-26 17:17:20 -07:00
Bill Richardson
7363535f0e Add 'TAGS' target to Makefile
This creates cscope.files and an emacs TAGS file for the specified BOARD. If
you don't have etags installed, it just creates cscope.files.

BUG=none
BRANCH=none
TEST=manual

  make BOARD=link tags
  ls

Change-Id: I9b27ba42ac4e85822c5a5a6e8cb5b5148a3435c3
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49356
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-26 17:17:20 -07:00
Vic Yang
8a06eb1d35 Only includes necessary tasks for test binaries
This changes current TASK() syntax to TASK_BASE() and TASK_NORMAL(),
where TASK_BASE is necessary for the EC to boot on a board and
TASK_NORMAL represents the task that can be removed in a test binary.

Tasks introduced by a test should be listed as TASK_TEST().

Note that this CL breaks current tests (many of them are broken anyway),
which will be fixed in up coming CLs.

BUG=chrome-os-partner:18598
TEST=Build link/bds/spring/snow/daisy/mccroskey. (mccroskey failed for
unrelated issue)
BRANCH=none

Change-Id: Ic645cdae0906ed21dc473553f1f43c2537ec4bb9
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47531
2013-04-10 01:08:45 -07:00
Randall Spangler
00b344ddbb Clean up vboot hash support
This copies the parts of sha256.c that we need from vboot_reference,
and removes the explicit dependency on vboot_reference.  That
dependency was a good idea when we were doing full verified boot in
the EC, but is now overkill and makes it harder for others to reuse
the EC code.  This also lets us call EC functions directly instead of
needing vboot_stub.cc; that reduces code size by ~100 bytes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=vboot_hash ro, then compare with result of sha256sum build/link/ec.RO.flat

Change-Id: I0f236174291df3e7f3c75e960fe9ab32af305a61
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36589
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-25 17:03:44 -07:00
Louis Yung-Chieh Lo
03d4ed278d Add GEC lock mechanism.
Basically re-use the gec lock code from flashrom package.

BUG=chrome-os-partner:12319
TEST=Build and run on link. Only build on snow.
while true; do ectool hello; done &   ; run 10 instances.
                                      ; expect all instances runs okay.

Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Change-Id: I11d5824f46810c6f5a04a564a81387cdea081697
Reviewed-on: https://gerrit.chromium.org/gerrit/29763
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-08-10 09:28:34 -07:00
Vic Yang
dde4e99faa Prevent parallel make from failing
When we do parallel 'make', it fails intermittently. We might be hitting
a make bug: http://savannah.gnu.org/bugs/?30653
Let's remove the intermediate file for now and see if this happens
again.

BUG=chrome-os-partner:11614
TEST=Repeatedly remove some file and parallel make. This originally
gave an error once every two time. It doesn't now.

Change-Id: Iaaf48e7d19b11dad30bc70cd50e73c195caf17b4
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28105
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-07-20 18:57:06 -07:00
Randall Spangler
fc7b64e186 Remove firmware B
BUG=chrome-os-partner:11449
TEST=build link, snow, bds; ectool reboot_ec cold to make sure enums line up

Change-Id: Ie09db2080a00f1a7e2c05579b9b41ea5137c1af0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27658
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-17 13:11:44 -07:00
Randall Spangler
c44c17890c Rename A and B images to RW and RW_B, part 1
All of our current EC configs have RO and a single RW image.  Calling
that image 'A' is confusing, particularly when combined with EC
software sync (where the RW image is updated from either the A or B AP
RW firmware).  So, rename it.

This changes all the build artifacts and constants.  Internal EC
commands and host commands still refer to A/B; that will be fixed in
part 2.

BUG=none
TEST=build link, snow, bds

Change-Id: Icfed4914745f0799bb71befb6a6563cfd8bc90ab
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27649
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-07-17 10:50:30 -07:00
Randall Spangler
fb123b4838 Only one RW image is now the default
And if RW B isn't enabled, it's not even linked.

BUG=chrome-os-partner:10881
TEST=on link, should be no B image, and 'sysjump B' should fail
On BDS, still should be A and B images

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: Icb2af07881cc7e28b9b877f45824486a22fde8d7
Reviewed-on: https://gerrit.chromium.org/gerrit/26116
2012-06-26 13:58:54 -07:00