summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/hatch_fp/build.mk1
-rw-r--r--board/nocturne_fp/build.mk1
-rw-r--r--board/nucleo-f412zg/build.mk1
-rw-r--r--board/nucleo-h743zi/build.mk1
-rw-r--r--test/build.mk1
-rw-r--r--test/scratchpad.c34
-rw-r--r--test/scratchpad.tasklist9
7 files changed, 48 insertions, 0 deletions
diff --git a/board/hatch_fp/build.mk b/board/hatch_fp/build.mk
index 54c7fe05e7..48ed6d2aae 100644
--- a/board/hatch_fp/build.mk
+++ b/board/hatch_fp/build.mk
@@ -21,6 +21,7 @@ test-list-y=\
rollback \
rollback_entropy \
rtc \
+ scratchpad \
sha256 \
sha256_unrolled \
stm32f_rtc \
diff --git a/board/nocturne_fp/build.mk b/board/nocturne_fp/build.mk
index 89aa12a002..d11c25c805 100644
--- a/board/nocturne_fp/build.mk
+++ b/board/nocturne_fp/build.mk
@@ -22,6 +22,7 @@ test-list-y=\
rollback \
rollback_entropy \
rtc \
+ scratchpad \
sha256 \
sha256_unrolled \
stm32f_rtc \
diff --git a/board/nucleo-f412zg/build.mk b/board/nucleo-f412zg/build.mk
index 31c6d52799..17be2a15bf 100644
--- a/board/nucleo-f412zg/build.mk
+++ b/board/nucleo-f412zg/build.mk
@@ -19,6 +19,7 @@ test-list-y=\
rollback \
rollback_entropy \
rtc \
+ scratchpad \
sha256 \
sha256_unrolled \
stm32f_rtc \
diff --git a/board/nucleo-h743zi/build.mk b/board/nucleo-h743zi/build.mk
index 018a67c030..25d76458d2 100644
--- a/board/nucleo-h743zi/build.mk
+++ b/board/nucleo-h743zi/build.mk
@@ -19,5 +19,6 @@ test-list-y=\
rollback \
rollback_entropy \
rtc \
+ scratchpad \
sha256 \
sha256_unrolled \
diff --git a/test/build.mk b/test/build.mk
index 3491852b0c..8f82f917f4 100644
--- a/test/build.mk
+++ b/test/build.mk
@@ -163,6 +163,7 @@ rollback_entropy-y=rollback_entropy.o
rsa-y=rsa.o
rsa3-y=rsa.o
rtc-y=rtc.o
+scratchpad-y=scratchpad.o
sbs_charging-y=sbs_charging.o
sbs_charging_v2-y=sbs_charging_v2.o
sha256-y=sha256.o
diff --git a/test/scratchpad.c b/test/scratchpad.c
new file mode 100644
index 0000000000..8af697f0ae
--- /dev/null
+++ b/test/scratchpad.c
@@ -0,0 +1,34 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "system.h"
+#include "test_util.h"
+
+/**
+ * The first time this test runs, it should pass. After rebooting, the test
+ * should fail because the scratchpad register is set to 1.
+ */
+test_static int test_scratchpad(void)
+{
+ int rv;
+ uint32_t scratch;
+
+ scratch = system_get_scratchpad();
+ TEST_EQ(scratch, 0, "%d");
+
+ rv = system_set_scratchpad(1);
+ TEST_EQ(rv, EC_SUCCESS, "%d");
+
+ scratch = system_get_scratchpad();
+ TEST_EQ(scratch, 1, "%d");
+
+ return EC_SUCCESS;
+}
+
+void run_test(void)
+{
+ RUN_TEST(test_scratchpad);
+ test_print_result();
+}
diff --git a/test/scratchpad.tasklist b/test/scratchpad.tasklist
new file mode 100644
index 0000000000..51734f058d
--- /dev/null
+++ b/test/scratchpad.tasklist
@@ -0,0 +1,9 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * See CONFIG_TASK_LIST in config.h for details.
+ */
+#define CONFIG_TEST_TASK_LIST /* no tasks */