summaryrefslogtreecommitdiff
path: root/util
Commit message (Collapse)AuthorAgeFilesLines
* util: presubmit_check.sh: Exclude OWNERS file.stabilize-kukui-12285.BAseda Aboagye2019-06-191-0/+2
| | | | | | | | | | | | | | | | | | | | The OWNERS file isn't used by `make buildall`, so it shouldn't cause a developer to run `make buildall` before submitting a change to the file. This commit simply filters out changes to the OWNERS file from the presubmit_check script. BUG=None BRANCH=None TEST=Modify OWNERS. Try to upload and verify that the presubmit check does not flag it. Change-Id: I71452ac0a751335f815c707b554a2578c532b476 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1666754 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* util: Source files should not be executableTom Hughes2019-06-192-0/+0
| | | | | | | | | | | | | | | | | | | | | | "repo upload" warned me about this file when making another change: These files should not be executable. Please `chmod -x` them. * util/ecst.h Other file found with: find . -name '*.[ch]' -executable BRANCH=none BUG=none TEST=make buildall -j Change-Id: I3acc3c22a302f3f5dfd2ae00d2b65da15b7813d7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1665211 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-1932-32/+32
| | | | | | | | | | | | | | | | Ran the following command: git grep -l 'Copyright (c)' | \ xargs sed -i 's/Copyright (c)/Copyright/g' BRANCH=none BUG=none TEST=make buildall -j Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* stm32mon: Added declarations for stm32g0 seriesJes Klinke2019-06-151-0/+44
| | | | | | | | | Bug: 132247842 Change-Id: Ib1defbabd6e2835d8ce8485c80f22254d2b49db7 Signed-off-by: jbk@chromium.org Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1620789 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: James Deng <jaamesd@chromium.org>
* util: Enable -Wstrict-prototypes for ftdi.hTom Hughes2019-06-151-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | The pragma is missing a push before the ignore line, which means as it was written the warning continued to be disabled. https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html clang catches this bug, but gcc doesn't. util/ec_uartd.c:26:24: error: pragma diagnostic pop could not pop, no matching push [-Werror,-Wunknown-pragmas] ^ However, it appears we don't even need to disable this warning anymore since the compilation succeeds without it. BRANCH=none BUG=chromium:931797 TEST=make buildall -j Change-Id: I81d48a841cb16d54fe0878b218e80d8a1d89e129 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1660020 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* ectool: Clarify addressing mode for I2C commandsDaisuke Nojiri2019-06-101-8/+19
| | | | | | | | | | | | | | | | | | This patch updates the help message for i2cread, i2cwrite, i2cxfer to clarify which addressing mode (7-bit or 8-bit) each command uses. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=chromium:971296 BRANCH=none TEST=buildall Change-Id: I757e8a1d30ad19dbc333a30a97f8049f007853d1 Reviewed-on: https://chromium-review.googlesource.com/1641600 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util: introduce uart stress testerNamyoon Woo2019-06-082-0/+353
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This script repeats a console command on target UARTs, and collects the output. It checks whether there are any lost characters or patterns are corrupted. BUG=b:131340067 BRANCH=None TEST=manually ran this script on scarlet with suzy-Q. $ ./util/uart_stress_tester.sh -h usage: uart_stress_tester.sh [flags] example: uart_stress_tester.sh --pty /dev/ttyUSB0 --min_char 100000 uart_stress_tester.sh --pty="/dev/ttyUSB0 /dev/ttyUSB2" flags: --pty: List of UART device path(s) to test (default: '') --min_char: Minimum number of characters to generate. \ (default: 40000) -h,--[no]help: show this help (default: false) $ echo 'chan save' > /dev/ttyUSB0 $ echo 'chan save' > /dev/ttyUSB2 $ echo 'chan 0' > /dev/ttyUSB0 $ echo 'chan 0' > /dev/ttyUSB2 $ ./util/uart_stress_tester.sh --pty="/dev/ttyUSB0 /dev/tty/USB1 \ /dev/ttyUSB2" INFO : ChromeOS UART stress test starts. INFO : UART devices: /dev/ttyUSB0 /dev/ttyUSB2 /dev/ttyUSB1 ..... INFO : /dev/ttyUSB0: 0 lost / 48785 : 0 % ERROR : /dev/ttyUSB2: 19444 lost / 41965 : 46.3 % ERROR : /dev/ttyUSB1: 16768 lost / 40425 : 41.4 % INFO : Test files are in /tmp/uart_stress_tester.sh_latest ERROR : FAIL Change-Id: Iedd8c9a62e089fde8894ee93329ee9f4a31bb3e7 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1586581 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* fpsensor: Add API to check FP sensor encryption status.Yicheng Li2019-06-071-0/+28
| | | | | | | | | | | | | | | | | | Add EC command for the host to query FP sensor encryption status. Currently it's just FP TPM seed has been set or not. Add unit test for this command. Also add ectool command for querying encryption status. BRANCH=nocturne BUG=chromium:952275 TEST=ran unittests TEST=tested enrollment, matching and multifinger on DUT nocturne. TEST=tested querying sensor encryption status using ectool. Change-Id: I07d1e471ead85a517105b38d1ddd793c3046ce8f Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1633272 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* common: Add EC_CMD_LOCATE_CHIPDaisuke Nojiri2019-06-061-17/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces EC_CMD_I2C_LOOKUP with EC_CMD_LOCATE_CHIP. This is a more generic command which locates a peripheral chip in i2c or other bus types. Additionally, it includes the following changes: - Change chip (device) type # of CBI_EEPROM (from 1 to 0). - Support TCPCs. localhost ~ # ectool locatechip 0 0 BUS: I2C; Port: 0; Address: 0x50 (7-bit format) localhost ~ # ectool locatechip 1 0 BUS: I2C; Port: 0; Address: 0x0b (7-bit format) localhost ~ # ectool locatechip 1 1 BUS: I2C; Port: 1; Address: 0x29 (7-bit format) localhost ~ # ectool locatechip 1 2 EC result 11 (OVERFLOW) Index too large localhost ~ # ectool locatechip 2 Usage: locatechip <type> <index> <type> is one of: 0: CBI_EEPROM 1: TCPCs <index> instance # of <type> Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=Verified ectool locatechip work on Nami. Change-Id: I1a773ced65b1c5ce3656f03eff04a6eadd4bc5ff Reviewed-on: https://chromium-review.googlesource.com/1614582 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* cr50: prepare to release 0.4.19Vadim Bendebury2019-06-061-1/+1
| | | | | | | | | | | BRANCH=cr50 BUG=none TEST=none Change-Id: I1b36658342314e86e3310acd85d821388be3bd57 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1646539 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* ectool: add async flash eraseTom Hughes2019-06-063-1/+61
| | | | | | | | | | | | | | | BRANCH=none TEST=ectool --name=cros_fp reboot_ec; sleep 0.5 && \ ectool --name=cros_fp rwsigaction abort; \ ectool --name=cros_fp flasheraseasync 393216 131072 (using hatch EVT fingerprint board: STM32F412) TEST=make buildall -j BUG=b:132444384 Change-Id: I4a78c5bf7ef323a14083cc9d5fa3ec2c5218245d Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1637496 Reviewed-by: Jett Rink <jettrink@chromium.org>
* Makefile: Replace flag -DX with -DX= to be supported by IS_ENABLED().Yilun Lin2019-06-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | IS_ENABLED works for an empty-string-defined macro. However, -D options default to define the macro to 1. This CL forces those macros, such as BOARD_* CHIP_*, CORE_*, CHIP_VARIANT_* and CHIP_FAMILIY_*, to be defined as an empty string, so that it can be supported by IS_ENABLED macro. TEST=use if(IS_ENABLED(BOARD_KRANE)) and see compilation success. TEST=compares build directory w/ and w/o this CL, and see the .smap are the same: ls build/*/*/ec.*.smap | sed -e 's|build/||' | \ xargs -I{} diff -u -a build/{} build.new/{} BUG=none BRANCH=None Change-Id: I96e2aa1cb5f3369e5e445a674595a9234f26707a Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1627840 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util: update hardware write protect check for flash_fp_mcuTom Hughes2019-05-311-2/+4
| | | | | | | | | | | | | | | | | This method of checking seems more robust across devices. The old way did not work on hatch. BRANCH=none BUG=b:124405913 TEST=make buildall -j TEST=flash_fp_mcu /opt/google/biod/fw/nocturne_fp_v2.2.110-b936c0a3c.bin TEST=flash_fp_mcu /opt/google/biod/fw/hatch_fp_v2.0.1359-6f54be08d.bin Change-Id: I513f8bc5dafcdec7a95ac38657a342b3af509ccc Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1637584 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* Adds filtering of the STM32 DFU devices to eliminate devices withBrian J. Nemec2019-05-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | DFU's 'Runtime' identifier. Some USB devices include the DFU Runtime descriptor during normal use. These devices are detected as potential targets by DFU-UTIL causing it to incorrectly identify multiple potential DFU targets leading to errors while flashing. This change adds an additional requirement using the device's expected vendor:product id to select the correct device. BUG=b:133329195 BRANCH=none TEST=Verified DFU with STM32 based devices: Servo_v4, Servo_Micro, and Sweetberry flash as expected. Verified that the awk correctly extracts and eliminates devices with the DFU's Runtime identifier when a suitable device connects. Verified pattern matching on variations of the serial. Signed-off-by: Brian Nemec <bnemec@chromium.org> Change-Id: I2331b5e06d2eebf8dc28f20b9dd6b10bf2abe02a Reviewed-on: https://chromium-review.googlesource.com/1626650 Commit-Ready: Todd Broch <tbroch@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org>
* stm32mon: : fix coverity scan issue on a write_wrapper() callNamyoon Woo2019-05-211-1/+7
| | | | | | | | | | | | | | | | | | | This CL fixes coverity scan check issue, which points that there is a call to write_wrapper() missing return value checking. This was added by crrev.com/c/1540496, which is about a sending garbage byte to DUT to avoid reTIMEOUT response repeating. BUG=b:131231369 BRANCH=none TEST=ran flash_ec on scarlet at 9600 bps. flash_ec --board scarlet --image ${IMG} --bitbang_rate 9600 Change-Id: I25ea43ae13d9fbf16b90fba4030c9bb640498453 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1588497 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: prepare to release 0.4.18Vadim Bendebury2019-05-211-1/+1
| | | | | | | | | | | BRANCH=cr50, cr50-mp BUG=b:133187513 TEST=none Change-Id: Ifcddb73577e6510ddc33c97cdf83af1ddcf2a616 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1621073 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* flash_ec: prevent null entry in dut-control recovery listNamyoon Woo2019-05-171-2/+8
| | | | | | | | | | | | | | | | | | With some faulty platforms, dut-control might fail and dut-control recovery list might have a null entry. On flash_ec exit, the command run "dut-control ''" displays a long error message, which confuses users. This CL prevents that happening. BUG=None BRANCH=None TEST=manually ran on hatch, scarlet and coral Change-Id: I26b8c46b5ce6ff529cd368adeb6b24a01ed14566 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1614360 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* flash_ec: expand the list of directories where npcx_monitor.bin can be foundPaul Fagerburg2019-05-171-9/+16
| | | | | | | | | | | | | | | | | | | | | Add the dirs for LOCAL_BUILD or EMERGE_BUILD to the list of directories to search for npcx_monitor.bin. Prioritize the directory where the EC binary is located (which could be specified with the --image parameter). BUG=b:132350402 BRANCH=none TEST=Build with 'sudo emerge ec-devutils' Test with and without an --image parameter: flash_ec --board=kohaku flash_ec --board=kohaku --image=build/kohaku/ec.bin Verify that flash_ec is able to locate npcx_monitor.bin in both cases. Change-Id: I5a679d1bc215cc0383f60e02aa702db79cd968b3 Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1613437 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* i2c: add i2clookup host commandJett Rink2019-05-161-1/+53
| | | | | | | | | | | | | | | Add a new host command that will allow you to lookup a well known device on the EC. This is useful for FAFT tests that want to talk directly with i2c devices but don't know the physical address for each platform. BRANCH=octopus BUG=b:119065537 TEST=Used this with new faft test in CL:1601300 Change-Id: I82c2d5462fcb4edbc92ea60765971190fed7ae81 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1601060 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* iteflash: use serial number to find the ccd deviceMary Ruthven2019-05-141-9/+4
| | | | | | | | | | | | | | | There may be multiple ccd devices connected to the host. Use the serial number to choose the correct device. BUG=none BRANCH=none TEST=try to flash ampton with two CCD devices connected to the host Change-Id: I1554e94f31b5582955ea25c19da2c3da98012e46 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1600502 Reviewed-by: Matthew Blecker <matthewb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* usb_if: use the device with the matching serial numberMary Ruthven2019-05-123-13/+74
| | | | | | | | | | | | | | There might be multiple devices with the same VID:PID connected to the host. Use the serial number to find the correct device if it is given. BUG=none BRANCH=none TEST=none Change-Id: I96f31e8e7ceb0dd2c3c643771b38752da88a2a9e Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1600500 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* cr50: rebuild board image if essential make variables changeVadim Bendebury2019-05-101-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When building Cr50 board image, some make variables get converted into compilation flags, which affect image composition. Changes of these variables go unnoticed as they do not directly affect make dependencies. Let's define the set of essential variables in ENV_VARS, and save the state of these variables at build time in a generated .h file, updating it only if any of the variables' values changed since the previous make run. The generated .h file is included in board.h, which guarantees that files dependent on board.h are recompiled if the generated .h file changes. BRANCH=cr50 BUG=none TEST=verified that changing of CR50_DEV and/or H1_RED_BOARD or CR50_SQA values triggers full rebuild of the Cr50 image. Verified that 'emerge-atlas ec-utils' also succeeds. Change-Id: Id0589a3b6a66fe4da90a9aea894bc83eb6337c8c Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/707915 Reviewed-by: Keith Short <keithshort@chromium.org>
* cleanup: fix cros_sh to cros_ish typoJett Rink2019-05-101-1/+1
| | | | | | | | | | | | | Update command line usage help string for ectool to specify cros_ish instead of cros_sh. BRANCH=none BUG=none TEST=see usage string update Change-Id: I52f36b88598af980788eec8a1ed15160ba0f1175 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1605219
* flash_ec: fix in restoring "fw_up" controlNamyoon Woo2019-05-081-6/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | crrev.com/c/1593817 falsely restored "fw_up" at exit. It was supposed to restore "fw_up" as "off" unconditionally , but it restored with the initial value at the beginning of flash_ec. Fixed it by specifying the recovery value in the function servo_save_add(). BUG=b:132097230 BRANCH=None TEST=manually ran flash_ec on atlas via servo_v2. ./util/flash_ec --board atlas --image /Downloads/atlas/ec.bin --verbose INFO: Using servo_v2. INFO: Using ec image : /Downloads/atlas/ec.bin dut-control --port=9999 i2c_mux_en:on dut-control --port=9999 i2c_mux:remote_adc INFO: Flashing chip npcx_int_spi. dut-control --port=9999 cold_reset:on dut-control --port=9999 fw_up:on dut-control --port=9999 cold_reset:off dut-control --port=9999 spi1_vref:pp3300 spi1_buf_en:on dut-control --port=9999 spi1_buf_on_flex_en:on ... Erasing and writing flash chip... Verifying flash... VERIFIED. SUCCESS INFO: Restoring servo settings... dut-control --port=9999 cold_reset:off dut-control --port=9999 i2c_mux_en:on dut-control --port=9999 i2c_mux:remote_adc dut-control --port=9999 fw_up:off <--- It is recovered as 'off'. dut-control --port=9999 spi1_vref:off dut-control --port=9999 spi1_buf_en:off dut-control --port=9999 spi1_buf_on_flex_en:off dut-control --port=9999 cold_reset:on dut-control --port=9999 cold_reset:off Change-Id: I423b921fd54f59a5e3538d1fbdd0fb6b09632625 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1597798 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* cr50: prepare to release 0.4.17Vadim Bendebury2019-05-071-1/+1
| | | | | | | | | | | BRANCH=cr50 BUG=none TEST=none Change-Id: I25c87502d3e38b42430c85a4426e43a2f5f6a7f3 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1595157 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* flash_ec: collect dut-control values to restore before they changeNamyoon Woo2019-05-041-73/+57
| | | | | | | | | | | | | | | | | | | | | | | | This CL enables add dut-control values to restore during execution. This helps flash_ec store necessary values only. Also this CL fixes the problem that flash_ec failure leaves spi1_buf_en:on, not restoring to off. Cq-Depend:chromium:1591590 BUG=None BRANCH=None TEST=manually ran flash_ec on duts. soraka with servo_v2, ccd_cr50 scarlet with servo_v2, ccd_cr50 dragontalon with servo_v2, servo_micro coral with servo_v2, servo_micro, ccd_cr50 grunt(liara) with servo_v2, servo_micro, ccd_cr50 fleex with servo_v2, servo_micro, ccd_cr50 ampton with servo_v2, servo_v4, ccd_cr50 Change-Id: Iefb8c85125841040ab408551ab254f8151080a54 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1593817 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* common: add MOTIONSENSE_CHIP_TCS3400Nick Vaccaro2019-05-041-0/+3
| | | | | | | | | | | | | | Add new chip definition for AMS TCS3400 light sensor. BUG=b:129419982 BRANCH=master TEST=none Change-Id: Ic66a0922f3c48775f2eaeff0c5ac37a09624a5d6 Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/1541954 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* common: add new MOTIONSENSE_TYPE_LIGHT_RGB sensor typeNick Vaccaro2019-05-041-0/+3
| | | | | | | | | | | | | | Add a new light sensor type for color light sensors. BUG=b:129419982 BRANCH=master TEST=none Change-Id: I30cec56761b1f7f90544dda52a90415d39ded337 Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/1541953 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* console: add support for disabling timestampsMary Ruthven2019-04-301-14/+23
| | | | | | | | | | | | | People may want to disable timestamps. Add a command to do that. BUG=none BRANCH=none TEST=none Change-Id: I702c41a214367b6c58f3d9b932310e1bb7e08b95 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1586588 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* mt_scp: Generate IPI tables with util gen_ipi_table.Yilun Lin2019-04-302-0/+66
| | | | | | | | | | | | | | | | | | | | IPI table is board-specific. This CL removes the original IPI table in chip layer, and uses gen_ipi_table to generate the table for each board to reduce the maintenance effort. TEST=make BOARD=kukui_scp, and see build/kukui_scp/ipi_table_gen.inc exists. Push to Kukui, and see SCP boots. TEST=modify IPI_COUNT in board.h and see it generates a new ipi_table_gen.inc BUG=b:130508869 BRANCH=None Change-Id: I0c05319447d15917e8833aa80d61166c4e396370 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1568890 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* cr50: update version to .16Mary Ruthven2019-04-262-2/+2
| | | | | | | | | | | BRANCH=none BUG=none TEST=none Change-Id: I873b50ebd73c0edd16c278b1fa825378e693d18d Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1584589 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* flash_fp_mcu: use modalias to detect FP spiidTom Hughes2019-04-261-5/+28
| | | | | | | | | | | | | | | | | | During bringup there was a point where the spiid for the fingerprint sensor changed between devices (apparently due to broken TPM firmware since the TPM is usually the first SPI device)). This resulted in non-obvious failures when running flash_fp_mcu since many other things were also not working. BRANCH=none BUG=chromium:955117 TEST=emerge-nocturne ec-utils-test && cros deploy nocturne ec-utils-test flash_fp_mcu /opt/google/biod/fw/nocturne_fp_v2.2.110-b936c0a3c.bin Change-Id: I9161361e2c66de200f618c00074eeb42a9ecb29b Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1566653 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* uartupdatetool: retry opr_check_sync() if the first attept failsNamyoon Woo2019-04-261-0/+8
| | | | | | | | | | | | | | | | This is a workaround fix for grunt, where the first command after EC reset gets zero bytes as response. BUG=b:126795953 BRANCH=none TEST=manually ran flash_ec on grunt/careena, grunt/liara and octopus/fleex through servo_v4_with_ccd_cr50 or suzy-Qable. Change-Id: I5da3bd7889d9e4059a8f523352db4f3e5a7ce841 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1583128 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* util: Add tool to generate cros_ec_commands.hGwendal Grignou2019-04-262-0/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a rule to generate a new cros_ec_commands.h when ec_commands.h is modified. The rule is checked when buildall is invoked. At Presubmit stage, check a cros_ec_commands.h exists if ec_commands.h is modified. The CL author is responsible to upstream that file. BUG=chromium:945948 BRANCH=none Cq-Depend: chromium:1558853 TEST=Check manually cros_ec_commands.h is generated with make build_cros_ec_commands Check no bread crumbs are left-over when the rule fails. Check checkpatch triggers when it finds an invalid syntax in the output file. Check ../../repohooks/pre-upload.py returns a meaningful error when cros_ec_commands.h file is not present. Change-Id: Ibc8ed7165914d39b5f0bd41643932a8514768925 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1559380 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Brian Norris <briannorris@chromium.org>
* util/stm32mon: Add cmdline option to display versionTom Hughes2019-04-242-2/+20
| | | | | | | | | | | | | | | | | | | Also display the version when running in order to make it easier to debug flashing issues in the field or factory. BRANCH=none BUG=chromium:952332 TEST=./util/flash_ec --board=hatch_fp --image=./build/hatch_fp/ec.bin => displays stm32mon version ./build/hatch_fp/util/stm32mon -v => displays version ./build/hatch_fp/util/stm32mon --version => displays version Change-Id: I43f622ed370938eeed31453d5b11806f02b47277 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1565462 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* util/ectool, common/system: Share sysmbol reset_flag_desc.Yilun Lin2019-04-181-24/+17
| | | | | | | | | | | | | | | | | There were two symbols reset_flag_desc and reset_flag_strings used in two separated places: host binary ectool and device. This CL combines these two symbols to reduce maintance efforts. TEST=make buildall -j BRANCH=None BUG=None Change-Id: I3b5731ab08804f46629d6e43466dce963bd86a69 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1514395 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* *_fp: Add private version infoTom Hughes2019-04-181-0/+3
| | | | | | | | | | | | | | | | | | This shows up when you run the "version" command in the UART console. BRANCH=none BUG=b:130417373 TEST=BOARD=hatch_fp ./util/getversion.sh => shows private version in VERSION BOARD=nocturne_fp ./util/getversion.sh => shows private version in VERSION BOARD=nocturne ./util/getversion.sh => does not show private version in VERSION Change-Id: Ibdf94795bbc8bc823d29ec006b01fc89e8f37114 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1566040 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* flash_fp_mcu: print canonical pathTom Hughes2019-04-161-0/+4
| | | | | | | | | | | | | | | | | This avoids confusion when installing in /usr/local/bin vs /usr/bin. See https://crbug.com/341708 for more details. BRANCH=none BUG=chromium:952447 TEST=emerge-nocturne ec-utils-test && cros deploy nocturne ec-utils-test flash_fp_mcu /opt/google/biod/fw/nocturne_fp_v2.2.110-b936c0a3c.bin Change-Id: Ifba5c668613bc35e24d9466c6e7245b6b862fc90 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1566650 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* signer: allow board id of 0:0:0Mary Ruthven2019-04-151-2/+9
| | | | | | | | | | | | | | | | | | | | | In the prod branch the prod signer sets the board id to FFFF:0:10000, because we're going to start doing automatic signing. We need to be able to override that board id to 0:0:0. bs doesn't support this right now because it always assumes the first field of the given board id is a 4 character string that it needs to convert into hex. This change modifies bs to use 0 for the board_id rlz if the rlz is 0 instead of trying to convert an ascii character into hex. 0 is the only digit bs will accept for the board_id, because it's easy to interpret. BUG=none BRANCH=cr50 TEST=sign image with CR50_BOARD_ID=0:0:0. Make sure gsctool -b shows the RLZ is 0 instead of 0x30. Change-Id: I1fe30877ff8d6d1574934c55c2fb5cdc543c34ad Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1565549 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* util/usb_if: return failure when usb device cannot be claimed.Namyoon Woo2019-04-141-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL returns an error code when usb device finding fails. BUG=none BRANCH=none TEST=manually ran flash_ec on dragonegg in CCD with servod. [Before this CL] ... iteflash -W 0 -c ccd -e -w ${IMG} found interface 5 endpoint 6, chunk_len 64 util/usb_if.c:106, libusb_claim_interface returned -6 (Resource busy) READY <----- should not proceed. ------- Using CCD device util/usb_if.c:127, libusb_bulk_transfer returned -99 (Other error) ... [After this CL] ... iteflash -W 0 -c ccd -e -w ${IMG} found interface 5 endpoint 6, chunk_len 64 util/usb_if.c:106, libusb_claim_interface returned -6 (Resource busy) connect_to_ccd_i2c_bridge: usb_findit returned error -1 dut-control --port=9999 ccd_ec_boot_mode_uut:off dut-control --port=9999 ccd_ec_boot_mode_bitbang:off ... Change-Id: Ibec9828487b2fed5f5a5bc2012b8b9f29d182531 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1490831 Reviewed-by: Matthew Blecker <matthewb@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* stm32mon: retry on damaged ACK, NACK or timeoutNamyoon Woo2019-04-121-126/+253
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BUG=b:112837404 BRANCH=None TEST=manually ran stm32mon or flash_ec on scarlet and DragonTalon. 1. stm32mon via Servo V4 type-C at 57600 bps on scarlet. $ ./util/flash_ec --board scarlet --image ${IMG} \ --bitbang_rate 57600 --verbose 2. stm32mon via Servo V4 type-C at 9600 bps on scarlet. which tends to fail for NACK or timeout. $ ./util/flash_ec --board scarlet --image ${IMG} \ --bitbang_rate 9600 --verbose 3. flash_ec via Servo Micro on scarlet $ ./util/flash_ec --board scarlet --image ${IMG} --verbose 4. flash_ec on DragonTalon via Servo V2 and Servo Micro respectively. $ ./util/flash_ec --board hatch_fp --image ${IMG} --verbose Full log can be found at http://gpaste/5439133910564864 Change-Id: I3c8e8c81d9d12475f5722eaacc932dc1244625d5 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1540496 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* iteflash.md: revised the steps in 'Prerequisites for CR50 CCD'Namyoon Woo2019-04-111-3/+3
| | | | | | | | | | | BRANCH=none BUG=b:124388894 TEST=checked the document through Gitiles. Change-Id: I11fe46a8900ec59edee799157358698e4c0e1cc6 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1555026 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* make: include iteflash in host-util groupNamyoon Woo2019-04-111-2/+2
| | | | | | | | | | | | | | | | iteflash is a flash tool for ITE EC, and needs to be installed in labstations. iteflash should belong to host-util like other EC flash tools. BUG=b:130036463 BRANCH=None TEST=built and ran iteflash on Ampton using servo_v2, servo_micro and Suzy-Q. Change-Id: If711a26f7d6d3979332b9064313a7e1b87cd594a Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1560143 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* ectool: cleanup cmd_fp_seed()Nicolas Norvez2019-04-111-6/+5
| | | | | | | | | | | | | | | | - check |argc| before accessing argv[1] - remove redundant variables/assignments BRANCH=None BUG=None TEST=ectool --name=cros_fp fpseed => fails TEST=ectool --name=cros_fp fpseed aabb => fails (only 4 bytes) TEST=ectool --name=cros_fp fpseed aabb...aabb => succeeds Change-Id: I515de53a2ee3b934da2e930e32d0680375488711 Signed-off-by: Nicolas Norvez <norvez@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1558970 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* flash_ec: Update error msg and TODO bug num for servo I2C adapter lookup.Matthew Blecker2019-04-091-16/+6
| | | | | | | | | | | | | | | | | | This also removes the placeholder code for a dut-control command that does not actually exist yet. BRANCH=none BUG=b:79684405,b:130165933 TEST=Ran flash_ec using Servo v4 -> Servo Micro -> Ampton. With i2c-pseudo loaded and servod running, reflashing worked. With i2c-pseudo unloaded and servod running, the new error message was written stderr and flash_ec exited non-zero as desired. Change-Id: Icfa4f4a894eda6c683a2d1cef4a87b3ac3a0a359 Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1558371 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* hatch_fp: STM32F412 can have up to 1 MB Flash (some have less)Tom Hughes2019-04-091-15/+291
| | | | | | | | | | | | | | | | | | | | | | | | For sizes, see: See https://www.st.com/resource/en/reference_manual/dm00180369.pdf Section 3.3 Embedded Flash Memory We read the Flash size data register to get the actual size: See https://www.st.com/resource/en/reference_manual/dm00180369.pdf Section 31 Device electronic signature BRANCH=none BUG=b:126455006,b:124996507 TEST=make BOARD=hatch_fp -j ./build/host/util/stm32mon -b 115200 -d /dev/pts/24 \ -u -e -w ./build/hatch_fp/ec.bin Change-Id: I105840150cde68c7c7579d44c8d8c43b6b567233 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1541818 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* iteflash.md: Document procedure for reflashing ITE ECs.Matthew Blecker2019-04-051-0/+119
| | | | | | | | | | BRANCH=none BUG=b:79684405,b:124388894 TEST=Viewed the document through Gitiles, verified formatting. Change-Id: I95ffccca3d7b88f4ab478e85bc1af252813100ff Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1549982
* cr50 signer: make sure SQA images can not be signed with prod keysVadim Bendebury2019-04-051-2/+2
| | | | | | | | | | | | | | | This patch makes sure that SQA images can not be signed with prod keys. BRANCH=none BUG=none TEST=manually verified that the modified grep expression triggers for both DBG and SQA containing strings. Change-Id: I3c8b8c45dbbf5d38bc9c35f766e80ada8257cb65 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1553575 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* hatch_fp: Fix flash erase in stm32monTom Hughes2019-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hatch_fp uses STM32F412, which *does* support mass erase. The original commit that matches against STM32F41 seems to be targeted to the STM32F411 based on the commit message: 09a7fa4ae When trying to erase the STM32F412 for hatch_fp by page, the command fails: Waiting for the monitor startup ...Done. ChipID 0x441 : STM32F412 Bootloader v1.1, commands : 00 01 02 11 21 31 44 63 73 82 92 Unprotecting flash read... Flash read unprotected. Waiting for the monitor startup ...Done. Flash write unprotected. Waiting for the monitor startup ...Timeout Done. Erasing... NACK payload 0 ACK failed for CMD44 BRANCH=None BUG=b:124996507 TEST=hatch_dut> flash_fp_mcu ec.bin Change-Id: Idc800b1f3ae29f7776405b1e952f71ef2d7c8a14 Signed-off-by: Nicolas Norvez <norvez@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1539016 Commit-Ready: Tom Hughes <tomhughes@chromium.org> Tested-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* util:ecst: add the support of CHIP_VARIANT npcx7m7wc for NPCX7CHLin2019-04-031-3/+5
| | | | | | | | | | | | | | | | | | This CL adds the support for chip variant npcx7m7wc in the ecst utility. BRANCH:none BUG=none TEST=pass "make buildall" TEST=in the follow CL, change CHIP_VARIANT to npcx7m7wc in board/npcx7_evb/build.mk; build the image by "BOARD=npcx7_evb make"; check the image can be built and the image header is correct. Change-Id: I6031a6f188f06e31ca7ce0571065b11ee68b27ab Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/1543061 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>