| # Copyright 2024 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # https://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # Support for building cheriot-rtos functional tests to run on sencha | |
| SENCHA_TEST_DIR := $(OUT)/cheriot/sencha/test-suite | |
| SENCHA_TEST := $(SENCHA_TEST_DIR)/release/cheriot/cheriot/release/test-suite | |
| TEST_FLASH_RELEASE=$(CHERIOT_OUT_RELEASE)/test_flash.tar | |
| # XXX symlink cheriot fw to "kernel" to satisfy elfloader | |
| $(TEST_FLASH_RELEASE): $(MATCHA_BUNDLE_RELEASE) $(SENCHA_TEST) | $(TMP_RELEASE) | |
| cp -f $(MATCHA_BUNDLE_RELEASE) $(TMP_RELEASE)/matcha-tock-bundle | |
| ${C_PREFIX}strip $(TMP_RELEASE)/matcha-tock-bundle | |
| ${C_PREFIX}objcopy -O binary -g $(TMP_RELEASE)/matcha-tock-bundle $(TMP_RELEASE)/matcha-tock-bundle.bin | |
| ln -sf $(SENCHA_TEST) $(TMP_RELEASE)/kernel | |
| tar -C $(TMP_RELEASE) -cvhf $@ matcha-tock-bundle.bin kernel | |
| test_flash_release: sencha-test $(TEST_FLASH_RELEASE) | |
| ## Runs the cheriot-rtos testbench in renode on sencha | |
| sencha-testbench: test_flash_release | |
| ${MAKE} \ | |
| __SENCHA_TAR="@${TEST_FLASH_RELEASE}" \ | |
| __SENCHA_CHERIOT_ELF="@${TMP_RELEASE}/kernel" \ | |
| __sencha-simulate | |
| ## Version of the `sencha-testbench` target that also enables the simulator command | |
| ## line interface on port 4567. To access the simulator use something like | |
| ## telnet localhost 4567. Note renode will block until the cli is connected. | |
| sencha-testbench+cli: test_flash_release | |
| ${MAKE} \ | |
| __SENCHA_TAR="@${TEST_FLASH_RELEASE}" \ | |
| __SENCHA_CHERIOT_ELF="@${TMP_RELEASE}/kernel" \ | |
| __sencha-simulate+cli | |
| ## Generates the cheriot-rtos test-suite firmware | |
| sencha-test: | |
| ${MAKE} \ | |
| CHERIOT_BOARD=sencha \ | |
| CHERIOT_OUT_DIR=${SENCHA_TEST_DIR} \ | |
| CHERIOT_FIRMWARE_SRC_DIR=${CHERIOT_SRC_DIR}/tests \ | |
| CHERIOT_FIRMWARE_RELEASE=$(SENCHA_TEST) \ | |
| $(SENCHA_TEST) | |
| ## Cleans all build artifacts for the cheriot-rtos test suite built for sencha | |
| sencha-test-clean: | |
| rm -rf ${SENCHA_TEST_DIR} ${TMP_RELEASE} | |
| .PHONY:: sencha-testbench sencha-testbench+cli | |
| .PHONY:: test_flash_release | |
| .PHONY:: sencha-test sencha-test-clean |