mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 09:01:35 +00:00
discovery-stm32f072: Initial working version
This version of the EC firmware just provides a console and some blinking lights for the stm32f0 discovery board. This is a convenient board to work with for peripheral bringup. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=none TEST=make buildall -j Change-Id: I9ae87235e8a505d58fa7a5c996528c4dd6c3f2ac Reviewed-on: https://chromium-review.googlesource.com/207130 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
0a9545cb9e
commit
c14b0644e3
20
board/discovery-stm32f072/Makefile
Normal file
20
board/discovery-stm32f072/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# 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.
|
||||
|
||||
#
|
||||
# Simple flashing command to reflash the discovery board using openocd
|
||||
#
|
||||
.PHONY: flash
|
||||
|
||||
flash:
|
||||
sudo openocd -f board/stm32f0discovery.cfg \
|
||||
-c "gdb_port 0" \
|
||||
-c "tcl_port 0" \
|
||||
-c "telnet_port 0" \
|
||||
-c "init" \
|
||||
-c "reset init" \
|
||||
-c "flash write_image erase ../../build/discovery-stm32f072/ec.bin 0x08000000" \
|
||||
-c "reset halt" \
|
||||
-c "resume" \
|
||||
-c "shutdown"
|
||||
41
board/discovery-stm32f072/board.c
Normal file
41
board/discovery-stm32f072/board.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/* 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.
|
||||
*/
|
||||
/* STM32F072-discovery 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);
|
||||
|
||||
#include "gpio_list.h"
|
||||
|
||||
void button_event(enum gpio_signal signal)
|
||||
{
|
||||
static int count = 0;
|
||||
|
||||
gpio_set_level(GPIO_LED_U, (count & 0x03) == 0);
|
||||
gpio_set_level(GPIO_LED_R, (count & 0x03) == 1);
|
||||
gpio_set_level(GPIO_LED_D, (count & 0x03) == 2);
|
||||
gpio_set_level(GPIO_LED_L, (count & 0x03) == 3);
|
||||
|
||||
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);
|
||||
40
board/discovery-stm32f072/board.h
Normal file
40
board/discovery-stm32f072/board.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/* STM32F072-discovery 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 */
|
||||
#define CONFIG_STM_HWTIMER32
|
||||
#define CONFIG_HW_CRC
|
||||
|
||||
#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 /* __BOARD_H */
|
||||
13
board/discovery-stm32f072/build.mk
Normal file
13
board/discovery-stm32f072/build.mk
Normal file
@@ -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 STM32F072RBT6
|
||||
CHIP:=stm32
|
||||
CHIP_FAMILY:=stm32f0
|
||||
CHIP_VARIANT:=stm32f07x
|
||||
|
||||
board-y=board.o
|
||||
21
board/discovery-stm32f072/ec.tasklist
Normal file
21
board/discovery-stm32f072/ec.tasklist
Normal file
@@ -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)
|
||||
19
board/discovery-stm32f072/gpio.inc
Normal file
19
board/discovery-stm32f072/gpio.inc
Normal file
@@ -0,0 +1,19 @@
|
||||
/* -*- mode:c -*-
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* Inputs with interrupt handlers are first for efficiency */
|
||||
GPIO(USER_BUTTON, A, 0, GPIO_INT_FALLING, button_event)
|
||||
|
||||
/* Outputs */
|
||||
GPIO(LED_U, C, 6, GPIO_OUT_LOW, NULL)
|
||||
GPIO(LED_D, C, 7, GPIO_OUT_LOW, NULL)
|
||||
GPIO(LED_L, C, 8, GPIO_OUT_LOW, NULL)
|
||||
GPIO(LED_R, C, 9, GPIO_OUT_LOW, NULL)
|
||||
|
||||
/* Unimplemented signals which we need to emulate for now */
|
||||
UNIMPLEMENTED(ENTERING_RW)
|
||||
UNIMPLEMENTED(WP_L)
|
||||
Reference in New Issue
Block a user