Commit Graph

862 Commits

Author SHA1 Message Date
Wai-Hong Tam
b40f6e5939 flash_ec: For npcx_uut, use servo to boot EC into the flashing mode
Use servo to boot EC into the flashing mode. Use the unified control
ec_boot_mode to do so.

CQ-DEPEND=CL:1018206
BRANCH=none
BUG=b:68707064
TEST=Ran the flash_ec script on Cheza using servo-micro
TEST=Ran the flash_ec script on Meowth using CCD, with some servo
overlays to drive the ccd_ec_boot_mode control

Change-Id: I32dfe5baa82dd842b5237f38ea971c09e91c47d3
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1020159
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2018-04-23 18:09:16 -07:00
Caveh Jalali
e09917178d flash_ec: remove redundant sudo
we were invoking flashrom as "sudo sudo flashrom", so remove
the gratuitous sudo.

BUG=none
BRANCH=none
TEST=used flash_ec to flash atlas

Change-Id: I420ada94c4b973c8f7efe546670dd04cfbb1b234
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1020782
Commit-Ready: Caveh Jalali <caveh@google.com>
Tested-by: Caveh Jalali <caveh@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-20 23:01:26 -07:00
Wai-Hong Tam
2d5331b9a2 flash_ec: Save the original servo states
When first supporting CCD, it skips saving the original servo states
as some of the controls are not supported in CCD.
https://chromium-review.googlesource.com/344427

But then we customized what controls will be used according to the
servo board type.
https://chromium-review.googlesource.com/572142

So we should save original states again. It helps to restore the
original servo states if it gets interrupted in the middle.

BRANCH=none
BUG=none
TEST=Tried running flash_ec using servo-micro.

