New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
board/cpu: Added support for the stm32f3discovery board and stm32f3 cpu #1456
Merged
haukepetersen
merged 4 commits into
RIOT-OS:master
from
haukepetersen:board_stm32f3discovery
Jul 31, 2014
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c5c860f
cpu: Initial import of stm32f3
haukepetersen 94848cf
board: Initial import of stm32f3discovery
haukepetersen 275e8f0
cpu - cortex-m4_common: fixes to thread_arch.c
haukepetersen f2c8997
examples/tests: blacklisted stm32f3discovery
haukepetersen File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# tell the Makefile.base which module to build | ||
MODULE = $(BOARD)_base | ||
|
||
include $(RIOTBASE)/Makefile.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# define the cpu used by the stm32f3-discovery board | ||
export CPU = stm32f3 | ||
export CPU_MODEL = stm32f303vc | ||
|
||
#define the default port depending on the host OS | ||
OS := $(shell uname) | ||
ifeq ($(OS),Linux) | ||
PORT ?= /dev/ttyUSB0 | ||
else ifeq ($(OS),Darwin) | ||
PORT ?= $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1) | ||
else | ||
$(info CAUTION: No flash tool for your host system found!) | ||
# TODO: add support for windows as host platform | ||
endif | ||
export PORT | ||
|
||
# define tools used for building the project | ||
export PREFIX = arm-none-eabi- | ||
export CC = $(PREFIX)gcc | ||
export AR = $(PREFIX)ar | ||
export AS = $(PREFIX)as | ||
export LINK = $(PREFIX)gcc | ||
export SIZE = $(PREFIX)size | ||
export OBJCOPY = $(PREFIX)objcopy | ||
export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm.py | ||
export FLASHER = st-flash | ||
export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh | ||
|
||
# define build specific options | ||
CPU_USAGE = -mcpu=cortex-m4 | ||
FPU_USAGE = -mfloat-abi=hard -mfpu=fpv4-sp-d16 | ||
export CFLAGS += -ggdb -g3 -std=gnu99 -Os -Wall -Wstrict-prototypes $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -mthumb -mthumb-interwork -nostartfiles | ||
export CFLAGS += -ffunction-sections -fdata-sections -fno-builtin | ||
export ASFLAGS += -ggdb -g3 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian | ||
export LINKFLAGS += -g3 -ggdb -std=gnu99 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -static -lgcc -mthumb -mthumb-interwork -nostartfiles | ||
export LINKFLAGS += -T$(LINKERSCRIPT) | ||
export OFLAGS = -O binary | ||
export FFLAGS = write bin/$(BOARD)/$(APPLICATION).hex 0x8000000 | ||
export DEBUGGER_FLAGS = $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(BINDIR)/$(APPLICATION).elf | ||
|
||
# use newLib nano-specs if available | ||
ifeq ($(shell $(LINK) -specs=nano.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0) | ||
export LINKFLAGS += -specs=nano.specs -lc -lnosys | ||
endif | ||
|
||
# export board specific includes to the global includes-listing | ||
export INCLUDES += -I$(RIOTBOARD)/$(BOARD)/include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (C) 2014 Freie Universität Berlin | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser General | ||
* Public License v2.1. See the file LICENSE in the top level directory for more | ||
* details. | ||
*/ | ||
|
||
/** | ||
* @ingroup board_stm32f3discovery | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board specific implementations for the STM32F3Discovery evaluation board | ||
* | ||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> | ||
* | ||
* @} | ||
*/ | ||
|
||
#include "board.h" | ||
|
||
static void leds_init(void); | ||
|
||
void board_init(void) | ||
{ | ||
/* initialize the boards LEDs */ | ||
leds_init(); | ||
|
||
/* initialize the CPU */ | ||
cpu_init(); | ||
} | ||
|
||
/** | ||
* @brief Initialize the boards on-board LEDs (LD3 to LD10) | ||
* | ||
* The LED initialization is hard-coded in this function. As the LEDs are soldered | ||
* onto the board they are fixed to their CPU pins. | ||
* | ||
* The LEDs are connected to the following pins: | ||
* - LD3: PE9 | ||
* - LD4: PE8 | ||
* - LD5: PE10 | ||
* - LD6: PE15 | ||
* - LD7: PE11 | ||
* - LD8: PE14 | ||
* - LD9: PE12 | ||
* - LD10: PE13 | ||
*/ | ||
static void leds_init(void) | ||
{ | ||
/* enable clock for port GPIOE */ | ||
RCC->AHBENR |= RCC_AHBENR_GPIOEEN; | ||
|
||
/* set output speed to 50MHz */ | ||
LED_PORT->OSPEEDR |= 0xffff0000; | ||
/* set output type to push-pull */ | ||
LED_PORT->OTYPER &= ~(0x0000ff00); | ||
/* configure pins as general outputs */ | ||
LED_PORT->MODER &= ~(0xffff0000); | ||
LED_PORT->MODER |= 0x55550000; | ||
/* disable pull resistors */ | ||
LED_PORT->PUPDR &= ~(0xffff0000); | ||
|
||
/* turn all LEDs off */ | ||
LED_PORT->BRR = 0xff00; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
echo "Debugging $1" | ||
arm-none-eabi-gdb -tui -command=$1 $2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tar extended-remote :4242 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright (C) 2014 Freie Universität Berlin | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser General | ||
* Public License v2.1. See the file LICENSE in the top level directory for more | ||
* details. | ||
*/ | ||
|
||
/** | ||
* @defgroup board_stm32f3discovery STM32F3Discovery | ||
* @ingroup boards | ||
* @brief Board specific files for the STM32F3Discovery board | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board specific definitions for the STM32F3Discovery evaluation board | ||
* | ||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> | ||
*/ | ||
|
||
#ifndef __BOARD_H | ||
#define __BOARD_H | ||
|
||
#include "cpu.h" | ||
|
||
/** | ||
* Define the nominal CPU core clock in this board | ||
*/ | ||
#define F_CPU (72000000UL) | ||
|
||
/** | ||
* @name Assign the hardware timer | ||
*/ | ||
#define HW_TIMER TIMER_0 | ||
|
||
/** | ||
* @name Define the UART used for stdio | ||
* @{ | ||
*/ | ||
#define STDIO UART_0 | ||
#define STDIO_BAUDRATE (115200U) | ||
#define STDIO_BUFSIZE (64U) | ||
/** @} */ | ||
|
||
/** | ||
* @name LED pin definitions | ||
* @{ | ||
*/ | ||
#define LED_PORT GPIOE | ||
#define LD3_PIN (1 << 9) | ||
#define LD4_PIN (1 << 8) | ||
#define LD5_PIN (1 << 10) | ||
#define LD6_PIN (1 << 15) | ||
#define LD7_PIN (1 << 11) | ||
#define LD8_PIN (1 << 14) | ||
#define LD9_PIN (1 << 12) | ||
#define LD10_PIN (1 << 13) | ||
/** @} */ | ||
|
||
/** | ||
* @name Macros for controlling the on-board LEDs. | ||
* @{ | ||
*/ | ||
#define LD3_ON (LED_PORT->BSRRL = LD3_PIN) | ||
#define LD3_OFF (LED_PORT->BSRRH = LD3_PIN) | ||
#define LD3_TOGGLE (LED_PORT->ODR ^= LD3_PIN) | ||
#define LD4_ON (LED_PORT->BSRRL = LD4_PIN) | ||
#define LD4_OFF (LED_PORT->BSRRH = LD4_PIN) | ||
#define LD4_TOGGLE (LED_PORT->ODR ^= LD4_PIN) | ||
#define LD5_ON (LED_PORT->BSRRL = LD5_PIN) | ||
#define LD5_OFF (LED_PORT->BSRRH = LD5_PIN) | ||
#define LD5_TOGGLE (LED_PORT->ODR ^= LD5_PIN) | ||
#define LD6_ON (LED_PORT->BSRRL = LD6_PIN) | ||
#define LD6_OFF (LED_PORT->BSRRH = LD6_PIN) | ||
#define LD6_TOGGLE (LED_PORT->ODR ^= LD6_PIN) | ||
#define LD7_ON (LED_PORT->BSRRL = LD7_PIN) | ||
#define LD7_OFF (LED_PORT->BSRRH = LD7_PIN) | ||
#define LD7_TOGGLE (LED_PORT->ODR ^= LD7_PIN) | ||
#define LD8_ON (LED_PORT->BSRRL = LD8_PIN) | ||
#define LD8_OFF (LED_PORT->BSRRH = LD8_PIN) | ||
#define LD8_TOGGLE (LED_PORT->ODR ^= LD8_PIN) | ||
#define LD9_ON (LED_PORT->BSRRL = LD9_PIN) | ||
#define LD9_OFF (LED_PORT->BSRRH = LD9_PIN) | ||
#define LD9_TOGGLE (LED_PORT->ODR ^= LD9_PIN) | ||
#define LD10_ON (LED_PORT->BSRRL = LD10_PIN) | ||
#define LD10_OFF (LED_PORT->BSRRH = LD10_PIN) | ||
#define LD10_TOGGLE (LED_PORT->ODR ^= LD10_PIN) | ||
/* for compatability to other boards */ | ||
#define LED_GREEN_ON LD4_ON | ||
#define LED_GREEN_OFF LD4_OFF | ||
#define LED_GREEN_TOGGLE LD4_TOGGLE | ||
#define LED_RED_ON LD5_ON | ||
#define LED_RED_OFF LD5_OFF | ||
#define LED_RED_TOGGLE LD5_TOGGLE | ||
/** @} */ | ||
|
||
/** | ||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO | ||
*/ | ||
void board_init(void); | ||
|
||
#endif /** __BOARD_H */ | ||
/** @} */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not part of this PR, but shouldn't we outsource this to something like
cortex_m3_common
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in #1510