More EFM32 files and logic

This commit is contained in:
Gregory Nutt 2014-10-17 12:02:32 -06:00
parent 2bafdf3d59
commit a45de60aca
11 changed files with 954 additions and 0 deletions

0
arch/arm/src/efm32/Kconfig Executable file → Normal file
View file

View file

@ -0,0 +1,103 @@
############################################################################
# arch/arm/src/efm32/Make.defs
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y)
HEAD_ASRC =
else
HEAD_ASRC = efm32_vectors.S
endif
CMN_UASRCS =
CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += vfork.S
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c
CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c
CMN_CSRCS += up_initialize.c up_initialstate.c up_interruptcontext.c
CMN_CSRCS += up_memfault.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c
CMN_CSRCS += up_releasepending.c up_releasestack.c up_reprioritizertr.c
CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_systemreset.c
CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c
CMN_CSRCS += up_svcall.c up_vfork.c
CMN_CSRCS += up_allocateheap.c
CMN_CSRCS += up_stackframe.c
ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y)
CMN_ASRCS += up_exception.S
CMN_CSRCS += up_vectors.c
endif
ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c
endif
ifeq ($(CONFIG_ARCH_MEMCPY),y)
CMN_ASRCS += up_memcpy.S
endif
ifeq ($(CONFIG_BUILD_PROTECTED),y)
CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CMN_CSRCS += up_signal_dispatch.c
CMN_UASRCS += up_signal_handler.S
endif
endif
ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_ELF),y)
CMN_CSRCS += up_elf.c
endif
ifeq ($(CONFIG_ARCH_FPU),y)
CMN_ASRCS += up_fpu.S
ifneq ($(CONFIG_ARMV7M_CMNVECTOR),y)
CMN_CSRCS += up_copyarmstate.c
endif
endif
CHIP_ASRCS =
CHIP_CSRCS =
CHIP_CSRCS += efm32_start.c
ifneq ($(CONFIG_ARCH_IDLE_CUSTOM),y)
CHIP_CSRCS += efm32_idle.c
endif

73
arch/arm/src/efm32/chip.h Normal file
View file

@ -0,0 +1,73 @@
/************************************************************************************
* arch/arm/src/efm32/chip.h
*
* Copyright (C) 2009, 2011-2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2014 Pierre-noel Bouteville . All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Pierre-noel Bouteville <pnb990@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
#ifndef __ARCH_ARM_SRC_EFM32_CHIP_H
#define __ARCH_ARM_SRC_EFM32_CHIP_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
/* Include the chip capabilities file */
#include <arch/efm32/chip.h>
/* Include the chip pin configuration file */
#ifdef CONFIG_ARMV7M_CMNVECTOR
# if defined(CONFIG_EFM32_EFM32TG)
# include "chip/efm32tg_vectors.h"
# elif defined(CONFIG_EFM32_EFM32G)
# include "chip/efm32g_vectors.h"
# elif defined(CONFIG_EFM32_EFM32GG)
# include "chip/efm32gg_vectors.h"
# else
# error "No vector file for this EFM32 family"
# endif
#endif
/* Include the chip memory map. */
//#include "chip/efm32_memorymap.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
#endif /* __ARCH_ARM_SRC_EFM32_CHIP_H */

View file