Change-Id: I5b873d871d36feed4a0e511ba858db9e093a22be
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1020158
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-19 19:29:02 -07:00
Nicolas Boichat
c6ce2208e3 flash_ec: Fix SERVO_TYPE test
Without this, we see this line when running flash_ec.
util/flash_ec: line 787: [: =~: binary operator expected

These kind of tests require double brackets.

BUG=b:77825616
BRANCH=none
TEST=run util/flash_ec using servo_micro on staff.

Change-Id: I6baecec2252276ac06992fd2b2e50f74d55805f2
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1018560
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-04-19 03:37:13 -07:00
Vadim Bendebury
49241f476e g: fix signer to always use the manifest
Since the proper signer utility has been introduced in the chroot,
there is no need in generating reduced command option set when
building a self signed image.

Also, the same manifest can be used for all images, self signed or
signed using a fob. The manifest needs to be tweaked for the self
signed images to match the test Key ID.

Since the same base manifest is used for all signings, there is no
need to support the "poor man's json parser" any more.

Rearranged build.mk to accommodate new logic, and added some comments.

BRANCH=cr50, cr50-mp
BUG=b:78212718
TEST=verified that images with proper header version are created when
     both self signed and signed with a private key coming from the
     signing fob.

Change-Id: I5a1f8a223098b0a6c830ef24ffe380fc0badcafa
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1017238
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-18 17:35:41 -07:00
Nick Sanders
ee7850b50f ec3po: console: Detect HUP from user console
ec3po writes to the user pty, which may or may not be open.
Since ptys have limited buffer space, we need to avoid
writing to them if they will never be drained.

ec3po now looks for HUP to indicate whether the pts is opened
or closed, and reads/writes accordingly.

BRANCH=None
BUG=b:76111225
TEST=dut-control ec_board:fizz x 400

Change-Id: Icbecb2e42b261659a006eb1b9fc6dd73490a2218
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1014792
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-18 09:30:34 -07:00
CHLin
dcaf8edc47 util: uartupdatetool (UUT): Add tool to flash firmware by UART
When the FLPRG# strap pin is set to active low, and npcx7 chip is reset,
it will enter uut mode. This CL adds the host tool to communicate with
npcx chip in uut mode to flash ec firmware via UART port.

BRANCH=none
BUG=none
TEST=No build errors for make buildall.
TEST=
------------------------------------------------------------------------
1. Connect the servo connector (J24) on npcx7 EVB to servo board v2 via
flex cable.
2. Manually turn the switch SW1.6 to "ON" on npcx7 EVB.
3. Reset ec by issuing Power-Up or VCC1_RST reset.
4. Manually turn the switch SW1.6 to "OFF" on npcx7 EVB.
5. Move npcx7_evb from array BOARDS_NPCX_7M7X_JTAG to BOARDS_NPCX_UUT in
flash_ec.
6. "./util/flash_ec --board=npcx7_evb."

Change-Id: I2c588418e809e59f97ef4c3ad7ad13a3fef42f11
Signed-off-by: Dror Goldstein <dror.goldstein@nuvoton.com>
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/952037
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: Alexandru M Stan <amstan@chromium.org>
Tested-by: CH Lin <chlin56@nuvoton.com>
Tested-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-18 02:07:59 -07:00
Vadim Bendebury
f929c8202b cr50: prepare to release prepvt 0.4.5
BRANCH=cr50
BUG=none
TEST=none

Change-Id: Ieb8eef7d64ee22a8ba04f0b09f22d04387042b45
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1015631
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-04-17 20:53:05 -07:00
Caveh Jalali
ab94e7ac45 flash_ec: fail on flash chip size of 0
flashrom --get-size seems to return a size of 0 in some failure cases.
add specific handling of this case so we don't proceed and end up
failing with a somewhat misleading message like:

Error: Image size doesn't match: stat 524288 bytes, wanted 1048576!

BUG=none
BRANCH=none
TEST=flashrom now fails with "chip size is 0" instead of complaining
	about wanting a 1048576 byte image.

Change-Id: Iab4d0843d86ceec9f0ca482d9e060a33c7a58c7a
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1011823
Commit-Ready: Caveh Jalali <caveh@google.com>
Tested-by: Caveh Jalali <caveh@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-17 00:47:08 -07:00
Vijay Hiremath
867a567229 glkrvp_ite: Initial bring-up code
Initial bring-up code for GLKRVP using ITE8320 MECC.

BUG=b:77798195
BRANCH=none
TEST=Able to boot to OS with host communication disabled
     Coreboot image.

Change-Id: Iad0e22c9e7ef1c36889ef5e7f7e3f5a121f234e1
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1003766
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-14 12:46:59 -07:00
Mary Ruthven
69d3059d76 flash_ec: fix UART bitbang flashing with ccd
Cr50 is pretty slow to update it's ccd state right now. Add some delays
when flashing devices using uart bitbang, so cr50 will have enough time
to enable bitbang and configure the uarts correctly.

Also add some commands to cleanup to cleanup the cr50 state.

BUG=b:77825616
BRANCH=none
TEST=run util/flash_ec using ccd on reef and scarlet.

Change-Id: I1c84e36c9bb290c49fd15971c7f61f9e1151a424
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1006484
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-04-12 18:03:06 -07:00
Nick Sanders
2dcd5c19c1 flash_ec: add more verbose options
Print stm32mon command in verbose mode.

BUG=None
BRANCH=None
TEST=it prints

Signed-off-by: Nick Sanders <nsanders@chromium.org>

Change-Id: I4b31d1212c139f64e34e92fa0def662202aa3b41
Reviewed-on: https://chromium-review.googlesource.com/1004436
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-12 18:03:03 -07:00
Vincent Palatin
92503e0f7f nocturne_fp: add flashing configuration
Declare it in the proper category for flash_ec

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

BRANCH=poppy
BUG=b:77836478
TEST=./util/flash_ec --board=nocturne_fp

Change-Id: If5b9882bb919505c724d4536521b57279a6a302b
Reviewed-on: https://chromium-review.googlesource.com/1009842
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
2018-04-12 15:22:27 -07:00
Vincent Palatin
ce02b59656 stm32mon: terminate gracefully when failing to get commands list
When the CMD_GETCMD transaction fails, terminate immediately rather than
continuing and crashing when we use later the uninitialized 'erase'
function.

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

BRANCH=none
BUG=b:77825616
TEST=flash Scarlet EC through CCD.

Change-Id: Ia40107fe27d81fdb9ee8220f73f4215d936a41c1
Reviewed-on: https://chromium-review.googlesource.com/1006595
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-04-12 07:59:48 -07:00
Vadim Bendebury
a696908bf3 cr50: substitute RMA keys when signing for prod
A recent codebase change included the test RMA reset server public key
in the Cr50 image by default.

Prod images must not include the test key, and luckily recent
modifications of the cr50-codesigner utility allow to swap the keys
before signing. This patch adds the command line option for swapping
the keys and a check to ensure that the signed image includes the
prod key and does not include the test key.

Note that cr50-codesigner would fail to sign if the swap was requested
but the test RMA key was not found in the input .efl file. Thus both
conditions are verified: that the original image includes the test key
and that the signed image includes the prod key.

BRANCH=none
BUG=b:73296144
TEST=prod signed an image, verified that it can be RMA reset using the
     prod RMA reset server.

Change-Id: Ic084d0c5e1de9f027db05c63f82542c2b7cbd916
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1000756
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-04-11 20:28:00 -07:00
Vadim Bendebury
80f0f5c7cf cr50: bypass signing step if cr50-codesigner is not available
When building EC targets in the setups where the Cr50 codesigner
utility is not present let's just bypass the signing step.

Also removing bitrotten source code of the old codesigner.

BRANCH=none
BUG=chromium:830302
TEST='make buildall' succeeds even if cr50-codesigner is not available.

Change-Id: Ic6c4988455bcee6c45504e1fe781f6e03636d57a
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1005401
Reviewed-by: Allen Webb <allenwebb@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-11 11:25:15 -07:00
Dino Li
3a96c3cec4 iteflash: Continue call ftdi_read_data() until all data is read
We found a symptom that iteflash always programming EC failed
on a specific host machine.
For this failed case, it is caused by the incomplete read from
ftdi_read_data(). For example, we want to read 32 bytes by just
call ftdi_read_data() one time, but ftdi_read_data() may return
(number of bytes read) 10 or 20 but just not 32.
This change will call ftdi_read_data() again and again until all
data is read.

Change draw_spinner() function to use fprintf().
We will show percentage increase from 0 percent to 100 percen
during verifying.

Change of flash_ec script:
Move operations of reinitialize ftdi_i2c interface to cleanup()
and we won't miss them if programming is failed.

BUG=none
BRANCH=none
TEST=To run iteflash on that host machine and flashing is done.

Change-Id: Ifa374652870737c8231fce5a699abe033a1f0237
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/979903
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-10 19:13:29 -07:00
Wai-Hong Tam
995f23b866 cheza: Add Cheza to use UUT flashing
Cheza board doesn't have the SPI guag programming interface. Should use
Uart to flash it.

BRANCH=none
BUG=b:74395451
TEST=Manual, steps:
 * Add Uartupdatetool to the PATH
 * Build the Cheza EC image
 * Run "flash_ec --board cheza" on a reworked Meowth, which uses the
   same EC chip as Cheza

Change-Id: Ica0878778314ad016273877683a85a912890161c
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/969419
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2018-04-10 19:13:24 -07:00
Vadim Bendebury
dc82178796 cr50: fix assorted signer script issues
- make sure DBG images could not be signed for prod

    When debug image marker was changed from "DEV" to "DBG", the
    script checking for this was not updated.

    Fix that and also use 'strings' generated output to not require
    grep to delineate input binary blobs into strings.

  - do not invoke cr50-codesigner as sudo, it is not necessary with
    the correct udev rules in place.

BRANCH=none
BUG=b:73296144
TEST=Tried signing for prod a DBG image, the attempt failed. Then
     built a non DBG image, signed it successfully.

Change-Id: I7cec2d9eb344b40f7726d7e432689b0c0416dc47
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1000755
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-04-10 19:13:12 -07:00
Vadim Bendebury
9e50bb0473 cr50: use codesigner from chroot
Source code for Cr50 codesigner has been added to the chroot and the
executable is installed as /usr/bin/cr50-codesigner when cros sdk is
created/updated.

Let's use the 'official' version instead of outdated local one.

BRANCH=cr50,cr50-mp
BUG=b:73296144
TEST=verified that properly signed Cr50 images can be built.

Change-Id: Ibc68340a26011c7d5ac028bbee73cd0f2c39c291
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/996512
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-04-05 22:12:13 -07:00
Jett Rink
039c4a95eb util: update flash_ec script to handle installed location
When flash_ec script is run from /usr/bin it could not find
the ec source directory to calculate the basebord. Handle flash_ec
running from /usr/bin by using the default chroot source layout to
find ec platform dir. If dir is not present, then skip baseboard
check

BRANCH=none
BUG=b:77128456
TEST=sudo emerge ec-devutils && flash_ec --board=yorp

Change-Id: Ib7766e5c7ca701f0a209c6e6e6c1a192284b9d0b
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/992993
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-04-04 20:55:29 -07:00
Daisuke Nojiri
5daa45c2fe Features: Add EXEC_IN_RAM
This patch adds execution-in-ram, opposite of XIP: execution-in-place
(a.k.a. XIP) to the EC features. It can be currently implied by
CONFIG_EXTERNAL_STORAGE.

BUG=b:77306460
BRANCH=none
TEST=Verify ectool prints EXEC_IN_RAM on Fizz.

Change-Id: I4a7fb3b267864debe59fd211956371eceac57613
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/995968
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-04 18:52:15 -07:00
Vadim Bendebury
44c81deec4 cr50: prepare using blobs as RMA key sources
This patch brings in both prod and test RMA server public keys as two
binary files.

A bash script for converting binary blob into C definition is also
provided.

BRANCH=cr50, cr50-mp
BUG=b:73296144, b:74100307
TEST=none yet

Change-Id: I2edd78164b8c912408ac7eda2e0a3a0262a8e81f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/990782
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-03 18:47:04 -07:00
Jett Rink
375ecebcb7 util: update flash_ec to handle unibuild emerge paths
If a baseboard exists in the build.mk for a board, use that
as the unibuild path.

BRANCH=none
BUG=b:77128456
TEST=tested the following command with correct results:
	    flash_ec --board=yorp  (baseboard)
	    flash_ec --board=bip   (baseboard)
	    flash_ec --board=grunt (non-baseboard)

Change-Id: Ic4573cb01849275d1333ff9e715f69a4c95444b0
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/986753
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-03-30 16:53:04 -07:00
Todd Broch
e0b7137f47 battery_temp: initial commit.
Simple script to read battery temperature and return
degrees Celsius if readable, 'error' if unreadable or 'unknown'
otherwise.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=none
BUG=chromium:816744
TEST=manual, run on following duts with return values of:
  elm: <degC>
  eve: <degC>
  expresso: <degC>
  heli: <degC>
  peppy: 'unknown'
  samus: <degC>
  squawks: <degC> | 'error' if battery removed.

Change-Id: I3147ceb3ea0e0a22c08617e212c66d0c3e58b300
Reviewed-on: https://chromium-review.googlesource.com/982815
Commit-Ready: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2018-03-29 19:51:40 -07:00
Caveh Jalali
415dba09fb atlas: add board name to flash_ec
This teaches flash_ec that the atlas EC is an NPCX with internal SPI
flash.

BRANCH=none
BUG=b:75070158
TEST=NONE

Change-Id: I8d6d9556ebc7408695aaad764847d1cc06d95eae
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/965637
Commit-Ready: caveh jalali <caveh@chromium.org>
Tested-by: caveh jalali <caveh@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2018-03-29 19:51:39 -07:00
Vadim Bendebury
da431a7898 cr50 release: use signer executable installed on chroot
A new ebuild allows to install codesigner as /usr/bin/cr50-codesigner,
let's make use of it instead of manually copied instance of the
signer.

BRANCH=none
BUG=b:74100307
TEST=verified that error message is generated if cr50-codesigner is
     not installed, and that signing succeeds once cr50-codesigner is
     installed.

Change-Id: I468803443e7b052a8ecb074ee80f63f588888985
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/982495
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-03-27 18:01:39 -07:00
Vadim Bendebury
4d959e92ca cr50: update manifests for both dev and prod versions
BRANCH=cr50, cr50-mp
BUG=none
TEST=none

Change-Id: I377aab1b5a729a0ca98e2340050300d938e51bd5
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/978541
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-03-23 18:11:27 +00:00
Jett Rink
7742e06e45 bip: initial add of bip skeleton
BRANCH=none
BUG=b:75972988
TEST=build all

Change-Id: Ibfadaee3b9584a7e2c87f6f607be4cba20f338b7
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/972142
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-03-22 18:16:47 -07:00
Wei-Han Chen
9a8e4226c3 util/unpack_ftb.py: a script to convert FTB file into bin file
ST firmwares are released in FTB format, which can't be written to flash
directly.  This python script can convert a file in FTB format into
bin file.  Currently, we only support FTB files of whiskers touchpad
firmware.

BRANCH=none
BUG=b:70482333
TEST=manual
Signed-off-by: Wei-Han Chen <stimim@chromium.org>

Change-Id: I179de12663580881347a31f11b5b10659e00b879
Reviewed-on: https://chromium-review.googlesource.com/918603
Commit-Ready: Wei-Han Chen <stimim@chromium.org>
Tested-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-03-22 10:58:26 -07:00
Vincent Palatin
fed441c689 fpsensor: add enrollment and matching interface
Add the state machine and the interfacing to the enrollment and matching
algorithm providing by the private driver part.

Implement the host commands interface for it (based on MKBP event) along
with the console debug commands to exercise it.

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

BRANCH=none
BUG=b:72360575
TEST=On ZerbleBarn console, use 'fpenroll' then 'fpmatch' for several
fingers.
TEST=With ZerbleBarn and a servo-v2, retrieve and upload templates with
'ectool_servo fptemplate'.
TEST=On Meowth, exercise with the prototype of biod
CrosFpBiometricsManager.
CQ-DEPEND=CL:*555078

Change-Id: I10b0d76d3faa898a682cf9a2eb7fc7e212b0c20c
Reviewed-on: https://chromium-review.googlesource.com/886401
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-03-20 07:24:25 -07:00
Vadim Bendebury
48d6891db8 cr50 signer: allow to use directory to specify source files
In most cases when Cr50 signer script is invoked, the input elf files
are stored in the same directory and named ec.RW.elf and ec.RW_B.elf,
the way they produced by the EC makefile.

Let's allow create_released_image.sh to accept a directory name
instead of two elf file names.

BRANCH=none
BUG=none
TEST=verified that the script properly handles both old and new
     command line options (allows to pass individual elf files and a
     directory name).

Change-Id: I40bb8983fd97e6cd82e235308622ba2f20119ce5
Signed-off-by: Vadim Bendebury <vbendeb@google.com>
Reviewed-on: https://chromium-review.googlesource.com/963618
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: caveh jalali <caveh@chromium.org>
2018-03-19 21:34:30 -07:00
Nick Sanders
831d2b2597 servod: add command muxing in ec3po
This creates a second pty for pty_driver to open, to prevent the
need for freezing the user pty. This also allows the user pty to
fully log and print all output.

BRANCH=None
BUG=b:74023102,b:73310923
TEST=servod is fast now, recovery works
CQ-DEPEND=CL:958127

Change-Id: Ib369a5e64838ded98719d76f8159d71a97fe08ad
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/958128
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-03-19 19:21:25 -07:00
Gwendal Grignou
b87bea3289 driver: lsm6dsm: Add ectool support.
BUG=b:73546254
BRANCH=master
TEST=compile

Change-Id: If914dfbf7bb30e934b711d8f89c46af2787f917c
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/924406
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-03-19 19:21:20 -07:00
Gwendal Grignou
88613a3aa2 driver: accel_lis2dh: Fix interface
Add support in ectool, expose min/max ODR.

BUG=b:73546254
BRANCH=master
TEST=compile

Change-Id: Ib09c06e17d7d73aaab91680672de4d5267299c7f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/924405
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-03-19 19:21:19 -07:00
Vadim Bendebury
1f4d4f8a4e cr50: update version numbers to match Cr50 branches
This reflects version changes in Cr50 branches.

BRANCH=none
BUG=none
TEST=none

Change-Id: I121c65797a30595a58d0b55774e80147692bda38
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/969340
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-03-19 17:05:03 -07:00
Ruben Rodriguez Buchillon
43d0769918 temp_metrics: use fanduty 0 to enable fan
If the fan is never enabled, temp_metrics itself has no code-path to
enable the fan. This fixes this by calling fanduty 0 in the beginning
of temp_metrics, since fanduty does explicitly enable the fan.

Note: This is a hack to avoid having to flash a new EC image. See
crrev.com/c/964037 for a more fundamental fix to the same issue.

BRANCH=link
BUG=chromium:808764
TEST=couldn't reproduce issue with this version of temp_metrics.

Change-Id: I8a9b258ba7b50cf5180497d318f8d94454dab434
Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/964069
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
2018-03-16 15:56:23 -07:00
Vincent Palatin
68461a1242 stm32mon: fix progressbar parameter
Ensure that the short parameter '-p' works as well as the long one
'--progressbar'.

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

BRANCH=none
BUG=none
TEST=run 'stm32mon -p' and 'stm32mon --progress' none of them are
displaying the command usage.

Change-Id: If24accf0991dc9705a1fb3e29acf12581d7ab8dc
Reviewed-on: https://chromium-review.googlesource.com/952966
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
2018-03-07 16:55:28 -08:00
Daisuke Nojiri
2b1715b212 CBI: Make cbi-util set field size automatically
Currently cbi-util accepts only fixed length values. This patch makes
it automatically calculate the required field size to accomodate the
given integer value.

The stored values are expanded to uint32_t when they're read.

BUG=b:74174598,b:70702820
BRANCH=none
TEST=Run cbi-util with --sku_id set to the followings:
0x10 -> field size = 1,
0x1000 -> field size = 2,
0x10000 -> field size = 4,
0x100000000 -> Error

Change-Id: I2221ebfa18260bae2c574d9ebb794dbe645579e5
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/951711
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-03-07 16:55:14 -08:00
Vincent Palatin
258b9b1ebe ectool: fix error codes for servo v2 spi support
When the EC sends back an error code inside the 'result' field of the v3
protocol, the transport is supposed to return -EECRESULT-error_code.
Fix the the servo spi transport to do so.

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

BRANCH=none
BUG=b:72360575
TEST=with ZerbleBarn connected to a Servo v2, run 'ectool_servo fpinfo'
and 'ectool_servo fptemplate badfile.bin'

Change-Id: I54eec9194cfefd422078344500685736aadaffcf
Reviewed-on: https://chromium-review.googlesource.com/951682
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-03-06 14:38:53 -08:00
Vincent Palatin
870fa901a3 ectool: add missing EC feature strings
Add the strings to display the recently added EC feature flags.

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

BRANCH=none
BUG=none
TEST=on ZerbleBarn, run 'ectool inventory'

Change-Id: I213d34515800532fc3b2378b8619e2b90ce5fd28
Reviewed-on: https://chromium-review.googlesource.com/937263
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-03-01 16:13:10 -08:00
Vincent Palatin
045aef2cda make EC_FEATURE_RWSIG definition more useful
Also define the EC_FEATURE_RWSIG feature bit if the RO firmware contains
the RWSIG task but not the RW.
Given the RWSIG verification task is not terribly useful in RW
(where it is never executed), it can be skipped there but the host
program trying to detect RWSIG usage (e.g. flashrom) still wants to be
able to detect it.

In order to be able to do so, add the HAS_TASK_xXx_RO and
HAS_TASK_xXx_RW flags which define the tasks defined in the other
partition (at compilation-time you might still run a frankeinstein combo).

Fix ectool 'inventory' to avoid segfaulting on missing feature string
definition.

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

BRANCH=none
BUG=b:36125319
TEST=on ZerbleBarn, run 'ectool inventory', also uses flashrom to
re-flash the RW partition.

Change-Id: I224a6cc4aef956204792a2cc04ad12aaed5abf47
Reviewed-on: https://chromium-review.googlesource.com/937262
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-03-01 16:13:10 -08:00
Vincent Palatin
2e9ea7bf85 stm32mon: add option to replace the spinner
Using only a Carriage Return as done to have a nice spinner is not
terribly compatible with logging the output of the tool to a file or
piping it to anything.
Add another option to have a simple progress-bar instead.

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

BRANCH=none
BUG=none
TEST=on Meowth, run flash_fp_mcu from the factory UI.

Change-Id: I0c37689d2ed1e45dff54b7f1eb2be515ea37e004
Reviewed-on: https://chromium-review.googlesource.com/936766
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
2018-03-01 16:13:09 -08:00
CHLin
5e614b1c98 npcx7: WoV: Add support for Wake-on-Voice (WoV) module
This CL adds the driver support for the WoV module which inludes the
following files:
  - wov.c
  - wov_chip.h
  - apm.c
  - apm_chip.h
It also supports the console commad "wov" which can test different
configuration and audio quality by entering different parameters.

The detail description of WoV console command is listed below:
------------------------------------------------------------------------
 [Note]: Before changing any of settings, please make sure the operation
 mode is on the "OFF" state. (ie. run the command wov cfgmod off
 first) .

 > wov init
 Initialize WoV interface, including pin mux and interrupt
 registration etc.

 > wov mute <enable / disable >
 mute enable / disable.

 > wov cfgsrc  <mono | stereo | left | right>
 set audio source, ex: wov cfgsrc left, means audio source from left
 MIC.

 > wov cfgbis  <16|18|20|24>
 set audio resolution, ex: wov cfgbit 16 means audio resolution are
 16bits.

 > wov cfgsfs  <8000|12000|16000|24000|32000|48000>
 set audio sampling frequency rate, ex: wov cfgsfs 48000 means audio
 sampling rate are 48Khz.

 > wov cfgbck  <32fs|48fs|64fs|128fs|256fs>
 set I2S bit clock rate, ex: wov cfgsfs 48000 and wov cfgbck 32fs
 means audio sampling rate are 1536Khz (32*48000).

 > wov cfgfmt  <i2s|right|left|pcma|pcmb|tdm>
 set I2S but format, ex: wov cfgfmt right means audio I2S format are
 Right-Justify.

 > wov cfgmod  <off|vad|ram|i2s|rami2s>
 set audio operation mode ,ex: wov cfgmod i2s means audio output via
 I2S bus.

 > wov cfgtdm  <0~496 0~496 0~3>
 set TDM time slot, the first values is left channel delay counter,
 the second is right channel, and the 3rd is startup counting condition.
 (chosen LRCK raising or falling edge) .
 [Note: this command is just working on cfgmod equal to tdm]

 > wov cfgget
  retrieve above settings.

 > wov vadsens
 (currently not support, reserve for next version)

 > wov gain (0~31)
 set audio data gain value, ex: wov gain 10 means setting audio digital
 gain are 10dB.

 > wov cfgdck <1.0 | 2.4 | 3.0 >
 set digital MIC PDM clock rate. ex: wov cfgdck 2.4 means PDM clock
 are 2.4Mhz.

-----------------------------------------------------------------------

This CL also adds the chip ID (0x24) for npcx7m7w. So the console
command "version" can show the chip is npcx7m7w.

BRANCH=none
BUG=none
TEST=No build errors for make buildall.
TEST="BOARD=npcx7_evb make"; Flash the image on EVB; Test WoV function
with console commands described above.

Change-Id: Ief2b3e89edbd3e6d2a9d82d317a93c9f0b7a20cd
Signed-off-by: Dror Goldstein <dror.goldstein@nuvoton.com>
Signed-off-by: Simon Liang <CMLiang@nuvoton.com>
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/897314
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2018-02-28 15:21:13 -08:00
Jett Rink
7a0a4d6393 yorp: initial add of octopus BOM-A board
BRANCH=none
BUG=b:73811887
TEST=build yorp and all other boards

Change-Id: I2c29ba86f29a3d25128c00c1b55e90f6843bcdd5
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/935367
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-02-28 15:21:06 -08:00
Jett Rink
75acf08118 cleanup: Sorting list alphabetically
BRANCH=none
BUG=none
TEST=make buildall

Change-Id: I3c07a87e0a41ad3ec51f78e30e14ac7d45d3e531
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/935366
2018-02-28 15:21:05 -08:00
Vadim Bendebury
5bab2ee13d cr50: move dev version to 0.2.3
This will make sure that Cr50 images built from dev branch can take
over images built from either MP or pre-MP branches.

BRANCH=none
BUG=none
TEST=verified that it is possible to overwrite pre-MP Cr50 version of
     0.2.2.

Change-Id: I929cb2be857ea90c544f83160d6820c73e23c69d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/938946
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-02-26 22:07:22 -08:00
Vincent Palatin
36679bb544 stm32mon: skip empty blocks
Skip the empty blocks when writing even if they are in the middle of the
firmware.
This greatly improves flashing speed when the firmware contains a
signature at the end of the RW.

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

BRANCH=none
BUG=b:36125319
TEST=./util/flash_ec --board=meowth_fp

Change-Id: I3cd1c1bd2670be23d3d9daf9b87d9af0bdfc8963
Reviewed-on: https://chromium-review.googlesource.com/880956
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2018-02-26 14:10:02 -08:00
Daisuke Nojiri
55249ef653 ectool: Print tool version
ectool can be older or newer than the EC's firmware. The version of
the tool needs to be found to debug compatibility issue.

This patch makes ectool print its own version in addition to EC's
version.

BUG=none
BRANCH=none
TEST=Run 'ectool version':
RO version:    fizz_v1.1.7833+5a0bbd8fe
RW version:    fizz_v1.1.7833+5a0bbd8fe
Firmware copy: RW
Build info:    fizz_v1.1.7833+5a0bbd8fe 2018-02-20 09:56:26 foo
Tool version:  fizz_v1.1.7831+d173cf4d6 2018-02-20 16:57:43 bar

Change-Id: Iac641c76e450368175213ab6d277e56d43742429
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/927305
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-02-23 03:37:09 -08:00
Daisuke Nojiri
546c606b5f CBI: Share common code between host tool and firmware
This patch makes EC firmware and cbi-util share the common code.

BUG=b:70294260
BRANCH=none
TEST=Set fields using ectool. Verify the contents by cbi command.
Verify cbi-util creates the same binary as before.
Verify emerge ec-utils ec-devutils pass.

Change-Id: If5e65e48dd03960e0adf23ef775f67aecf785d85
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/932001
2018-02-23 03:36:35 -08:00