summaryrefslogtreecommitdiff
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* boringssl: Add elliptic curve key helpersYi Chou2023-05-161-0/+3
| | | | | | | | | | | | | | | BUG=b:248508087 TEST=make V=1 BOARD=bloonchipper -j TEST=./test/run_device_tests.py --board bloonchipper -t boringssl_crypto => PASS TEST=./test/run_device_tests.py --board dartmonkey -t boringssl_crypto => PASS Change-Id: Ifdca7743c09910d413407be986e9d959e5b90479 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4505560 Tested-by: Yi Chou <yich@google.com> Commit-Queue: Yi Chou <yich@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* boringssl: Implement sysrand from TRNGYi Chou2023-05-161-0/+12
| | | | | | | | | | | | | | | | | | The boringssl doesn't include the TRNG implementation, we need our own CRYPTO_sysrand. BUG=b:248508087 TEST=make V=1 BOARD=bloonchipper -j TEST=./test/run_device_tests.py --board bloonchipper -t boringssl_crypto => PASS TEST=./test/run_device_tests.py --board dartmonkey -t boringssl_crypto => PASS Change-Id: I3136bcc96e09f674278bf338297d7bc0576e174c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4496289 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Yi Chou <yich@google.com> Tested-by: Yi Chou <yich@google.com>
* Add ability to get struct offsets for use in assemblyTom Hughes2022-10-211-0/+1
| | | | | | | | | | | | | | BRANCH=none BUG=b:172020503 TEST=Using https://crrev.com/c/3299275: make BOARD=discovery-stm32f072 -j manually inspect generated file: build/discovery-stm32f072/RW/core/cortex-m0/asm_offsets.h Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I6c5a982a88ed1e77f8e98b9a0a451d52d5c03a87 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3299274 Reviewed-by: Diana Z <dzigterman@chromium.org>
* libc: Implement _exit(), which is needed by libcTom Hughes2022-10-141-0/+6
| | | | | | | | | | | | | | _exit() is called by libc functions such as abort() or exit(). This implementation replaces the one from newlib's libnosys. BRANCH=none BUG=b:234181908 TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I1d8f65fa206b3544a2772f38be854ee905532ad3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3933256 Reviewed-by: Andrea Grandi <agrandi@google.com>
* Makefile: Only build host-utils for BOARD=hostTom Hughes2022-10-121-0/+2
| | | | | | | | | | | | | | | | In EC terminology, "host" refers to the target platform on top of the EC. It only makes sense to build the host utilities for the host board, not the board running the EC firmware. BRANCH=none BUG=b:252817153 TEST=make buildall Force-Relevant-Builds: all Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I255024c6b2fa8cababdfbed6501730d5dd6308a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3943248 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util: Compile ectool (and other utils) with C++Tom Hughes2022-09-221-0/+3
| | | | | | | | | | | | | | | | The utils only run on the host, so we have no restrictions on compiler. Use C++ so that ectool can use "libec". BRANCH=none BUG=b:144959033 TEST=make buildall Force-Relevant-Builds: all Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I44b9bb25b2659b678bc4b71e203a1901eff51b13 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2556757 Reviewed-by: Yuval Peress <peress@google.com> Code-Coverage: Yuval Peress <peress@google.com>
* Makefile: Set prefixed toolchain for hostTom Hughes2022-09-161-2/+0
| | | | | | | | | | | | | | | | When building with portage, the build fails if we use the "unprefixed" compiler (e.g., "g++"). Explicitly use the prefixed compiler when building for the host. BRANCH=none BUG=b:246424843 TEST=emerge-hatch chromeos-ec Force-Relevant-Builds: all Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I50d2b437374bf6857b19151edb5eaea24a7330c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3894407 Reviewed-by: Eric Yilun Lin <yllin@google.com>
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Makefile: Add option to compile with the C standard libraryTom Hughes2022-07-191-0/+6
| | | | | | | | | | | | | | | | | Add the USE_BUILTIN_STDLIB variable, which defaults to 1 and will use the EC standard library implementation (the "builtin" directory). When USE_BUILTIN_STDLIB is set to 0, the toolchain's C standard library will be used instead. BRANCH=none BUG=b:234181908 TEST=./util/compare_build.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I63285569205b9c560655dfead6a260c270a92494 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3712035 Reviewed-by: Eric Yilun Lin <yllin@google.com>
* tree: Move stdlib implementation to builtin directoryTom Hughes2022-07-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keeping all of the standard library implementation in a single directory makes it easier to choose between EC's implementation or the implementation from the toolchain. BRANCH=none BUG=b:234181908, b:172020503 TEST=make buildall -j TEST=Using icetower v0.1, Segger J-Trace, and servo micro: ./test/run_device_tests.py -b dartmonkey Test "aes": PASSED Test "cec": PASSED Test "cortexm_fpu": PASSED Test "crc": PASSED Test "flash_physical": PASSED Test "flash_write_protect": PASSED Test "fpsensor_hw": PASSED Test "fpsensor_spi_ro": PASSED Test "fpsensor_spi_rw": PASSED Test "fpsensor_uart_ro": PASSED Test "fpsensor_uart_rw": PASSED Test "mpu_ro": PASSED Test "mpu_rw": PASSED Test "mutex": PASSED Test "pingpong": PASSED Test "printf": PASSED Test "queue": PASSED Test "rollback_region0": PASSED Test "rollback_region1": PASSED Test "rollback_entropy": PASSED Test "rtc": PASSED Test "sha256": PASSED Test "sha256_unrolled": PASSED Test "static_if": PASSED Test "system_is_locked_wp_on": PASSED Test "system_is_locked_wp_off": PASSED Test "timer_dos": PASSED Test "utils": PASSED Test "utils_str": PASSED Test "panic_data_dartmonkey_v2.0.2887": PASSED Test "panic_data_nocturne_fp_v2.2.64": PASSED Test "panic_data_nami_fp_v2.2.144": PASSED Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I75f8591e87a9076d47208eb598186a391c77966d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3724488 Reviewed-by: Edward Hill <ecgh@chromium.org>
* Makefile: Make sure CROSS_COMPILE is set correctlyTom Hughes2022-06-211-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When testing a change to set the default compiler to clang for dartmonkey, I encountered an error when building with "make proj-bloonchipper": ccache: error: execv of /opt/coreboot-sdk/bin/arm-eabi-clang failed: No such file or directory In this case the CC variable (defined in Makefile.toolchain as "CC=$(CCACHE) $(CROSS_COMPILE)$(cc-name))" had CROSS_COMPILE set to "/opt/coreboot-sdk/bin/arm-eabi-" (gcc toolchain) and cc-name set to "clang", which is not correct. The problem was that the Makefile has simply expanded variables (https://www.gnu.org/software/make/manual/html_node/Flavors.html#Flavors) that reference CC before the core/$(CORE)/build.mk is included (e.g., "_tsk_lst_ro" that uses CPP, which is defined as "CPP=$(CC) -E"). This change pulls the toolchain configuration out of core/$(CORE)/build.mk into a separate core/$(CORE)/toolchain.mk file that is included earlier in the top-level Makefile, which ensures that CC is defined before it is used by the simply expanded variables. BRANCH=none BUG=b:172020503, b:234181908 TEST=make proj-bloonchipper -j TEST=./util/compare_build.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ia41d2de61ee786df044d484c146d6970de183562 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3706036 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* test/run_device_tests.py: Add private testsAndrea Grandi2022-04-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the list of tests is hard-coded in the Python script. Add ability to fetch additional tests from the private folder, if available. This is a reland of commit b97ba790690d1ee86c001ef0a82be5897645ae2f BRANCH=none BUG=b:226385185 TEST=cros lint test/run_device_tests.py TEST=make V=1 run-<private_test> TEST=test/run_device_tests.py --flasher=jtrace --remote=localhost --board=dartmonkey TEST=test/run_device_tests.py --flasher=jtrace --remote=localhost --board=dartmonkey --tests=<private_test> Cq-Depend: chrome-internal:4650299, chrome-internal:4650281, chrome-internal:4650279 Signed-off-by: Andrea Grandi <agrandi@google.com> Change-Id: I67866ced27414d495bfad5eff9825cf68c8c22cf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3562041 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Feels: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Bobby Casey <bobbycasey@google.com> Feels: Bobby Casey <bobbycasey@google.com>
* Revert "test/run_device_tests.py: Add private tests"Hsu Wei-Cheng2022-03-301-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit b97ba790690d1ee86c001ef0a82be5897645ae2f. Reason for revert: failed chromeos-fpmcu-unittests Original change's description: > test/run_device_tests.py: Add private tests > > Currently, the list of tests is hard-coded in the Python script. > Add ability to fetch additional tests from the private folder, if > available. > > BRANCH=none > BUG=b:226385185 > TEST=cros lint test/run_device_tests.py > TEST=make V=1 run-<private_test> > TEST=test/run_device_tests.py --flasher=jtrace --remote=localhost > --board=dartmonkey > TEST=test/run_device_tests.py --flasher=jtrace --remote=localhost > --board=dartmonkey --tests=<private_test> > > Cq-Depend: chrome-internal:4633118, chrome-internal:4639001 > Signed-off-by: Andrea Grandi <agrandi@google.com> > Change-Id: I6d84b652d8f0e3d479bb227cbcc25d0b6f8f274b > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3544427 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> Bug: b:227414670, b:226385185 Cq-Depend: chrome-internal:4647165, chrome-internal:4647014 Change-Id: I751a8e0953f6d61a14ff9065ec930bdb774b5364 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3559970 Reviewed-by: David Stevens <stevensd@chromium.org> Reviewed-by: Morg <morg@chromium.org> Owners-Override: Morg <morg@chromium.org> Tested-by: Hsu Wei-Cheng <mojahsu@chromium.org> Commit-Queue: Hsu Wei-Cheng <mojahsu@chromium.org>
* test/run_device_tests.py: Add private testsAndrea Grandi2022-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | Currently, the list of tests is hard-coded in the Python script. Add ability to fetch additional tests from the private folder, if available. BRANCH=none BUG=b:226385185 TEST=cros lint test/run_device_tests.py TEST=make V=1 run-<private_test> TEST=test/run_device_tests.py --flasher=jtrace --remote=localhost --board=dartmonkey TEST=test/run_device_tests.py --flasher=jtrace --remote=localhost --board=dartmonkey --tests=<private_test> Cq-Depend: chrome-internal:4633118, chrome-internal:4639001 Signed-off-by: Andrea Grandi <agrandi@google.com> Change-Id: I6d84b652d8f0e3d479bb227cbcc25d0b6f8f274b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3544427 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* stm32: Add the DFU Boot ManagerBrian J. Nemec2022-02-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added the DFU Boot Manager to control the switch between the DFU and main application region. The DFU Bootmanager performs self checks when the application boots. If any of the following conditions are true it will jump into DFU: * The system backup registers contain a 'Jump to DFU' request. * The start of the RW region is erased indicating the prior firmware update has failed. * An optional check can be enabled to record the number of consecutive unexpected reboots which will be useful for developer test images to avoid locked systems. Testing requires enabling multiple configuration settings set in the follower CL which enables it on Servo_v4. dfu-util version 0.9 lacks the 'leave' parameter required to automatically jump out, systems using this would need to be power cycled to leave DFU. BRANCH=servo BUG=b:217955677 TEST=Enabled the DFU configuration on a Servo_v4. Verified that the runtime identifier is correctly recognized by dfu-util and pydfu.py implementations of the DFU host protocol. Verified firmware updates via the DFU protocol function correctly. TEST=sudo dfu-util -a 0 -s 0x08000000:leave -e -D ec.bin Verified that dfu-util can program the application region. Signed-off-by: Brian Nemec <bnemec@chromium.org> Change-Id: Ie535efc91318244574949542c03efa0b5973cbe5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3443960 Tested-by: Brian Nemec <bnemec@google.com> Reviewed-by: Sam Hurst <shurst@google.com> Commit-Queue: Brian Nemec <bnemec@google.com>
* tree: Delete chip/lm4 and board/bdsTom Hughes2022-01-221-1/+1
| | | | | | | | | | | | | | | | | | While working on https://crrev.com/c/3373621, I noticed that either the comment or code was wrong in chip/lm4/clock.c. chip/lm4 is only used by the "bds" board, which doesn't appear to be used anymore, so just delete it. BRANCH=none BUG=b:200828093 TEST=make buildall -j Cq-Depend: chromium:3378222 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I444a9a6e2c853dc4f9f3d799182daaeb110b1277 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3373622 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* ec: Improve coverage report.Jeremy Bettis2021-04-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | Exclude the test directories from ec coverage report. Include the test name into the coverage data. Show the test name details in the coverage report. Build several boards with coverage enabled, and use that to make sure all used files are in the coverage report. This lowers the coverage to 38.4% which seems much more realistic than the old value. BRANCH=none BUG=b:156895937 TEST=make -j coverage Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I91fc5bc7ce676943d34e91e16662e680628d1b7e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2811939 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* make/util: Modularize util make var buildingCraig Hesling2021-02-031-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* No init.rom section support in ZephyrHyungwoo Yang2021-01-221-1/+1
| | | | | | | | | | | | | | | | | Building zephyr generates a warning on init.rom section. This change removes init.rom section declaration in Zephyr build. The change also added third_party into include folders so files in third_party now can be included in Zephyr build. BUG=b:173508071 BRANCH=none TEST=make BOARD=volteer -j8 build volteer on zephyr Change-Id: Ic86866e41d87d83c00a06a207a352a25fe57054b Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2638135 Reviewed-by: Keith Short <keithshort@chromium.org>
* tcpm: Move tcpm.h into an include directorySimon Glass2020-12-221-1/+1
| | | | | | | | | | | | | | | | | | This header file is used from quite a few files, relying on the EC build system to find includes in the driver/tcpm directory. For Zephyr we don't want to add that as an include. It makes more sense for header files to be in an include directory, so move it and fix up the users. BUG=b:175434113 BRANCH=none TEST=build Zephyr and ECOS on volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I5851914b1a7d3fdc1ba911c0fbe9046afbaf6f5d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597985 Reviewed-by: Keith Short <keithshort@chromium.org>
* Makefile: add support for private-kandou directoryKeith Short2020-09-221-1/+3
| | | | | | | | | | | BUG=b:168930682 BRANCH=none TEST=make buildall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I658f309644cdbeb050523cab722de71bb052bf25 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2421301 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* kukui: include a dummy bootblock if BOOTBLOCK variable not setTing Shen2019-12-191-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a dummy bootblock to make sure size check is accurate during `make buildall`. The default size is picked from build 12769.0: $ ls -al */coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:20 kodama/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:20 krane/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:20 kukui/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:33 damu/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:33 jacuzzi/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:33 juniper/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:33 kappa/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:21 flapjack/coreboot/bootblock.bin BUG=chromium:1034518 TEST=1) make buildall # use dummy bootblock 2) make BOARD=kukui # same as above, ~1.7k bytes left 3) make BOARD=kukui BOOTBLOCK=/dev/null # empty bootblock, 23k bytes left 4) make BOARD=kukui BOOTBLOCK=a-large-file # fail early before linking BRANCH=kukui Change-Id: I65c18f567dce0cb315e0cdc4f30ada5e83275d72 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1973550 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* makefile: support PORT for flash_ecYilun Lin2019-08-291-0/+3
| | | | | | | | | | | | | | Add variable PORT to select the flashing port. TEST=make BOARD=kukui flash_ec PORT=9998, and flash success BUG=none BRANCH=none Change-Id: Ic9ba318ffee70ec1f7789f2dcccc6025263e5436 Signed-off-by: Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1770330 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* mock: Add mock structure for fuzzers and testsCraig Hesling2019-07-311-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces the common/mock and include/mock directories which hold mock implementations of other common libraries. The general idea it to create mocks which can be used in simple scenarios, by providing meaningful default return values and functionality, and more complicated scenarios like fuzzers, where the return values need to continuously change. The build system has been adapted to allow the inclusion of a new .mocklist file for tests and fuzzers. This file specifies exactly which mocks will be pulled into the build for a given test/fuzz. In order to maintain cleanliness, this file is optional. Examples: * http://crrev.com/c/1682945/17 makes use of three different mocks, one of which is the rollback mock. * An upcoming rollback unit test ( http://crrev.com/c/1686460 ), needs to pull in mocks that support the rollback interface, but explicitly cannot pull in the rollback mock. BRANCH=none BUG=b:116065496 TEST=make buildall -j Change-Id: Ib87b1a93b6d73309afaf7115276ead49218598ff Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1719569 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-16/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ec: common: Make IS_ENABLED fail on unknown valuesRaul E Rangel2019-05-151-2/+3
| | | | | | | | | | | | | | | | | If IS_ENABLED is called with any unknown values, a compiler error will be thrown. This change requires that the optimizer always be enabled, otherwise errors will be thrown when a value is not defined. BUG=none BRANCH=none TEST=make runtests TEST_LIST_HOST="is_enabled_error is_enabled" Change-Id: I1b166311f81d07e48b3665f4bc0e9502d2ccc4c6 Signed-off-by: Raul E Rangel <rrangel@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1592728 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* cr50: rebuild board image if essential make variables changeVadim Bendebury2019-05-101-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* makefile: don't build ro if EC_INCLUDE_RO not setTing Shen2019-05-081-1/+4
| | | | | | | | | | | | | | BUG=b:121406695 TEST=make BRANCH=None Change-Id: Ib678678330837fefffd12a7ac445038661639e8c Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/1595929 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Makefile: Clarify/fix PDIR assignementNicolas Boichat2019-02-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous version has this: PDIR=$(subst /board/$(BOARD),,$(BDIR)) which is a little confusing as, when no public board overlay is set, BDIR is only set to PBDIR _after_ this statement (but the logic works as Makefile = recursively expands). Also, this does not set PDIR correctly if both PBDIR and BDIR are set (board overlay in both public and private). It is much simpler to just use, as PBDIR is set correctly in both cases, at that point in the function: PDIR:=$(subst /board/$(BOARD),,$(PBDIR)) BRANCH=none BUG=b:124804731 TEST=On m/master make buildall -j; mv build build.old After this CL: make buildall -j ls build/*/*/ec.*.smap | sed -e 's|build/||' | \ xargs -I{} diff build/{} build.old/{} => no difference Change-Id: I0a7a0c631b9b72dfcbf11d7cfd78bbaf3e21f1d5 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1485035 Reviewed-by: Yilun Lin <yllin@chromium.org>
* Makefile: Allow board to be both in public and private foldersNicolas Boichat2019-02-211-7/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | All current boards only exist in either board/$BOARD, or in private-*/board/$BOARD. However, for kukui_scp, we want to be able to use the same target for public and private builds, extending functions by adding some files in private-mt8183/board/kukui_scp. Change the Makefile inclusion logic to make this possible. BRANCH=none BUG=b:124804731 TEST=On m/master make buildall -j; mv build build.old After this CL: make buildall -j ls build/*/*/ec.*.smap | sed -e 's|build/||' | \ xargs -I{} diff build/{} build.old/{} => no difference Change-Id: I595a7b9159d5c9a54f25a8e7d09437ab47d3dbcd Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1475107 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Makefile: Drop warning about using ASAN by defaultNicolas Boichat2018-12-281-1/+0
| | | | | | | | | | | | | | | | The warning is distracting in build output. If TEST_FUZZ is set, it is sensible to use TEST_ASAN by default, let's not print any warning. BRANCH=none BUG=none TEST=make buildall -j >/dev/null => No more warnings. Change-Id: I8875b7f63154a4e051a5bb29f6640d4ee2923c19 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1389990 Tested-by: Allen Webb <allenwebb@google.com> Reviewed-by: Allen Webb <allenwebb@google.com>
* Makefile.rules: Add buildfuzztests to buildall.Allen Webb2018-12-191-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This incorporates the fuzz targets into buildall and adds a quick sanity check to each fuzz target to make sure it exits successfully for an empty input. This adds roughly 5.88 seconds to "make -j buildall" (This includes an addtionally target that will be enabled in a later CL). time make -j buildall # BEFORE real 1m19.519s user 23m9.220s sys 5m1.690s time make -j buildall # AFTER real 1m25.399s user 23m35.753s sys 5m12.609s BRANCH=None BUG=None TEST=make -j buildall Change-Id: Ib77a57297ee896569c509d0c8c998552d2a3a76c Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1370934 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Makefiles: Add support for MSAN and UBSAN.Allen Webb2018-12-111-0/+6
| | | | | | | | | | | | | | | | | | This adds support for building fuzz targets with memory and undefined behavior sanitizers. BRANCH=None BUG=chromium:911310 TEST=USE="ubsan fuzzer" ./build_packages \ --board=amd64-generic --skip_chroot_upgrade chromeos-ec && (cd ../platform/ec && unset BOARD && make -j buildall buildfuzztests) Change-Id: Ic7f4c1d7fcc1f6347f091b98567167066787cb9c Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1364326 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Add rules for building protocol buffers.Allen Webb2018-09-071-1/+1
| | | | | | | | | | | | | | | | | To facilitate using libprotobuf-mutator in fuzzing targets, rules for generating sources from proto files and compiling those to object files were added. BRANCH=none BUG=chromium:876582 TEST=rm -rf build && make -j buildfuzztests && ./build/host/cr50_fuzz/cr50_fuzz.exe (after cr50_fuzz.proto is added) Change-Id: Id645d0b60397bfeb71d60d601c4f65eefcbdf228 Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1184106 Reviewed-by: Mattias Nissler <mnissler@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Move fuzzing tests into a fuzz subfolder.Allen Webb2018-08-221-3/+9
| | | | | | | | | | | | | BRANCH=none CQ-DEPEND=CL:*664115 BUG=chromium:876582 TEST=make -j buildall && make -j buildfuzztests Change-Id: Iade5e5138f495e6b3b99ec16f1a467861ade5537 Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1180179 Reviewed-by: Mattias Nissler <mnissler@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* common/bootblock: Pack bootblock in EC image.Yilun Lin2018-07-021-0/+4
| | | | | | | | | | | | | | | | | | | 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>
* Makefile.toolchain: Switch from cpp to $(CC) -ENicolas Boichat2018-06-281-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes it more straightforward to switch to clang preprocessor later on. This requires a few other modifications in the Makefiles (gcc -E does not read from stdin by default, and does not process files that do not end in .c/.h). BRANCH=none BUG=chromium:854924 TEST=make buildall -j TEST=Before and after the change, all ec.bin binaries are identical: git checkout m/master make REAL_SIGNER=dummy buildall -j mv build build-master find build-master -type d | sed -e 's/-master//' | \ xargs -I{} mkdir -p {} find build-master -name ec_version.h | sed -e 's|build-master/||' | \ xargs -I{} cp build-master/{} build/{} git checkout this-cl => comment out .PHONY: $(out)/ec_version.h in Makefiles.rules make REAL_SIGNER=dummy buildall -j find build-master -name ec.bin | sed -e 's|build-master/||' | \ xargs -I{} diff build-master/{} build/{} => No difference Change-Id: If07f033dc7e9a73245499c656562bb906dcd4130 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1117721 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* make: add size calculationsVadim Bendebury2018-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Room remaining in flash is an ever important property of many EC images. This patch adds a makefile rule with will calculate how much free room is left in the RW partition with the current image. The calculation uses two variables set by the linker: 'FLASH' which shows how much room is allocated to the image and '__image_size' which shows how much room is actually taken. The difference is how much room is still available. Wnen building with V=0, size is not reported. BRANCH=cr50, cr50-mp BUG=b:65253310 TEST=observed reported values: $ make BOARD=cr50 -j ... *** 7864 bytes still available in flash on cr50 **** $ rm -rf build/cr50/ $ make BOARD=cr50 CR50_DEV=1 -j *** 4488 bytes still available in flash on cr50 **** Change-Id: I66e23dc72905988b21666c5dc9608d92e3fead50 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1030909 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* octopus: move more implementation to baseboardJett Rink2018-05-041-2/+4
| | | | | | | | | | | | | | Move driver configuration to baseboard in preparation for phaser board BRANCH=none BUG=none TEST=yorp still works Change-Id: Ifeb434d2d4103160acd6eb9f784533d1ae0ae35a Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1042729 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* g: fix signer to always use the manifestVadim Bendebury2018-04-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Since the proper signer utility has been introduced in the chroot, there is no need in generating reduced command option set when building a self signed image. Also, the same manifest can be used for all images, self signed or signed using a fob. The manifest needs to be tweaked for the self signed images to match the test Key ID. Since the same base manifest is used for all signings, there is no need to support the "poor man's json parser" any more. Rearranged build.mk to accommodate new logic, and added some comments. BRANCH=cr50, cr50-mp BUG=b:78212718 TEST=verified that images with proper header version are created when both self signed and signed with a private key coming from the signing fob. Change-Id: I5a1f8a223098b0a6c830ef24ffe380fc0badcafa Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1017238 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* makefile: fix build time warningsVadim Bendebury2018-03-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Recently, when building images for Cr50 the following warnings started being generated by make: board/cr50/build.mk:98: warning: overriding recipe for target \ 'build/cr50/tpm2/libtpm2.a' board/cr50/build.mk:98: warning: ignoring old recipe for target \ 'build/cr50/tpm2/libtpm2.a' The reason for this turned out to be changes under https://chromium-review.googlesource.com/954444 Let's make sure specific make file is not included in the build twice. BRANCH=cr50, cr50-mp BUG=none TEST='make buildall -j' succeeded. Verified that there is no warnings reported in the make output. Change-Id: I96924752eb91669957d2b514d8926ac843b2bf93 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/977021 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* ec: Add /baseboard to EC projectScott Collyer2018-03-151-11/+30
| | | | | | | | | | | | | | | | | | | | | | This CL introduces /baseboard to the EC project which can contain config options and code which is specific to certain family, but can be shared among the board derivatives of that family. Only the infrastructure changes are included with an empty baseboard.c/.h for octopus. BRANCH=none BUG=b:74358864 TEST='make buildall' and ensure that all boards build successfully. In addition, temporarily moved config options for USB-C and charger to baseboard.h and tested that 'make BOARD=yorp' is successful. Change-Id: I16656574f835c56598a9d2bf49bc1e946d71fe76 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/954444 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* make EC_FEATURE_RWSIG definition more usefulVincent Palatin2018-03-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also define the EC_FEATURE_RWSIG feature bit if the RO firmware contains the RWSIG task but not the RW. Given the RWSIG verification task is not terribly useful in RW (where it is never executed), it can be skipped there but the host program trying to detect RWSIG usage (e.g. flashrom) still wants to be able to detect it. In order to be able to do so, add the HAS_TASK_xXx_RO and HAS_TASK_xXx_RW flags which define the tasks defined in the other partition (at compilation-time you might still run a frankeinstein combo). Fix ectool 'inventory' to avoid segfaulting on missing feature string definition. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:36125319 TEST=on ZerbleBarn, run 'ectool inventory', also uses flashrom to re-flash the RW partition. Change-Id: I224a6cc4aef956204792a2cc04ad12aaed5abf47 Reviewed-on: https://chromium-review.googlesource.com/937262 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Make CONFIG_MALLOC partition-specificVincent Palatin2018-01-261-0/+8
| | | | | | | | | | | | | | | | | | | Allow to have CONFIG_MALLOC defined for one partition and not the other. The typical use-case is asymetric firmware whose small RO is typically just an updater/verifier (and RW signature verification currently doesn't like malloc as the memory initialization is done too late). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:72360575 TEST=make buildall Change-Id: I67cc04cd11385d4c05556ea41ef674cb7a232e65 Reviewed-on: https://chromium-review.googlesource.com/885820 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Makefile: Generate hashes for the touchpad FWNicolas Boichat2017-09-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* vboot: Move common code under common/vbootDaisuke Nojiri2017-07-131-0/+1
| | | | | | | | | | | | | | | This patch moves the code which can be shared with other data verification schemes (e.g. RWSIG) under common/vboot. It also adds unit tests for it. BUG=b:38462249 BRANCH=none TEST=make run-vboot. Verify verification succeeds on Fizz. Change-Id: Icab4d96dd2c154a12b01c41ebe9b46286b4b590e Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/563463 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Makefile: Allow different task list for RO and RWNicolas Boichat2017-04-251-24/+31
| | | | | | | | | | | | | | | | | | | | | | | This adds new macros for tasks (_RO and _RW), which allows to enable a task only for RO or RW section. We also create a new task_filter.h include file, that helps pre-filter those tasks, and can be used either from Makefile, or included from task_id.h. BRANCH=none BUG=b:35582031 TEST=make buildall -j; make savesizes Apply this CL make buildall -j; make newsizes => No size change Change-Id: I472bc6d4ab250a0a0e1fa6aeb4b748ba6968bedf Reviewed-on: https://chromium-review.googlesource.com/479491 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Nick Sanders <nsanders@google.com>
* makefile: allow different RO and RW CONFIGNick Sanders2017-01-261-17/+45
| | | | | | | | | | | | | | | | | | | | | This adds a separate CONFIG check for RO and RW. Each section is built with the objects generated based on it's own calculated CONFIGs, so that the object list may be different for RO and RW. The intent is to allow for differnt sized RO and RW partitions to allow for a small RO and lager code space for RW, for servo_v4 and hammer. BRANCH=none BUG=chrome-os-partner:61170 TEST=builds successfully Change-Id: I5549cc7ac218e0c7681108074ecfd3b80d4af545 Reviewed-on: https://chromium-review.googlesource.com/433079 Commit-Ready: Nick Sanders <nsanders@chromium.org> Tested-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>