@ -0,0 +1,97 @@
/*****************************************************************************
* arch/arm/src/efm32/chip/efm32ggxxx_vectors.h
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
/*****************************************************************************
* Pre-processor Definitions
*****************************************************************************/
/* This file is included by efm32_vectors.S. It provides the macro VECTOR
* that supplies each EFM32G vector in terms of a (lower-case) ISR label and
* an (upper-case) IRQ number as defined in arch/arm/include/efm32/efm32g_irq.h.
* efm32_vectors.S will defined the VECTOR in different ways in order to
* generate the interrupt vectors and handlers in their final form.
*
* Vectors for low and medium density devices
*/
#if defined(CONFIG_EFM32_EFM32G)
/* If the common ARMv7-M vector handling is used, then all it needs is the
* following definition that provides the number of supported vectors.
*/
#ifdef CONFIG_ARMV7M_CMNVECTOR
/* Reserve 30 interrupt table entries for I/O interrupts. */
# define ARMV7M_PERIPHERAL_INTERRUPTS 30
#else
/* IRQ# Source */
VECTOR(EFM32_IRQ_DMA, EFM32_IRQ_DMA ) /* 0 DMA */
VECTOR(EFM32_IRQ_GPIO_EVEN, EFM32_IRQ_GPIO_EVEN ) /* 1 GPIO_EVEN */
VECTOR(EFM32_IRQ_TIMER0, EFM32_IRQ_TIMER0 ) /* 2 TIMER0 */
VECTOR(EFM32_IRQ_USART0_RX, EFM32_IRQ_USART0_RX ) /* 3 USART0_RX */
VECTOR(EFM32_IRQ_USART0_TX, EFM32_IRQ_USART0_TX ) /* 4 USART0_TX */
VECTOR(EFM32_IRQ_ACMP, EFM32_IRQ_ACMP ) /* 5 ACMP0/ACMP1 */
VECTOR(EFM32_IRQ_ADC0, EFM32_IRQ_ADC0 ) /* 6 ADC0 */
VECTOR(EFM32_IRQ_DAC0, EFM32_IRQ_DAC0 ) /* 7 DAC0 */
VECTOR(EFM32_IRQ_I2C0, EFM32_IRQ_I2C0 ) /* 8 I2C0 */
VECTOR(EFM32_IRQ_GPIO_ODD, EFM32_IRQ_GPIO_ODD ) /* 9 GPIO_ODD */
VECTOR(EFM32_IRQ_TIMER1, EFM32_IRQ_TIMER1 ) /* 10 TIMER1 */
VECTOR(EFM32_IRQ_TIMER2, EFM32_IRQ_TIMER2 ) /* 11 TIMER2 */
VECTOR(EFM32_IRQ_USART1_RX, EFM32_IRQ_USART1_RX ) /* 12 USART1_RX */
VECTOR(EFM32_IRQ_USART1_TX, EFM32_IRQ_USART1_TX ) /* 13 USART1_TX */
VECTOR(EFM32_IRQ_USART2_RX, EFM32_IRQ_USART2_RX ) /* 14 USART2_RX */
VECTOR(EFM32_IRQ_USART2_TX, EFM32_IRQ_USART2_TX ) /* 15 USART2_TX */
VECTOR(EFM32_IRQ_UART0_RX, EFM32_IRQ_UART0_RX ) /* 16 UART0_RX */
VECTOR(EFM32_IRQ_UART0_TX, EFM32_IRQ_UART0_TX ) /* 17 UART0_TX */
VECTOR(EFM32_IRQ_LEUART0, EFM32_IRQ_LEUART0 ) /* 18 LEUART0 */
VECTOR(EFM32_IRQ_LEUART1, EFM32_IRQ_LEUART1 ) /* 19 LEUART1 */
VECTOR(EFM32_IRQ_LETIMER0, EFM32_IRQ_LETIMER0 ) /* 20 LETIMER0 */
VECTOR(EFM32_IRQ_PCNT0, EFM32_IRQ_PCNT0 ) /* 21 PCNT0 */
VECTOR(EFM32_IRQ_PCNT1, EFM32_IRQ_PCNT1 ) /* 22 PCNT1 */
VECTOR(EFM32_IRQ_PCNT2, EFM32_IRQ_PCNT2 ) /* 23 PCNT2 */
VECTOR(EFM32_IRQ_RTC, EFM32_IRQ_RTC ) /* 24 RTC */
VECTOR(EFM32_IRQ_CMU, EFM32_IRQ_CMU ) /* 25 CMU */
VECTOR(EFM32_IRQ_VCMP, EFM32_IRQ_VCMP ) /* 26 VCMP */
VECTOR(EFM32_IRQ_LCD, EFM32_IRQ_LCD ) /* 27 LCD */
VECTOR(EFM32_IRQ_MSC, EFM32_IRQ_MSC ) /* 28 MSC */
VECTOR(EFM32_IRQ_AES, EFM32_IRQ_AES ) /* 29 AES */
#endif
#else
# error "Unknown EFM32 Type"
#endif

