summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/hatch_fp/board.h2
-rw-r--r--board/nocturne_fp/board.h2
-rw-r--r--common/build.mk16
-rw-r--r--include/config.h6
4 files changed, 26 insertions, 0 deletions
diff --git a/board/hatch_fp/board.h b/board/hatch_fp/board.h
index c8b8bc726e..d51f57a7fb 100644
--- a/board/hatch_fp/board.h
+++ b/board/hatch_fp/board.h
@@ -165,6 +165,8 @@
#define CONFIG_RNG
+#define CONFIG_ALWAYS_MEMSET
+
#define CONFIG_CMD_FLASH
#define CONFIG_CMD_SPI_XFER
diff --git a/board/nocturne_fp/board.h b/board/nocturne_fp/board.h
index 82fa7805b7..4b0a3a5426 100644
--- a/board/nocturne_fp/board.h
+++ b/board/nocturne_fp/board.h
@@ -150,6 +150,8 @@
#define CONFIG_RNG
+#define CONFIG_ALWAYS_MEMSET
+
#define CONFIG_CMD_FLASH
#define CONFIG_CMD_SPI_XFER
diff --git a/common/build.mk b/common/build.mk
index ba8432b252..63e5d052dc 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -240,6 +240,22 @@ $(out)/rma_key_from_blob.h: board/$(BOARD)/$(BLOB_FILE) util/bin2h.sh
endif
+ifeq ($(CONFIG_ALWAYS_MEMSET),y)
+CRYPTOCLIB := $(realpath ../../third_party/cryptoc)
+CPPFLAGS += -I$(abspath ./builtin)
+CPPFLAGS += -I$(CRYPTOCLIB)/include
+
+CRYPTOC_OBJS = $(shell find $(out)/cryptoc -name 'util.o')
+$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: LDFLAGS_EXTRA += $(CRYPTOC_OBJS)
+$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: cryptoc_objs
+
+# Force the external build each time, so it can look for changed sources.
+.PHONY: cryptoc_objs
+cryptoc_objs:
+ $(MAKE) obj=$(realpath $(out))/cryptoc SUPPORT_UNALIGNED=1 \
+ CONFIG_UPTO_SHA512=$(CONFIG_UPTO_SHA512) -C $(CRYPTOCLIB) objs
+endif
+
include $(_common_dir)fpsensor/build.mk
include $(_common_dir)usbc/build.mk
diff --git a/include/config.h b/include/config.h
index 867b3a5dca..832f1a740a 100644
--- a/include/config.h
+++ b/include/config.h
@@ -299,6 +299,12 @@
/* Define which ALS sensor is used for dimming the lightbar when dark */
#undef CONFIG_ALS_LIGHTBAR_DIMMING
+/*
+ * Support always_memset() defined in third_party/cryptoc, which will not be
+ * optimized out by compiler.
+ */
+#undef CONFIG_ALWAYS_MEMSET
+
/* Support AP hang detection host command and state machine */
#undef CONFIG_AP_HANG_DETECT