Initial STM32F0xx support.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4198 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
3654758ac2
commit
e0b177423e
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
/**
|
||||
* @brief PAL setup.
|
||||
* @details Digital I/O ports static configuration as defined in @p board.h.
|
||||
* This variable is used by the HAL when initializing the PAL driver.
|
||||
*/
|
||||
#if HAL_USE_PAL || defined(__DOXYGEN__)
|
||||
const PALConfig pal_default_config =
|
||||
{
|
||||
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
|
||||
{VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
|
||||
{VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
|
||||
{VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
|
||||
{VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Early initialization code.
|
||||
* This initialization must be performed just after stack setup and before
|
||||
* any other initialization.
|
||||
*/
|
||||
void __early_init(void) {
|
||||
|
||||
stm32_clock_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Board-specific initialization code.
|
||||
*/
|
||||
void boardInit(void) {
|
||||
}
|
|
@ -0,0 +1,321 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* Setup for STMicroelectronics STM32F0-Discovery board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_ST_STM32L_DISCOVERY
|
||||
#define BOARD_NAME "ST STM32L-Discovery"
|
||||
|
||||
/*
|
||||
* Board frequencies.
|
||||
* NOTE: The both crystals are not fitted by default on the board but there
|
||||
* the option to both mount an 8MHz HE crystal or drive HSE with an
|
||||
* 8MHz clock from the on-board ST-Link. LSE can be optionally mounted
|
||||
* too.
|
||||
*/
|
||||
#if defined(DISCOVERY_HSE_MOUNTED) && defined(DISCOVERY_HSE_DRIVEN)
|
||||
#error "HSE OSC-IN cannot be both crystal equipped and externally driven"
|
||||
#endif
|
||||
|
||||
#if defined(DISCOVERY_LSE_MOUNTED)
|
||||
#define STM32_LSECLK 32768
|
||||
#else
|
||||
#define STM32_LSECLK 0
|
||||
#endif
|
||||
|
||||
#if defined(DISCOVERY_HSE_MOUNTED) || defined(DISCOVERY_HSE_DRIVEN)
|
||||
#define STM32_HSECLK 8000000
|
||||
#else
|
||||
#define STM32_HSECLK 0
|
||||
#endif
|
||||
|
||||
#if defined(DISCOVERY_HSE_DRIVEN)
|
||||
#define STM32_HSE_BYPASS
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MCU type as defined in the ST header file stm32f0xx.h.
|
||||
*/
|
||||
#define STM32F0XX
|
||||
|
||||
/*
|
||||
* IO pins assignments.
|
||||
*/
|
||||
#define GPIOA_BUTTON 0
|
||||
|
||||
#define GPIOC_LED4 8
|
||||
#define GPIOC_LED3 9
|
||||
|
||||
/*
|
||||
* I/O ports initial setup, this configuration is established soon after reset
|
||||
* in the initialization code.
|
||||
* Please refer to the STM32 Reference Manual for details.
|
||||
*/
|
||||
#define PIN_MODE_INPUT(n) (0U << ((n) * 2))
|
||||
#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2))
|
||||
#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2))
|
||||
#define PIN_MODE_ANALOG(n) (3U << ((n) * 2))
|
||||
#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
|
||||
#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
|
||||
#define PIN_OSPEED_400K(n) (0U << ((n) * 2))
|
||||
#define PIN_OSPEED_2M(n) (1U << ((n) * 2))
|
||||
#define PIN_OSPEED_10M(n) (2U << ((n) * 2))
|
||||
#define PIN_OSPEED_40M(n) (3U << ((n) * 2))
|
||||
#define PIN_PUDR_FLOATING(n) (0U << ((n) * 2))
|
||||
#define PIN_PUDR_PULLUP(n) (1U << ((n) * 2))
|
||||
#define PIN_PUDR_PULLDOWN(n) (2U << ((n) * 2))
|
||||
#define PIN_AFIO_AF(n, v) ((v##U) << ((n % 8) * 4))
|
||||
|
||||
/*
|
||||
* Port A setup.
|
||||
* All input with pull-up except:
|
||||
* PA0 - GPIOA_BUTTON (input floating).
|
||||
* PA13 - JTMS/SWDAT (alternate 0).
|
||||
* PA14 - JTCK/SWCLK (alternate 0).
|
||||
*/
|
||||
#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_BUTTON) | \
|
||||
PIN_MODE_INPUT(1) | \
|
||||
PIN_MODE_INPUT(2) | \
|
||||
PIN_MODE_INPUT(3) | \
|
||||
PIN_MODE_INPUT(4) | \
|
||||
PIN_MODE_INPUT(5) | \
|
||||
PIN_MODE_INPUT(6) | \
|
||||
PIN_MODE_INPUT(7) | \
|
||||
PIN_MODE_INPUT(8) | \
|
||||
PIN_MODE_INPUT(9) | \
|
||||
PIN_MODE_INPUT(10) | \
|
||||
PIN_MODE_INPUT(11) | \
|
||||
PIN_MODE_INPUT(12) | \
|
||||
PIN_MODE_ALTERNATE(13) | \
|
||||
PIN_MODE_ALTERNATE(14) | \
|
||||
PIN_MODE_INPUT(15))
|
||||
#define VAL_GPIOA_OTYPER 0x00000000
|
||||
#define VAL_GPIOA_OSPEEDR 0xFFFFFFFF
|
||||
#define VAL_GPIOA_PUPDR (PIN_PUDR_FLOATING(GPIOA_BUTTON) | \
|
||||
PIN_PUDR_PULLUP(1) | \
|
||||
PIN_PUDR_PULLUP(2) | \
|
||||
PIN_PUDR_PULLUP(3) | \
|
||||
PIN_PUDR_PULLUP(4) | \
|
||||
PIN_PUDR_PULLUP(5) | \
|
||||
PIN_PUDR_PULLUP(6) | \
|
||||
PIN_PUDR_PULLUP(7) | \
|
||||
PIN_PUDR_PULLUP(8) | \
|
||||
PIN_PUDR_PULLUP(9) | \
|
||||
PIN_PUDR_PULLUP(10) | \
|
||||
PIN_PUDR_PULLUP(11) | \
|
||||
PIN_PUDR_PULLUP(12) | \
|
||||
PIN_PUDR_PULLUP(13) | \
|
||||
PIN_PUDR_PULLUP(14) | \
|
||||
PIN_PUDR_PULLUP(15))
|
||||
#define VAL_GPIOA_ODR 0xFFFFFFFF
|
||||
#define VAL_GPIOA_AFRL 0x00000000
|
||||
#define VAL_GPIOA_AFRH 0x00000000
|
||||
|
||||
/*
|
||||
* Port B setup.
|
||||
* All input with pull-up except:
|
||||
*/
|
||||
#define VAL_GPIOB_MODER (PIN_MODE_INPUT(0) | \
|
||||
PIN_MODE_INPUT(1) | \
|
||||
PIN_MODE_INPUT(2) | \
|
||||
PIN_MODE_INPUT(3) | \
|
||||
PIN_MODE_INPUT(4) | \
|
||||
PIN_MODE_INPUT(5) | \
|
||||
PIN_MODE_INPUT(6) | \
|
||||
PIN_MODE_INPUT(7) | \
|
||||
PIN_MODE_INPUT(8) | \
|
||||
PIN_MODE_INPUT(9) | \
|
||||
PIN_MODE_INPUT(10) | \
|
||||
PIN_MODE_INPUT(11) | \
|
||||
PIN_MODE_INPUT(12) | \
|
||||
PIN_MODE_INPUT(13) | \
|
||||
PIN_MODE_INPUT(14) | \
|
||||
PIN_MODE_INPUT(15))
|
||||
#define VAL_GPIOB_OTYPER 0x00000000
|
||||
#define VAL_GPIOB_OSPEEDR 0xFFFFFFFF
|
||||
#define VAL_GPIOB_PUPDR (PIN_PUDR_PULLUP(0) | \
|
||||
PIN_PUDR_PULLUP(1) | \
|
||||
PIN_PUDR_PULLUP(2) | \
|
||||
PIN_PUDR_PULLUP(3) | \
|
||||
PIN_PUDR_PULLUP(4) | \
|
||||
PIN_PUDR_PULLUP(5) | \
|
||||
PIN_PUDR_PULLUP(6) | \
|
||||
PIN_PUDR_PULLUP(7) | \
|
||||
PIN_PUDR_PULLUP(8) | \
|
||||
PIN_PUDR_PULLUP(9) | \
|
||||
PIN_PUDR_PULLUP(10) | \
|
||||
PIN_PUDR_PULLUP(11) | \
|
||||
PIN_PUDR_PULLUP(12) | \
|
||||
PIN_PUDR_PULLUP(13) | \
|
||||
PIN_PUDR_PULLUP(14) | \
|
||||
PIN_PUDR_PULLUP(15))
|
||||
#define VAL_GPIOB_ODR 0xFFFFFFFF
|
||||
#define VAL_GPIOB_AFRL 0x00000000
|
||||
#define VAL_GPIOB_AFRH 0x00000000
|
||||
|
||||
/*
|
||||
* Port C setup.
|
||||
* All input with pull-up except:
|
||||
* PC8 - GPIOC_LED4 (output push-pull).
|
||||
* PC9 - GPIOC_LED3 (output push-pull).
|
||||
* PC13 - OSC32_OUT (input floating).
|
||||
* PC14 - OSC32_IN (input floating).
|
||||
*/
|
||||
#define VAL_GPIOC_MODER (PIN_MODE_INPUT(0) | \
|
||||
PIN_MODE_INPUT(1) | \
|
||||
PIN_MODE_INPUT(2) | \
|
||||
PIN_MODE_INPUT(3) | \
|
||||
PIN_MODE_INPUT(4) | \
|
||||
PIN_MODE_INPUT(5) | \
|
||||
PIN_MODE_INPUT(6) | \
|
||||
PIN_MODE_INPUT(7) | \
|
||||
PIN_MODE_OUTPUT(GPIOC_LED4) | \
|
||||
PIN_MODE_OUTPUT(GPIOC_LED3) | \
|
||||
PIN_MODE_INPUT(10) | \
|
||||
PIN_MODE_INPUT(11) | \
|
||||
PIN_MODE_INPUT(12) | \
|
||||
PIN_MODE_INPUT(13) | \
|
||||
PIN_MODE_INPUT(14) | \
|
||||
PIN_MODE_INPUT(15))
|
||||
#define VAL_GPIOC_OTYPER 0x00000000
|
||||
#define VAL_GPIOC_OSPEEDR 0xFFFFFFFF
|
||||
#define VAL_GPIOC_PUPDR (PIN_PUDR_PULLUP(0) | \
|
||||
PIN_PUDR_PULLUP(1) | \
|
||||
PIN_PUDR_PULLUP(2) | \
|
||||
PIN_PUDR_PULLUP(3) | \
|
||||
PIN_PUDR_PULLUP(4) | \
|
||||
PIN_PUDR_PULLUP(5) | \
|
||||
PIN_PUDR_PULLUP(6) | \
|
||||
PIN_PUDR_PULLUP(7) | \
|
||||
PIN_PUDR_FLOATING(GPIOC_LED4) | \
|
||||
PIN_PUDR_FLOATING(GPIOC_LED3) | \
|
||||
PIN_PUDR_PULLUP(10) | \
|
||||
PIN_PUDR_PULLUP(11) | \
|
||||
PIN_PUDR_PULLUP(12) | \
|
||||
PIN_PUDR_PULLUP(13) | \
|
||||
PIN_PUDR_FLOATING(14) | \
|
||||
PIN_PUDR_FLOATING(15))
|
||||
#define VAL_GPIOC_ODR 0xFFFFFCFF
|
||||
#define VAL_GPIOC_AFRL 0x00000000
|
||||
#define VAL_GPIOC_AFRH 0x00000000
|
||||
|
||||
/*
|
||||
* Port D setup.
|
||||
* All input with pull-up.
|
||||
*/
|
||||
#define VAL_GPIOD_MODER (PIN_MODE_INPUT(0) | \
|
||||
PIN_MODE_INPUT(1) | \
|
||||
PIN_MODE_INPUT(2) | \
|
||||
PIN_MODE_INPUT(3) | \
|
||||
PIN_MODE_INPUT(4) | \
|
||||
PIN_MODE_INPUT(5) | \
|
||||
PIN_MODE_INPUT(6) | \
|
||||
PIN_MODE_INPUT(7) | \
|
||||
PIN_MODE_INPUT(8) | \
|
||||
PIN_MODE_INPUT(9) | \
|
||||
PIN_MODE_INPUT(10) | \
|
||||
PIN_MODE_INPUT(11) | \
|
||||
PIN_MODE_INPUT(12) | \
|
||||
PIN_MODE_INPUT(13) | \
|
||||
PIN_MODE_INPUT(14) | \
|
||||
PIN_MODE_INPUT(15))
|
||||
#define VAL_GPIOD_OTYPER 0x00000000
|
||||
#define VAL_GPIOD_OSPEEDR 0xFFFFFFFF
|
||||
#define VAL_GPIOD_PUPDR (PIN_PUDR_PULLUP(0) | \
|
||||
PIN_PUDR_PULLUP(1) | \
|
||||
PIN_PUDR_PULLUP(2) | \
|
||||
PIN_PUDR_PULLUP(3) | \
|
||||
PIN_PUDR_PULLUP(4) | \
|
||||
PIN_PUDR_PULLUP(5) | \
|
||||
PIN_PUDR_PULLUP(6) | \
|
||||
PIN_PUDR_PULLUP(7) | \
|
||||
PIN_PUDR_PULLUP(8) | \
|
||||
PIN_PUDR_PULLUP(9) | \
|
||||
PIN_PUDR_PULLUP(10) | \
|
||||
PIN_PUDR_PULLUP(11) | \
|
||||
PIN_PUDR_PULLUP(12) | \
|
||||
PIN_PUDR_PULLUP(13) | \
|
||||
PIN_PUDR_PULLUP(14) | \
|
||||
PIN_PUDR_PULLUP(15))
|
||||
#define VAL_GPIOD_ODR 0xFFFFFFFF
|
||||
#define VAL_GPIOD_AFRL 0x00000000
|
||||
#define VAL_GPIOD_AFRH 0x00000000
|
||||
|
||||
/*
|
||||
* Port F setup.
|
||||
* All input with pull-up.
|
||||
*/
|
||||
#define VAL_GPIOF_MODER (PIN_MODE_INPUT(0) | \
|
||||
PIN_MODE_INPUT(1) | \
|
||||
PIN_MODE_INPUT(2) | \
|
||||
PIN_MODE_INPUT(3) | \
|
||||
PIN_MODE_INPUT(4) | \
|
||||
PIN_MODE_INPUT(5) | \
|
||||
PIN_MODE_INPUT(6) | \
|
||||
PIN_MODE_INPUT(7) | \
|
||||
PIN_MODE_INPUT(8) | \
|
||||
PIN_MODE_INPUT(9) | \
|
||||
PIN_MODE_INPUT(10) | \
|
||||
PIN_MODE_INPUT(11) | \
|
||||
PIN_MODE_INPUT(12) | \
|
||||
PIN_MODE_INPUT(13) | \
|
||||
PIN_MODE_INPUT(14) | \
|
||||
PIN_MODE_INPUT(15))
|
||||
#define VAL_GPIOF_OTYPER 0x00000000
|
||||
#define VAL_GPIOF_OSPEEDR 0xFFFFFFFF
|
||||
#define VAL_GPIOF_PUPDR (PIN_PUDR_PULLUP(0) | \
|
||||
PIN_PUDR_PULLUP(1) | \
|
||||
PIN_PUDR_PULLUP(2) | \
|
||||
PIN_PUDR_PULLUP(3) | \
|
||||
PIN_PUDR_PULLUP(4) | \
|
||||
PIN_PUDR_PULLUP(5) | \
|
||||
PIN_PUDR_PULLUP(6) | \
|
||||
PIN_PUDR_PULLUP(7) | \
|
||||
PIN_PUDR_PULLUP(8) | \
|
||||
PIN_PUDR_PULLUP(9) | \
|
||||
PIN_PUDR_PULLUP(10) | \
|
||||
PIN_PUDR_PULLUP(11) | \
|
||||
PIN_PUDR_PULLUP(12) | \
|
||||
PIN_PUDR_PULLUP(13) | \
|
||||
PIN_PUDR_PULLUP(14) | \
|
||||
PIN_PUDR_PULLUP(15))
|
||||
#define VAL_GPIOF_ODR 0xFFFFFFFF
|
||||
#define VAL_GPIOF_AFRL 0x00000000
|
||||
#define VAL_GPIOF_AFRH 0x00000000
|
||||
|
||||
#if !defined(_FROM_ASM_)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void boardInit(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _FROM_ASM_ */
|
||||
|
||||
#endif /* _BOARD_H_ */
|
|
@ -0,0 +1,5 @@
|
|||
# List of all the board related files.
|
||||
BOARDSRC = ${CHIBIOS}/boards/ST_STM32F0_DISCOVERY/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = ${CHIBIOS}/boards/ST_STM32F0_DISCOVERY
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file GCC/ARMCMx/STM32F0xx/cmparams.h
|
||||
* @brief ARM Cortex-M0 parameters for the STM32F0xx.
|
||||
*
|
||||
* @defgroup ARMCMx_STM32F0xx STM32F0xx Specific Parameters
|
||||
* @ingroup ARMCMx_SPECIFIC
|
||||
* @details This file contains the Cortex-M0 specific parameters for the
|
||||
* STM32F0xx platform.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _CMPARAMS_H_
|
||||
#define _CMPARAMS_H_
|
||||
|
||||
/**
|
||||
* @brief Cortex core model.
|
||||
*/
|
||||
#define CORTEX_MODEL CORTEX_M3
|
||||
|
||||
/**
|
||||
* @brief Systick unit presence.
|
||||
*/
|
||||
#define CORTEX_HAS_ST TRUE
|
||||
|
||||
/**
|
||||
* @brief Memory Protection unit presence.
|
||||
*/
|
||||
#define CORTEX_HAS_MPU FALSE
|
||||
|
||||
/**
|
||||
* @brief Floating Point unit presence.
|
||||
*/
|
||||
#define CORTEX_HAS_FPU FALSE
|
||||
|
||||
/**
|
||||
* @brief Number of bits in priority masks.
|
||||
*/
|
||||
#define CORTEX_PRIORITY_BITS 2
|
||||
|
||||
#endif /* _CMPARAMS_H_ */
|
||||
|
||||
/** @} */
|
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ST32F051x8 memory setup.
|
||||
*/
|
||||
__main_stack_size__ = 0x0400;
|
||||
__process_stack_size__ = 0x0400;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash : org = 0x08000000, len = 64k
|
||||
ram : org = 0x20000000, len = 8k
|
||||
}
|
||||
|
||||
__ram_start__ = ORIGIN(ram);
|
||||
__ram_size__ = LENGTH(ram);
|
||||
__ram_end__ = __ram_start__ + __ram_size__;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0;
|
||||
_text = .;
|
||||
|
||||
startup : ALIGN(16) SUBALIGN(16)
|
||||
{
|
||||
KEEP(*(vectors))
|
||||
} > flash
|
||||
|
||||
constructors : ALIGN(4) SUBALIGN(4)
|
||||
{
|
||||
PROVIDE(__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE(__init_array_end = .);
|
||||
} > flash
|
||||
|
||||
destructors : ALIGN(4) SUBALIGN(4)
|
||||
{
|
||||
PROVIDE(__fini_array_start = .);
|
||||
KEEP(*(.fini_array))
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
PROVIDE(__fini_array_end = .);
|
||||
} > flash
|
||||
|
||||
.text : ALIGN(16) SUBALIGN(16)
|
||||
{
|
||||
*(.text.startup.*)
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.glue_7t)
|
||||
*(.glue_7)
|
||||
*(.gcc*)
|
||||
} > flash
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > flash
|
||||
|
||||
.ARM.exidx : {
|
||||
PROVIDE(__exidx_start = .);
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
PROVIDE(__exidx_end = .);
|
||||
} > flash
|
||||
|
||||
.eh_frame_hdr :
|
||||
{
|
||||
*(.eh_frame_hdr)
|
||||
} > flash
|
||||
|
||||
.eh_frame : ONLY_IF_RO
|
||||
{
|
||||
*(.eh_frame)
|
||||
} > flash
|
||||
|
||||
.textalign : ONLY_IF_RO
|
||||
{
|
||||
. = ALIGN(8);
|
||||
} > flash
|
||||
|
||||
_etext = .;
|
||||
_textdata = _etext;
|
||||
|
||||
.stacks :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
__main_stack_base__ = .;
|
||||
. += __main_stack_size__;
|
||||
. = ALIGN(8);
|
||||
__main_stack_end__ = .;
|
||||
__process_stack_base__ = .;
|
||||
__main_thread_stack_base__ = .;
|
||||
. += __process_stack_size__;
|
||||
. = ALIGN(8);
|
||||
__process_stack_end__ = .;
|
||||
__main_thread_stack_end__ = .;
|
||||
} > ram
|
||||
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
PROVIDE(_data = .);
|
||||
*(.data)
|
||||
. = ALIGN(4);
|
||||
*(.data.*)
|
||||
. = ALIGN(4);
|
||||
*(.ramtext)
|
||||
. = ALIGN(4);
|
||||
PROVIDE(_edata = .);
|
||||
} > ram AT > flash
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
PROVIDE(_bss_start = .);
|
||||
*(.bss)
|
||||
. = ALIGN(4);
|
||||
*(.bss.*)
|
||||
. = ALIGN(4);
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
PROVIDE(_bss_end = .);
|
||||
} > ram
|
||||
}
|
||||
|
||||
PROVIDE(end = .);
|
||||
_end = .;
|
||||
|
||||
__heap_base__ = _end;
|
||||
__heap_end__ = __ram_end__;
|
|
@ -0,0 +1,15 @@
|
|||
# List of the ChibiOS/RT Cortex-M3 STM32 port files.
|
||||
PORTSRC = $(CHIBIOS)/os/ports/GCC/ARMCMx/crt0.c \
|
||||
$(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F0xx/vectors.c \
|
||||
${CHIBIOS}/os/ports/GCC/ARMCMx/chcore.c \
|
||||
${CHIBIOS}/os/ports/GCC/ARMCMx/chcore_v6m.c \
|
||||
${CHIBIOS}/os/ports/common/ARMCMx/nvic.c
|
||||
|
||||
PORTASM =
|
||||
|
||||
PORTINC = ${CHIBIOS}/os/ports/common/ARMCMx/CMSIS/include \
|
||||
${CHIBIOS}/os/ports/common/ARMCMx \
|
||||
${CHIBIOS}/os/ports/GCC/ARMCMx \
|
||||
${CHIBIOS}/os/ports/GCC/ARMCMx/STM32F0xx
|
||||
|
||||
PORTLD = ${CHIBIOS}/os/ports/GCC/ARMCMx/STM32F0xx/ld
|
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ChibiOS/RT is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file GCC/ARMCMx/STM32F0xx/vectors.c
|
||||
* @brief Interrupt vectors for the STM32F0xx family.
|
||||
*
|
||||
* @defgroup ARMCMx_STM32F0xx_VECTORS STM32F0xx Interrupt Vectors
|
||||
* @ingroup ARMCMx_SPECIFIC
|
||||
* @details Interrupt vectors for the STM32F0xx family.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
|
||||
#if !defined(__DOXYGEN__)
|
||||
extern void __main_stack_end__(void);
|
||||
extern void ResetHandler(void);
|
||||
extern void NMIVector(void);
|
||||
extern void HardFaultVector(void);
|
||||
extern void MemManageVector(void);
|
||||
extern void BusFaultVector(void);
|
||||
extern void UsageFaultVector(void);
|
||||
extern void Vector1C(void);
|
||||
extern void Vector20(void);
|
||||
extern void Vector24(void);
|
||||
extern void Vector28(void);
|
||||
extern void SVCallVector(void);
|
||||
extern void DebugMonitorVector(void);
|
||||
extern void Vector34(void);
|
||||
extern void PendSVVector(void);
|
||||
extern void SysTickVector(void);
|
||||
extern void Vector40(void);
|
||||
extern void Vector44(void);
|
||||
extern void Vector48(void);
|
||||
extern void Vector4C(void);
|
||||
extern void Vector50(void);
|
||||
extern void Vector54(void);
|
||||
extern void Vector58(void);
|
||||
extern void Vector5C(void);
|
||||
extern void Vector60(void);
|
||||
extern void Vector64(void);
|
||||
extern void Vector68(void);
|
||||
extern void Vector6C(void);
|
||||
extern void Vector70(void);
|
||||
extern void Vector74(void);
|
||||
extern void Vector78(void);
|
||||
extern void Vector7C(void);
|
||||
extern void Vector80(void);
|
||||
extern void Vector84(void);
|
||||
extern void Vector88(void);
|
||||
extern void Vector8C(void);
|
||||
extern void Vector90(void);
|
||||
extern void Vector94(void);
|
||||
extern void Vector98(void);
|
||||
extern void Vector9C(void);
|
||||
extern void VectorA0(void);
|
||||
extern void VectorA4(void);
|
||||
extern void VectorA8(void);
|
||||
extern void VectorAC(void);
|
||||
extern void VectorB0(void);
|
||||
extern void VectorB4(void);
|
||||
extern void VectorB8(void);
|
||||
extern void VectorBC(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief STM32 vectors table.
|
||||
*/
|
||||
#if !defined(__DOXYGEN__)
|
||||
__attribute__ ((section("vectors")))
|
||||
#endif
|
||||
void (*_vectors[])(void) = {
|
||||
__main_stack_end__, ResetHandler, NMIVector, HardFaultVector,
|
||||
MemManageVector, BusFaultVector, UsageFaultVector, Vector1C,
|
||||
Vector20, Vector24, Vector28, SVCallVector,
|
||||
DebugMonitorVector, Vector34, PendSVVector, SysTickVector,
|
||||
Vector40, Vector44, Vector48, Vector4C,
|
||||
Vector50, Vector54, Vector58, Vector5C,
|
||||
Vector60, Vector64, Vector68, Vector6C,
|
||||
Vector70, Vector74, Vector78, Vector7C,
|
||||
Vector80, Vector84, Vector88, Vector8C,
|
||||
Vector90, Vector94, Vector98, Vector9C,
|
||||
VectorA0, VectorA4, VectorA8, VectorAC,
|
||||
VectorB0, VectorB4, VectorB8, VectorBC
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Unhandled exceptions handler.
|
||||
* @details Any undefined exception vector points to this function by default.
|
||||
* This function simply stops the system into an infinite loop.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
#if !defined(__DOXYGEN__)
|
||||
__attribute__ ((naked))
|
||||
#endif
|
||||
void _unhandled_exception(void) {
|
||||
|
||||
while (TRUE)
|
||||
;
|
||||
}
|
||||
|
||||
void NMIVector(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void HardFaultVector(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void MemManageVector(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void BusFaultVector(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void UsageFaultVector(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector1C(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector20(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector24(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector28(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void SVCallVector(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void DebugMonitorVector(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector34(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void PendSVVector(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void SysTickVector(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector40(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector44(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector48(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector4C(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector50(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector54(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector58(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector5C(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector60(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector64(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector68(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector6C(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector70(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector74(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector78(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector7C(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector80(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector84(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector88(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector8C(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector90(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector94(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector98(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void Vector9C(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void VectorA0(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void VectorA4(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void VectorA8(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void VectorAC(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void VectorB0(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void VectorB4(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void VectorB8(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
void VectorBC(void) __attribute__((weak, alias("_unhandled_exception")));
|
||||
|
||||
/** @} */
|
Loading…
Reference in New Issue