View file

@ -0,0 +1,104 @@
/*****************************************************************************
* arch/arm/src/efm32/chip/efm32ggxxx_vectors.h
*
* Copyright (C) 2014 Pierre-noel Bouteville . All rights reserved.
* Author: Pierre-noel Bouteville <pnb990@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
/*****************************************************************************
* Pre-processor Definitions
*****************************************************************************/
/* This file is included by efm32_vectors.S. It provides the macro VECTOR
* that supplies each EFM32GG vector in terms of a (lower-case) ISR label and
* an (upper-case) IRQ number as defined in arch/arm/include/efm32/efm32gg_irq.h.
* efm32_vectors.S will defined the VECTOR in different ways in order to
* generate the interrupt vectors and handlers in their final form.
*
* Vectors for low and medium density devices
*/
#if defined(CONFIG_EFM32_EFM32GG)
/* If the common ARMv7-M vector handling is used, then all it needs is the
* following definition that provides the number of supported vectors.
*/
#ifdef CONFIG_ARMV7M_CMNVECTOR
/* Reserve 39 interrupt table entries for I/O interrupts. */
# define ARMV7M_PERIPHERAL_INTERRUPTS 39
#else
VECTOR(EFM32_IRQ_DMA, EFM32_IRQ_DMA ) /* 0: EFM32_IRQ_DMA */
VECTOR(EFM32_IRQ_GPIO_EVEN, EFM32_IRQ_GPIO_EVEN ) /* 1: EFM32_IRQ_GPIO_EVEN */
VECTOR(EFM32_IRQ_TIMER0, EFM32_IRQ_TIMER0 ) /* 2: EFM32_IRQ_TIMER0 */
VECTOR(EFM32_IRQ_USART0_RX, EFM32_IRQ_USART0_RX ) /* 3: EFM32_IRQ_USART0_RX */
VECTOR(EFM32_IRQ_USART0_TX, EFM32_IRQ_USART0_TX ) /* 4: EFM32_IRQ_USART0_TX */
VECTOR(EFM32_IRQ_USB, EFM32_IRQ_USB ) /* 5: EFM32_IRQ_USB */
VECTOR(EFM32_IRQ_ACMP, EFM32_IRQ_ACMP ) /* 6: EFM32_IRQ_ACMP */
VECTOR(EFM32_IRQ_ADC0, EFM32_IRQ_ADC0 ) /* 7: EFM32_IRQ_ADC0 */
VECTOR(EFM32_IRQ_DAC0, EFM32_IRQ_DAC0 ) /* 8: EFM32_IRQ_DAC0 */
VECTOR(EFM32_IRQ_I2C0, EFM32_IRQ_I2C0 ) /* 9: EFM32_IRQ_I2C0 */
VECTOR(EFM32_IRQ_I2C1, EFM32_IRQ_I2C1 ) /* 10: EFM32_IRQ_I2C1 */
VECTOR(EFM32_IRQ_GPIO_ODD, EFM32_IRQ_GPIO_ODD ) /* 11: EFM32_IRQ_GPIO_ODD */
VECTOR(EFM32_IRQ_TIMER1, EFM32_IRQ_TIMER1 ) /* 12: EFM32_IRQ_TIMER1 */
VECTOR(EFM32_IRQ_TIMER2, EFM32_IRQ_TIMER2 ) /* 13: EFM32_IRQ_TIMER2 */
VECTOR(EFM32_IRQ_TIMER3, EFM32_IRQ_TIMER3 ) /* 14: EFM32_IRQ_TIMER3 */
VECTOR(EFM32_IRQ_USART1_RX, EFM32_IRQ_USART1_RX ) /* 15: EFM32_IRQ_USART1_RX */
VECTOR(EFM32_IRQ_USART1_TX, EFM32_IRQ_USART1_TX ) /* 16: EFM32_IRQ_USART1_TX */
VECTOR(EFM32_IRQ_LESENSE, EFM32_IRQ_LESENSE ) /* 17: EFM32_IRQ_LESENSE */
VECTOR(EFM32_IRQ_USART2_RX, EFM32_IRQ_USART2_RX ) /* 18: EFM32_IRQ_USART2_RX */
VECTOR(EFM32_IRQ_USART2_TX, EFM32_IRQ_USART2_TX ) /* 19: EFM32_IRQ_USART2_TX */
VECTOR(EFM32_IRQ_UART0_RX, EFM32_IRQ_UART0_RX ) /* 20: EFM32_IRQ_UART0_RX */
VECTOR(EFM32_IRQ_UART0_TX, EFM32_IRQ_UART0_TX ) /* 21: EFM32_IRQ_UART0_TX */
VECTOR(EFM32_IRQ_UART1_RX, EFM32_IRQ_UART1_RX ) /* 22: EFM32_IRQ_UART1_RX */
VECTOR(EFM32_IRQ_UART1_TX, EFM32_IRQ_UART1_TX ) /* 23: EFM32_IRQ_UART1_TX */
VECTOR(EFM32_IRQ_LEUART0, EFM32_IRQ_LEUART0 ) /* 24: EFM32_IRQ_LEUART0 */
VECTOR(EFM32_IRQ_LEUART1, EFM32_IRQ_LEUART1 ) /* 25: EFM32_IRQ_LEUART1 */
VECTOR(EFM32_IRQ_LETIMER0, EFM32_IRQ_LETIMER0 ) /* 26: EFM32_IRQ_LETIMER0 */
VECTOR(EFM32_IRQ_PCNT0, EFM32_IRQ_PCNT0 ) /* 27: EFM32_IRQ_PCNT0 */
VECTOR(EFM32_IRQ_PCNT1, EFM32_IRQ_PCNT1 ) /* 28: EFM32_IRQ_PCNT1 */
VECTOR(EFM32_IRQ_PCNT2, EFM32_IRQ_PCNT2 ) /* 29: EFM32_IRQ_PCNT2 */
VECTOR(EFM32_IRQ_RTC, EFM32_IRQ_RTC ) /* 30: EFM32_IRQ_RTC */
VECTOR(EFM32_IRQ_BURTC, EFM32_IRQ_BURTC ) /* 31: EFM32_IRQ_BURTC */
VECTOR(EFM32_IRQ_CMU, EFM32_IRQ_CMU ) /* 32: EFM32_IRQ_CMU */
VECTOR(EFM32_IRQ_VCMP, EFM32_IRQ_VCMP ) /* 33: EFM32_IRQ_VCMP */
VECTOR(EFM32_IRQ_LCD, EFM32_IRQ_LCD ) /* 34: EFM32_IRQ_LCD */
VECTOR(EFM32_IRQ_MSC, EFM32_IRQ_MSC ) /* 35: EFM32_IRQ_MSC */
VECTOR(EFM32_IRQ_AES, EFM32_IRQ_AES ) /* 36: EFM32_IRQ_AES */
VECTOR(EFM32_IRQ_EBI, EFM32_IRQ_EBI ) /* 37: EFM32_IRQ_EBI */
VECTOR(EFM32_IRQ_EMI, EFM32_IRQ_EMI ) /* 38: EFM32_IRQ_EMI */
#endif
#else
# error "Unknown EFM32 Type"
#endif

