Skip to content
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: Import of STM32F3discovery (Cortex-M4) port #932

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6c91b75
vtimer: renamed eINT to restoreIRQ
haukepetersen Mar 26, 2014
18aa105
vtimer: added disableIRQ to vtimer_remove
haukepetersen Mar 27, 2014
9d20ac9
core: changed e|dINT calls to en|disableIRQ
haukepetersen Mar 25, 2014
d551ee4
core: changed e|dINT to en|disableIRQ in hwtimer.c
haukepetersen Mar 26, 2014
c7a4762
core: added comments where e|dINT was replaced
haukepetersen Apr 1, 2014
dddaff8
core: hwtimer eINT substitution fixes
haukepetersen Apr 1, 2014
6a96092
core/cpu/board: moved F_CPU define to board
haukepetersen Mar 25, 2014
9eced97
Introduced a cleaned-up cpu/core interface
haukepetersen Mar 17, 2014
c8bcad3
core: added flag for disabling arch interface
haukepetersen Mar 26, 2014
bb7b802
core: added missing state to lpm_arch interface
haukepetersen Mar 26, 2014
b729a8a
core: added arch interface for reboot
haukepetersen May 5, 2014
358033d
core: fixed newline issues that were pointed out
haukepetersen May 6, 2014
355545f
board: added stm32f3discovery
haukepetersen Mar 26, 2014
088c033
cpu: added cortexm common
haukepetersen Mar 26, 2014
5c33a71
cpu: added stm32f303vc
haukepetersen Mar 26, 2014
3612566
pkg: added makefiles for building stm32f3 std-lib
haukepetersen Mar 26, 2014
bbd46a0
cpu/board: added missing newlines for stm32f3 port
haukepetersen Mar 31, 2014
adecfef
board: adjusted includes and copyrights
haukepetersen May 6, 2014
4bca2a0
cpu: cortexm_common adjusted cpyrights and includes
haukepetersen May 6, 2014
25dd0fd
cpu: stm32f303vc adjusted includes and copyrights
haukepetersen May 6, 2014
394811f
cpu: cortexm-common fixed includes
haukepetersen May 6, 2014
5cd9ec9
cpu: stm32f303vc fixed Makefiles
haukepetersen May 6, 2014
50dde1c
cpu: stm32f303vc - fixed gpio driver implementation
haukepetersen May 6, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions boards/mbed_lpc1768/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include <stdint.h>
#include "bitarithm.h"

#define F_CPU (96000000)


#define PIN_LED1 (BIT18)
#define PIN_LED2 (BIT20)
#define PIN_LED3 (BIT21)
Expand Down
4 changes: 4 additions & 0 deletions boards/native/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@

#include <stdint.h>

/* TODO: choose better value? */
#define F_CPU 1000000


void _native_LED_GREEN_OFF(void);
#define LED_GREEN_OFF (_native_LED_GREEN_OFF())
void _native_LED_GREEN_ON(void);
Expand Down
2 changes: 2 additions & 0 deletions boards/redbee-econotag/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include <stdint.h>

#define F_CPU (24000000) ///< CPU target speed in Hz

#define CTUNE 0xb
#define IBIAS 0x1f
#define FTUNE 0x7
Expand Down
16 changes: 16 additions & 0 deletions boards/stm32f3discovery/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

# tell the Makefile.base which module to build
MODULE = $(BOARD)_base

# add a list of board specific subdirectories that should also be build
DIRS =

.PHONY: all clean

all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do $(MAKE) -C $$i ; done ;

include $(RIOTBASE)/Makefile.base

clean::
@for i in $(DIRS) ; do $(MAKE) -C $$i clean ; done ;
32 changes: 32 additions & 0 deletions boards/stm32f3discovery/Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

# define the cpu used by the stm32f3-discovery board
export CPU = stm32f303vc


# 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

# define build specific options
export CPU_USAGE = -mcpu=cortex-m4
export 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 += -DREENTRANT_SYSCALLS_PROVIDED
export CFLAGS += -flto -ffunction-sections -fdata-sections -fno-builtin # addiontal compiler flags to optimize compiling for newlib-nano
export ASFLAGS = -ggdb -g3 -mcpu=cortex-m4 $(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) # linkerscript specified in cpu/Makefile.include
export LINKFLAGS += -specs=nano.specs -lc -lnosys # additional linker flags to enable newlib-nano
export OFLAGS = -O binary
export FFLAGS = write bin/$(BOARD)/$(PROJECT).hex 0x8000000


# export board specific includes to the global includes-listing
export INCLUDES += -I$(RIOTBOARD)/stm32f3discovery/include
78 changes: 78 additions & 0 deletions boards/stm32f3discovery/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (C) 2014 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License. See the file LICENSE in the top level directory for more
* details.
*/

/**
* @ingroup board_stm32f3discovery
* @{
*
* @file board.c
* @brief Board specific implementations for the STM32F3Discovery evaluation board
*
* @author Hauke Petersen <[email protected]>
*
* @}
*/

#include <stdint.h>
#include <stdio.h>

#include "board.h"
#include "cpu.h"


extern void SystemInit(void);
void leds_init(void);


void board_init(void)
{
/* initialize core clocks via STM-lib given function */
SystemInit();

/* initialize the CPU */
cpu_init();

/* initialize the boards LEDs */
leds_init();
}


/**
* @brief Initialize the boards on-board LEDs (LD3 - 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
*/
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;
}
104 changes: 104 additions & 0 deletions boards/stm32f3discovery/include/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* Copyright (C) 2014 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License. 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 board.h
* @brief Board specific definitions for the STM32F3Discovery evaluation board.
*
* @author Hauke Petersen <[email protected]>
*/

#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 Example: configure connected NRF24L01+ (radio) device
*
* This is just an example on how to bind (externally or internally) connected
* devices to the CPUs peripherals.
* @{
*/
#define NRF24L01P_NUMOF (1U)
#define NRF24L01P_SPI SPI_0
#define NRF24L01P_CE GPIO_0
#define NRF24L01P_CSN GPIO_1
#define NRF24L01P_INT GPIO_2
/** @} */

/**
* @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->BSRR = LD3_PIN
#define LD3_OFF LED_PORT->BRR = LD3_PIN
#define LD4_ON LED_PORT->BSRR = LD4_PIN
#define LD4_OFF LED_PORT->BRR = LD4_PIN
#define LD5_ON LED_PORT->BSRR = LD5_PIN
#define LD5_OFF LED_PORT->BRR = LD5_PIN
#define LD6_ON LED_PORT->BSRR = LD6_PIN
#define LD6_OFF LED_PORT->BRR = LD6_PIN
#define LD7_ON LED_PORT->BSRR = LD7_PIN
#define LD7_OFF LED_PORT->BRR = LD7_PIN
#define LD8_ON LED_PORT->BSRR = LD8_PIN
#define LD8_OFF LED_PORT->BRR = LD8_PIN
#define LD9_ON LED_PORT->BSRR = LD9_PIN
#define LD9_OFF LED_PORT->BRR = LD9_PIN
#define LD10_ON LED_PORT->BSRR = LD10_PIN
#define LD10_OFF LED_PORT->BRR = LD10_PIN

/* for compatability to other boards */
#define LED_GREEN_ON LD3_ON
#define LED_GREEN_OFF LD3_OFF
#define LED_RED_ON LD10_ON
#define LED_RED_OFF LD10_OFF
/** @} */


/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);


/** @} */
#endif /** __BOARD_H */
Loading