diff --git a/src/integration/stimulus/L0_regression.yml b/src/integration/stimulus/L0_regression.yml index c261c8d60..5868cdf89 100644 --- a/src/integration/stimulus/L0_regression.yml +++ b/src/integration/stimulus/L0_regression.yml @@ -31,6 +31,7 @@ contents: - ../test_suites/smoke_test_trng/smoke_test_trng.yml - ../test_suites/smoke_test_qspi/smoke_test_qspi.yml - ../test_suites/smoke_test_uart/smoke_test_uart.yml + - ../test_suites/smoke_test_hw_config/smoke_test_hw_config.yml - ../test_suites/smoke_test_kv_uds_reset/smoke_test_kv_uds_reset.yml - ../test_suites/smoke_test_kv_securitystate/smoke_test_kv_securitystate.yml - ../test_suites/smoke_test_kv_ecc_flow/smoke_test_kv_ecc_flow.yml diff --git a/src/integration/stimulus/L0_trng_regression.yml b/src/integration/stimulus/L0_trng_regression.yml index 9bf496444..e55a5adbb 100644 --- a/src/integration/stimulus/L0_trng_regression.yml +++ b/src/integration/stimulus/L0_trng_regression.yml @@ -14,6 +14,7 @@ contents: - ../test_suites/c_intr_handler/c_intr_handler.yml - ../test_suites/smoke_test_sram_ecc/smoke_test_sram_ecc.yml - ../test_suites/smoke_test_trng/smoke_test_trng.yml + - ../test_suites/smoke_test_hw_config/smoke_test_hw_config.yml - ../test_suites/smoke_test_kv_uds_reset/smoke_test_kv_uds_reset.yml - ../test_suites/smoke_test_wdt/smoke_test_wdt.yml - ../test_suites/smoke_test_cg_wdt/smoke_test_cg_wdt.yml diff --git a/src/integration/stimulus/testsuites/caliptra_top_nightly_directed_regression.yml b/src/integration/stimulus/testsuites/caliptra_top_nightly_directed_regression.yml index 1c0bce644..f37d768ba 100644 --- a/src/integration/stimulus/testsuites/caliptra_top_nightly_directed_regression.yml +++ b/src/integration/stimulus/testsuites/caliptra_top_nightly_directed_regression.yml @@ -29,12 +29,14 @@ contents: - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_trng/smoke_test_trng.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_qspi/smoke_test_qspi.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_uart/smoke_test_uart.yml + - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_hw_config/smoke_test_hw_config.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_uds_reset/smoke_test_kv_uds_reset.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_securitystate/smoke_test_kv_securitystate.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_ecc_flow/smoke_test_kv_ecc_flow.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_hmac_flow/smoke_test_kv_hmac_flow.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_hmac_multiblock_flow/smoke_test_kv_hmac_multiblock_flow.yml - - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_sha512_flow/smoke_test_kv_sha512_flow.yml +# SHA512 KV functionality is removed +# - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_sha512_flow/smoke_test_kv_sha512_flow.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_crypto_flow/smoke_test_kv_crypto_flow.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/pv_hash_and_sign/pv_hash_and_sign.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_pcr_signing/smoke_test_pcr_signing.yml diff --git a/src/integration/test_suites/smoke_test_hw_config/caliptra_isr.h b/src/integration/test_suites/smoke_test_hw_config/caliptra_isr.h new file mode 100644 index 000000000..7bf456414 --- /dev/null +++ b/src/integration/test_suites/smoke_test_hw_config/caliptra_isr.h @@ -0,0 +1,193 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// 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 +// +// http://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. +// +// --------------------------------------------------------------------- +// File: caliptra_isr.h +// Description: +// Provides function declarations for use by external test files, so +// that the ISR functionality may behave like a library. +// TODO: +// This header file includes inline function definitions for event and +// test specific interrupt service behavior, so it should be copied and +// modified for each test. +// --------------------------------------------------------------------- + +#ifndef CALIPTRA_ISR_H + #define CALIPTRA_ISR_H + +#include "caliptra_reg.h" +#include +#include "printf.h" +#include "riscv_hw_if.h" + +/* --------------- symbols/typedefs --------------- */ +typedef struct { + uint32_t doe_error; + uint32_t doe_notif; + uint32_t ecc_error; + uint32_t ecc_notif; + uint32_t hmac_error; + uint32_t hmac_notif; + uint32_t kv_error; + uint32_t kv_notif; + uint32_t sha512_error; + uint32_t sha512_notif; + uint32_t sha256_error; + uint32_t sha256_notif; + uint32_t qspi_error; + uint32_t qspi_notif; + uint32_t uart_error; + uint32_t uart_notif; + uint32_t i3c_error; + uint32_t i3c_notif; + uint32_t soc_ifc_error; + uint32_t soc_ifc_notif; + uint32_t sha512_acc_error; + uint32_t sha512_acc_notif; +} caliptra_intr_received_s; +extern volatile caliptra_intr_received_s cptra_intr_rcv; + +/* --------------- Function Declarations --------------- */ + +// Performs all the CSR setup to configure and enable vectored external interrupts +void init_interrupts(void); + +// These inline functions are used to insert event-specific functionality into the +// otherwise generic ISR that gets laid down by the parameterized macro "nonstd_veer_isr" +inline void service_doe_error_intr() {return;} +inline void service_doe_notif_intr() {return;} + +inline void service_ecc_error_intr() {return;} +inline void service_ecc_notif_intr() {return;} + +inline void service_hmac_error_intr() {return;} +inline void service_hmac_notif_intr() {return;} + +inline void service_kv_error_intr() {return;} +inline void service_kv_notif_intr() {return;} +inline void service_sha512_error_intr() {return;} +inline void service_sha512_notif_intr() {return;} + +inline void service_sha256_error_intr() {return;} +inline void service_sha256_notif_intr() {return;} + +inline void service_qspi_error_intr() {return;} +inline void service_qspi_notif_intr() {return;} +inline void service_uart_error_intr() {return;} +inline void service_uart_notif_intr() {return;} +inline void service_i3c_error_intr() {return;} +inline void service_i3c_notif_intr() {return;} + +inline void service_soc_ifc_error_intr() { + uint32_t * reg = (uint32_t *) (CLP_SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R); + uint32_t sts = *reg; + /* Write 1 to Clear the pending interrupt */ + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_INTERNAL_STS_MASK) { + *reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_INTERNAL_STS_MASK; + cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_INTERNAL_STS_MASK; + } + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_INV_DEV_STS_MASK) { + *reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_INV_DEV_STS_MASK; + cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_INV_DEV_STS_MASK; + } + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_CMD_FAIL_STS_MASK) { + *reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_CMD_FAIL_STS_MASK; + cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_CMD_FAIL_STS_MASK; + } + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_BAD_FUSE_STS_MASK) { + *reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_BAD_FUSE_STS_MASK; + cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_BAD_FUSE_STS_MASK; + } + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_ICCM_BLOCKED_STS_MASK) { + *reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_ICCM_BLOCKED_STS_MASK; + cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_ICCM_BLOCKED_STS_MASK; + } + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_MBOX_ECC_UNC_STS_MASK) { + *reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_MBOX_ECC_UNC_STS_MASK; + cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_MBOX_ECC_UNC_STS_MASK; + } + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_WDT_TIMER1_TIMEOUT_STS_MASK) { + *reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_WDT_TIMER1_TIMEOUT_STS_MASK; + cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_WDT_TIMER1_TIMEOUT_STS_MASK; + } + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_WDT_TIMER2_TIMEOUT_STS_MASK) { + *reg = SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_WDT_TIMER2_TIMEOUT_STS_MASK; + cptra_intr_rcv.soc_ifc_error |= SOC_IFC_REG_INTR_BLOCK_RF_ERROR_INTERNAL_INTR_R_ERROR_WDT_TIMER2_TIMEOUT_STS_MASK; + } + if (sts == 0) { + VPRINTF(ERROR,"bad soc_ifc_error_intr sts:%x\n", sts); + SEND_STDOUT_CTRL(0x1); + while(1); + } +} + +inline void service_soc_ifc_notif_intr () { + uint32_t * reg = (uint32_t *) (CLP_SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R); + uint32_t sts = *reg; + /* Write 1 to Clear the pending interrupt */ + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_AVAIL_STS_MASK) { + VPRINTF(HIGH, "cmd_avail\n"); + *reg = SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_AVAIL_STS_MASK; + cptra_intr_rcv.soc_ifc_notif |= SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_AVAIL_STS_MASK; + } + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_MBOX_ECC_COR_STS_MASK) { + VPRINTF(HIGH, "mbox_ecc_cor\n"); + *reg = SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_MBOX_ECC_COR_STS_MASK; + cptra_intr_rcv.soc_ifc_notif |= SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_MBOX_ECC_COR_STS_MASK; + } + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_DEBUG_LOCKED_STS_MASK) { + VPRINTF(HIGH, "debug_locked\n"); + *reg = SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_DEBUG_LOCKED_STS_MASK; + cptra_intr_rcv.soc_ifc_notif |= SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_DEBUG_LOCKED_STS_MASK; + } + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_SCAN_MODE_STS_MASK) { + VPRINTF(HIGH, "SCAN_MODE\n"); + *reg = SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_SCAN_MODE_STS_MASK; + cptra_intr_rcv.soc_ifc_notif |= SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_SCAN_MODE_STS_MASK; + } + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_SOC_REQ_LOCK_STS_MASK) { + VPRINTF(HIGH, "soc_req_lock\n"); + *reg = SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_SOC_REQ_LOCK_STS_MASK; + cptra_intr_rcv.soc_ifc_notif |= SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_SOC_REQ_LOCK_STS_MASK; + } + if (sts & SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_GEN_IN_TOGGLE_STS_MASK) { + VPRINTF(HIGH, "gen_in_toggle\n"); + *reg = SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_GEN_IN_TOGGLE_STS_MASK; + cptra_intr_rcv.soc_ifc_notif |= SOC_IFC_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_GEN_IN_TOGGLE_STS_MASK; + } + if (sts == 0) { + VPRINTF(ERROR,"bad soc_ifc_notif_intr sts:%x\n", sts); + SEND_STDOUT_CTRL(0x1); + while(1); + } +} + +inline void service_sha512_acc_error_intr() {return;} +inline void service_sha512_acc_notif_intr() { + uint32_t * reg = (uint32_t *) (CLP_SHA512_ACC_CSR_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R); + uint32_t sts = *reg; + /* Write 1 to Clear the pending interrupt */ + if (sts & SHA512_ACC_CSR_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_DONE_STS_MASK) { + *reg = SHA512_ACC_CSR_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_DONE_STS_MASK; + cptra_intr_rcv.sha512_acc_notif |= SHA512_ACC_CSR_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_DONE_STS_MASK; + } + if (sts == 0) { + VPRINTF(ERROR,"bad sha512_acc_notif_intr sts:%x\n", sts); + SEND_STDOUT_CTRL(0x1); + while(1); + } +} + + +#endif //CALIPTRA_ISR_H diff --git a/src/integration/test_suites/smoke_test_hw_config/smoke_test_hw_config.c b/src/integration/test_suites/smoke_test_hw_config/smoke_test_hw_config.c new file mode 100644 index 000000000..0fd04b750 --- /dev/null +++ b/src/integration/test_suites/smoke_test_hw_config/smoke_test_hw_config.c @@ -0,0 +1,138 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// 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 +// +// http://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. +// +#include "caliptra_defines.h" +#include "caliptra_isr.h" +#include "riscv-csr.h" +#include "veer-csr.h" +#include "riscv_hw_if.h" +#include +#include +#include "printf.h" + + +//int whisperPrintf(const char* format, ...); +//#define ee_printf whisperPrintf + + +volatile char* stdout = (char *)STDOUT; +volatile uint32_t intr_count; +#ifdef CPT_VERBOSITY + enum printf_verbosity verbosity_g = CPT_VERBOSITY; +#else + enum printf_verbosity verbosity_g = LOW; +#endif + +volatile caliptra_intr_received_s cptra_intr_rcv = { + .doe_error = 0, + .doe_notif = 0, + .ecc_error = 0, + .ecc_notif = 0, + .hmac_error = 0, + .hmac_notif = 0, + .kv_error = 0, + .kv_notif = 0, + .sha512_error = 0, + .sha512_notif = 0, + .sha256_error = 0, + .sha256_notif = 0, + .qspi_error = 0, + .qspi_notif = 0, + .uart_error = 0, + .uart_notif = 0, + .i3c_error = 0, + .i3c_notif = 0, + .soc_ifc_error = 0, + .soc_ifc_notif = 0, + .sha512_acc_error = 0, + .sha512_acc_notif = 0, +}; + +void main(void) { + int argc=0; + char *argv[1]; + uint32_t data; + uint32_t data_exp; + uint8_t fail = 0; + + VPRINTF(LOW, "----------------------------------\nHardware Config Test from VeeR EL2 !!\n----------------------------------\n"); + + // Setup the interrupt CSR configuration + init_interrupts(); + + // Test HW REV ID + data = (lsu_read_32(CLP_SOC_IFC_REG_CPTRA_HW_REV_ID) & SOC_IFC_REG_CPTRA_HW_REV_ID_CPTRA_GENERATION_MASK) >> SOC_IFC_REG_CPTRA_HW_REV_ID_CPTRA_GENERATION_LOW; + #ifdef CALIPTRA_HW_REV_ID + if (data != CALIPTRA_HW_REV_ID) { + VPRINTF(FATAL, "HW REV ID register reports a version of major [%u], minor [%u], patch [%u] which does not match the expected value %u.%u.%u\n", + (data & 0xf), + (data & 0xf0) >> 4, + (data & 0xff00) >> 16, + (CALIPTRA_HW_REV_ID & 0xf), + (CALIPTRA_HW_REV_ID & 0xf0) >> 4, + (CALIPTRA_HW_REV_ID & 0xff00) >> 16); + fail = 1; + } + #else + VPRINTF(FATAL, "CALIPTRA_HW_REV_ID is not defined!\n"); + fail = 1; + #endif + + // Test HW CONFIG + data = lsu_read_32(CLP_SOC_IFC_REG_CPTRA_HW_CONFIG); + #ifdef CALIPTRA_HWCONFIG_TRNG_EN + data_exp = SOC_IFC_REG_CPTRA_HW_CONFIG_ITRNG_EN_MASK; + #else + data_exp = 0; + #endif + if ((data & SOC_IFC_REG_CPTRA_HW_CONFIG_ITRNG_EN_MASK) != data_exp) { + VPRINTF(FATAL, "HW Config register reports [%d] for ITRNG EN, expected [%d]!\n", (data & SOC_IFC_REG_CPTRA_HW_CONFIG_ITRNG_EN_MASK), data_exp); + fail = 1; + } + #ifdef CALIPTRA_HWCONFIG_QSPI_EN + data_exp = SOC_IFC_REG_CPTRA_HW_CONFIG_QSPI_EN_MASK; + #else + data_exp = 0; + #endif + if ((data & SOC_IFC_REG_CPTRA_HW_CONFIG_QSPI_EN_MASK) != data_exp) { + VPRINTF(FATAL, "HW Config register reports [%d] for QSPI EN, expected [%d]!\n", (data & SOC_IFC_REG_CPTRA_HW_CONFIG_QSPI_EN_MASK), data_exp); + fail = 1; + } + #ifdef CALIPTRA_HWCONFIG_I3C_EN + data_exp = SOC_IFC_REG_CPTRA_HW_CONFIG_I3C_EN_MASK; + #else + data_exp = 0; + #endif + if ((data & SOC_IFC_REG_CPTRA_HW_CONFIG_I3C_EN_MASK) != data_exp) { + VPRINTF(FATAL, "HW Config register reports [%d] for I3C EN, expected [%d]!\n", (data & SOC_IFC_REG_CPTRA_HW_CONFIG_I3C_EN_MASK), data_exp); + fail = 1; + } + #ifdef CALIPTRA_HWCONFIG_UART_EN + data_exp = SOC_IFC_REG_CPTRA_HW_CONFIG_UART_EN_MASK; + #else + data_exp = 0; + #endif + if ((data & SOC_IFC_REG_CPTRA_HW_CONFIG_UART_EN_MASK) != data_exp) { + VPRINTF(FATAL, "HW Config register reports [%d] for UART EN, expected [%d]!\n", (data & SOC_IFC_REG_CPTRA_HW_CONFIG_UART_EN_MASK), data_exp); + fail = 1; + } + + // Ending status + if (fail) { + SEND_STDOUT_CTRL(0x1); + while(1); + } + + return; +} diff --git a/src/integration/test_suites/smoke_test_hw_config/smoke_test_hw_config.yml b/src/integration/test_suites/smoke_test_hw_config/smoke_test_hw_config.yml new file mode 100755 index 000000000..ce834e9ee --- /dev/null +++ b/src/integration/test_suites/smoke_test_hw_config/smoke_test_hw_config.yml @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# 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 +# +# http://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. +# +--- +seed: 1 +testname: smoke_test_hw_config diff --git a/tools/scripts/Makefile b/tools/scripts/Makefile index 65bc2941e..6d94d4d84 100644 --- a/tools/scripts/Makefile +++ b/tools/scripts/Makefile @@ -15,7 +15,16 @@ PLAYBOOK_RANDOM_SEED ?= $(shell date +%s) BUILD_CFLAGS ?= +# Cflags to give fw visibility to expected hw configuration +# Current release version is 1.0.2 - smoke test uses this value to check HW_REV_ID register +# Update the value here after 1.0.2 +CALIPTRA_HW_REV_ID=0x0201 +HWCFG_CFLAGS ?= -DCALIPTRA_HW_REV_ID=$(CALIPTRA_HW_REV_ID) TEST_CFLAGS = -g -O3 -DMY_RANDOM_SEED=$(PLAYBOOK_RANDOM_SEED) $(BUILD_CFLAGS) +CALIPTRA_INTERNAL_QSPI ?= 1 +CALIPTRA_INTERNAL_TRNG ?= 1 +CALIPTRA_INTERNAL_UART ?= 1 +CALIPTRA_INTERNAL_I3C ?= 0 VERILATOR = verilator GCC_PREFIX = riscv64-unknown-elf BUILD_DIR = $(CURDIR) @@ -182,7 +191,23 @@ TB_DPI_SRCS := $(addprefix $(CALIPTRA_ROOT)/src/integration/test_suites/libs/,$( TB_VERILATOR_SRCS = $(TBDIR)/test_caliptra_top_tb.cpp $(TB_DPI_SRCS) # Testbench defs -TB_DEFS = +define+CALIPTRA_INTERNAL_QSPI+CALIPTRA_INTERNAL_TRNG+CALIPTRA_INTERNAL_UART +TB_DEFS = +ifeq ($(CALIPTRA_INTERNAL_QSPI), 1) +TB_DEFS += +define+CALIPTRA_INTERNAL_QSPI +HWCFG_CFLAGS += -DCALIPTRA_HWCONFIG_QSPI_EN +endif +ifeq ($(CALIPTRA_INTERNAL_TRNG), 1) +TB_DEFS += +define+CALIPTRA_INTERNAL_TRNG +HWCFG_CFLAGS += -DCALIPTRA_HWCONFIG_TRNG_EN +endif +ifeq ($(CALIPTRA_INTERNAL_UART), 1) +TB_DEFS += +define+CALIPTRA_INTERNAL_UART +HWCFG_CFLAGS += -DCALIPTRA_HWCONFIG_UART_EN +endif +ifeq ($(CALIPTRA_INTERNAL_I3C) , 1) +TB_DEFS += +define+CALIPTRA_INTERNAL_I3C +HWCFG_CFLAGS += -DCALIPTRA_HWCONFIG_I3C_EN +endif # By default debugging (JTAG) is locked in Caliptra. Add "DEBUG_UNLOCKED=1" to # enable it. @@ -311,7 +336,7 @@ program.hex: $(OFILE_CRT) $(OFILES) $(LINK) %.o : %.c $(HEADER_FILES) cp $(HEADER_FILES) $(BUILD_DIR) - $(GCC_PREFIX)-gcc $(includes) $(TEST_CFLAGS) -DCOMPILER_FLAGS="\"$(TEST_CFLAGS)\"" $(ABI) -nostdlib -c $< -o $@ + $(GCC_PREFIX)-gcc $(includes) $(TEST_CFLAGS) $(HWCFG_CFLAGS) -DCOMPILER_FLAGS="\"$(TEST_CFLAGS)\"" $(ABI) -nostdlib -c $< -o $@ endif