View file

@ -0,0 +1,88 @@
/*****************************************************************************
* arch/arm/src/efm32/chip/efm32tg_vectors.h
*
* Copyright (C) 2014 Pierre-noel Bouteville . All rights reserved.
* Author: Pierre-noel Bouteville <pnb990@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
/*****************************************************************************
* Pre-processor Definitions
*****************************************************************************/
/* This file is included by efm32_vectors.S. It provides the macro VECTOR that
* supplies ach EFM32TG vector in terms of a (lower-case) ISR label and an
* (upper-case) IRQ number as defined in arch/arm/include/efm32/efm32tg_irq.h.
* efm32_vectors.S will defined the VECTOR in different ways in order to
* generate the interrupt vectors and handlers in their final form.
*
* Vectors for low and medium density devices
*/
#if defined(CONFIG_EFM32_EFM32TG)
/* If the common ARMv7-M vector handling is used, then all it needs is the
* following definition that provides the number of supported vectors.
*/
#ifdef CONFIG_ARMV7M_CMNVECTOR
/* Reserve 23 interrupt table entries for I/O interrupts. */
# define ARMV7M_PERIPHERAL_INTERRUPTS 23
#else
VECTOR(EFM32_IRQ_DMA, EFM32_IRQ_DMA ) /* 0: EFM32_IRQ_DMA */
VECTOR(EFM32_IRQ_GPIO_EVEN, EFM32_IRQ_GPIO_EVEN ) /* 1: EFM32_IRQ_GPIO_EVEN */
VECTOR(EFM32_IRQ_TIMER0, EFM32_IRQ_TIMER0 ) /* 2: EFM32_IRQ_TIMER0 */
VECTOR(EFM32_IRQ_USART0_RX, EFM32_IRQ_USART0_RX ) /* 3: EFM32_IRQ_USART0_RX */
VECTOR(EFM32_IRQ_USART0_TX, EFM32_IRQ_USART0_TX ) /* 4: EFM32_IRQ_USART0_TX */
VECTOR(EFM32_IRQ_ACMP, EFM32_IRQ_ACMP ) /* 5: EFM32_IRQ_ACMP */
VECTOR(EFM32_IRQ_ADC0, EFM32_IRQ_ADC0 ) /* 6: EFM32_IRQ_ADC0 */
VECTOR(EFM32_IRQ_DAC0, EFM32_IRQ_DAC0 ) /* 7: EFM32_IRQ_DAC0 */
VECTOR(EFM32_IRQ_I2C0, EFM32_IRQ_I2C0 ) /* 8: EFM32_IRQ_I2C0 */
VECTOR(EFM32_IRQ_GPIO_ODD, EFM32_IRQ_GPIO_ODD ) /* 9: EFM32_IRQ_GPIO_ODD */
VECTOR(EFM32_IRQ_TIMER1, EFM32_IRQ_TIMER1 ) /* 10: EFM32_IRQ_TIMER1 */
VECTOR(EFM32_IRQ_USART1_RX, EFM32_IRQ_USART1_RX ) /* 11: EFM32_IRQ_USART1_RX */
VECTOR(EFM32_IRQ_USART1_TX, EFM32_IRQ_USART1_TX ) /* 12: EFM32_IRQ_USART1_TX */
VECTOR(EFM32_IRQ_LESENSE, EFM32_IRQ_LESENSE ) /* 13: EFM32_IRQ_LESENSE */
VECTOR(EFM32_IRQ_LEUART0, EFM32_IRQ_LEUART0 ) /* 14: EFM32_IRQ_LEUART0 */
VECTOR(EFM32_IRQ_LETIMER0, EFM32_IRQ_LETIMER0 ) /* 15: EFM32_IRQ_LETIMER0 */
VECTOR(EFM32_IRQ_PCNT0, EFM32_IRQ_PCNT0 ) /* 16: EFM32_IRQ_PCNT0 */
VECTOR(EFM32_IRQ_RTC, EFM32_IRQ_RTC ) /* 17: EFM32_IRQ_RTC */
VECTOR(EFM32_IRQ_CMU, EFM32_IRQ_CMU ) /* 18: EFM32_IRQ_CMU */
VECTOR(EFM32_IRQ_VCMP, EFM32_IRQ_VCMP ) /* 19: EFM32_IRQ_VCMP */
VECTOR(EFM32_IRQ_LCD, EFM32_IRQ_LCD ) /* 20: EFM32_IRQ_LCD */
VECTOR(EFM32_IRQ_MSC, EFM32_IRQ_MSC ) /* 21: EFM32_IRQ_MSC */
VECTOR(EFM32_IRQ_AES, EFM32_IRQ_AES ) /* 22: EFM32_IRQ_AES */
#endif
#else
# error "Unknown EFM32 Type"
#endif

View file

@ -0,0 +1,61 @@
/****************************************************************************
* arch/arm/src/efm32/efm32_clockconfig.h
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_EFM32_EFM32_CLOCKCONFIG_H
#define __ARCH_ARM_SRC_EFM32_EFM32_CLOCKCONFIG_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: efm32_clockconfig
*
* Description:
* Called to initialize the EFM32. This does whatever setup is needed to
* put the SoC in a usable state. This includes the initialization of
* clocking using the settings in board.h.
*
****************************************************************************/
void efm32_clockconfig(void);
#endif /* __ARCH_ARM_SRC_EFM32_EFM32_CLOCKCONFIG_H */

View file

@ -0,0 +1,96 @@
/****************************************************************************
* arch/arm/src/efm32/efm32_idle.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <arch/board/board.h>
#include <nuttx/config.h>
#include <nuttx/arch.h>
#include <nuttx/power/pm.h>
#include <arch/irq.h>
#include "chip.h"
#include "up_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Does the board support an IDLE LED to indicate that the board is in the
* IDLE state?
*/
#if defined(CONFIG_ARCH_LEDS) && defined(LED_IDLE)
# define BEGIN_IDLE() board_led_on(LED_IDLE)
# define END_IDLE() board_led_off(LED_IDLE)
#else
# define BEGIN_IDLE()
# define END_IDLE()
#endif
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_idle
*
* Description:
* up_idle() is the logic that will be executed when their is no other
* ready-to-run task. This is processor idle time and will continue until
* some interrupt occurs to cause a context switch from the idle task.
*
* Processing in this state may be processor-specific. e.g., this is where
* power management operations might be performed.
*
****************************************************************************/
void up_idle(void)
{
/* Perform IDLE mode power management */
/* Sleep until an interrupt occurs to save power. */
}

