summaryrefslogtreecommitdiff
path: root/util
Commit message (Collapse)AuthorAgeFilesLines
* ectool: Fix "rwsig dump key_id" hex outputCraig Hesling2020-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ectool command rwsig dump key_id's output was missing zeros in the hex string output. This is because we print each byte independently using the naked %x formatter, which will print the minimum hex characters necessary to represent the independent number provided. We need to force exactly 2 hex characters for each independent byte printed. BRANCH=none BUG=b:162588911 TEST=# Nocturne make BOARD=nocturne_fp build/nocturne_fp/util/ectool # Copy build/nocturne_fp/util/ectool to fat32 flash drive mkdir /tmp/rem mount /dev/sda1 /tmp/rem ectool --name=cros_fp rwsig dump key_id | tr -d '\n' | wc -c # Identify there are less than 40 chars (39 in my case) /tmp/rem/ectool --name=cros_fp rwsig dump key_id | tr -d '\n' | wc -c # Identify there are exactly 40 chars # Rerun both commands without the byte counting to sanity # check the output Change-Id: I0a43833adb647aa034df87678c9657466cc8aef5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2336865 Commit-Queue: Craig Hesling <hesling@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org> Tested-by: Craig Hesling <hesling@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Auto-Submit: Craig Hesling <hesling@chromium.org>
* util/flash_ec: fix in parse error in getting flash_size from flashromNamyoon Woo2020-08-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes flash_ec to take the last line of grep result from the output of 'flashrom --flash-size'. BUG=b:162771462 BRANCH=none TEST=ran flash_ec on nocturne with suzy-Q connected. $ ./util/flash_ec --image /Downloads/nocturne.bin --board nocturne \ --verbose INFO: Using ccd_cr50. INFO: Using ec image : /Downloads/nocturne.bin 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 INFO: Running flashrom: ... Erasing and writing flash chip... SUCCESS INFO: Flashing done. INFO: Restoring servo settings... dut-control --port=9999 fw_up:off dut-control --port=9999 ccd_ec_boot_mode_uut:off dut-control --port=9999 ccd_ec_boot_mode_bitbang:off dut-control --port=9999 cold_reset:on Signed-off-by: Namyoon Woo <namyoon@chromium.org> Change-Id: I1120c828ddb33f327cce46435ec9fa26b10d1908 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2340088 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* ec: change usage of dummySam Hurst2020-08-053-9/+8
| | | | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the term "dummy" with inclusive alternatives. BUG=b:162781382 BRANCH=None TEST=make -j buildall `grep -ir dummy *` The only results are in "private/nordic_keyboard/sdk8.0.0" which is not our code. Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I6a42183d998e4db4bb61625f962867fda10722e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2335737 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* it8xxx2_pdevb: flash code by SPIRuibin Chang2020-08-051-1/+1
| | | | | | | | | | | | | | | Flash it8xxx2_pdevb code by SPI. BUG=none BRANCH=none TEST=can flash code by SPI on board it81202_pdevb. Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw> Change-Id: Ibc83bd5596f65fe8f9558f9575677feeb3da2f91 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2334435 Commit-Queue: Ruibin Chang <Ruibin.Chang@ite.com.tw> Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-by: Jett Rink <jettrink@chromium.org>
* flash_ec: ite_spi: Put FW image at the beginning of temp imagetim2020-08-051-1/+2
| | | | | | | | | | | | | | | When FW image size is less than flash rom SPI size, the temp image should be placed after FW image for ite_spi programming mode. BUG=none BRANCH=none TEST=zephyr.bin(size=18.4k) is successfully burned to it8xxx2_evb to print hello world. Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com> Change-Id: I163d954e91d31a598d0957f7a4de67cef13223f9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2335525 Reviewed-by: Jett Rink <jettrink@chromium.org>
* vif: Update VIF generator to Revision 1.40, Version 1.0 of the specSam Hurst2020-08-051-336/+769
| | | | | | | | | | | | | | | | | | | | | | | | Update the Vendor Information File generator so that it complies with Revision 1.40, Version 1.0 of the spec. The VIF files are generated when the board is built. So, make -j BOARD=<board> will create build/<board>/<board>_vif.txt A VIF can be generated manually after the board is built with build/<board>/util/genvif -b <board name> -o <out directory> BUG=b:131087690 BRANCH=none TEST=manual Generate VIF for Atlas and checked fields. Signed-off-by: Sam Hurst <shurst@chromium.org> Change-Id: Iaa1eaf1f01f9d36ad3afd2818ebe81359b8531f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1577739 Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Sam Hurst <shurst@google.com>
* ec: change usage of whitelist/blacklistPaul Fagerburg2020-07-281-3/+3
| | | | | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the terms "whitelist", "blacklist", and similar with inclusive alternatives. BUG=b:162262297 BRANCH=None TEST=`grep -Eirl "(white|black)[ _\-]*list" .` The only results are in "private/nordic_keyboard/sdk8.0.0" which is not our code. Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: Ie5210b98e1096c22d0e9284c101a42820bd3d79d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2321549 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* util/flash_ec: drop support for toad cableJack Rosenthal2020-07-231-30/+0
| | | | | | | | | | | | | | | | | All devices with a servo v1 connector are AUE... assume we can drop this old code from ToT. BUG=none BRANCH=none TEST=run with dry run params for scarlet and attached servo v4... no output diff Change-Id: I09df37e2e287337f7962055c3244eab4afacead8 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2313597 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util/flash_ec: add --dry_run flagJack Rosenthal2020-07-231-21/+46
| | | | | | | | | | | | | | | | | | | I've found it useful discover what commands are being run to actually flash the EC, without actually flashing it. This CL adds a new flag, --dry_run, which prints the commands necessary to reproduce the flash, instead of running them. Commands which probe hardware presence (e.g., dut_control_get) are not printed. BUG=none BRANCH=none TEST=manual, observe operation with scarlet connected, both with and without --dry_run Change-Id: Ib7de66176625878370d5b24a5fb7a32b37965cb8 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2226505 Reviewed-by: Jett Rink <jettrink@chromium.org>
* ec: change usage of "sane" per inclusive languagePaul Fagerburg2020-07-221-1/+1
| | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the terms "sane", "sanity check", and similar with inclusive/non-stigmatizing alternatives. BUG=b:161832469 BRANCH=None TEST=`make buildall -j` succeeds. `grep -Eir "sane|sanity" .` shows results only in third-party code or documentation. Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Change-Id: I29e78ab27f84f17b1ded75cfa10868fa4e5ae88c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2311169 Reviewed-by: Jett Rink <jettrink@chromium.org>
* CBI: Add ectool command to remove board infoCheng-Han Yang2020-07-161-2/+27
| | | | | | | | | | | | | | | | Add a ectool command to remove board information in EEPROM. BUG=b:161208512 BRANCH=none TEST=Run `ectool cbi remove <tag>`, then `ectool cbi get <tag>` to verify that the CBI fields are removed and getting INVALID_PARAM error. Change-Id: I6f2aec477f68f258c76d99d1e67d155784b37d42 Signed-off-by: Cheng-Han Yang <chenghan@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2299606 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Cheng-Han Yang <chenghan@chromium.org> Tested-by: Cheng-Han Yang <chenghan@chromium.org>
* util: add gen_bmi_config utilityKeith Short2020-07-102-1/+308
| | | | | | | | | | | | | | | | | | | | | | | Add the gen_bmi_config utility used to generate a compressed version of the configuration file required by the BMI260 IMU sensor. This is expected to be a temporary solution until the 8 KiB BMI configuration file can be moved out of the EC code. BUG=b:160330682 BRANCH=none TEST=make utils TEST=run "gen_bmi_config compress BMI260_main.tbin bmi260_compressed.bin" TEST=run "gen_bmi_config decrompress bmi260_compressed.bin bmi260_uncompressed.bin", verify uncompressed file matches original file. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I7ef06414f84169f2e16f26df4f83455c3df37e51 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2289215 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* util/ecst: Make sure that copying back arguments doesn't exceed MAX_ARGSPatrick Georgi2020-06-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Newer gcc than we have in CrOS shows a non-helpful error message: util/ecst.c: In function 'main': util/ecst.c:398:7: error: 'strncpy' output may be truncated copying 100 bytes from a string of length 9999 [-Werror=stringop-truncation] 398 | strncpy(hdr_args[arg_ind++], | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | tmp_hdr_args[tmp_ind], | ~~~~~~~~~~~~~~~~~~~~~~ 400 | ARG_SIZE); | ~~~~~~~~~ In the end it's about gcc not being able to ensure that hdr_args[] doesn't overflow. BUG=none BRANCH=none TEST=gcc 9.3 as shipped with debian sid compiles ecst without error Change-Id: I2c30cdfaac0305ea4e4c19477469bcf497469caa Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2273240 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* ectool: Show smartdischarge thresholds by charge %Daisuke Nojiri2020-06-301-2/+12
| | | | | | | | | | | | | | | | | | | | | | | Currently, the smartdischarge command prints cutoff and stay-up thresholds by the remaining capacity. This CL makes it print the thresholds by the state of charge as well. $ ectool smartdischarge 2880 1150 65 Hours to zero capacity: 2880 h Stay-up threshold: 3312 mAh (64 %) Cutoff threshold: 187 mAh (3 %) Hibernate discharge rate: 1150 uA Cutoff discharge rate: 65 uA BUG=b:152431365, b:157602162 BRANCH=none TEST=See above Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I9aa163eab861f766a8f1120481c0e1db2608aa77 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2268280 Reviewed-by: Mengqi Guo <mqg@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org>
* ectool: motionsense: add commands for fast/manual offset compensationInno.Park2020-06-241-26/+77
| | | | | | | | | | | | | | | | - command 'calibrate' added for accel/gyro calibration - command 'offset' modified so that it can also set offset manually BUG=b:159557101 BRANCH=none TEST=build ectool and run following commands. 'ectool motionsense calibrate 2' 'ectool motionsense offset 2 -- -187 312 -62' Change-Id: I58d0920e0ed48145cad55587ee3ba125d6a5c175 Signed-off-by: Inno.Park <ih.yoo.park@samsung.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256964 Reviewed-by: Jett Rink <jettrink@chromium.org>
* flash_ec: remove verify-whole option for npcx_(int_)spiNamyoon Woo2020-06-231-11/+0
| | | | | | | | | | | | | | | | | | | This patch removes the verification of the whole firmware area for npcx_spi and npcx_int_spi chip. The reason is flash_ec programs WP_RO and EC_RW area only so it should verify partially on those area only, not the whole area. The option "--fast-verify" already was used for that purpose in flash_ec script. BUG=b:158864362 BRANCH=none TEST=ran flash_ec on nami. Signed-off-by: Namyoon Woo <namyoon@google.com> Change-Id: If08194697e1b15b13c592be94d5268359edd6b5a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2254739 Tested-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Namyoon Woo <namyoon@chromium.org>
* Battery: Implement smart discharge systemDaisuke Nojiri2020-06-201-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, CrOS EC chooses only one of the two powre-saving states when the system is left idle. One is to hibernate and the other is to cut off the battery. And these are determined at compile time. If the system hibernates, EC will not have a chance to cut off the battery before the state of charge reaches critical low. If the system is in cutoff, it requires an AC adapter to wake up. So, neither behavior is ideal. This patch introduces the smart discharge system. Given the number of hours to zero capacity as a target, it tries to choose the better state for idling. For example, if the state of charge is high, it will hibernate the system because the target can be met before the battery completely drains. If the state of charge is low, it will keep the EC up so that it can cutoff the battery. Tests are done on Bloog as follows: Verify EC selects not to hibernate when the remaining capacity is below the stay-up threshold. The ectool smartdischarge command is tested as follows: localhost ~ # ectool smartdischarge Hours to zero capacity: 0 h Stay-up threshold: 0 mAh Cutoff threshold: 0 mAh Hibernate discharge rate: 0 uA Cutoff discharge rate: 0 uA localhost ~ # ectool smartdischarge 2160 Hours to zero capacity: 2160 h Stay-up threshold: 0 mAh Cutoff threshold: 0 mAh Hibernate discharge rate: 0 uA Cutoff discharge rate: 0 uA localhost ~ # ectool smartdischarge 2160 200 1500 EC result 3 (INVALID_PARAM) localhost ~ # ectool smartdischarge 2160 1500 200 Hours to zero capacity: 2160 h Stay-up threshold: 3240 mAh Cutoff threshold: 432 mAh Hibernate discharge rate: 1500 uA Cutoff discharge rate: 200 uA localhost ~ # ectool smartdischarge 2160 1500 0 EC result 3 (INVALID_PARAM) localhost ~ # ectool smartdischarge 0 Hours to zero capacity: 0 h Stay-up threshold: 0 mAh Cutoff threshold: 0 mAh Hibernate discharge rate: 1500 uA Cutoff discharge rate: 200 uA Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:152431365, b:157602162 BRANCH=none TEST=See above Change-Id: I1470b13203f3653ae0e495cd5ec8ed05f3c5102f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2216392 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
* util/ide-config: Add basic eclipse supportCraig Hesling2020-06-191-1/+121
| | | | | | | | | | | | | | | | * It can only generate for a single board-image at a time. * It generates an XML that is importable from an existing CDT project. See https://gn.googlesource.com/gn/+/master/docs/reference.md#eclipse-ide-support for a better description about what is generated. BRANCH=none BUG=none TEST=./util/ide-config.sh eclipse nocturne_fp:RW >nocturne_fp-rw.xml Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I891bce7fedf6cf10778618638f7bf5caffe57717 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2084413 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util/flash_jlink.py: Exit with error codeTom Hughes2020-06-161-2/+8
| | | | | | | | | | | | | | | | | | When flashing fails, the script will exit with non-zero exit code. BRANCH=none BUG=b:151105339 TEST=Stop JLinkRemoteServerCLExe: ./util/flash_jlink.py --board bloonchipper --image \ ./build/bloonchipper/flash_write_protect/flash_write_protect.bin echo $? 1 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I75052eb52d0690e7a6ba3ae9e5ccbf877bee2cd2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2233781 Commit-Queue: Craig Hesling <hesling@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org>
* makefile: use separate directory for code coveragePaul Fagerburg2020-06-121-9/+13
| | | | | | | | | | | | | | | | | | | | | | | When building host-based unit tests for code coverage, put the build outputs in a different directory. Because the code coverage build has calls into gcov library functions, a partial rebuild without code coverage will result in undefined linker errors. The previous solution was an inefficient cycle of `make clobber` and full rebuild when switching between building with and without code coverage. BUG=b:157091606 BRANCH=None TEST=`make buildall -j ; make coverage -j` Verify that build/host and build/coverage both exist, and that code coverage data (*.gcno, *.gcda, *.info) is only in build/coverage. Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: Iac0b18068082d34546aa15b174f86efb6a7f41a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242351 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* flash_ec: flashrom: Use google-servo-v2 instead of servo-v2Nicolas Boichat2020-06-081-1/+1
| | | | | | | | | | | | | | | Get rid of deprecation warning. BRANCH=master BUG=b:145175076 TEST=none Change-Id: I4fe9adc3811f8dcd6a75fe9481d7e44a29d5126e Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2234042 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org>
* flash_fp_mcu: fix the volteer gpio settingZhuohao Lee2020-06-081-15/+15
| | | | | | | | | | | | | | | | | Due to the latest coreboot change, the gpiochip252 and gpiochip445 were removed and the gpiochip152 was added. Besides, the GPIO pin also changed. This patch fixes the gpio pin setting. BUG=b:156993750 BRANCH=none TEST=ran flash_fp_mcu on the Volteer Change-Id: I54082eea90e85746976d427523cfc0b53e87ddda Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2214876 Tested-by: Jesper Lin <jesper_lin@wistron.corp-partner.google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Alex Levin <levinale@chromium.org>
* util/flash_jlink.py: Reset after flashingCraig Hesling2020-06-041-0/+1
| | | | | | | | | | | | | | | | | | | You must reset the chip after flashing to start the new code. It is possible that the chip was resetting without this fix due to a double fault after flashing. In cases where the CPU is hung before flashing, the CPU would not reset. BRANCH=none BUG=none TEST=# Ensure that the chip is hung in on b/147520242 ./local/flash_jlink.py --ip '' # The UART console should reflect a reset and become interactive again Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I5006eff5d3a955ba9b8e6ecee4f72d7ad851f239 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2226520 Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* util/flash_jlink.py: Allow USB modeCraig Hesling2020-06-041-3/+8
| | | | | | | | | | | | | | | | | | | | This adds the option to specify "" for --ip, which will disable the TCP/IP mode. Thus, the JLink tool will default to USB direct. BRANCH=none BUG=none TEST=# Ensure JLinkRemoteServerCLExe is not running ./util/flash_jlink.py --ip '' # Ensure JLinkExe uses direct USB and succeeds TEST=# Ensure "JLinkRemoteServerCLExe -Port 2551 -select USB" is running ./util/flash_jlink.py # Ensure JLinkExe uses TCP/IP and succeeds Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I9da2efa8adf155673f14f12dbb354492b0827332 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2226880 Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* util/flash_jlink.py: Allow using PATH to find JLinkExeCraig Hesling2020-06-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Installing Jlink Debian package places JLinkExe in a PATH area. This allow flash_jlink to find the normal path'ed executable in addition to the hand placed binary. BRANCH=none BUG=none TEST=# Assume JLink_Linux_V670e_x86_64 dir does not exist mkdir ./JLink_Linux_V670e_x86_64 touch ./JLink_Linux_V670e_x86_64/JLinkExe chmod +x ./JLink_Linux_V670e_x86_64/JLinkExe ./util/flash_jlink.py # Should fail TEST=# Ensure the proper JLinkExe is in PATH rm -rf ./JLink_Linux_V670e_x86_64 ./util/flash_jlink.py # Should succeed Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: Ife0c2b7a47f989877f7b81a81a7dadd2b7cb5c1b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2226879 Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* util/flash_jlink.py: Fix formatting + parsing conventionCraig Hesling2020-06-041-14/+15
| | | | | | | | | | | | | BRANCH=none BUG=none TEST=./util/flash_jlink.py --jlink JLinkExe --ip blah # Ensure that the blah parameter was passed Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: Iee38468eb38e91eb3f2b6c19de9c5070f1c0bc5a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2226878 Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* util/flash_jlink: Enforce python3Craig Hesling2020-06-041-1/+1
| | | | | | | | | | | | | | | | | Python 3 is required for the subprocess.run line. Enforcing python 3 helps our non-chroot devs. BRANCH=none BUG=none TEST=# Outside chroot ./util/flash_jlink.py # Ensure the error does not reference subprocess.run Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I057c1b00696a4b356f162795fd1794eba9c54bd7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2226877 Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* servo_updater: Updates the Servo V4.1 nameBrian J. Nemec2020-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | Updates the Servo V4.1 name from 'servo_v41' to 'servo_v4p1' and the corresponding files and fields. As the VID:PID is used to identify the device, no other changes are required. BUG=b:157059356 BRANCH=servod TEST=Updated the ServoV4.1 from 'servo_v41_v2.0.3735+440cf71e0' to 'servo_v4p1_v2.0.4232-514cb4e92' to verify the servo_updater supports renames. TEST=Verified servo_v4p1 manually: Validated console, firmware update, and servod can connect to the device. Signed-off-by: Brian Nemec <bnemec@chromium.org> Depends-On: Ia05134179fab4ff118355ba9b3b1b92cdf0748f2 Change-Id: Ie470469bf9115bbfef14a08c02b156dcd5aed849 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2219124 Tested-by: Brian Nemec <bnemec@chromium.org> Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* console: add micro seconds in timestampsEric Yilun Lin2020-05-301-3/+15
| | | | | | | | | | | | | | | | | | | | | A more precise timestamp will be helpful while debugging with AP and EC uart logs. This CL adds extra 3 micro second digits in timestamps, and also uses 'yy' rather than 'YYYY' year format. BRANCH=none BUG=none TEST=sudo emerge ec-devutils; dut-control timestamp:on see cpu_uart_pty in such format: 20-05-27 15:50:36.034 Developer Console 20-05-27 15:50:36.038 20-05-27 15:50:36.038 To return to the browser, press: Change-Id: I782e6e080f38cbaaa31b0b96fac839e118619266 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2217493 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* flash_ec: keep h1 awake while flashing with c2d2Jett Rink2020-05-261-4/+12
| | | | | | | | | | | | | | | | | | | | | | | The H1 controls the DUT-side i2c muxes that the C2D2 programming path need to stay active. If the H1 goes to sleep during the flash process the flash will fail. Use new dut-control for cr50 that will keep the cr50 from going into a deep low power mode during flashing Also initialize the c2d2 i2c before turning on the DUT-side i2c muxes; this is not strictly necessary, but seems prudent to change. BRANCH=none BUG=b:153475851 TEST=flash waddledee multiple times without issue Cq-Depend: chromium:2188853 Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I39fac618dc6436f547d723364a2273cc03563593 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2189070 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* util: Fix platform name in flash_fp_mcuTom Hughes2020-05-211-13/+12
| | | | | | | | | | | | | | | | | | | | | | | | | cros_config /identity platform-name is specific to mosys and not guaranteed to be the same as the board name. Always use CHROMEOS_RELEASE_BOARD from /etc/lsb-release instead. BRANCH=none BUG=b:156650654 TEST=On ekko: flash_fp_mcu /opt/google/biod/fw/nami*.bin TEST=On kohaku: flash_fp_mcu /opt/google/biod/fw/dartmonkey*.bin TEST=On nocturne: flash_fp_mcu /opt/google/biod/fw/nocturne*.bin TEST=On dratini: flash_fp_mcu /opt/google/biod/fw/bloonchipper*.bin Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ic395e1c6bfdd5c9d4e397a50e594c03d2cf91af1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2212689 Commit-Queue: Yicheng Li <yichengli@chromium.org> Reviewed-by: Yicheng Li <yichengli@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* util: Script for flashing via J-LinkTom Hughes2020-05-151-0/+118
| | | | | | | | | | | | | BRANCH=none BUG=none TEST=make BOARD=bloonchipper -j && \ ./util/flash_jlink.py --board bloonchipper Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ida382ade28451eaab62ca852337256740b81d30f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2191292 Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* util: Remove unnecessary halt in gdbinitTom Hughes2020-05-111-2/+0
| | | | | | | | | | | | | | The reset on the line before is sufficient. BRANCH=none BUG=none TEST=none Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I7eef41a4263764375ff1c8a16bb462edf7b3209c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2190820 Commit-Queue: Craig Hesling <hesling@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org>
* ec: fix `make coverage` code coverage reportingPaul Fagerburg2020-05-111-1/+7
| | | | | | | | | | | | | | | | | | | | | | | Fixed problems that were preventing us from building the unit tests with code coverage testing via `make coverage`. * Changed test_util so that programs will cleanly exit on SIGTERM. * Changed run_host_test to wait for the child process to exit, and only proc.kill() if it times out, so the child process will generate code coverage output files on exit. * Changed Makefile.toolchain to use the --coverage flag for both compile and link. * Changed build.mk and Makefile.rules to exclude certain tests from code coverage because they were causing failures either during the individual stage of code coverage, or generating the overall report. BUG=b:143065231 BRANCH=none TEST=`make coverage` produces results Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Change-Id: I8575013551ce1dba3fd249cd933a3cf6d110db8d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2186853 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* uart_stress_tester: import logging instead of cros_loggingNamyoon Woo2020-05-081-1/+1
| | | | | | | | | | | | | | | | | This patch makes uart_stress_tester.py import logging instead of cros_logging from chromite.lib. BUG=none BRANCH=none TEST=ran uart_stress_tester.py on local chroot and on labstation. Signed-off-by: Namyoon Woo <namyoon@google.com> Change-Id: I479e2b7a046d6c7b02fb4aca2c7e1fc83334e294 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2190826 Tested-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Commit-Queue: Namyoon Woo <namyoon@chromium.org>
* compare_build.sh: Fix chip boards-with parsingCraig Hesling2020-05-071-3/+2
| | | | | | | | | | | | | | | | | This fixes board expansions that use the boards-with search feature. The boards-with function outputs a newline separated list, while the static board expansions emit a space separated list. This allows read to tokenize either format. BRANCH=none BUG=none TEST=./util/compare_build.sh -bstm32f4 TEST=./util/compare_build.sh -bfp Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: Iebf4309fc7ea2ba66a637a5446aa283552ef67c8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2187951 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* compare_build.sh: Add stm32f4 and stm32h7 board groupsCraig Hesling2020-05-071-0/+4
| | | | | | | | | | | BRANCH=none BUG=none TEST=./util/compare_build.sh -b "stm32f4 stm32h7" Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: Ie7645300d3731bbd93449722b674b4806dff8063 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2110536 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* compare_build.sh: Modularize parsing board groupsCraig Hesling2020-05-071-49/+61
| | | | | | | | | | | | | Allow reuse of the board/board-group parsing function. BRANCH=none BUG=none TEST=./util/compare_build.sh -b "mchp fp -nucleo-h743zi" TEST=./util/compare_build.sh Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I7acaeaf93830c10dca2fa49c23593d0940191848 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2110535
* compare_build.sh: Improve board selectionCraig Hesling2020-05-071-29/+135
| | | | | | | | | | | | | | | | | | | | New features: * Add board validation * Add many new board groups BRANCH=none BUG=none TEST=time ./util/compare_build.sh -b "all -all"; echo $? TEST=time ./util/compare_build.sh -b ""; echo $? TEST=time ./util/compare_build.sh -b stm32 -j 7; echo $? TEST=time ./util/compare_build.sh -b hatch_fp -j 7; echo $? TEST=time ./util/compare_build.sh -o -b fp -j 7; echo $? TEST=time ./util/compare_build.sh -o -b bloonchipper; echo $? TEST=time ./util/compare_build.sh -o -b "fp -bloonchipper" -j 7; echo $? Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: Ia802f3b0c595f2c7aafeee8e247077333625888a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2093897
* util: Add support for flashing and debugging unit tests with gdbTom Hughes2020-05-051-4/+10
| | | | | | | | | | | | | | | | | | | | BRANCH=none BUG=none TEST=On machine with dragonclaw attached to J-Trace: JLink_Linux_V670e_x86_64/JLinkGDBServerCLExe -select USB -device STM32F412CG -endian little -if SWD -speed auto -noir -noLocalhostOnly make BOARD=bloonchipper tests -j BOARD=bloonchipper GDBSERVER=segger BIN_NAME=sha256 gdb --ex "target remote 127.0.0.1:2331" Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I6a130c9d4d676d017969aac579d43f995b4dad09 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2172060 Reviewed-by: Harry Cutts <hcutts@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org>
* util: Add support to auto-flash with Segger J-Link gdbserverTom Hughes2020-05-051-5/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Automatically flash the EC binary when running gdb combined with Segger J-Link gdbserver and JTrace. For most code changes, the flashing only takes a 10-20 seconds. Also updated FPMCU debugging docs to mention the gdbinit. BRANCH=none BUG=none TEST=On machine with dragonclaw attached to J-Trace: JLink_Linux_V670e_x86_64/JLinkGDBServerCLExe -select USB -device STM32F412CG -endian little -if SWD -speed auto -noir -noLocalhostOnly BOARD=bloonchipper GDBSERVER=segger gdb --ex "target remote 127.0.0.1:2331" TEST=Same as above, but using CLion for gdb as described in https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/master/docs/fingerprint/fingerprint-debugging.md and setting USING_CLION=FALSE Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I88440c0bc8c9b170b239335a33b3c0a0387447f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2166143 Reviewed-by: Craig Hesling <hesling@chromium.org>
* it8xxx(iteflash): Support KGD FlashDonald Huang2020-04-301-14/+255
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | KGD flash command is different on the erase and program. =================================================================== Command Eflash KGD Page Program No Support 0x02 (256 bytes) AAI WORD Program 0xAD No Support Sector Erase 0xD7(size:1K bytes) 0x20(size:4K bytes) =================================================================== BUG=none BRANCH=none TEST=Check it ok on IT81202 (cr) (333) donald@donald-Aspire-4752 ~/trunk/src/platform/ec $ sudo ./util/flash_ec --board=it8xxx2_evb INFO: Using servo_v2. INFO: Using ec image : /mnt/host/source/src/platform/ec/build/it8xxx2_evb/ec.bin INFO: Flashing chip it83xx. INFO: Closing servod connection to ftdi_i2c interface INFO: Programming EC firmware image using iteflash... Flash enter follow mode enter follow mode FAILED (-5) !please reset EC if flashing sequence is not starting! Flash enter follow mode enter follow mode FAILED (-5) CHIPID 81202, CHIPVER c0, Flash size 1024 kB Done with sending special waveform. EFLASH TYPE = KGD Disabling watchdog... Disabling protect path... Erasing flash...erase size=1048576 \100% Erasing Done. Writing 524288 bytes at 0x00000000....... \100% Writing Done. Verify 524288 bytes at 0x00000000 \ 99% Verify Done. INFO: Flashing done. INFO: Reinitializing ftdi_i2c interface Change-Id: I639a8d049b8a53085e103c4259a92ae5549c6fe6 Signed-off-by: Donald Huang <donald.huang@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1736409 Tested-by: Donald Huang <cguwinds@gmail.com> Reviewed-by: Namyoon Woo <namyoon@chromium.org> Commit-Queue: Donald Huang <cguwinds@gmail.com>
* driver: Add BMI260 basic driver supportChing-Kang Yen2020-04-231-0/+3
| | | | | | | | | | | | | | | | | | | | Add BMI260 accel/gyro driver code. Be able to do initial configuration, start up sensor, config interrupt and fifo, perform calibration, and access the sensor data from AP. BRANCH=None BUG=b:146144827 TEST=make -j4 BOARD=volteer \ && flash_ec --image build/volteer/ec.bin --board volteer Then, check sensor data is available on DUT by "ectool motionsense". TEST=make buildall -j TEST=tast run ${IP} hardware.SensorRing Cq-Depend: chromium:2148802 Change-Id: I5124ee8359a74f98cfe8d26da640325f5e00cb15 Signed-off-by: Ching-Kang Yen <chingkang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2086534 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* flash_ec: reduce C2D2 i2c bus speed from 1Mhz to 400kHzJett Rink2020-04-231-2/+2
| | | | | | | | | | | | | | | Based on the resistors on Dedede (and most likely other future platforms), reduce the i2c bus speed to ensure that our i2c waveform stays within time spec. BRANCH=none BUG=b:153475851 TEST=none Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Icc8de0ea0d2af7d75efce696e96b2c0db67c0fee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2161447 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* util/run_host_test: increase default test timeout to 60sJack Rosenthal2020-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | Most all of our unit tests are very fast (<1s), but in the CQ, we are hitting test timeouts, likely because the CPU is being starved as many packages are being emerged with a high "-j". From a conversation on cros-oncall, apparently this is "WAI" and we should expect that we will run in a highly CPU starved environment, so bump the timeout to account for that. BUG=chromium:1070651 BRANCH=none TEST=sheriffs stop bugging me about test timeouts Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I04033d2f51e4264d5f0741322c608258decb6a2f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2149534 Reviewed-by: Paul Moy <pmoy@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* servo_updater: Add Servo V4.1 to flash and servo updaterBrian J. Nemec2020-04-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Adds the Servo V4.1 to the servo updater as the target 'servo_v41'. Some minor cleanup was done on the servo_updater logic to make it clearer which issue is occurring and to address common substrings in 'servo_v4' and 'servo_v41' by extracting the binary name from the config files directly rather than inferring from the name. BUG=b:153391164 TEST=sudo emerge chromeos-base/ec-devutils TEST=flash_ec --board=servo_v41 --image ec.bin Verify the flash_ec using the STM32 DFU to flash the image on reworked board with compatible BC1.2 change TEST=sudo servo_updater -b servo_v41 Verify the servo_updater finds the latest servo_v4.1 version and flashes it TEST=Attempted to flash V4 and V41 devices with each other's images verified that the checks prevent flashing the other version. Change-Id: I77d94ce9a641f39b7ee446af05e52441b7762c96 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2138638 Tested-by: Brian Nemec <bnemec@chromium.org> Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Commit-Queue: Brian Nemec <bnemec@chromium.org>
* flash_ec: remove warm_reset for it83xx caseJett Rink2020-04-071-6/+5
| | | | | | | | | | | | | | | | We removed the warm reset code for it I2C flashing recent, so we should remove the warm reset clean up section. The cold reset is a superset of warm reset. BRANCH=none BUG=b:153165576 TEST=waddledee flashing works Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Iac691bfa127dac0f279ac92519c58b0e4211873b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2137922 Tested-by: David Schneider <dnschneid@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* flash_fp_mcu: Add a config for the Volteer fingerprint MCUZhuohao Lee2020-04-071-0/+21
| | | | | | | | | | | | | | | To enable the flash_fp_mcu to update the fingerprint MCU firmware, we need to add a config for the Volteer fingerprint MCU. BUG=b:147687800 BRANCH=None TEST=use 'flash_fp_mcu ${BINARY_PATH}', the firmware is programmed correctly. Change-Id: Ib62ae29ca805985e0256c2ebee5fee633ccef082 Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2089214 Reviewed-by: Alex Levin <levinale@chromium.org>
* flash_ec: fix issue with h1 resetJett Rink2020-04-061-31/+35
| | | | | | | | | | | | | | | | When we call cold_reset on waddledee, it actually pulls the H1 down, which will make h1 stop driving the I2C mux, which makes i2c communication fail. We already have a way to hold only the EC in reset from recent Doo changes, so make use of those now for Dee flashing BRANCH=none BUG=b:152936415,b:153165576 TEST=flash Dee and Doo Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I0cafcf1696216ef9ea2ee2169a0b0094140bccc3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2135139 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* EFS2: Add EC_FEATURE_EFS2dnojiri2020-03-311-0/+1
| | | | | | | | | | | | | | | | | | This patch adds EC_EEATURE_EFS2. It allows AP, servo, and a developer to query whether EFS2 is supported or not. Signed-off-by: dnojiri <dnojiri@chromium.org> BUG=b/152449880 BRANCH=none TEST=Verify ectool inventory prints 38 on Helios. Change-Id: Id308cad4115314380ca47c45c3212e2e6fb4095d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2125410 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>