summaryrefslogtreecommitdiff
path: root/Makefile.rules
Commit message (Collapse)AuthorAgeFilesLines
* Add rules for building protocol buffers.Allen Webb2018-09-071-4/+13
| | | | | | | | | | | | | | | | | 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>
* makefule.rules: Add cxx_to_o rule for building c++ files.Allen Webb2018-09-071-0/+7
| | | | | | | | | | | | | | | This adds a rule for building c++ object files to make it possible to use libprotobuf-mutator in fuzzing targets. BRANCH=none BUG=chromium:876582 TEST=make -j buildfuzztargets && ./build/host/cr50_fuzz/cr50_fuzz.exe Change-Id: I1355c313e47a1a83a599eb0f0b9142fefdf6de8b Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1183535 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cr50_fuzz: Add minimal fuzzer for pinweaver.Allen Webb2018-09-071-1/+1
| | | | | | | | | | | | | | | | | | | This adds a minimal pinweaver fuzzer as a foundation for further work. It will not be able to achieve good coverage because it doesn't have a proper description of the protocol, however it demonstrates that the prerequisites to build against dcrypto, nvmem_vars, and nvcounter are satisfied for the host board. CQ-DEPEND=CL:1183532 BRANCH=none BUG=chromium:876582 TEST=make -j buildfuzztests && ./build/host/cr50_fuzz/cr50_fuzz.exe Change-Id: I520d71c224d583c51dc3292dc051ee8de4a4116a Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1183534 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* fuzz: Hide conflicts with cstdlib and use clang++ for linking.Allen Webb2018-09-071-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | This creates a build target called libec.a by setting the visibility of functions that conflict with cstdlib to hidden. It then links those symbols locally into one large object file that makes up libec.a Fuzzing targets are linked against libec.a so that they can invoke ec functionality while depending on outside libraries that need cstdlib. When linking a particular object against cstdlib, to avoid conflicting function declarations put the following before any includes from the ec codebase: #define __stdlib_compat(...) The fuzzing targets are now linked using clang++, so that c++ libraries and objects can be used as part of the fuzzers. BRANCH=none BUG=chromium:876582 TEST=make -j buildfuzztests && ./build/host/host_command_fuzz/host_command_fuzz.exe Change-Id: Ifdfdc6a51c6ef23b4e192b013ca993bf48a4411b Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1180401 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* build: print out remaining RAM spaceJett Rink2018-08-291-10/+20
| | | | | | | | | | | | | | Some boards are pretty tight on RAM space. Print out remain RAM bytes for each board along with the tightest 3 boards during buildall. BRANCH=none BUG=none TEST=buildall now outputs the tightest boards on RAM. Change-Id: I819e554400e88937bb937f2ca51daf737588a9a5 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1194342 Reviewed-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org>
* test: host_command_fuzz: fuzzing testNicolas Boichat2018-08-161-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Writing fuzzing tests is a little tricky, as clang takes over the main function. Instead, we start the test main function in a thread, and have LLVMFuzzerTestOneInput prepare the host command buffer, and wake the TEST_RUNNER task. To make fuzzing faster, we only send somehow correctly formed requests, with a valid checksum and length (this can be disabled with an option). We also make sure that the emulator does not hibernate, reboot or jump to a different image when fuzzing is enabled. BRANCH=none BUG=chromium:854975 TEST=make buildfuzztests -j ASAN_OPTIONS="log_path=stderr" \ build/host/host_command_fuzz/host_command_fuzz.exe -timeout=5 Change-Id: I27b25e44c405f118dfc1296247479245e15e54b4 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1107523 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jonathan Metzman <metzman@chromium.org>
* Makefiles.rules: Silence cmpNicolas Boichat2018-07-181-1/+1
| | | | | | | | | | | | | | | | | | | When building with stdout redirected to /dev/null: make buildall -j >/dev/null One would still see "error" message like: cmp: build/hammer/ec_version.h: No such file or directory BRANCH=none BUG=none TEST=make buildall -j > /dev/null is quiet again. Change-Id: I3ee9d090d3d46a70a096db0bebbfecaf293dca6d Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1141448 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
* Makefile.rules: only update version.h timestamp if it changedPatrick Georgi2018-07-131-1/+2
| | | | | | | | | | | | | | BUG=none BRANCH=none TEST=buildall with no change is much faster now (no relinking of ec.*.elf) Change-Id: I844b5f6836462efaa98a1d26edcaf8f8a3c47567 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/1126316 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* common/bootblock: Pack bootblock in EC image.Yilun Lin2018-07-021-0/+3
| | | | | | | | | | | | | | | | | | | 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>
* ec: Make it possible to build tests using clangNicolas Boichat2018-06-281-1/+1
| | | | | | | | | | | | | | | | | | We might want to try out address sanitizer/fuzzer on some host tests: make it possible to build host tests using clang. Board builds are broken, and there is no intention to fix them, at least for now. BRANCH=none BUG=chromium:854924 TEST=make buildall -j TEST=make CC=clang runtests -j Change-Id: Id49a1b8537bc403d53437a2245f4fab6ceae89ac Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1107522 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Makefile.toolchain: Switch from cpp to $(CC) -ENicolas Boichat2018-06-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* kevin/gru: remove board almost completelyJett Rink2018-06-211-1/+1
| | | | | | | | | | | | | | | | Kevin/Gru are running out of space and we already have another ARM board on ToT for development. Remove maintenance burden of keeping them around. BRANCH=none BUG=chromium:851512 TEST=build_packages --board=kevin works with dependent CLs. CQ-DEPEND=CL:1102565,CL:*640973,CL:*640974 Change-Id: Ie7c65c7799acc9f4d266e40b29b37240fec345c6 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1100011 Reviewed-by: Ilja H. Friedel <ihf@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Makefile.rules: Have buildall list boards with lowest space remainingPatrick Georgi2018-06-141-0/+7
| | | | | | | | | | | | | | | | | | | | On successful build reports something like the following: Tightest boards' RW images, bytes left: zinger : 1580 minimuffin: 1584 wheatley : 2644 BUG=b:110043829 BRANCH=none TEST=make buildall emits a list of boards like shown above Change-Id: I36723cfdc9ae33e5861c1e0dfca322433520dce8 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/1096042 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Makefile.rules: Add buildalltests targetNicolas Boichat2018-05-261-0/+17
| | | | | | | | | | | | | | | | | In rare cases, it is useful to be able to build tests for all boards: buildall only builds the main image, but -paladin builders also builds test cases for each board. Also remove/fix tests for boards that currently fail. BRANCH=none BUG=b:35647963 TEST=make buildalltests -j, wait a long time, tests pass. Change-Id: Id6d978705a40a2045731cb08ad2ca5d62cc12ebb Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1072218 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* make: add size calculationsVadim Bendebury2018-05-141-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* build: add build option to print configsJett Rink2018-05-021-0/+15
| | | | | | | | | | | | | | | This is used verify moving define from board to baseboard is a no-op BRANCH=none BUG=none TEST=make BOARD=yorp print-configs works Change-Id: I6868e9ee9e52cd80791df734961d380bbe95bd1e Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1038895 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* util: uartupdatetool (UUT): Add tool to flash firmware by UARTCHLin2018-04-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* util: update flash_ec to handle unibuild emerge pathsJett Rink2018-03-301-0/+4
| | | | | | | | | | | | | | | | | If a baseboard exists in the build.mk for a board, use that as the unibuild path. BRANCH=none BUG=b:77128456 TEST=tested the following command with correct results: flash_ec --board=yorp (baseboard) flash_ec --board=bip (baseboard) flash_ec --board=grunt (non-baseboard) Change-Id: Ic4573cb01849275d1333ff9e715f69a4c95444b0 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/986753 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ectool: add servo v2 spi supportVincent Palatin2018-01-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* npcx: modify the npcxspiflash little firmware to support UUTCHLin2018-01-031-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original ec_npcxspiflash lfw is used by the openocd to program SPI flash via Servo JTAG. In order to support UUT mode to program SPI flash, this CL modified the lfw with the following changes: 1. Rename the lfw ec_npcxflash to npcx_monitor to unify the naming. 2. The npcx_monitor will read the first 4 bytes from the area of monitor header. If the monitor identifies the first 4 bytes is a UUT tag, it will read parameters(SPI_OFFSET/IMAGE_SIZE) from the relative offset of monitor header. Otherwise, it will read parameter from the general register r0/r1 which will be restored by openocd script in advance. 3. Add monitor_hdr.c to generate the monitor header binary files (monitor_hdr_ro.bin/monitor_hdr_rw.bin)) automatically after compiled. The memory layout to restore the reuqired binaries are listed below: ec firmware(RO/RW) - the start address of Code RAM area. monitor header - 0x200C3000 npcx_monitor - 0x200C3020 BRANCH=none BUG=none TEST=No build errors for "make buildall". TEST=Follow instructions in CL:826763; make sure the ec firmware is updated and ec can boot up. CQ-DEPEND=CL:828341 Change-Id: I5de997a4dee5449d578972e2f929c6e08c5dff67 Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/826909 Commit-Ready: CH Lin <chlin56@nuvoton.com> Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* make: allow deps to tolerate removal of .h filesVadim Bendebury2017-12-071-1/+1
| | | | | | | | | | | | | | | The -MP preprocessor option changes generated dependency files such that removal of .h files does not cause make to fail dependency check. BRANCH=none BUG=none TEST=verified that removal of .h file from the code and from the tree does not cause failing builds any more. Change-Id: If6adb6f53938878c914ca6ee6947012548bc0019 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/814876 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Enable it83xx based boardsPatrick Georgi2017-11-091-1/+1
| | | | | | | | | | | | | | | | They build with coreboot-sdk. BRANCH=none BUG=b:35572628 TEST=building with coreboot-sdk's compiler succeeds CQ-DEPEND=CL:757439 Change-Id: I9d81eeff4c75f22d6b9f20acc5be2a64effd04a1 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/756698 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* Makefile: Generate hashes for the touchpad FWNicolas Boichat2017-09-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* stack_analyzer: Use board/$BOARD/analyzestack.yaml by defaultNicolas Boichat2017-09-071-2/+3
| | | | | | | | | | | | BRANCH=none BUG=chromium:648840 TEST=make BOARD=hammer analyzestack Change-Id: Id05fee7e085a02dd4c2d36880f6891c3eb86b404 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/637550 Reviewed-by: Che-yu Wu <cheyuw@google.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ec: Add annotation feature to the stack analyzer.Che-yu Wu2017-08-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Get stack analyzer supported to read annotation file and do basic annotation on the callgraph. The basic annotation includes: 1. Add missing calls to the callgraph 2. Ignore functions on the callgraph 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 \ --annotation=./extra/stack_analyzer/example_annotation.yaml \ ./build/elm/RW/ec.RW.elf make BOARD=elm SECTION=RW \ ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \ analyzestack Change-Id: I4cc7c34f422655708a7312db3f6b4416e1af917f Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/614825 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ec: Add a task information library for the stack analyzer.Che-yu Wu2017-08-151-14/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ec: Add analysis tool for firmware stack usage.Che-yu Wu2017-08-141-0/+29
| | | | | | | | | | | | | | | | | | | | | | Add a static analysis tool for firmware stack usage. Add an new Makefile rule to analyze the stack usages of firmwares. Details about the tool can be found in extra/stack_analyzer/README.md. BUG=chromium:648840 BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py make BOARD=elm && make BOARD=elm build/elm/RW/ec.RW.taskinfo && \ extra/stack_analyzer/stack_analyzer.py \ --objdump=arm-none-eabi-objdump \ --addr2line=arm-none-eabi-addr2line \ ./build/elm/RW/ec.RW.elf ./build/elm/RW/ec.RW.taskinfo make BOARD=${BOARD} SECTION=${SECTION} analyzestack Change-Id: Ifb1b5f5ad6be8f8b125b14d6ee03e25cb385895b Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/576411 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* Allow core code to request its cross compilerPatrick Georgi2017-07-191-11/+14
| | | | | | | | | | | | | | | | | | | | | | | Instead of having to pass in both the board and the arch used there (which might be complicated in the light of different ECs with different arches), allow passing in the board and a set of cross compilers. The core/*/build.mk then pick the compiler that is responsible for them. The current method works just the same: If you've already set CROSS_COMPILE, no override happens. If you set neither CROSS_COMPILE nor CROSS_COMPILE_$arch, the same default as before this CL is set. BUG=none BRANCH=none TEST=emerge-{samus,kevin} chromeos-ec behave reasonably with adapted ebuild Change-Id: Icf1866f296412dd92ecfe134394224c49f7c3df5 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/549344 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com>
* g: do not invoke signer with sudo unless it is necessaryVadim Bendebury2017-06-081-1/+1
| | | | | | | | | | | | | | | | Invoking signer with sudo is required only when signing requires a USB fob. Let's not use it in unless necessary. BRANCH=cr50 BUG=chromium:728751 TEST=verified that Cr50 build succeeds when both using and not using the signing fob. Change-Id: I8f40bd52f1752bfd88ec002f298b991faf7a2512 Reviewed-on: https://chromium-review.googlesource.com/528373 Commit-Ready: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* codesigner: accept the new command line optionVadim Bendebury2017-05-311-1/+1
| | | | | | | | | | | | | | | | | | | | | The upcoming "real" signer update will introduce a version which is not backwards compatible with the existing one wrt the command line flags: the command line flag '-b' will have to be present. To keep the default "dummy" signer in sync let's make it accept and ignore the '-b' command line flag. BRANCH=none BUG=none TEST=verified that the updated signer and the dummy signer both work. Change-Id: Ia8ab6d7ae01d249046f267608b5971a7a7c95e29 Signed-off-by: Vadim Bendebury <vbendeb@google.com> Reviewed-on: https://chromium-review.googlesource.com/517678 Commit-Ready: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* reef_it8320: initial reef_it8320 boardDino Li2017-05-181-1/+1
| | | | | | | | | | | | | | This change is based on reef's board code and modified for it8320. BUG=none BRANCH=none TEST=Run the entire faft_ec suite and passed. Change-Id: I8977d7431eb0a97ceb4ee1dfd11a2c4433687db0 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/487792 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* pd: Make build of VIF utility less verboseSam Hurst2017-05-091-0/+2
| | | | | | | | | | | | 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-1/+9
| | | | | | | | | | | | | | | | | | 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>
* rwsig: Add support for rwsig image typesNicolas Boichat2017-02-171-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | usbpd1 futility image type is deprecated and should not be used for new designs. This adds proper support for rwsig image type. Key and signatures are added at linker stage step (futility cannot directly create such signed images). Thanks to VB21 header, rwsig.c can now tell how many bytes of the RW image need to be cryptographically verified, and ensure that the rest is blank (0xff). BRANCH=none BUG=chromium:690773 TEST=make BOARD=hammer; flash, RW image is verified correctly. TEST=make runtests -j TEST=For the rest of the tests: Change config option to CONFIG_RWSIG_TYPE_RWSIG TEST=make BOARD=hammer; flash, hammer still verifies correctly. TEST=cp build/hammer/ec.RW.bin build/hammer/ec.RW.bin.orig; futility sign --type rwsig --prikey build/hammer/key.vbprik2 \ build/hammer/ec.RW.bin diff build/hammer/ec.RW.bin build/hammer/ec.RW.bin.orig => Same file TEST=Add CONFIG_CMD_FLASH, flashwrite 0x1e000, reboot, EC does not verify anymore. TEST=dump_fmap build/hammer/ec.bin shows KEY_RO and SIG_RW at correct locations. Change-Id: I50ec828284c2d1eca67fa8cbddaf6f3b06606c82 Reviewed-on: https://chromium-review.googlesource.com/441546 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Makefile.rules: Clean ccache cache for 'clobber'.Aseda Aboagye2017-01-271-0/+3
| | | | | | | | | | | | | | | | | | | | | In the chroot, we use ccache to speed up compilation. However, it's possible for this cache to become corrupt which could lead to slower builds. In order to keep things fresh, 'make clobber' should clean up that ccache cache as well. This commit makes it so. Note, this is NOT *clearing* the cache entirely. BUG=chromium:681961 BRANCH=None TEST=make clobber; verify that ccache is cleaned. Change-Id: I8ccd7df4858c445485ed740843f3126af0abd33a Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/433108 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* Makefile: Suppress unwanted 'echo' outputSimon Glass2017-01-131-2/+4
| | | | | | | | | | | | | | | | Add a 'echo' command which can be called to generate output. If V=0 then it is suppressed. This drops the unwanted output when V=0. Signed-off-by: Simon Glass <sjg@chromium.org> BUG=chromium:680243 BRANCH=none TEST=V=0 emerge-reef chromeos-ec; See that the BUILD lines are gone Change-Id: Ie4474024c84345d427f4d95a9ff194dc740f860f Reviewed-on: https://chromium-review.googlesource.com/427364 Commit-Ready: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Makefile: Support three levels of verbositySimon Glass2017-01-131-4/+18
| | | | | | | | | | | | | | | | | | | | | | At present the EC Makefile supports two levels of verbosity: V unset: Show an abbreviated build log (operation and file only) V=1: Show the full build log, including all commands However, even the abbreviated build log includes a lot of output. It is basically a long list of filenames and is of little use during development. It is more useful to show just warnings and errors. Add a new setting, V=0, which provides this. BUG=chromium:680243 BRANCH=none TEST=emerge-reef chromeos-ec; test each of V=, V=0, V=1 and see that the Makefile does the correct thing. Change-Id: I85c0423c5299fa3ab624ed9f7f7b6b7f73236611 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/427363 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Makefile.rules: Allow specifying HOST_LDFLAGS for cross-compilationMoritz Fischer2017-01-051-1/+1
| | | | | | | | | | | | | | | | Add HOST_LDFLAGS to cmd_c_to_host to allow for cross-compilation of utils such as 'ectool'. BRANCH=master BUG=none TEST=Cross compile using arm-oe-linux-gnueabi with corresponding linkerflags and run resulting binary on armv7 device Change-Id: Iebdfa92239eb5f245d4ad3623cbdceafd82d1675 Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Reviewed-on: https://chromium-review.googlesource.com/424855 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org>
* Allow a subset of boards to be built with the "buildall" target.Carl Hamilton2017-01-051-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to reduce build times during development, this change allows an engineer to build a subset of all boards, writing the results for each board into the ".failedboards" directory. The expectation is that, while working on code that affects multiple boards, the engineer will invoke "make build_boards BOARDS=<board-list>" periodically to confirm that all affected boards still build. Before pushing any code for review, however, the engineer is still expected to run "make buildall" to ensure all boards still build and tests pass. * Define a new make variable, BOARDS, whose default value is $(boards). This variable can be overridden on the make command line or via the environment. Its value must be non-empty. * Use the BOARDS make variable to control which boards will be built by the new "build_boards" and "try_build_boards" targets. * Refactor the "buildall" target so that it depends on "build_boards". This indirectly allows the boards built to be controlled via the BOARDS make variable. * Here are some make command lines that were used to test the behavior of the change: make -j buildall # Builds all boards, runs tests. make -j build_boards # Builds all boards, doesn't run tests. make -j build_boards BOARDS="cr50 reef" # Builds cr50 and reef boards make -j build_boards BOARDS= # Fails due to empty BOARDS. BUG=none BRANCH=none TEST=make -j buildall Change-Id: I833277842e5e20d86eaa90df6457264a2f86a3fa Reviewed-on: https://chromium-review.googlesource.com/420110 Commit-Ready: Carl Hamilton <carlh@chromium.org> Tested-by: Carl Hamilton <carlh@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org>
* Update Makefile.rules with a showboards targetMartin Roth2016-11-161-0/+3
| | | | | | | | | | | | | | | | | | | | This prints all the boards that are part of the build. This will be used on coreboot's build system for running coverity. This allows the builds to keep in sync as platforms are added, and as anything is added to the "skip_boards" list. for board in $(make showboards); do make proj-$board CROSS_COMPILE="arm-eabi-" done BUG=none BRANCH=none TEST=make showboards shows boards, and excludes skip_boards list Change-Id: I34d8bc95cc5c7d05b4f2ec38b16b75f9f0c72c6f Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/403498 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* makefile: Add help targetMartin Roth2016-11-161-0/+18
| | | | | | | | | | | | | | This just adds some basic output as a reminder of what targets do what. BUG=none BRANCH=none TEST=make help shows useful output Change-Id: Ic46f153ce8ed0b39294644a01eba8e06f2abe1c6 Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/403497 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Makefile.rules: Add targets to see file size differencesMartin Roth2016-11-151-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the ec binaries are so tight on space, it would be nice to be able to see just how much changes are affecting the size. This allows users to easily do before/after comparisons. Sample output: build/sweetberry/RW/ec.RW.flat shrank by 44 bytes: (43828 to 43784) build/twinkie/RO/ec.RO.flat shrank by 64 bytes: (46312 to 46248) build/twinkie/RW/ec.RW.flat shrank by 40 bytes: (45900 to 45860) build/wheatley/RW/ec.RW.flat shrank by 40 bytes: (102692 to 102652) Compared 156 of 156 files. 81 files changed. Total size change: -3100 bytes. Average size change: -38 bytes. BRANCH=none BUG=none TEST=make clobber buildall -j; make savesizes [change some code that changes file sizes] make clobber buildall -j ; make newsizes [Shows size differences] Change-Id: I48b440063eb6eb6c00900af3d0dfa075be6f9ec7 Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/410860 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
* cts: Fix back-to-back buildDaisuke Nojiri2016-10-141-9/+2
| | | | | | | | | | | | | | | | | | | Currently eCTS suites share the same directory (e.g. build/stm32l476g -eval) to put build artifacts even though some files (e.g. board.c) compile differently suite to suite. So, if cts-i2c-stm32l476g-eval is built, followed by cts-gpio-stm32l476g-eval, build fails or produces incorrect binary. This patch makes eCTS create different directories for each suite. As a bonus, we can now builds eCTS suites in parallel. BUG=chromium:654549 BRANCH=none TEST=make buildall -j (with uncommitted change) Change-Id: I4abedc917787be5f79b97e0e50d0d08e01bd5f9d Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/398281
* g: Add support for hardware dcryptoBill Richardson2016-09-161-4/+0
| | | | | | | | | | | | | | | BUG=chrome-os-partner:54101 BRANCH=none CQ-DEPEND=CL:*287736 TEST=make buildall; try on Cr50 hardware All TCG tests passed before and after this CL. Change-Id: I65e31792b2912d588868cc298a01b0142ac7dadc Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/386258 Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: provide build mode for signing with fobVadim Bendebury2016-09-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't really have the ability to build the latest signer yet, but this should not stop us from being able to build a properly signed image using the ec makefiles. As a stopgap measure the suggestion is to keep the latest signer binary in ~/bin/codesigner in chroot, then with this patch applied invoking make with CR50_DEV=1 will cause the proper sighner used and proper signing procedure followed. The signed targets need to be built in series to avoid concurrent use of the signer fob, an addition dependency is being added to enforce that. BRANCH=none BUG=chrome-os-partner:55557 TEST=ran make as follows: CR50_DEV=1 make BOARD=cr50 touched the fob when requested, uploaded the generated build/cr50/ec.bin on a kevin-tpm2 using usb_updater, and observed it boot properly with the new version. Change-Id: Ia9494bdc60b4bd3b8e5e09cbcbd8b27409c739d2 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/376885 Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* cts: Build CTS suites in buildallDaisuke Nojiri2016-07-121-0/+39
| | | | | | | | | | | | | We need to (at least) build CTS for all boards & suites supported by CTS. This will prevent our investment from accidentally being broken. BUG=chromium:627252 BRANCH=none TEST=make buildall builds CTS suites Change-Id: Ib7bceaafd5e27ce9285b9d1bf35339bf6b04ba72 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359947
* build: Skip cr50 board in `make buildall` if private folder not presentShawn Nematbakhsh2016-06-211-0/+4
| | | | | | | | | | | | | | BUG=chromium:621993 BRANCH=None TEST=`make buildall -j` from public checkout succeeds. Also verify cr50 still built from private checkout. Change-Id: I982806e282146aab76154b51c366226d3d1aed14 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/354540 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* make: Fix npcx compile error due to missing ecst binaryShawn Nematbakhsh2016-06-081-1/+1
| | | | | | | | | | | | | | | | | | Add an explicit dependency on utils-build (includes ecst) to prevent ec_elf_to_flat from running before ecst is built during parallel make. BUG=chrome-os-partner:52777 BRANCH=None TEST=Modify Makefile.rules to add 5sec sleep in $(build-utils) rule, verify that `make BOARD=kevin clean && make BOARD=kevin -j` still succeeds. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ia443f8b880cbd4451d41302817e176201f7870dc Reviewed-on: https://chromium-review.googlesource.com/350162 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* board: rename it8380dev to it83xx_evbDino Li2016-05-031-1/+1
| | | | | | | | | | | | | | | | Unified board name for IT83-series. Signed-off-by: Dino Li <dino.li@ite.com.tw> BRANCH=none BUG=none TEST="make BOARD=it83xx_evb -j" and "make buildall -j" Change-Id: Ic96d0132fb31fcc8715d0dd810f8bd340035a640 Reviewed-on: https://chromium-review.googlesource.com/341843 Commit-Ready: Dino Li <dino.li@ite.com.tw> Tested-by: Dino Li <dino.li@ite.com.tw> Reviewed-by: Shawn N <shawnn@chromium.org>
* make: allow to see boards failed when making 'buildall'Vadim Bendebury2016-04-141-1/+7
| | | | | | | | | | | | | | | | | | | | | | It is quite annoying to see an error reported by buildall, but not knowing what board(s) actually failed to build. Create file for each board being built, put build progress information in it, and remove it if the board build succeeded. Then, once the build is completed see the failed boards in .failedboards/, if any, and the states they failed at. BRANCH=none BUG=none TEST=verified that the directory is empty after a successful buildall run, and has files named after failed boards in case of build failures. Change-Id: I67eb1671cadf58d9f8feccebfcc860524f33c2a0 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/338883 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>