summaryrefslogtreecommitdiff
path: root/util/build.mk
Commit message (Collapse)AuthorAgeFilesLines
* PCHG: Support firmware updateDaisuke Nojiri2021-04-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds EC_CMD_PCHG_UPDATE, which allows the host to update firmware of ctn730 via I2C. An updater (e.g. ectool) is expected to issue EC_PCHG_UPDATE_CMD_OPEN, multiple EC_PCHG_UPDATE_CMD_WRITEs, then EC_PCHG_UPDATE_CLOSE. Each sub-command completion is notified to the host via EC_MKBP_EVENT_PCHG. An updater is supposed to wait for the previous sub-command to complete before proceeding to the next. Example: localhost ~ # ectool pchg 0 State: DOWNLOAD (6) FW Version: 0x104 localhost ~ # ectool pchg 0 update 0x207000 0x105 /path/to/image.bin Update file /path/to/image.bin (85632 bytes) is opened. Writing firmware (port=0 ver=0x105 addr=0x207000 bsize=128): ********************************************************************** FW update session closed (CRC32=0x7bd5c66f). localhost ~ # ectool pchg 0 reset Reset port 0 complete localhost ~ # ectool pchg 0 State: ENABLED (2) FW Version: 0x105 BUG=b:182600604, b:173235954 BRANCH=trogdor TEST=ectool pchg 0 update 0x201200 0x105 /tmp/user_ee_X0.1_V1.5.bin TEST=ectool pchg 0 reset Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I9c62f1714dd69428ab5870c443cb4eb77881a6c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2757099
* make/util: Modularize util make var buildingCraig Hesling2021-02-031-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The key objectives are to * allow util targets to be added from outside of util/build.mk (for adding tools per board, like ectool_servo) * allow for easier conditioning of tool inclusion (for auto adding tools based on characteristic, like CHIP_NPCX) * reduce the number of tools being built (we can remove irrelevant tools for some boards, like removing stm32mon for npcx boards or iteflash for stm32 boards) We have tons of boards in EC now. This takes a significant amount of time to build, so we should be a bit more careful when adding utils for all boards. This and subsequent changes sets the precedent for selectivity. This shifts the initialization/control to the board and baseboard's build.mk and allows the util/build.mk to add items to these variables. Ideally, we would use multiple variables to aggregate the utils selection from the three sources (baseboard/build.mk, board/build.mk, and util/build.mk), but I don't think the addition complexity is currently warranted. BRANCH=none BUG=b:176500425 TEST=# Check all output artifacts from before and after this CL. make clobber make buildall STATIC_VERSION=1 -j mv build build-orig # Apply the change make clobber make buildall STATIC_VERSION=1 -j diff <(find build-orig | sed 's/build-orig//' | sort) <(find build | sed 's/build//' | sort) # Nothing should be different Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I23153850eda10fc1c88d386b9f3cd8296df9c6f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606511 Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* util: Drop ec_uartdPatrick Georgi2020-12-011-2/+1
| | | | | | | | | | | | | | | It is replaced by the hdctools in all current configurations (servod based development). BUG=none TEST=none Change-Id: I56d97d776a8c2aaf47aa39802cc9831c4f3416a7 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2560631 Reviewed-by: Namyoon Woo <namyoon@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* Use host's pkg-config for gen_touchpad_hashMattias Nissler2020-11-261-4/+4
| | | | | | | | | | | | | | | | | This is a helper running on the host, so should use host tooling. Changing this avoids a build failure on cheza where chromeos-ec the would fail to build before the openssl package (which is supposed to work given that chromeos-ec doesn't list openssl in its dependencies, and this pkg-config invocation is not a reason to start doing so). BUG=None BRANCH=None TEST=emerge-cheza -v1 chromeos-ec Signed-off-by: Mattias Nissler <mnissler@chromium.org> Change-Id: I45161285db17a56b29a36549d3b113f42dff9362 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2550660 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* genvif: add genvif.h to dependsDenis Brockus2020-11-121-1/+1
| | | | | | | | | | | | | | | BUG=b:172293518 BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ib2d1443f19667beadca36b3ce726f02e4d0084b6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2535671 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* genvif: Output to .xml pathAbe Levkoy2020-11-031-1/+1
| | | | | | | | | | | | | | | The currently generated format is XML. The GRL C2 software requires the the filename end in .xml to successfully use it. Output to a file with this name. BUG=b:170646602 TEST=make buildall BRANCH=none Change-Id: I54dbfaef1bc76be58a0007039da659562f97e372 Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2514902 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Revert "util: add gen_bmi_config utility"stabilize-13421.53.B-masterstabilize-13421.42.B-masterKeith Short2020-08-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f137f2493db5b5ee27ffc784538b766d5192704d. Reason for revert: Compression of BMI260 config no longer needed. Original change's description: > util: add gen_bmi_config utility > > 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. BUG=b:160330682 BRANCH=none TEST=make buildall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I2bfe8d7bef2a35f43b96cc0cd07209bef534ed63 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2354195 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: caveh jalali <caveh@chromium.org>
* util: add gen_bmi_config utilityKeith Short2020-07-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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>
* usb_pd_policy: Make a lot of objects commonAseda Aboagye2019-12-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a board specific usb_pd_policy.c file that contains a lot of code for handling DisplayPort Alternate mode, Google Firmware Update Alternate mode, as well as some PD policy functions such as deciding to Accept or Reject a data role swap or a power role swap. Several boards simply copy/paste this code from project to project as a lot of this functionality is not actually board specific. This commit tries to refactor this by pulling the functions that are not mainly board specific into common code. The functions are made overridable such that boards that truly do require a different implementation may do so. Additionally, this consolidation changes the policy behaviour for some boards, but they should be for the better. Some examples include that data swaps are always allowed if we are a UFP (no system image requirement), power swaps are allowed to become a sink if we are no longer dual role (e.g. - in suspend), and DisplayPort Alternate Mode is not entered if the AP is off. In order to facilitate this refactor, a couple CONFIG_* options were introduced: - CONFIG_USB_PD_DP_HPD_GPIO /* HPD is sent to the GPU from the EC via a GPIO */ - CONFIG_USB_PD_CUSTOM_VDO /* * Define this if a board needs custom SNK and/or SRC PDOs. * * The default SRC PDO is a fixed 5V/1.5A with PDO_FIXED_FLAGS indicating * Dual-Role power, USB Communication Capable, and Dual-Role data. * * The default SNK PDOs are: * - Fixed 5V/500mA with the same PDO_FIXED_FLAGS * - Variable (non-battery) min 4.75V, max PD_MAX_VOLTAGE_MV, * operational current PD_MAX_CURRENT_MA, * - Battery min 4.75V, max PD_MAX_VOLTAGE_MV, operational power * PD_OPERATING_POWER_MW */ BUG=chromium:1021724,b:141458448 BRANCH=<as many as we can that are still supported> TEST=`make -j buildall` TEST=Flash a kohaku, verify that DP Alt Mode still works with a variety of DP peripherals TEST=Repeat above with a nocturne TEST=Repeat above with an atlas Change-Id: I18fd7e22dc77fe1dc6c21c38cd7f1bc53cae86cb Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1949052 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* util: add build include for private host toolsHarry Cutts2019-10-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | We have provision for private host commands (see the `EC_PRIVATE_HOST_COMMAND_VALUE` macro), but no way to make a private host-side tool that can share the host command protocol implementation in util/. This CL allows a private directory to be symlinked as util/private and have its build.mk file included in the build. For an (internal-only) example of what you might put in private, see https://crrev.com/i/1914158. BRANCH=none BUG=chromium:1008568 TEST=Patch https://crrev.com/i/1914158 in the private repo (or add a util directory there with a build.mk), then from the ec directory, run `ln -s ../private/util util/private`. Run a build and verify that the private build.mk gets run. Change-Id: Ie1ad00cb454ba9ed57e4e9b24d4f5d397ca0d7a5 Signed-off-by: Harry Cutts <hcutts@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1836757 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-191-1/+1
| | | | | | | | | | | | | | | | 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>
* 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>
* mt_scp: Generate IPI tables with util gen_ipi_table.Yilun Lin2019-04-301-0/+8
| | | | | | | | | | | | | | | | | | | | 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>
* 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>
* meowth: remove meowth/zoombini overlays and repositoriesBob Moragues2018-12-081-1/+1
| | | | | | | | | | | | | | BRANCH=none BUG=b:118494679 TEST=Verify PreCQ build Signed-off-by: Bob Moragues <moragues@chromium.org> Change-Id: Id6889d922a2b4d812cc92ddbb35b2581d881459d Reviewed-on: https://chromium-review.googlesource.com/1354316 Commit-Ready: Bob Moragues <moragues@chromium.org> Tested-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* iteflash: add ability to program ITE chips over CCDVadim Bendebury2018-09-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is necessary to be able to program ITE chips using Cr50 as the USB to I2C bridge when Closed Case Debugging (CCD) is enabled. The existing iteflash utility already implements all logic of translating programming commands into sequences of I2C transactions, all what's missing is the ability to send I2C transactions over Cr50 instead of FTDI. This patch adds a new command line option for the iteflash utility, -c for ccd. When given, the utility instead of opening an FTDI connection tries to find a Cr50 USB endpoint for the I2C bridge. A common structure is introduced to communicate the properties of the interface down the stack, such that at the lowest level, when I2C commands need to be synthesized the correct interface is used. Another addition is using a special I2C address to send command to Cr50 to trigger generation of the ITE EC sync sequence (not yet supported on the Cr50 side, implemented in the following patches). BRANCH=none BUG=b:75976718 TEST=verified that iteflash still operates properly - updated the EC image on the dragonegg board. No Cr50 tests yet. Change-Id: Ibcc052b86021c0c4b4dbccadc3fded3100c92ccf Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1212525 Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* common/bootblock: Pack bootblock in EC image.Yilun Lin2018-07-021-0/+7
| | | | | | | | | | | | | | | | | | | Packs a bootblock into EC image. The bootblock content will be firstly tranlated to eMMC emulated data, and then been packed to the RO image. Getting idear from: CL:1039105(which generates eMMC data as a header file). BRANCH=none BUG=b:80159522 TEST=BOOTBLOCK=xyz make BOARD=kukui -j BOOTBLOCK=xyz make BOARD=kukui -j # check it doesn't repack. BOOTBLOCK=abc make BOARD=kukui -j # check it repacks the bootblock. Change-Id: Ia1564d6c54aed7a91fc42210d6247bdecfd82f4e Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1075907 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* hammer: Increase PDU size to 4kNicolas Boichat2018-05-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Saves another ~1300 bytes of flash size, as the touchpad hashes can now be computed in blocks of 4K, instead of 1K. This costs 3K of SRAM, which we would not otherwise need on hammer. wand can only fit 2k PDU, so let's stick to that. Also, make sure that util/gen_touchpad_fw is regenerated when the configuration option changes (touchpad FW size, PDU size). Sadly, this will still break bisection from commit after this CL, to before this CL. BRANCH=poppy BUG=b:80167548 TEST=make buildall -j TEST=make BOARD=hammer/staff/wand/whiskers all tests -j TEST=Copy new staff image with old touchpad FW to DUT, verify that FW can be updated. Change-Id: Ic1763684da730dc986bbbcb3312088c8208c84b5 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1070953 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* genvif: Allow usb_pd_policy.c only in baseboardEdward Hill2018-05-231-7/+11
| | | | | | | | | | | | | | | Update rules for util/genvif to allow usb_pd_policy.c to be present in just baseboard, or just board, or both. BUG=b:78638238,b:79704826 BRANCH=none TEST=make -j buildall Change-Id: I4e2970a65c131d0681d2159fe2ea18b2639048c9 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1067751 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* octopus: move common usb/battery code into baseboardJett Rink2018-04-261-1/+5
| | | | | | | | | | | | | Also implement a few remaining usb function for bip BRANCH=none BUG=b:75972988,b:76218141,b:74132235,b:78344554 TEST=verified yorp still functions Change-Id: I201408b5db689ac4a5bcab0011bc38698271b851 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1024279 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* util: uartupdatetool (UUT): Add tool to flash firmware by UARTCHLin2018-04-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ectool: Print tool versionDaisuke Nojiri2018-02-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
* CBI: Share common code between host tool and firmwareDaisuke Nojiri2018-02-231-1/+1
| | | | | | | | | | | | | | 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
* Fizz/CBI: Buid cbi-util as host-utilDaisuke Nojiri2018-02-161-6/+2
| | | | | | | | | | | | | | | This patch also removes make rules to stop producing CBI blobs. CBI blobs will be produced by another protage package. BUG=b:73123025,chromium:809250 BRANCH=none TEST=emerge-fizz chromeos-firmware-fizz and verify /build/fizz/firmware/cbi contains EEPROM images. Verify emerge ec-utils ec-devutils succeeds. Change-Id: I13744b0ab97675afa0247046bffa3edac3e62ceb Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/909692
* CBI: Add cbi-utilDaisuke Nojiri2018-01-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | cbi-util is a build command line tool, which creates a blob containing board information. When invoked with '--show' option, it prints the information stored in a blob and validates the data. BUG=b:70294260 BRANCH=none TEST=Run the command as follows: $ cbi-util --create /path/to/cbi.bin \ --board_version 0xabcd --oem_id 2 --sku_id 3 --size 256 $ cbi-util --show /path/to/cbi.bin CBI blob: /path/to/cbi.bin BOARD_VERSION: 0.1 (0xab.cd) OEM_ID: 2 (0x02) SKU_ID: 3 (0x03) Data validated successfully $ cbi-util --create /path/to/cbi.bin \ --board_version 0xabcd --oem_id 2 --sku_id 3 Missing required arguments $ cbi-util --create /path/to/cbi.bin --board_version 0xabcde Invalid --board_version Change-Id: I7e7b439c50943523039c3cafda3bdf7d08962c61 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/860961 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ectool: add servo v2 spi supportVincent Palatin2018-01-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new transport for ectool to send host command V3 over the Servo v2 SPI interface using libftdi. Build this new communication mechanism only for the 'build' architecture as it has a dependency on libftdi, the new ectool binary is called ectool_servo. Fix the 'build' tools build if they don't have a source file matching their binary name. The serial number of the servo board can be passed in the 'name' parameter, e.g. : sudo ectool_servo --name=905537-00474 version Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:70320279 TEST=with ZerbleBarn connected to a servo V2, run: sudo ectool_servo version Change-Id: Ia7067d465a42f76695fed5932f32fac9a6d0988e Reviewed-on: https://chromium-review.googlesource.com/864164 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* Makefile: Generate hashes for the touchpad FWNicolas Boichat2017-09-151-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on the passed TOUCHPAD_FW parameter to the make command, the build system generates hashes for the touchpad FW. To generate the hashes, gen_touchpad_hash splits the touchpad FW in blocks of CONFIG_UPDATE_PDU_SIZE, that are hashed individually (SHA-256), and then stored in the EC image. This will allow the USB updater code to verify the integrity of the touchpad firmware being flashed. When no FW is provided, zeros are output, which do not match any valid data. BRANCH=none BUG=b:63993173 TEST=make TOUCHPAD_FW=SA459C-1211_ForGoogleHammer_3.0.bin \ BOARD=hammer -j TEST=Using variations of make TOUCHPAD_FW=SA459C-1211_ForGoogleHammer_3.0.bin \ BOARD=hammer -j make TOUCHPAD_FW=SA459C-1211_ForGoogleHammer_4.0.bin \ BOARD=hammer -j make BOARD=hammer -j Check that TPHASH touchpad_fw_hash.h is only regenerated when the parameter changes. Change-Id: Ie347270aa9c00342de13489c9422e45e681b94c2 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/615321 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* util/build.mk: Fix makefile dependencies of export_taskinfoChe-yu Wu2017-09-061-0/+2
| | | | | | | | | | | | | | | | | export_taskinfo is a utility used by the stack analyzer. This patch makes sure it will be recompiled when the EC code changed. BUG=none BRANCH=none TEST=make BOARD=eve -j && make BOARD=eve analyzestack Add a fake task in board/eve/ec.tasklist make BOARD=eve -j && make BOARD=eve analyzestack The fake task shows in the report Change-Id: I57c2700610680975571d254e0059571556f184fe Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/651449 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ec: Fix missing Makefile dependencies.Che-yu Wu2017-09-051-1/+1
| | | | | | | | | | | | | | | Add the extra dependencies to "deps-y" and include it in "deps". BUG=chromium:761922 BRANCH=none TEST=Add "$(info $(deps))" before "-include $(deps)" in Makefile.rules make BOARD=eve utils | grep "build/eve/util/usb_pd_policy.o.d" There is "build/eve/util/usb_pd_policy.o.d" Change-Id: I77670a8e90a1a913943fcba143402318aaf7d274 Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/649455 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ec: Add a task information library for the stack analyzer.Che-yu Wu2017-08-151-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a shared library to export task information. Modified the stack analyzer to get information from the shared library. Show allocated stack sizes of tasks in the stack analyzer. To get the all task information (including the allocated stack size), A shared library is added and compiled with the board to export all configurations of the tasklist. BUG=chromium:648840 BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \ --objdump=arm-none-eabi-objdump \ --addr2line=arm-none-eabi-addr2line \ --export_taskinfo=./build/elm/util/export_taskinfo.so \ --section=RW \ ./build/elm/RW/ec.RW.elf make BOARD=${BOARD} SECTION=${SECTION} analyzestack Change-Id: I72f01424142bb0a99c6776a55735557308e2cab6 Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/611693 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* genvif: Prevent undefined referencer when using APIs not provided by genvifSam Hurst2017-07-141-1/+2
| | | | | | | | | | | | | | | | | | | | | Problem was detected while using ccprintf to debug a data role swap requests issue. To prevent errors similar to this, surround the API call as follows: ifndef VIF_BUILD ccprints("I won't generate an undefined reference when building genvif"); endif BUG=b:63664511 BRANCH=None TEST=`make -j buildall` Change-Id: Ieab9eaa638320cae67995a67c843d08b54acfbcb Signed-off-by: Sam Hurst <shurst@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/570820 Commit-Ready: Sam Hurst <shurst@google.com> Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* pd: Make build of VIF utility less verboseSam Hurst2017-05-091-2/+1
| | | | | | | | | | | | BUG=none BRANCH=none TEST=make -j buildall Change-Id: I37be7abde31d20e0f4227db97e6751c2998f418b Reviewed-on: https://chromium-review.googlesource.com/499871 Commit-Ready: Sam Hurst <shurst@google.com> Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: Support auto generation of USB Type-C VIFSam Hurst2017-05-031-0/+15
| | | | | | | | | | | | | | | | | | Create an app to extract relevant information from the EC code base that's used to create Vendor Information Files (VIFs) needed for USB Type-C compliance testing. BUG=chromium:701852 BRANCH=none TEST=make -j buildall Compared generated VIFs to expected values Change-Id: I600ca78b9fb5d2de78aa65a58264c6f79b36ea17 Reviewed-on: https://chromium-review.googlesource.com/455280 Commit-Ready: Sam Hurst <shurst@google.com> Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* util: Add ec_parse_panicinfo tool to parse binary panicinfoNicolas Boichat2016-09-061-2/+5
| | | | | | | | | | | | | | | | | To be able to parse binary panicinfo from feedback reports, we need a host tool: - Move panicinfo generic parsing functions to a separate C file - Create a new host utility to parse panicinfo BRANCH=none BUG=chromium:643062 TEST=base64 -d | ec_parse_panicinfo Change-Id: Idd8560a2894f270d0ab3a9f654c333135759e57f Reviewed-on: https://chromium-review.googlesource.com/379639 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* util: npcx: Fix build for ARM host boardsShawn Nematbakhsh2015-12-301-2/+2
| | | | | | | | | | | | | | | | | ecst is used at build / link time, so it should be compiled for the build machine architecture, not the architecture of the host board. BUG=chromium:567232 TEST=Verify 'cros_sdk ... cros_run_unit_tests --board=oak' passes with CL:319256. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ic7f6aa989d0760eda1fe64221e41d3230c9ab9b9 Reviewed-on: https://chromium-review.googlesource.com/319633 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* nuc:Ian Chao2015-07-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add ECST tool to modify the header used by npcx booter. Modified drivers: 1. i2c.c: Modify for i2c_port design. 2. i2c.c: Fixed bugs when mutil-tasks use the same i2c port and pull-up issue. 3. hwtimer.c: Fixed bug whcih event expired time is behide current timer. 4. lpc.c: Add intializing host settings after pltrst is deasserted. 5. uart.c/clock.c/register.h: Fixed bug which cannot enter deep-idle when gpio is any-edge trigger mode. 6. task.c: Add workaround method for hard fault issue. 7. keyboard_raw.c: Modified for support CONFIG_KEYBOARD_KSO_BASE 8. lpc.c: Modified for support CONFIG_KEYBOARD_IRQ_GPIO 9. lpc.c: fixed obe interrupt bug during 8042 initialization 10.Adjust path of flat files for new Makefile rules 11.Fixed build error on lpc.c without CONFIG_KEYBOARD_IRQ_GPIO BUG=chrome-os-partner:34346 TEST=make buildall -j; test nuvoton IC specific drivers BRANCH=none Change-Id: Icf9494174b245b4026e396be877d578f36b6f6a5 Signed-off-by: Ian Chao <mlchao@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/284036 Reviewed-by: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Commit-Queue: Shawn N <shawnn@chromium.org>
* ectool: query packet size and set them properly internally.Gwendal Grignou2015-05-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow to negotiate the packet command and responses to whatever values the EC can support. Set the buffer size including the necessary V3 header. If the EC run v3 protocol with large packet support, but the kernel does not have v3 support (3.10), we can not support sending or receiving large commands. Be aware that on 3.10, commands like ectool console will fail if the EC wants to send command larger than the kernel can handle. Copied kernel_version_ge from libusb-1.0.19/libusb/os/linux_usbfs.c. BUG=chrome-os-partner:31989,chrome-os-partner:31660,chromium:454324,chrome-os-partner:39265 BRANCH=none TEST=Build a special firmware to exchange 300 bytes. Check ectool console works with the righ size. Check that ectool is calling uname. Check on Nyan_big: without change, "ectool version" crashes kernel. With changes, "ectool version" works. In conseuqence, it reverts commit be0bd9b83538427cc350ad38d64b821dfcad82a0, "ectool: Do not increase buffer size after probe max size from ec" Change-Id: I54ffd43488ea81272f30789dc87a261085769fe0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274086 Reviewed-by: Shawn N <shawnn@chromium.org>
* clean up x86 i/o checksMike Frysinger2015-04-171-4/+1
| | | | | | | | | | | | | | | | Rather than hardcode a specific mips toolchain, do a build-time test to see if the target is x86 based. BUG=chromium:443783 TEST=link still includes comm-lpc TEST=arm64 omits comm-lpc BRANCH=none Change-Id: I0253df6cbe89bee231ec643dd6bb3498eb040708 Reviewed-on: https://chromium-review.googlesource.com/265793 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* util: Remove mec1322 comm driverShawn Nematbakhsh2015-04-101-4/+0
| | | | | | | | | | | | | | | | | The mec1322 LPC / EMI comm driver is no longer functional due to recent EC changes. Rather than re-implementing a working driver across user space tools, the plan of action is to use the kernel device driver (through comm-dev) for all access. BUG=chrome-os-partner:38103 TEST=Manual on glower with pending kernel cros_ec_lpc changes. Verify "ectool version" and "ectool gpioget" succeed. BRANCH=None Change-Id: I770cb06ca534a7c31794e6b37c226e952361ee32 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/265031 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* sb_firmware: write PID to lockfile for powerdSheng-Liang Song2015-03-271-0/+1
| | | | | | | | | | | | | | | Add logic to write PID to /var/lock/battery_tool_powerd.lock while performing destructive battery firmware update actions. BUG=chrome-os-partner:36310 BRANCH=none CQ-DEPEND=CL:261318 TEST=Verified on glimmer. Change-Id: I47f34a3a2cb890e66591ef16ac5cf7186d662900 Signed-off-by: Sheng-Liang Song <ssl@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/260868 Reviewed-by: Shawn N <shawnn@chromium.org>
* ec util: do not compile IO mapped memory related code for mips.Gwendal Grignou2015-01-131-0/+2
| | | | | | | | | | | | | | | | | MIPS host CPU does not access IO registers using a separate address space. Remove for support of LPC for this host architecture. Confine x86 function to Intel Architecture only. BRANCH=none TEST=Compile: Test on ARM, MIPS and X86: using emerge... ec-utils. BUG=chromium:443783 Change-Id: I9d4276ec3588037adfcff96e596bbe8be74f22fd Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/236687 Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Makefile: remove burn_my_ecGwendal Grignou2014-12-151-6/+3
| | | | | | | | | | | | | | | | | | burn_my_ec is an utility that flash an image embedded in its code. We can not compile it as part of ec-[dev]utils, because we have devices that firmware should be build as part of chrome-ec package. Remove burn_my_ec, barely used. Split the makefile to build just the host utility when requested. BRANCH=ToT BUG=chrome-os-partner:32025,chromium:408713 TEST=Check that files are stil built when needed and not when utils-host is invoked. Change-Id: I3fabe16067d57c74ae36b05138f4c6fd2483c7c4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/233347
* ectool: compile LPC and i2C support by default.Gwendal Grignou2014-11-051-3/+2
| | | | | | | | | | | | | | | | Currently, LPC or I2C are compiled based on the board.h. This is not really necessary, code can handle both at the same time. Note that LPC and I2C access mode are backup modes, the main mode is dev (accessing ECs through /dev/cros_XX). BRANCH=None BUG=chromium:408713 TEST=Compile, tested on Ryu and Samus. Change-Id: I8b4730f0f5708c543dc034165e9b53de0e543860 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/227432 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* zinger: Remove references to SHA1 hashShawn Nematbakhsh2014-10-091-1/+1
| | | | | | | | | | | | | | | | The PD protocol no longer uses a SHA1 RW hash. Instead, it uses the first 20 bytes of the SHA-256 hash. Update constants and comments accordingly. BUG=chrome-os-partner:31361 TEST='make buildall -j' BRANCH=samus Change-Id: Ice74b841dbd1d81205c1ef0079a5e18fca2153b6 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/222446 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add compiler/decompiler for lightbar bytecode programs.Bill Richardson2014-09-301-1/+1
| | | | | | | | | | | | | | | | | BUG=none BRANCH=ToT TEST=manual make BOARD=samus for i in extra/lightbar/programs/[g-z]*.bin; do ./build/samus/util/lbcc -d $i /tmp/x.lbs ./build/samus/util/lbcc /tmp/x.lbs /tmp/x.bin cmp $i /tmp/x.bin done Change-Id: I86c014c425e917ecafadd1c6845fcf2e5b4edbb7 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220244
* EC: Add util for battery firmware updateSheng-Liang Song2014-09-051-2/+5
| | | | | | | | | | | | | | | | | Ref: Common Smart Battery System Inferface Specification v8.0. Implemented smart battery firmware update util based the above spec. BUG=chrome-os-partner:24741 CQ-DEPEND=CL:210032 CQ-DEPEND=CL:210033 CQ-DEPEND=CL:215720 BRANCH=ToT TEST=Verified LGC & Simplo Battery Update on glimmer Change-Id: Ia61a49f4643ea349d42a4b87d6010c1ac011729b Signed-off-by: Sheng-Liang Song <ssl@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/205324 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* stm32mon: add support for i2c transport.Gwendal Grignou2014-09-041-2/+2
| | | | | | | | | | | BUG=chromium:405601 TEST=Able to read/erase/write flash on Ryu. Able to send go command. BRANCH=ToT Change-Id: I588cfee3dbbb3d8e3b66fe9d1044f3612f9b02c3 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/214032 Reviewed-by: Vic Yang <victoryang@chromium.org>
* samus: add host commands for flashing zinger RWAlec Berg2014-08-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new host commmand for sending RW updates to PD devices. The host command has a variety of sub-commands for performing the update, including: erase RW, reboot, write new hash, write flash. To program zinger RW, you should send host commands in this order: write new hash to all 0's reboot (zinger boots into RO since RW hash doesn't match) erase RW write flash write new hash to match contents of RW reboot This also adds an ectool command to write a new RW. Just pass it the RW .flat or .bin file. BUG=chrome-os-partner:31361 BRANCH=none TEST=ectool --dev=1 --interface=lpc flashpd 0 0 zinger.RW.flat Change-Id: Ia81615001b83ad7ee69b1af2bf1d7059177cde04 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213239 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* mec1322: temporary hack for using EMI moduleVic (Chun-Ju) Yang2013-12-041-1/+3
| | | | | | | | | | | | | | | | | | We are using EMI module instead of LPC memory transaction. This requires a different protocol for accessing mapped memory from host. For easier development, let's add a new comm-mec1322.c until we can switch back to LPC memory transaction. BUG=chrome-os-partner:24280 TEST=ectool version TEST=util/make_all.sh BRANCH=None Change-Id: Id8914d0413561991d3e46bef7e3fe76c4f8b83e4 Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/178251 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* util: declare all host utils source dependencies in build.mkVincent Palatin2013-11-141-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of hardcoding the common files for host utils in the generic rules, let's declare them in the build.mk file using the same system as the Linux kernel build. if a binary "foo" declared in "host-util-bin" or "build-util-bin" has a matching "foo-objs" variable, it will be build from all objects declared in "foo-objs" else it uses directly "foo.o" (single source file). This is preparatory to add new "build" tools sharing common sources. note: the dependencies on the utils are a bit less fine-grained as a result of this change, but given the low number of tools, that should be acceptable. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=./util/make_all.sh Change-Id: Ieffce7ca6f5b685ffb7d1f4626b99aff07b61443 Reviewed-on: https://chromium-review.googlesource.com/176174 Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>