summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Hesling <hesling@chromium.org>2020-03-18 16:44:25 -0700
committerCommit Bot <commit-bot@chromium.org>2020-03-24 21:05:26 +0000
commita847dd2e7a9feb8e584c31a9c491b5df4bf59c2c (patch)
tree6816c9297eee87b5e9a01cda1b7a2b873027db3c
parent110b50c718ff7cbceff7fe7591cead70b2bb6eba (diff)
downloadchrome-ec-a847dd2e7a9feb8e584c31a9c491b5df4bf59c2c.tar.gz
bloonchipper: Reorganize board.h into sections
This brings no functional change, as verified with compare_build.sh @ https://crrev.com/c/2093897/11. BRANCH=none BUG=none TEST=./util/compare_builds.sh -b hatch_fp Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I98cb9a8f3419b376051d23c64db11b2059d71aa3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2109246 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
-rw-r--r--board/hatch_fp/board.h187
1 files changed, 117 insertions, 70 deletions
diff --git a/board/hatch_fp/board.h b/board/hatch_fp/board.h
index 21cabc658a..da459e80aa 100644
--- a/board/hatch_fp/board.h
+++ b/board/hatch_fp/board.h
@@ -17,19 +17,26 @@
#undef CONFIG_SYSTEM_UNLOCKED
-/*
- * These allow console commands to be flagged as restricted.
- * Restricted commands will only be permitted to run when
- * console_is_restricted() returns false.
- * See console_is_restricted's definition in board.c.
- */
-#define CONFIG_CONSOLE_COMMAND_FLAGS
-#define CONFIG_RESTRICTED_CONSOLE_COMMANDS
+/*-------------------------------------------------------------------------*
+ * Flash layout:
+ *
+ * +++++++++++++
+ * | RO |
+ * | ......... |
+ * | Rollback | (two sectors)
+ * +-----------+
+ * | RW |
+ * | |
+ * | |
+ * | |
+ * | |
+ * +++++++++++++
+ *
+ * We adjust the following macros to accommodate a for a rollback, RO,
+ * and RW region of different sizes.
+ *
+ *-------------------------------------------------------------------------*/
-/*
- * Flash layout: we redefine the sections offsets and sizes as we want to
- * include a rollback region, and will use RO/RW regions of different sizes.
- */
#undef _IMAGE_SIZE
#undef CONFIG_ROLLBACK_OFF
#undef CONFIG_ROLLBACK_SIZE
@@ -81,7 +88,11 @@
*/
#define CONFIG_FLASH_READOUT_PROTECTION_AS_PSTATE
-/* the UART console is on USART1 */
+/*-------------------------------------------------------------------------*
+ * UART Console Setup
+ *-------------------------------------------------------------------------*/
+
+/* The UART console is on USART1 */
#undef CONFIG_UART_CONSOLE
#define CONFIG_UART_CONSOLE 1
#undef CONFIG_UART_TX_BUF_SIZE
@@ -93,92 +104,128 @@
#undef CONFIG_UART_TX_DMA
#undef CONFIG_UART_RX_DMA
+/*-------------------------------------------------------------------------*
+ * Console Commands
+ *-------------------------------------------------------------------------*/
-/* Optional features */
-#undef CONFIG_ADC
+#define CONFIG_CMD_FLASH
+#define CONFIG_CMD_SPI_XFER
#define CONFIG_CMD_IDLE_STATS
-#define CONFIG_DMA
-/*FIXME*/
-/*#define CONFIG_FORCE_CONSOLE_RESUME*/
-#define CONFIG_FPU
-#undef CONFIG_HIBERNATE
-#define CONFIG_HOST_COMMAND_STATUS
-#undef CONFIG_I2C
-#undef CONFIG_LID_SWITCH
-/*FIXME*/
-/*#define CONFIG_LOW_POWER_IDLE*/
-#define CONFIG_MKBP_EVENT
-#define CONFIG_MKBP_USE_GPIO
-#define CONFIG_PRINTF_LEGACY_LI_FORMAT
-#define CONFIG_SHA256
-#define CONFIG_SHA256_UNROLLED
-#define CONFIG_SPI
-#define CONFIG_STM_HWTIMER32
-#define CONFIG_SUPPRESSED_HOST_COMMANDS \
- EC_CMD_CONSOLE_SNAPSHOT, EC_CMD_CONSOLE_READ, EC_CMD_PD_GET_LOG_ENTRY
-#undef CONFIG_TASK_PROFILING
-#define CONFIG_WATCHDOG_HELP
-#define CONFIG_WP_ACTIVE_HIGH
-/* SPI configuration for the fingerprint sensor */
-#define CONFIG_SPI_MASTER
-#define CONFIG_SPI_FP_PORT 0 /* SPI2: first master config */
#ifdef SECTION_IS_RW
-#define CONFIG_FP_SENSOR_FPC1025
/* TODO(b/130249462): remove for release */
#define CONFIG_CMD_FPSENSOR_DEBUG
+#endif
+
/*
- * Use the malloc code only in the RW section (for the private library),
- * we cannot enable it in RO since it is not compatible with the RW verification
- * (shared_mem_init done too late).
+ * These allow console commands to be flagged as restricted.
+ * Restricted commands will only be permitted to run when
+ * console_is_restricted() returns false.
+ * See console_is_restricted's definition in board.c.
*/
-#define CONFIG_MALLOC
+#define CONFIG_CONSOLE_COMMAND_FLAGS
+#define CONFIG_RESTRICTED_CONSOLE_COMMANDS
+
+/*-------------------------------------------------------------------------*
+ * Rollback Block
+ *-------------------------------------------------------------------------*/
+
+#define CONFIG_ROLLBACK
+#define CONFIG_ROLLBACK_SECRET_SIZE 32
+#define CONFIG_MPU
+#define CONFIG_ROLLBACK_MPU_PROTECT
+
/*
- * FP buffers are allocated in regular SRAM on STM32F4.
- * TODO(b/124773209): Instead of defining to empty, #undef once all CLs that
- * depend on FP_*_SECTION have landed. Also rename the variables to CONFIG_*.
+ * We do not use any "locally" generated entropy: this is normally used
+ * to add local entropy when the main source of entropy is remote.
*/
-#define FP_FRAME_SECTION
-#define FP_TEMPLATE_SECTION
+#undef CONFIG_ROLLBACK_SECRET_LOCAL_ENTROPY_SIZE
+#ifdef SECTION_IS_RW
+#undef CONFIG_ROLLBACK_UPDATE
+#endif
-#else /* SECTION_IS_RO */
+/*-------------------------------------------------------------------------*
+ * RW Signature Verification
+ *-------------------------------------------------------------------------*/
+
+#ifdef SECTION_IS_RO
/* RO verifies the RW partition signature */
#define CONFIG_RSA
#define CONFIG_RWSIG
-#endif
-
+#endif /* SECTION_IS_RO */
#define CONFIG_RSA_KEY_SIZE 3072
#define CONFIG_RSA_EXPONENT_3
#define CONFIG_RWSIG_TYPE_RWSIG
-/* RW does slow compute, RO does slow flash erase. */
+/*-------------------------------------------------------------------------*
+ * Watchdog
+ *-------------------------------------------------------------------------*/
+
+/*
+ * RW does slow compute, RO does slow flash erase.
+ */
#undef CONFIG_WATCHDOG_PERIOD_MS
#define CONFIG_WATCHDOG_PERIOD_MS 10000
+#define CONFIG_WATCHDOG_HELP
+
+/*-------------------------------------------------------------------------*
+ * Fingerprint Specific
+ *-------------------------------------------------------------------------*/
+/* SPI configuration for the fingerprint sensor */
+#define CONFIG_SPI_MASTER
+#define CONFIG_SPI_FP_PORT 0 /* SPI2: first master config */
+#ifdef SECTION_IS_RW
+#define CONFIG_FP_SENSOR_FPC1025
/*
- * Add rollback protection
+ * Use the malloc code only in the RW section (for the private library),
+ * we cannot enable it in RO since it is not compatible with the RW verification
+ * (shared_mem_init done too late).
*/
-#define CONFIG_ROLLBACK
-#define CONFIG_ROLLBACK_SECRET_SIZE 32
-#define CONFIG_MPU
-#define CONFIG_ROLLBACK_MPU_PROTECT
-
+#define CONFIG_MALLOC
/*
- * We do not use any "locally" generated entropy: this is normally used
- * to add local entropy when the main source of entropy is remote.
+ * FP buffers are allocated in regular SRAM on STM32F4.
+ * TODO(b/124773209): Instead of defining to empty, #undef once all CLs that
+ * depend on FP_*_SECTION have landed. Also rename the variables to CONFIG_*.
*/
-#undef CONFIG_ROLLBACK_SECRET_LOCAL_ENTROPY_SIZE
-#ifdef SECTION_IS_RW
-#undef CONFIG_ROLLBACK_UPDATE
-#endif
+#define FP_FRAME_SECTION
+#define FP_TEMPLATE_SECTION
+#endif /* SECTION_IS_RW */
+
+/*-------------------------------------------------------------------------*
+ * Disable Features
+ *-------------------------------------------------------------------------*/
+
+#undef CONFIG_ADC
+#undef CONFIG_HIBERNATE
+#undef CONFIG_I2C
+#undef CONFIG_LID_SWITCH
+#undef CONFIG_TASK_PROFILING
+
+/*-------------------------------------------------------------------------*
+ * Other
+ *-------------------------------------------------------------------------*/
#define CONFIG_AES
#define CONFIG_AES_GCM
-
+#define CONFIG_DMA
+/*FIXME*/
+/*#define CONFIG_FORCE_CONSOLE_RESUME*/
+#define CONFIG_FPU
+#define CONFIG_HOST_COMMAND_STATUS
+/*FIXME*/
+/*#define CONFIG_LOW_POWER_IDLE*/
+#define CONFIG_MKBP_EVENT
+#define CONFIG_MKBP_USE_GPIO
+#define CONFIG_PRINTF_LEGACY_LI_FORMAT
#define CONFIG_RNG
-
-#define CONFIG_CMD_FLASH
-#define CONFIG_CMD_SPI_XFER
+#define CONFIG_SHA256
+#define CONFIG_SHA256_UNROLLED
+#define CONFIG_SPI
+#define CONFIG_STM_HWTIMER32
+#define CONFIG_SUPPRESSED_HOST_COMMANDS \
+ EC_CMD_CONSOLE_SNAPSHOT, EC_CMD_CONSOLE_READ, EC_CMD_PD_GET_LOG_ENTRY
+#define CONFIG_WP_ACTIVE_HIGH
#ifndef __ASSEMBLER__