summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2014-03-03 11:12:24 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-03-11 05:53:46 +0000
commite926fd63118e7da18373f5d0eae0b24dc4ab8b42 (patch)
tree2a8834b4d547c61a3e6cf4e8b54b524e2421a0c9
parent39327cc4cd80e8f5ba30435d497c666e10cd0054 (diff)
downloadchrome-ec-e926fd63118e7da18373f5d0eae0b24dc4ab8b42.tar.gz
add support for FruitPie board
Until we have real hardware, use the STM32F072B Discovery board as a test vehicle and do a configuration compatible with both boards. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=run EC console on STM32F072B Discovery board, and pass all available unit-tests on target. Change-Id: Ica691f9fc915d2873761025e7c019f8a6484b9b1 Reviewed-on: https://chromium-review.googlesource.com/188984 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/fruitpie/board.c43
-rw-r--r--board/fruitpie/board.h51
-rw-r--r--board/fruitpie/build.mk13
-rw-r--r--board/fruitpie/ec.tasklist21
4 files changed, 128 insertions, 0 deletions
diff --git a/board/fruitpie/board.c b/board/fruitpie/board.c
new file mode 100644
index 0000000000..bc933206b9
--- /dev/null
+++ b/board/fruitpie/board.c
@@ -0,0 +1,43 @@
+/* Copyright (c) 2014 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.
+ */
+/* Fruitpie board configuration */
+
+#include "common.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "registers.h"
+#include "task.h"
+#include "util.h"
+
+void button_event(enum gpio_signal signal)
+{
+}
+
+/* GPIO signal list. Must match order from enum gpio_signal. */
+const struct gpio_info gpio_list[] = {
+ /* Inputs with interrupt handlers are first for efficiency */
+ {"USER_BUTTON", GPIO_A, (1<<0), GPIO_INT_BOTH, button_event},
+ /* Outputs */
+ {"LED_BLUE", GPIO_B, (1<<6), GPIO_OUT_LOW, NULL},
+ {"LED_GREEN", GPIO_B, (1<<7), GPIO_OUT_LOW, NULL},
+
+ /* Unimplemented signals which we need to emulate for now */
+ GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"),
+ GPIO_SIGNAL_NOT_IMPLEMENTED("WP_L"),
+};
+BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+
+/* Initialize board. */
+static void board_init(void)
+{
+ gpio_enable_interrupt(GPIO_USER_BUTTON);
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+/* Pins with alternate functions */
+const struct gpio_alt_func gpio_alt_funcs[] = {
+ {GPIO_A, 0xC000, 1, MODULE_UART}, /* USART2: PA14/PA15 */
+};
+const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs);
diff --git a/board/fruitpie/board.h b/board/fruitpie/board.h
new file mode 100644
index 0000000000..bb1c28cf43
--- /dev/null
+++ b/board/fruitpie/board.h
@@ -0,0 +1,51 @@
+/* Copyright (c) 2014 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.
+ */
+
+/* Fruitpie board configuration */
+
+#ifndef __BOARD_H
+#define __BOARD_H
+
+/* 48 MHz SYSCLK clock frequency */
+#define CPU_CLOCK 48000000
+
+/* the UART console is on USART2 (PA14/PA15) */
+#undef CONFIG_UART_CONSOLE
+#define CONFIG_UART_CONSOLE 2
+
+/* Optional features */
+#undef CONFIG_WATCHDOG_HELP
+#undef CONFIG_LID_SWITCH
+#undef CONFIG_TASK_PROFILING
+
+/*
+ * Allow dangerous commands all the time, since we don't have a write protect
+ * switch.
+ */
+#define CONFIG_SYSTEM_UNLOCKED
+
+#ifndef __ASSEMBLER__
+
+/* Timer selection */
+#define TIM_CLOCK_MSB 3
+#define TIM_CLOCK_LSB 15
+
+/* GPIO signal list */
+enum gpio_signal {
+ /* Inputs with interrupt handlers are first for efficiency */
+ GPIO_USER_BUTTON = 0,
+ /* Outputs */
+ GPIO_LED_BLUE,
+ GPIO_LED_GREEN,
+ /* Unimplemented signals we emulate */
+ GPIO_ENTERING_RW,
+ GPIO_WP_L,
+ /* Number of GPIOs; not an actual GPIO */
+ GPIO_COUNT
+};
+
+#endif /* !__ASSEMBLER__ */
+
+#endif /* __BOARD_H */
diff --git a/board/fruitpie/build.mk b/board/fruitpie/build.mk
new file mode 100644
index 0000000000..83b8716734
--- /dev/null
+++ b/board/fruitpie/build.mk
@@ -0,0 +1,13 @@
+# -*- makefile -*-
+# Copyright (c) 2014 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.
+#
+# Board specific files build
+
+# the IC is STmicro STM32F072B
+CHIP:=stm32
+CHIP_FAMILY:=stm32f0
+CHIP_VARIANT:=stm32f07x
+
+board-y=board.o
diff --git a/board/fruitpie/ec.tasklist b/board/fruitpie/ec.tasklist
new file mode 100644
index 0000000000..8ff4e8234b
--- /dev/null
+++ b/board/fruitpie/ec.tasklist
@@ -0,0 +1,21 @@
+/* Copyright (c) 2014 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.
+ */
+
+/**
+ * List of enabled tasks in the priority order
+ *
+ * The first one has the lowest priority.
+ *
+ * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and
+ * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries,
+ * where :
+ * 'n' in the name of the task
+ * 'r' in the main routine of the task
+ * 'd' in an opaque parameter passed to the routine at startup
+ * 's' is the stack size in bytes; must be a multiple of 8
+ */
+#define CONFIG_TASK_LIST \
+ TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
+ TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE)