summaryrefslogtreecommitdiff
path: root/zephyr/test
Commit message (Collapse)AuthorAgeFilesLines
...
* zephyr: Shell of driver ztest.Jeremy Bettis2021-04-1211-0/+442
| | | | | | | | | | | | | | | | | | | | Create a shell of a test that can have many test suites for device drivers. Currently this test only checks that the EC_BATT_PRES_ODL can be read correctly by battery_is_present(). But it links in many device drivers and is a starting point for the next test. BUG=b:185118990 TEST=It is one BRANCH=none Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I07c8835015cbe0fec6aaf82f782400e894043a90 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2819029 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Fix duplicated definition warningKeith Short2021-04-091-10/+12
| | | | | | | | | | | | | | Fix a duplicated definition warning in zephyr/test/system. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ic18dbbd7a9523484c6c46552d807424dcf227d33 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2816142 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: i2c mapping using an enumYuval Peress2021-04-082-0/+2
| | | | | | | | | | | | | | | | | | | | Currently, every project will need to provide a custom mapping header for i2c as well as gpios. We'd like to move that overhead to the dts files, which will make the board dts a lot more reusable as well as clean up the bringup of new boards. Add to the i2c_ports enum from the dts named i2c port list. Each enum is only added if a node exists using that enum. This also allowes for verifying that the enum is only used once. BRANCH=none BUG=b:184786824 TEST=build and flashed volteer TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I42cc098a9badac57a3781fa9dfaf32c0ec0c5aca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2780838
* zephyr: lint pass, s/ {4}/\t/g for dts filesYuval Peress2021-04-072-24/+24
| | | | | | | | | | | | | | Use the same spacing (tab) for the i2c and i2c_dts overlay.dts files. BRANCH=none BUG=none TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I4e84ab626a2eb9a9eded304ef13153962cf863f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2811184 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zephyr: New test of ec appJeremy Bettis2021-04-024-0/+154
| | | | | | | | | | | | | | | | | | | | | | | Change zephy/app/ec/main.c:main to instead be named ec_app_main, so that it can be called from tests, and created a trivial stub main to call it. Fix up the CMake files for this change. Add a new ec_app test which calls the ec_app_main() and verifies that hooks of HOOK_INIT type are called. The CONFIG_PLATFORM_EC_HOOKS is the only config currently enabled in tests, so that is the only thing tested for now. BUG=b:184273560 TEST=zmake configure --test zephyr/test/ec_app BRANCH=none Change-Id: I84ca9b36d3f387629ff5bd83463429d762cc2301 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799914 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: implement task timersJack Rosenthal2021-03-202-1/+76
| | | | | | | | | | | | | | | | | | | | | CrOS EC OS provides one implicit timer associated with every task (see docs/core_runtime.md). As luck has it, we never needed these implicit timers for volteer, but ARM power sequencing code uses it. This implements the timer_arm and timer_cancel functions, which function equivalently to how they would in CrOS EC OS. (Note: we previously were compiling timer_arm and timer_cancel from CrOS EC, but these definitions were non-functional as we never call process_timers from Zephyr). BUG=b:183058135 BRANCH=none TEST=provided unit tests pass Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ibad20002c489a8149efde713d8273adae835f653 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774362 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: add bbram system callWealian Liao2021-03-101-1/+1
| | | | | | | | | | | | | | | | This CL include the following: 1. Adds BBRAM system call. 2. BBRAM read/write data isn't really for characters. Change to use uint8_t. BUG=None. BRANCH=None. TEST=build & boot EC on volteer Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: Iff92071e1808c4dacb24bf46e663898120369821 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2731177 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: add defer cancelingWealian Liao2021-03-101-1/+23
| | | | | | | | | | | | | | | | For the description of hook_call_deferred() in hooks.h, pass delay time -1 to hook_call_deferred() should cancel the deferred call. Add canceling to sync the original behavior in shim hook. BRANCH=none BUG=none TEST=zmake testall TEST=check defer is canceled by ` -1 ` parameter. Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I3e9743d5c19efbc8619fd5cbd61ff247db700af9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2738912 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: zmake: drop support for zephyr v2.4Jack Rosenthal2021-02-238-8/+0
| | | | | | | | | | | | | | | | | | | Drop support for Zephyr OS v2.4 on all boards, since the v2.5 uprev is successful. If someone still needs to manually compile for v2.4 for testing, one can do so by passing --zephyr-base=$PATH_TO_ZEPHYR_24 and --ignore-unsupported-zephyr-version to zmake. BUG=b:180409973 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I0b3922c0b7f47811b26bad4e7f99125cabdaed91 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2715345 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: support zephyr v2.5 on all projectsJack Rosenthal2021-02-188-0/+8
| | | | | | | | | | | | | | | | | | | | | | Zephyr v2.5 will build for all projects now, mark it as supported for all projects and it will be enabled by default. We can delete v2.4 from this list once v2.5 gets a bit more battle testing. If you need to build for v2.4 in the interim, you should pass the --zephyr-base flag to zmake, like so: $ zmake --zephyr-base ~/trunk/src/third_party/zephyr/main/v2.4 ... BUG=b:180409973 BRANCH=none TEST=zmake testall TEST=flash on delbin, test UART console functioning Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I9cb7902455b2c6f231bea5c0b08b0e18bca0ddd8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2705192 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: add board-specific DTS overlaysJack Rosenthal2021-02-066-0/+6
| | | | | | | | | | | | | | | Allow board-specific DTS overlays to be placed at zephyr/dts/board-overlays/${BOARD}.dts in any module. Zmake will find the file and append it to the DTC_OVERLAY_FILE list when discovered. BUG=b:179491802 BRANCH=none TEST=provided unit test passes Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I53d4a04b6056689696b4615b5998937dbcf801c4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2678795 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: Move bbram logic to devicetreeYuval Peress2021-02-052-5/+37
| | | | | | | | | | | | | | | | | Move all bbram logic to a common npcx.dtsi file included in both volteer and kohaku. Updates the bbram access logic in zephyr/shim/src/system.c to use devicetree. Updates the unit tests to match. BRANCH=none BUG=b:178807203 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I2a7c65b92a395c622e8cfe751e4e98b3173e38fb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2669271 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: flash/system: enable common/flash.c & common/system.cYuval Peress2021-02-032-228/+50
| | | | | | | | | | | | | | | | | | | Bring both flash.c and system.c into the build. zephyr/shim/src/system.c now includes only code that is needed to stub out the chip specific system.c implementation in platform/ec (which is now using the devicetree values). BRANCH=none BUG=b:176828988, b:174481378 TEST=zmake testall TEST=build volteer, flash, and test flashinfo. Cq-Depend: chromium:2631353 Change-Id: I5c542fca01dcc4af98401bcbbf402e579cd45e36 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2649463 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: test: update unit tests for zmakePaul Fagerburg2021-01-2515-131/+27
| | | | | | | | | | | | | | | | | Many of the options in CMakeLists.txt and prj.conf are no longer necessary with zmake and Kconfig handling them automatically now. BUG=b:178220157 BRANCH=none TEST=`zmake testall` Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: I845f42c4b51214f28ab7771734232fec763c04f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645696 Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* test: port accel_cal to ZtestPaul Fagerburg2021-01-224-0/+64
| | | | | | | | | | | | | | | BUG=b:172240633 BRANCH=none TEST=build for both EC and Ztest: `TEST_LIST_HOST=accel_cal make runhosttests` `zmake configure --test -B build/accel_cal zephyr/test/accel_cal` Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: Ie787403b36d775d4185cafad8ca134561a97794b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645198 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* volteer: i2c: rename i2c-keys node to named-i2c-portsFabio Baltieri2021-01-212-2/+2
| | | | | | | | | | | | | | Rename the node definition and instance to named-i2c-ports. This matches the node name and other references in the code. BUG=none TEST=zmake testall BRANCH=none Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I426cc29073d1725c208e151d0deeb9d5214bf7ac Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2638253 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: copy zephyr-chrome/tests/app/ec to platform/ecJack Rosenthal2021-01-124-0/+297
| | | | | | | | | | | | | | | The previous Git history can be found here: https://chromium.googlesource.com/chromiumos/platform/zephyr-chrome/+log/f500629b382077c1160ce9b1333afcf0f9c08d59/tests/app/ec BUG=b:177003034 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ia3fa7a2f3bd2861293ef78e53a98ae73257090e3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2622898 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: copy zephyr-chrome/tests/dts/bindings/i2c to platform/ecJack Rosenthal2021-01-125-0/+88
| | | | | | | | | | | | | | | Previous Git history can be found here: https://chromium.googlesource.com/chromiumos/platform/zephyr-chrome/+log/cc6e5d19939c03ac091b5e91d1a3b511ba99b68a/tests/dts/bindings/i2c BUG=b:177157241 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I6a0d774f8400a9fd2d7a8ce7f96943b3601debe4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2622899 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: switch to platform/ec printf format implementationJack Rosenthal2021-01-092-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this change, the cprints and cprintf shim implementations used Zephyr's printk to do the output formatting. Our EC code has some custom printf specifiers not supported by Zephyr's printk. We've already attempted to send some of our custom specifiers upstream, but upstream does not want them: https://github.com/zephyrproject-rtos/zephyr/pull/28882 The logical thing to do would be to bring in the vfnprintf function from our EC to the Zephyr build, and use that to do the output formatting instead. That's what this CL does. The binary cost of brining in this second printf implementation appears to be minimal (952 bytes on volteer). BUG=b:177065615 BRANCH=none TEST=on posix-ec and volteer, run gettime and observe output no longer contains %.6lld, but instead the correct system time Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I53cd4edf129223c12a2c5e7d0519623a8d07a328 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2618575
* zephyr: tasks: Fix collision of shimmed_tasks.hYuval Peress2020-12-282-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The issue here was initially found in https://crrev.com/c/2602440 where it was difficult (also not guaranteed to work) to declare custom tasks for tests. The issue was that in zephyr/test/tasks/ the file shimmed_tasks.h was used which is intended to replace zephyr/shim/include/shimmed_tasks.h. So far we've been lucky in that the build was resolving this to the test instance, but this is not guaranteed. This change does the following: 1. If running CONFIG_ZTEST then we add a new CONFIG_HAS_TEST_TASKS option that is defaulted to 'n'. 2. If CONFIG_HAS_TEST_TASKS is set to 'y', then we'll try to include shimmed_test_tasks.h which should be defined by the test and added somewhere in the include path (see zephyr/test/tasks/ for example). 3. We can now define custom tasks for tests. Note that in zephyr we can just use normal tasks via CROS_EC_TASK and don't need to use a special macro for test tasks. BRANCH=none BUG=b:172240633 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ib99c8ec08923a7e958e045d45d1aa2ec5e841ed5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2603458 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* zmake: change projects to chroot-supported toolchainsJack Rosenthal2020-12-165-5/+5
| | | | | | | | | | | | | | | | | Switch all zmake.yaml files to chroot-supported toolchains (chroot llvm for these files) so that we can run "zmake testall" without grabbing the Zephyr SDK. BUG=b:175248887 BRANCH=none TEST=zmake testall Cq-Depend: chromium:2590992 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I6c57ca734c18bdcc159b185709a3dd22a52a8b52 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2591628 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: put project(...) after find_package(Zephyr)Jack Rosenthal2020-12-155-5/+5
| | | | | | | | | | | | | | | | When including the Zephyr source, this will change the values of CMAKE_C_COMPILER and CMAKE_CXX_COMPILER, causing cmake to execute again having forgotten about some of the command (since these are cached variables). BUG=b:175248887 BRANCH=none TEST=zmake testall, no "cached variables have changed" from cmake Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I7eb1004060b0ba51d8c336dfe507ad747abe80ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2591627 Reviewed-by: Simon Glass <sjg@chromium.org>
* task_set_event: remove the wait argumentDawid Niedzwiecki2020-12-141-6/+6
| | | | | | | | | | | | | | | | | | | | There is an option in the task_set_event function which force the calling task to wait for an event. However, the option is never used thus remove it. This also will help in the Zephyr migration process. BUG=b:172360521 BRANCH=none TEST=make buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ic152fd3d6862d487bcc0024c48d136556c0b81bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521599 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: remove dependency on chip specific code for npcxYuval Peress2020-12-101-6/+0
| | | | | | | | | | | | | BRANCH=none BUG=b:175249000 TEST=zmake testall Cq-Depend: chromium:2583272 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ie50e56df60e060c3741013912ab46d807fc5e417 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2582819 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add is-test flag to zmake.yaml files under test/Yuval Peress2020-12-045-0/+5
| | | | | | | | | | | | | | | | This change will make the firmware builder auto-detect new tests. BRANCH=none BUG=none TEST=Ran zephyr's firmware_builder.py Cq-Depend: chromium:2551964 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I70ba1b32b67e2cb4e3676d228b299294028597a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2552848 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr/test/i2c: update to i2c_controller.c nameJett Rink2020-12-031-1/+1
| | | | | | | | | | | | | | After COIL rename, we need to update the CMakeLists.txt for the i2c test BRANCH=none BUG=b:174572350 TEST=builds and passes test Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I33b712876c11dc77e7835c2505749d449e11ffa6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2572398 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: add i2c_ports enumYuval Peress2020-11-205-0/+120
| | | | | | | | | | | | | | | | | | | This change adds an i2c_ports enum based on the devicetree phandle list 'named-i2c-ports'. Modeled after named-gpios. Currently, this is only enabled for ztests as it conflicts with the definitions in config_chip-npcx7.h. But once that dependency is removed, this enum will become publicly available. BUG=b:171302975 BRANCH=none TEST=../zephyr-chrome/firmware_builder.py test Cq-Depend: chromium:2546328 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I8e763da0c867fed383eb333092f191079fb792ea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2546997 Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr/tests: add zmake file for crc testJett Rink2020-11-161-0/+9
| | | | | | | | | | | | | | The zmake file allows us to use the zmake program to easily build this test BRANCH=none BUG=none TEST=use `zmake configure -b -B /tmp/build zephyr/test/crc` Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: If1928c8c6705b4e8905e2f84eee896158a7510e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2540732 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: fix issue with set_event hanging before tasks startJett Rink2020-11-131-3/+24
| | | | | | | | | | | | | | Initialize the kernel objects before application code as a chance to run. This ensures that any event that is set before tasks start will get delivered (and won't crash the kernel). BRANCH=none BUG=none TEST=included unit test Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I84ecfddbe706e7e1860f310571851ee8dedd07d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2535984
* zephyr: forward cros_crc8 to zephyrs crc8 implJett Rink2020-11-133-0/+49
| | | | | | | | | | | | | | | Shim in support for crc8 used in CBI, I2C, and other applications within platform/ec BRANCH=none BUG=b:168032589 TEST=add unit test for platform/ec and zephyr based CRC8 approaches and verify they both pass. Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I9b6112cb83dab81a44a1ac020d4efb1b7bb1df5f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532692 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr/test/base32: change test to depend on lessJett Rink2020-11-122-2/+16
| | | | | | | | | | | | | | | As we add more shim code and configs, we don't want to remove the functionality in all of the tests. Convert this test to only include the files it needs to link to perform the shim test. BRANCH=none BUG=b:172512307 TEST=base32 test builds and passes Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I4a7232c98397600d578e18b67935924b088f377b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532687 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr/test/hooks: change test to depend on lessJett Rink2020-11-122-6/+18
| | | | | | | | | | | | | | | As we add more shim code and configs, we don't want to remove the functionality in all of the tests. Convert this hooks test to only include the two files it needs to link to perform the shim test. BRANCH=none BUG=b:172512307 TEST=hooks test builds and passes Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I0613670fe3cc056e33035ccc5ad1418e5e3d6db0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532686 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Revert "zephyr: forward cros_crc8 to zephyrs crc8 impl"Jett Rink2020-11-113-49/+0
| | | | | | | | | | | | | | | Something slipped through CQ coverage. Need to figure out, but in the mean time, revert the 3 CLs that seemed to have caused the issue. BRANCH=none BUG=chromium:1147953 TEST=none This reverts commit 22ee9a346718a9a07955fd81b0d03c4dde5b2ec8. Change-Id: I5617e39204a7c05001363d5780fa2f52e3e1ea05 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2533355
* zephyr: forward cros_crc8 to zephyrs crc8 implJett Rink2020-11-113-0/+49
| | | | | | | | | | | | | | | Shim in support for crc8 used in CBI, I2C, and other applications within platform/ec BRANCH=none BUG=b:168032589 TEST=add unit test for platform/ec and zephyr based CRC8 approaches and verify they both pass. Change-Id: Ib609f98596c4edc6e6f0d01b6242e62a1f95ad72 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2527811 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: move from SYS_INIT to mainJett Rink2020-11-091-1/+6
| | | | | | | | | | | | | | | | | | We are going to need to perform initialization in Zephyr's main before we start the EC tasks or call the INIT hooks. If we rely on SYS_INIT, all of that happens before main is called. BRANCH=none BUG=none TEST=pass tasks unit tests and run on volteer Cq-Depend: chromium:2523462 Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Icd035695b86fc9690cea88887902be61d9b37a18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523380 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: add zmake.yaml filesJett Rink2020-11-062-0/+18
| | | | | | | | | | | | | | | | | Add the zmake config file for test that don't have one BRANCH=none BUG=none TEST=zmake builds both tests zmake configure -b /tmp/test ~/chromiumos/src/platform/ec/zephyr/test/tasks zmake build /tmp/test Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Ibd9fd114e7fff008bb07cb616529d82cdb774a0a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521064 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: shim in hooks and deferredJack Rosenthal2020-11-054-0/+163
| | | | | | | | | | | | | | | | | | | | | | Implement deferred calls using the Zephyr's delayed work queues. Implement hooks using SYS_INIT and a hooks registry created during init. BUG=b:168030971 BRANCH=none TEST=provided unit tests Build instructions for unit tests: zmake configure -B/tmp/test \ ~/trunk/src/platform/ec/zephyr/test/hooks zmake build /tmp/test Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id019cd1fe7bb3354377773d171036767e7efa706 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2504489 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: add task shimJett Rink2020-11-054-0/+253
| | | | | | | | | | | | | | | | Provide shim/translation layer for converting platform/ec tasks into zephyr threads. Provide implementation API for platform/ec task_ API BRANCH=none BUG=b:171741620 TEST=unit test provided TEST=clean_build.sh ~/chromiumos/src/platform/ec/zephyr/tests/tasks && ../build/zephyr/zephyr.elf Change-Id: Ia2a1f808ec56a89c2a08df9de318edb1b6e9f869 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2518665 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr/test/base32: specify board in makelistJett Rink2020-11-051-0/+1
| | | | | | | | | | | | | | | | Instead of specifying the board on the command line to build the base32 test. Specify it in Cmakelist instead. BRANCH=none BUG=none TEST=build and run base32 without passing board on commandline Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I8e7defa48cc285de1e1f32919b3e576698603e78 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2519240 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* test: support building base32 as a Zephyr testPaul Fagerburg2020-10-282-0/+13
With the Ztest API supported now, add the files to build the base32 unit test as a Zephyr test (instead of an EC test). BUG=b:168032590 BRANCH=None TEST=follow instructions in docs/ztest.md to build as a Zephyr test Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: I06dd7864f2de48aab5776950d4840f81728137f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2500465 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>