summaryrefslogtreecommitdiff
path: root/Makefile.toolchain
Commit message (Collapse)AuthorAgeFilesLines
* ec_commands: Make importing ec_commands.h easier for foreign projectsYu-Ping Wu2019-08-211-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are many projects (e.g., kernel, coreboot, flashrom, mosys) having their own copy of the ec_commands.h header file. To reduce the effort of synchronization, this file should be maintained so that it can be copied and included without modification whenever possible. Currently ec_commands.h includes compile_time_macros.h only if __KERNEL__ is not defined. However, there are many macros defined in the latter file (e.g., ARRAY_SIZE) that are already defined in other projects, leading to a redefinition error. To resolve this issue, ec_commands.h is modified in this CL so that compile_time_macros.h is only included when inside the Chromium EC repository, which is controlled by the macro CHROMIUM_EC. Option '-DCHROMIUM_EC' is also added to CPPFLAGS to avoid redefinition error of macro 'BUILD_ASSERT'. BUG=b:109900671,b:118654976,chromium:984623 BRANCH=none TEST=make buildall -j Cq-Depend:chromium:1760656 Change-Id: I38c77f0233ff5962b6f90f25ba96802d05e706d7 Signed-off-by: Yu-Ping Wu <yupingso@chromium.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1535086 Tested-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* ec: Pass -fno-experimental-new-pass-manager when building fuzzersManoj Gupta2019-07-031-1/+2
| | | | | | | | | | | | | | | New pass manager in clang is breaking EC builds. Fix by explicitily passing -fno-experimental-new-pass-manager in EC makefile when building fuzzers. BUG=chromium:955021 TEST=fuzzers work. Change-Id: Ia4f62bb94b144772a845fe9974588dcb00eabe9c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1688411 Commit-Queue: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Manoj Gupta <manojgupta@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: add -ffat-lto-objects to CFLAGSVadim Bendebury2019-06-071-0/+1
| | | | | | | | | | | | | | | | | | This command line option causes .o files to include additional information and seems to be triggering a more thorough code analysis. In particular, the uninitalized variable use cases previously missed trigger compilation warnings when this option is enabled. Generated code size for the Cr50 target does not change. BRANCH=cr50, cr50-mp BUG=b:134623681 TEST=make buildall -j Change-Id: I1d916f0e6592757a073ae44e8e38c8a60384d576 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1648924 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
* Makefile: Replace flag -DX with -DX= to be supported by IS_ENABLED().Yilun Lin2019-06-031-13/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+2
| | | | | | | | | | | | | | | | | 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>
* make: include iteflash in host-util groupNamyoon Woo2019-04-111-0/+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>
* Makefile.toolchain: strip leading whitespace in set-optionPatrick Georgi2019-04-031-1/+1
| | | | | | | | | | | | | | | | | That function is only used to set CROSS_COMPILE, and we never need leading whitespace in there. It sneaks in when the set-option call is split across several lines, breaking the analyzestack target. BUG=chromium:875295 BRANCH=none TEST=make BOARD=yorp analyzestack works Change-Id: I1b2dccd9753b0662067d77bd9c58d4ccf6daeb4d Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/1547563 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* Makefile: fix compatibility with Protobuf 3.7.0Allen Webb2019-03-211-1/+2
| | | | | | | | | | | | | | | | This defines PROTOBUF_MIN_PROTOC_VERSION so protobuf headers don't fail with -Wundef and sets -Wno-unreachable-code to allow for maps to be used in protocol buffers. BRANCH=None BUG=chromium:937442 TEST=make -j buildall Change-Id: Id595825c224e34df1034c26d49bb4f6263358470 Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1531336 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Makefile: fix building utils outside chrootVadim Bendebury2019-02-191-4/+5
| | | | | | | | | | | | | | | | | | | | On newer desktop distributions pkg-config queries for libftdi do not include usb-1.0 library specific output any more, so both libraries' compilation and linking flags need to be retrieved explicitly. BRANCH=none BUG=none TEST=verified that make BOARD=host clean; make BOARD=host utils succeed both inside and outside chroot. Change-Id: I659d31fac2d9b9c8c50a13d18ed09e86b913ec74 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1474893 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* Makefile.toolchain: enable -fno-delete-null-pointer-checks for clangTom Hughes2019-01-251-2/+1
| | | | | | | | | | | | | | | clang now supports this flag as mentioned in the TODO BRANCH=none BUG=chromium:854924 TEST=make V=1 BOARD=nocturne_fp run-host_command_fuzz TEST=make buildall -j Change-Id: I6afc0be2f92c68d7ef6e25299554ef1fbaa903ae Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1435095 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Allen Webb <allenwebb@google.com>
* build: add centroiding C++ supportRong Chang2019-01-241-1/+1
| | | | | | | | | | | | | | | | Centroiding source is in C++. This CL removes -W flags only for building C files from CFLAGS and also prevents typedef existing C++ keyword wchar_t. BUG=b:120961468 BRANCH=none TEST=make buildall Change-Id: Ifb8793a8e7e69b26a742b7dbf70289747a0ee7b3 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1372874 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Tai-Hsu Lin <sheckylin@chromium.org>
* Makefiles: Set fuzz targets to use the correct CROSS_COMPILE.Allen Webb2018-12-141-0/+1
| | | | | | | | | | | | | | | | | This addresses a cross compilation bug for fuzzing targets where CROSS_COMPILE was always ''. BRANCH=None BUG=chromium:911310 TEST=USE="ubsan asan fuzzer" ./build_packages \ --board=amd64-generic --skip_chroot_upgrade chromeos-ec && (cd ../platform/ec && unset BOARD && make -j buildall) Change-Id: I1c0b99f4ecef1e6ddec489568ccb13a8e8f5fb85 Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1363541 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* Makefiles: Add support for MSAN and UBSAN.Allen Webb2018-12-111-1/+9
| | | | | | | | | | | | | | | | | | 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>
* Makefile.toolchain: Set sysroot correctly when linking.Allen Webb2018-12-061-0/+3
| | | | | | | | | | | | | | | | | This fixes cross compilation by setting --sysroot=${SYSROOT} when applicable so that targets that depend on outside libraries link correctly. BRANCH=None BUG=chromium:911310 TEST=USE="ubsan asan fuzzer" ./build_packages \ --board=amd64-generic --skip_chroot_upgrade chromeos-ec && (cd ../platform/ec && unset BOARD && make -j buildall) Change-Id: I6b0d3554d91460a9bca58e800c9e1cea9c3caf7a Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1363674 Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
* Makefile.toolchain: Add TEST_FUZZ checks.Allen Webb2018-11-161-0/+2
| | | | | | | | | | | | | | | This prevents a bunch of warnings that show when trying to run pkg-config for libprotobuf-mutator when not building the fuzzer targets. BRANCH=None BUG=None TEST=make -j buildall Change-Id: Idf8de959d86db744754cd237796ccaacd3668a63 Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1338605 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Makefile.toolchain: Add vars for libprotobuf-mutator.Allen Webb2018-11-151-3/+11
| | | | | | | | | | | | | | libprotobuf-mutator is a helper library for fuzzing using protocol buffers. BRANCH=None BUG=None TEST=make -j buildfuzztests && make -j buildall Change-Id: I855691860042bdbdeafe68cc0e0d7bea0f2667cc Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1334030 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Add rules for building protocol buffers.Allen Webb2018-09-071-0/+2
| | | | | | | | | | | | | | | | | 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>
* fuzz: Hide conflicts with cstdlib and use clang++ for linking.Allen Webb2018-09-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* test: host_command_fuzz: fuzzing testNicolas Boichat2018-08-161-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ec: Make it possible to run tests with AddressSanitizer enabledNicolas Boichat2018-06-281-2/+9
| | | | | | | | | | | | | | | | | | | Automatically use CC=clang if TEST_ASAN is specified. Also, add a __no_sanitize_address attribute macro to prevent ASan from adding guards around host_command, mkbp_event, and hook "arrays" that are generated at link-time. Also, set ASAN_OPTIONS env variable in run_host_test. BRANCH=none BUG=chromium:854924 TEST=make TEST_ASAN=y runtests -j Change-Id: Iaf0ec405022760d757a8a9d62a5022460d1b16e1 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1109661 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ec: Make it possible to build tests using clangNicolas Boichat2018-06-281-3/+14
| | | | | | | | | | | | | | | | | | 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>
* Tell linker about the arch and CPU it's linking forPatrick Georgi2018-05-181-1/+2
| | | | | | | | | | | | | | | | | | | GCC 8.1's linker tries to rewrite the code to match the lowest common denominator, reintroducing references to __aeabi_idivmod and friends even on ARM revisions that don't need them. Tell it what it's linking for to keep it harmless. BUG=b:65441143 BRANCH=none TEST=make buildall works with gcc 8.1 Change-Id: I7296aa80f587aa4f004fb20958714766793ab2b5 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/1061693 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com>
* ec: Add /baseboard to EC projectScott Collyer2018-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* ec_chip_mchp: Add MCHP chip folderScott Worley2017-12-281-0/+1
| | | | | | | | | | BRANCH=none BUG= TEST=Review only. Committing small pieces until all code passes review. Change-Id: I9d16f95314a7c97b11c4fe61602c6db2621e6024 Signed-off-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
* BUILDCC fragments should include core/hostStefan Reinauer2017-08-211-1/+1
| | | | | | | | | | | | | | | | This will prevent userland code to pull in includes from core/stm32 etc. Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> BRANCH=none BUG=none TEST=make buildall -j Change-Id: I450b17baf579cbaee04c253c1e86d998f6e329da Reviewed-on: https://chromium-review.googlesource.com/618270 Commit-Ready: Stefan Reinauer <reinauer@google.com> Tested-by: Stefan Reinauer <reinauer@google.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ec: Add analysis tool for firmware stack usage.Che-yu Wu2017-08-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* toolchain: set correct toolchain when buildallli feng2017-08-011-1/+1
| | | | | | | | | | | | | | | | | | | | In the "make buildall", since no BOARD is defined, core/minute-ia has to use whatever toolchain value set by previous board build. "arm-none-eabi-" is used instead of "i686-pc-linux-gnu-" and causes build failed. BUG=none BRANCH=None TEST=Including Soraka ISH board, make buildall passed. Change-Id: I2682e4b73f608756842870e584f559166354b00b Signed-off-by: li feng <li1.feng@intel.com> Reviewed-on: https://chromium-review.googlesource.com/595221 Commit-Ready: Stefan Reinauer <reinauer@chromium.org> Tested-by: Li1 Feng <li1.feng@intel.com> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Li1 Feng <li1.feng@intel.com> Reviewed-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
* core: Fix missing debug symbol when enabling LTOChe-yu Wu2017-07-191-1/+1
| | | | | | | | | | | | | | | Add "-g" to "LDFLAGS" for preserving debug symbol when enabling LTO. BUG=chromium:742697 BRANCH=none TEST=make BOARD=eve -j arm-none-eabi-objdump -h build/eve/RW/ec.RW.elf | grep debug_loc 7 .debug_loc 00027bf0 00000000 00000000 0009a549 2**0 Change-Id: I6b2b00846ce71002262a10357fd4dccbe82b6e6f Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/575312 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* Allow core code to request its cross compilerPatrick Georgi2017-07-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | 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>
* eCTS: Print start marker before syncDaisuke Nojiri2017-06-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes each test print start marker before sync. This will allow us to distinguish the failure before even sync is attempted (CTS_RC_DID_NOT_START, thus probably caused by the previous test) and the failure caused by the hanging partner, in which case the one good and alive will be stuck in sync (and should return _DID_NOT_END or even better _BAD_SYNC once we implement timeout in sync). This patch also: * Adds did_not_start_test to and removes debug_test from meta suite * Consolidates test runner loops into common cts_main_loop * Removes dut_common.h and th_common.h * Removes debug print macro and CTS_DEBUG * Replaces all infinite loops after tests with task_wait_event(-1) * Removes meaningless comments and debug printfs * Removes CTS_TEST_ID_* * Adds sync() to task suite BUG=chromium:736104 BRANCH=none TEST=Run run_ects.sh and verify all tests pass Change-Id: I6ccdf26afac6b8e8cb16483c5d75e4e77e7962f4 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/545176
* Makefile: Allow different task list for RO and RWNicolas Boichat2017-04-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Support alignment for EC host command structuresRandall Spangler2016-10-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The host command parameter and response buffers should be explicitly aligned by the LPC/SPI/I2C drivers. But the host command handlers don't know that, and the structs are all __packed, so the compiler generates horribly inefficient ARM Cortex-M code to cope with unaligned accesses. Add __ec_align{1,2,4} to force the param / response structs to be aligned. Use it in a few structs now which were straightforward to test. It should be added to more structs as space is needed, but that would make this change unwieldy to review and test. Add CONFIG_HOSTCMD_ALIGNED to enable the additional alignment. Currently, this is enabled only for LM4 and samus_pd, so that EC code can be tested without affecting other non-samus ToT development (none of which uses LM4). Fix the two handlers that weren't actually aligned (despite one of them having comments to the contrary). Also, add a CHROMIUM_EC define that can be used to determine if a file is being compiled for an EC target. We need that so that we only force structure alignment for EC binaries. On the AP side, buffers may not be aligned, so we should not force alignment. BUG=chromium:647727 BRANCH=none TEST=Flash samus and samus_pd. Boot samus and run a bunch of ectool commands (with and without --dev=1, so it tests both EC and PD). System boots and all commands return expected results. Change-Id: I4537d61a75cf087647e24281288392eb85f22eba Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/387126
* Makefile.toolchain: Add error if make version will not build the ECMartin Roth2016-08-121-0/+7
| | | | | | | | | | | | | | | | | | | | If you try to build the EC codebase with GNU make version 3.81 or less, you currently get an error: Makefile.rules:286: *** multiple target patterns. Stop. Since this message isn't helpful in letting you know that the version of make needs to be updated, let's print something more useful. ERROR: GNU make version 3.82 or higher required. Stop. TEST=Built with Make 3.81 and saw the new error message. Built with make 3.82 and 4.0 and the EC built correctly. BRANCH=None BUG=None Change-Id: I5813fd26fa8120742544567c5ae04af01f993f94 Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/367944 Reviewed-by: David Hendricks <dhendrix@chromium.org>
* cts: Debug message support added to cts testsChris Chen2016-08-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | You can now add debug messages into a cts test and they will be displayed with the test report html page. The macro to use is CTS_DEBUG_PRINTF Adding debug messages can potentially change test results by slowing down the test, so you can choose when compiling a test suite if you want the debug messages present or not by adding --debug as an argument when you call ./cts --build. BRANCH=None BUG=None TEST=Manual - Add a debug statement to a test - Build the test suite with --debug specified - Flash the boards - Run './cts/cts.py -r' - Open /tmp/cts_results/<board_name>/<test_suite>.html to view see your debug message for the test Change-Id: Icad8e0ac5cc905010caa4e7616f81572ce6ac771 Reviewed-on: https://chromium-review.googlesource.com/362475 Commit-Ready: Chris Chen <twothreecc@google.com> Tested-by: Chris Chen <twothreecc@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cts: Move C flags to cts/build.mkDaisuke Nojiri2016-07-261-2/+1
| | | | | | | | | | | | | | | We should separate global Makefile from CTS stuff as much as possible. This makes reading and chaging code simpler. BUG=none BRANCH=none TEST=make buildall Change-Id: If9e99e0e9b660707b1e22f2362bd6f782930dc09 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/363006 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Chris Chen <twothreecc@google.com>
* Add cts.tasklistDaisuke Nojiri2016-07-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | cts.tasklist contains tasks run only for CTS. These tasks are added to the tasks registered in ec.tasklist with higher priority. This design allows board directories to be free from CTS stuff. cts.tasklist can be placed in each suite directory (cts/suite/cts.tasklist). If a suite does not define its own cts.tasklist, the common list is used (i.e. cts/cts.tasklist). BUG=chromium:624520 BRANCH=none TEST=Ran the followings: make buildall make CTS_MODULE=gpio BOARD=nucleo-f072rb make CTS_MODULE=gpio BOARD=stm32l476g-eval Change-Id: Ibb242297ee10a397a8fcb6ff73d8cbc560daa885 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359445 Reviewed-by: Chris Chen <twothreecc@google.com>
* cts: First patch flashes blank testsChris Chen2016-07-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The first time you use this with a particular th, connect only th and run ./cts.py --th Then connect both boards and you can run ./cts.py to build/flash both boards. BRANCH=None BUG=None TEST=manual - Enter chroot - Navigate to ec/cts - Connect only th - 'sudo ./cts.py --th' - './cts.py -b' - Exit chroot - Connect both boards - './cts.py -f' Each board should flash successfully Change-Id: Ib14fccabcd9fdad04f9b92817da597bc0dcb3d89 Reviewed-on: https://chromium-review.googlesource.com/358100 Commit-Ready: Chris Chen <twothreecc@google.com> Tested-by: Chris Chen <twothreecc@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* cleanup: Makefiles should check path assumptionsBill Richardson2016-04-051-6/+11
| | | | | | | | | | | | | | | | | | | | When compiling the EC firmware outside of the chroot, some optional packages may not be installed. Let's be sure the tools exist before we try to use them. BUG=none BRANCH=none TEST=make buildall, both inside and outside of the chroot Note that to build outside the chroot, we need to 1. Use GNU make verion 4.1 or later 2. Install the gcc-arm-none-eabi package Change-Id: I78c75cb4ad658c003ded71b244b0458ae5532e0b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/337341 Reviewed-by: Shawn N <shawnn@chromium.org>
* Enforce compilation without system headersStefan Reinauer2016-02-031-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces HOST_CPPFLAGS to be used for all objects being compiled with HOSTCC rather then the target compiler. Since glibc is not linked into the EC, no glibc include files should be included in the EC code base. Hence, create local definitions for clock_t and wchar_t that match what the glibc include would have done, and remove some unneeded includes. Due to very eager optimization, we have to give gcc a little notch to not kick out memset. Signed-off-by: Stefan Reinauer <reinauer@chromium.org> BUG=chrome-os-partner:43025 BUG=chrome-os-partner:49517 BRANCH=none TEST=compile tested Change-Id: Idf3a2881fa8352756b0927b09c6a97473358f239 Reviewed-on: https://chromium-review.googlesource.com/322435 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
* Build: Use ccache to speed up buildsAnton Staaf2016-01-191-5/+5
| | | | | | | | | | | | | | | | | | This almost halves buildall times on my machine. Aseda reminded me of ccache. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I819eb1e9558a65fef5bd188c487115609da8ab92 Reviewed-on: https://chromium-review.googlesource.com/321911 Commit-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Define SECTION=* and SECTION_IS_* when compilingBill Richardson2015-09-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The linker scripts are passed through the preprocessor so that they can distinguish between RO and RW images. This change makes the same macros available when compiling, so that code can contain directives like #ifdef SECTION_IS_RO or #define FW_SIZE_(section) CONFIG_##section##_SIZE #define FW_SIZE(section) FW_SIZE_(section) int size = FW_SIZE(SECTION); BUG=none BRANCH=none TEST=make buildall Nothing uses this yet, so there's no change to the images. Change-Id: I6e03cd07c134f4b86aeddd9d516b74bbdb95b8a8 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/301255 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cr50: add plumbing for signing CR50 RO imagesVadim Bendebury2015-08-251-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The signer utility needs to be built and the flat image needs to be signed. The signer utility is written in C++, supporting this required adding a new make command to Makefile.rules and a build file for the utility. The signing now needs to be a part of generating the .flat file. To achieve this an alternative set of rules is defined in Makfile.rules for targets where RO image needs to be signed. Rules for converting elf to hex have been consolidated as there is no need to omit the --set-section-flags when it does not apply. BRANCH=none BUG=chrome-os-partner:43025 TEST=as follows: - ran 'rm build/cr50; make BOARD=cr50' - observed that both build/cr50/ec.bin and build/cr50/RO/ec.RO.flat have the required signature header in the first 1024 bytes. - verified that the cr50 board can be booted over SPI using the image in build/cr50/RO/ec.RO.flat Change-Id: Iacc22561de67fadfaf8e049bf9578cbd08cfad86 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/295291 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* build-infr: Add support for shared RO library.Aseda Aboagye2015-07-171-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces the build infrastructure changes needed for creating a shared RO library. (libsharedobjs). The end goal is for the library to contain various objects that can be shared with both the RO and RW EC images. Now, there are 3 make goals: ro, rw, and libsharedobjs. In order for changes that are only specific to a single image (ie: RW only) to be applied correctly, the object files are now built separately for the RO, RW, shared objects library targets. NOTE: Certain EC targets are incompatible with this model due to the fact that only one image is present within flash at a time. BRANCH=none BUG=None TEST=make -j buildall tests TEST=make -j BOARD=cr50 xrefs TEST=make BOARD=samus dis TEST=Built samus EC image and compared that the final EC image was identical to the upstream version (except for the git SHAs & version strings). CQ-DEPEND=CL:285934 Change-Id: I8e67f089710be9c6d7017718109262394bdad2f5 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/274079 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* Add option to enable GCC LTOVincent Palatin2015-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | Add CONFIG_LTO to use GCC Link-Time Optimizations to try to reduce the flash footprint of the firmware. Add additional protection to some functions/data to avoid removal by the linker when their usage is not obvious. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=make buildall (with and without LTO enable on all boards) Change-Id: I586b8c1eda4592b416c85383b65153c1d5ab0059 Reviewed-on: https://chromium-review.googlesource.com/271291 Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* Use GCC instead of LD to trigger the linkerVincent Palatin2015-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | Invoke the linker through gcc rather than directly with ld. This will allow us to use some more advanced features : e.g. LTO. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=none BRANCH=none TEST=make buildall then compare manually old and new binaries Change-Id: I101b1edbaebd5628624a5a8c12d5c0b5fa9e2c50 Reviewed-on: https://chromium-review.googlesource.com/271290 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
* make: add generation of sorted symbol mapsstabilize-7059.BVadim Bendebury2015-05-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Sorted symbol maps are useful when one wants to look up an address to associate it with a function or a variable, or to estimate how much room certain components of the image take. This patch adds a rule and creates a dependency to make sure that sorted maps (assigned extension .smap) are generated during builds. BRANCH=none BUG=none TEST=make buildall -j observed 91 .elf files and 89 .smap files generated. the two images not triggering .smap file generation are build/npcx_evb/chip/npcx/lfw/ec_lfw build/npcx_evb/chip/npcx/spiflashfw/ec_npcxflash they could be added in a follow up patch if deemed necessary. Change-Id: I196a2ffe059a83481b7a313617d516634762dc60 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/270117 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move target specific GCC code generation optionsVincent Palatin2015-04-181-2/+2
| | | | | | | | | | | | | | | | | | | | | Move "-fno-delete-null-pointer-checks -fconserve-stack" to the target-only portion of the CFLAGS as they are no needed for host tools (and not supported by clang). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chromium:475960 TEST=make utils-host V=1 make BOARD=samus_pd V=1 and manually check the compilation flags Change-Id: I001359621d60b5ad4e020f41fe2e97d4b7edec2a Reviewed-on: https://chromium-review.googlesource.com/266212 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* twinkie: build a combined firmwareVincent Palatin2015-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Build a Twinkie firmware image with the regular Twinkie sniffer firmware in the RO partition and a firmware behaving as a USB PD sink in the RW partition. The user can call the "twinkie sink" command to switch the USB PD sink firmware in the RW partition (and call "reboot" if he changes his mind and wants the sniffer back). Restore the ability of building different tasklists which was broken where the tests build was simplified. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=make buildall ./board/twinkie/build_rw_variant Try "twinkie sink" command on a Twinkie with the combined firmware. Change-Id: Ie489ce97a774ae7a22ac639c49a3d6e412e62de8 Reviewed-on: https://chromium-review.googlesource.com/237221 Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>