summaryrefslogtreecommitdiff
path: root/board/nucleo-f072rb
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2016-04-11 15:24:38 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-04-20 21:56:06 -0700
commit671621b4c404f277173780d9ce3346204ab58fec (patch)
tree5566a37a4b1bab53414aa328f33ba6cfe92d51a2 /board/nucleo-f072rb
parentba27af23156f77ab30790ba095ae6696dc3ee572 (diff)
downloadchrome-ec-671621b4c404f277173780d9ce3346204ab58fec.tar.gz
nucleo-f072rb: Add initial set of board files
This change adds files to support nucleo-f072rb. This board can be used as a DUT to test STM32F072. BUG=none BRANCH=tot TEST=Verified EC console works. Flashed the board by 'make flash'. User LED brinks periodically and when user button is pressed. make buildall && make tests Change-Id: I628f229b62c4b06d19d8245121f79a13e17bc2e9 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/338461
Diffstat (limited to 'board/nucleo-f072rb')
l---------board/nucleo-f072rb/Makefile1
-rw-r--r--board/nucleo-f072rb/board.c37
-rw-r--r--board/nucleo-f072rb/board.h38
-rw-r--r--board/nucleo-f072rb/build.mk13
-rw-r--r--board/nucleo-f072rb/ec.tasklist21
-rw-r--r--board/nucleo-f072rb/gpio.inc20
-rw-r--r--board/nucleo-f072rb/openocd-flash.cfg19
7 files changed, 149 insertions, 0 deletions
diff --git a/board/nucleo-f072rb/Makefile b/board/nucleo-f072rb/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/nucleo-f072rb/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/nucleo-f072rb/board.c b/board/nucleo-f072rb/board.c
new file mode 100644
index 0000000000..7bbfdfab39
--- /dev/null
+++ b/board/nucleo-f072rb/board.c
@@ -0,0 +1,37 @@
+/* Copyright 2016 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 "common.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "registers.h"
+#include "task.h"
+
+void button_event(enum gpio_signal signal)
+{
+ gpio_set_level(GPIO_LED_U, 1);
+}
+
+#include "gpio_list.h"
+
+void tick_event(void)
+{
+ static int count;
+
+ gpio_set_level(GPIO_LED_U, (count & 0x07) == 0);
+
+ count++;
+}
+DECLARE_HOOK(HOOK_TICK, tick_event, HOOK_PRIO_DEFAULT);
+
+/******************************************************************************
+ * Initialize board.
+ */
+static void board_init(void)
+{
+ gpio_enable_interrupt(GPIO_USER_BUTTON);
+
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/nucleo-f072rb/board.h b/board/nucleo-f072rb/board.h
new file mode 100644
index 0000000000..6c934f8450
--- /dev/null
+++ b/board/nucleo-f072rb/board.h
@@ -0,0 +1,38 @@
+/* Copyright 2016 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.
+ */
+
+/* Nucleo-F072RB board configuration */
+
+#ifndef __CROS_EC_BOARD_H
+#define __CROS_EC_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 */
+#define CONFIG_STM_HWTIMER32
+
+#undef CONFIG_WATCHDOG_HELP
+#undef CONFIG_LID_SWITCH
+
+/*
+ * 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_CLOCK32 2
+
+#include "gpio_signal.h"
+
+#endif /* !__ASSEMBLER__ */
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/nucleo-f072rb/build.mk b/board/nucleo-f072rb/build.mk
new file mode 100644
index 0000000000..0e069a31ad
--- /dev/null
+++ b/board/nucleo-f072rb/build.mk
@@ -0,0 +1,13 @@
+# -*- makefile -*-
+# Copyright 2016 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 STM32F072RBT6
+CHIP:=stm32
+CHIP_FAMILY:=stm32f0
+CHIP_VARIANT:=stm32f07x
+
+board-y=board.o
diff --git a/board/nucleo-f072rb/ec.tasklist b/board/nucleo-f072rb/ec.tasklist
new file mode 100644
index 0000000000..1944ef3874
--- /dev/null
+++ b/board/nucleo-f072rb/ec.tasklist
@@ -0,0 +1,21 @@
+/* Copyright 2016 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)
diff --git a/board/nucleo-f072rb/gpio.inc b/board/nucleo-f072rb/gpio.inc
new file mode 100644
index 0000000000..26f532f39f
--- /dev/null
+++ b/board/nucleo-f072rb/gpio.inc
@@ -0,0 +1,20 @@
+/* -*- mode:c -*-
+ *
+ * Copyright 2016 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.
+ */
+
+/* Declare symbolic names for all the GPIOs that we care about.
+ * Note: Those with interrupt handlers must be declared first. */
+
+GPIO_INT(USER_BUTTON, PIN(C, 13), GPIO_INT_FALLING, button_event)
+
+/* Outputs */
+GPIO(LED_U, PIN(A, 5), GPIO_OUT_LOW)
+
+/* Unimplemented signals which we need to emulate for now */
+UNIMPLEMENTED(ENTERING_RW)
+UNIMPLEMENTED(WP_L)
+
+ALTERNATE(PIN_MASK(A, 0x000C), 1, MODULE_UART, 0) /* USART2: PA2/PA3 */
diff --git a/board/nucleo-f072rb/openocd-flash.cfg b/board/nucleo-f072rb/openocd-flash.cfg
new file mode 100644
index 0000000000..91e3805c74
--- /dev/null
+++ b/board/nucleo-f072rb/openocd-flash.cfg
@@ -0,0 +1,19 @@
+# Copyright 2016 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.
+
+source [find board/st_nucleo_f0.cfg]
+
+# For flashing, force the board into reset on connect, this ensures that
+# code running on the core can't interfere with programming.
+reset_config connect_assert_srst
+
+gdb_port 0
+tcl_port 0
+telnet_port 0
+init
+reset init
+flash write_image erase $BUILD_DIR/ec.bin 0x08000000
+reset halt
+resume
+shutdown