View file

@ -0,0 +1,66 @@
/****************************************************************************
* arch/arm/src/efm32/efm32_lowputc.h
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_EFM32_EFM32_LOWPUTC_H
#define __ARCH_ARM_SRC_EFM32_EFM32_LOWPUTC_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: efm32_lowsetup
*
* Description:
* Called at the very beginning of _start. Performs low level
* initialization including setup of the console UART. This UART done
* early so that the serial console is available for debugging very early
* in the boot sequence.
*
****************************************************************************/
#if defined(CONFIG_DEV_LOWCONSOLE) || defined(CONFIG_DEBUG)
void efm32_lowsetup(void);
#else
# define efm32_lowsetup()
#endif
#endif /* __ARCH_ARM_SRC_EFM32_EFM32_LOWPUTC_H */

View file

@ -0,0 +1,205 @@
/****************************************************************************
* arch/arm/src/efm32/efm32_start.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/init.h>
#include <arch/board/board.h>
#include <arch/efm32/chip.h>
#include "up_arch.h"
#include "up_internal.h"
#include "efm32_lowputc.h"
#include "efm32_clockconfig.h"
#include "efm32_start.h"
/****************************************************************************
* Private Function prototypes
****************************************************************************/
#ifdef CONFIG_DEBUG_STACK
static void go_os_start(void *pv, unsigned int nbytes)
__attribute__ ((naked,no_instrument_function,noreturn));
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: showprogress
*
* Description:
* Print a character on the UART to show boot status.
*
****************************************************************************/
#ifdef CONFIG_DEBUG
# define showprogress(c) up_lowputc(c)
#else
# define showprogress(c)
#endif
/****************************************************************************
* Name: go_os_start
*
* Description:
* Set the IDLE stack to the
*
****************************************************************************/
#ifdef CONFIG_DEBUG_STACK
static void go_os_start(void *pv, unsigned int nbytes)
{
/* Set the IDLE stack to the stack coloration value then jump to
* os_start(). We take extreme care here because were currently
* executing on this stack.
*
* We want to avoid sneak stack access generated by the compiler.
*/
__asm__ __volatile__
(
"\tmov r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */
"\tbeq 2f\n" /* (should not happen) */
"\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */
"\tmovw r2, #0xbeef\n" /* R2 = STACK_COLOR = 0xdeadbeef */
"\tmovt r2, #0xdead\n"
"1:\n" /* Top of the loop */
"\tsub r1, r1, #1\n" /* R1 nwords-- */
"\tcmp r1, #0\n" /* Check (nwords == 0) */
"\tstr r2, [r0], #4\n" /* Save stack color word, increment stackptr */
"\tbne 1b\n" /* Bottom of the loop */
"2:\n"
"\tmov r14, #0\n" /* LR = return address (none) */
"\tb os_start\n" /* Branch to os_start */
);
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: _start
*
* Description:
* This is the reset entry point.
*
****************************************************************************/
void __start(void)
{
const uint32_t *src;
uint32_t *dest;
/* Configure the uart so that we can get debug output as soon as possible */
efm32_clockconfig();
efm32_lowsetup();
showprogress('A');
/* Clear .bss. We'll do this inline (vs. calling memset) just to be
* certain that there are no issues with the state of global variables.
*/
for (dest = &_sbss; dest < &_ebss; )
{
*dest++ = 0;
}
showprogress('B');
/* Move the initialized data section from his temporary holding spot in
* FLASH into the correct place in SRAM. The correct place in SRAM is
* give by _sdata and _edata. The temporary location is in FLASH at the
* end of all of the other read-only data (.text, .rodata) at _eronly.
*/
for (src = &_eronly, dest = &_sdata; dest < &_edata; )
{
*dest++ = *src++;
}
showprogress('C');
/* Perform early serial initialization */
up_earlyserialinit();
showprogress('D');
/* For the case of the separate user-/kernel-space build, perform whatever
* platform specific initialization of the user memory is required.
* Normally this just means initializing the user space .data and .bss
* segments.
*/
#ifdef CONFIG_NUTTX_KERNEL
efm32_userspace();
showprogress('E');
#endif
/* Then start NuttX */
showprogress('\r');
showprogress('\n');
#ifdef CONFIG_DEBUG_STACK
/* Set the IDLE stack to the coloration value and jump into os_start() */
go_os_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE);
#else
/* Call os_start() */
os_start();
/* Shouldn't get here */
for(;;);
#endif
}

View file

@ -0,0 +1,61 @@
/****************************************************************************
* arch/arm/src/efm32/efm32_start.h
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_EFM32_EFM32_START_H
#define __ARCH_ARM_SRC_EFM32_EFM32_START_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: efm32_boardinitialize
*
* Description:
* All EFM32 architectures must provide the following entry point. This
* entry point is called early in the initialization before any devices
* have been initialized.
*
****************************************************************************/
void efm32_boardinitialize(void);
#endif /* __ARCH_ARM_SRC_EFM32_EFM32_START_H */