Merge remote-tracking branch 'origin/master' into bas24

This commit is contained in:
Gregory Nutt
2014-11-03 17:22:38 -06:00
21 changed files with 2113 additions and 24 deletions
+3
View File
@@ -8902,4 +8902,7 @@
PDC or DMAC support is required (2014-10-29).
* configs/sam4e-ek/src/sam4e-ek.h: Fix an error in a USART1 pin number
(2014-10-29).
* configs/efm32gg-stk3700: Board support for the SiLbas EFM32GG
Giant Gecko Starter kit. Current with basic NSH configuration only.
Testing is on hold until I receive hardware (20145-11-03).
+5 -4
View File
@@ -1391,7 +1391,7 @@
<li><a href="#m16c">Renesas M16C/26</a></li>
</ul>
</li>
<li>Silicon Laboratories
<li>Silicon Laboratories, Inc.
<ul>
<li><a href="#efm32g">EFM32 Gecko</a> <small>(ARM Cortex-M3)</small></li>
<li><a href="#emf32gg">EFM32 Giant Gecko</a> <small>(ARM Cortex-M3)</small></li>
@@ -2283,7 +2283,7 @@ nsh>
<td>
<p>
<a name="efm32g"><b>SiLabs EFM32 Gecko</b>.</a>
This is a port for the Silicon Laboraties EFM32 <i>Gecko</i> family.
This is a port for the Silicon Laboratories' EFM32 <i>Gecko</i> family.
Board support is available for the following:
</p>
<ol>
@@ -2352,7 +2352,7 @@ nsh>
<td>
<p>
<a name="efm32gg"><b>SiLabs EFM32 Giant Gecko</b>.</a>
This is a port for the Silicon Laboraties EFM32 <i>Giant Gecko</i> family.
This is a port for the Silicon Laboratories' EFM32 <i>Giant Gecko</i> family.
</p>
<ul>
<p>
@@ -4672,11 +4672,12 @@ if [ -x "$WINELOADER" ]; then exec "$WINELOADER" "$appname" "$@"; fi
</table>
<ul>
<li>ARM, ARM7 ARM7TDMI, ARM9, ARM920T, ARM926EJS Cortex-M3 are trademarks of Advanced RISC Machines, Limited.</li>
<li>ARM, ARM7 ARM7TDMI, ARM9, ARM920T, ARM926EJS, Cortex-M3 are trademarks of Advanced RISC Machines, Limited.</li>
<li>Cygwin is a trademark of Red Hat, Incorporated.</li>
<li>Linux is a registered trademark of Linus Torvalds.</li>
<li>Eagle-100 is a trademark of <a href=" http://www.micromint.com/">Micromint USA, LLC</a>.
<li>EnergyLite is a trademark of STMicroelectronics.</li>
<li>EFM32 is a trademark of Silicon Laboratories, Inc.</li>
<li>LPC2148 is a trademark of NXP Semiconductors.</li>
<li>TI is a tradename of Texas Instruments Incorporated.</li>
<li>UNIX is a registered trademark of The Open Group.</li>
+6 -3
View File
@@ -46,7 +46,7 @@
* Pre-processor Definitions
************************************************************************************/
/* EFM32 EnergyMicro ************************************************************/
/* EFM32 EnergyMicro ****************************************************************/
/* Tiny Gecko with 32KiB FLASH and 4KiB RAM in a QFN64 package */
@@ -59,9 +59,12 @@
#elif defined(CONFIG_ARCH_CHIP_EFM32G880F128) || \
defined(CONFIG_ARCH_CHIP_EFM32G890F128)
/* Giant Gecko with 1024KiB FLASH and 128KiB RAM in a QFP64 package */
/* Giant Gecko with 1024KiB FLASH and 128KiB RAM in a QFP64 package
* (EFM32GG332F1024) or BGA112 (EFM32GG990F1024) package
*/
#elif defined(CONFIG_ARCH_CHIP_EFM32GG332F1024)
#elif defined(CONFIG_ARCH_CHIP_EFM32GG332F1024) || \
defined(CONFIG_ARCH_CHIP_EFM32GG990F1024)
#else
# error "Unsupported EFM32 chip"
+8
View File
@@ -42,6 +42,14 @@ config ARCH_CHIP_EFM32GG332F1024
This chip is a Giant Gecko with 1024KiB flash and 128KiB RAM in a
QFP64 package.
config ARCH_CHIP_EFM32GG990F1024
bool "EFM32GG990F1024"
select EFM32_EFM32GG
select ARCH_CORTEXM3
---help---
This chip is a Giant Gecko with 1024KiB flash and 128KiB RAM in a
BGA112 package.
endchoice
# These hidden selections represent automatically selected MCU families and,
+13 -1
View File
@@ -132,7 +132,15 @@ config ARCH_BOARD_EFM32G8XXSTK
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
---help---
This options selects the EFM32 Gecko Starter Kit (EFM32-G8XX-STK).
This option selects the EFM32 Gecko Starter Kit (EFM32-G8XX-STK).
config ARCH_BOARD_EFM32GG_STK3700
bool "EFM32 Giant Gecko Starter Kit"
depends on ARCH_CHIP_EFM32GG990F1024
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
---help---
This option selects the EFM32 Giant Gecko Starter Kit (EFM32GG-STK3700).
config ARCH_BOARD_EKKLM3S9B96
bool "TI/Stellaris EKK-LM3S9B96"
@@ -1017,6 +1025,7 @@ config ARCH_BOARD
default "ea3152" if ARCH_BOARD_EA3152
default "eagle100" if ARCH_BOARD_EAGLE100
default "efm32-g8xx-stk" if ARCH_BOARD_EFM32G8XXSTK
default "efm32gg-stk3700" if ARCH_BOARD_EFM32GG_STK3700
default "ekk-lm3s9b96" if ARCH_BOARD_EKKLM3S9B96
default "ez80f910200kitg" if ARCH_BOARD_EZ80F910200KITG
default "ez80f910200zco" if ARCH_BOARD_EZ80F910200ZCO
@@ -1192,6 +1201,9 @@ endif
if ARCH_BOARD_EFM32G8XXSTK
source "configs/efm32-g8xx-stk/Kconfig"
endif
if ARCH_BOARD_EFM32GG_STK3700
source "configs/efm32gg-stk3700/Kconfig"
endif
if ARCH_BOARD_EKKLM3S9B96
source "configs/ekk-lm3s9b96/Kconfig"
endif
+7
View File
@@ -218,6 +218,13 @@ configs/eagle100
an ARM Cortex-M3 MCU, the Luminary LM3S6918. This OS is built with the
arm-nuttx-elf toolchain*. STATUS: This port is complete and mature.
configs/efm32-g8xx-stk
The port of NuttX to the the EFM32 Gecko Starter Kit (EFM32-G8XX-STK).
configs/efm32gg-stk3700
The port of NuttX to the the EFM32 Giant Gecko Starter Kit
(EFM32GG-STK3700).
configs/ekk-lm3s9b96
TI/Stellaris EKK-LM3S9B96 board. This board is based on the
an EKK-LM3S9B96 which is a Cortex-M3.
+1 -1
View File
@@ -240,4 +240,4 @@ void efm32_setled(int led, bool ledon);
void efm32_setleds(uint8_t ledset);
#endif
#endif /* __CONFIGS_EFM32_DK3650_INCLUDE_BOARD_H */
#endif /* __CONFIGS_EFM32_G8XX_STK_INCLUDE_BOARD_H */
+9 -9
View File
@@ -43,14 +43,14 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* UART0
*
* The control MCU acts as a board controller (BC). There is a UART
* connection between the EFM and the BC. The connection is made by
* setting the EFM_BC_EN (PD13) line high. The EFM can then use the BSP to
* send commands to the BC. When EFM_BC_EN is low, EFM_BC_TX and EFM_BC_RX
* can be used by other applications.
*/
/* UART0
*
* The control MCU acts as a board controller (BC). There is a UART
* connection between the EFM and the BC. The connection is made by
* setting the EFM_BC_EN (PD13) line high. The EFM can then use the BSP to
* send commands to the BC. When EFM_BC_EN is low, EFM_BC_TX and EFM_BC_RX
* can be used by other applications.
*/
#ifdef CONFIG_EFM32G8STK_BCEN
# define GPIO_BC_EN (GPIO_OUTPUT_PUSHPULL|GPIO_OUTPUT_SET|\
@@ -99,4 +99,4 @@
void board_led_initialize(void);
#endif
#endif /* __CONFIGS_EFM32_DK3650_INCLUDE_BOARD_H */
#endif /* __CONFIGS_EFM32_G8XX_STK_SRC_EFM32_G8XX_STK_H */
+22
View File
@@ -0,0 +1,22 @@
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
if ARCH_BOARD_EFM32GG_STK3700
comment "EFM32GG-STK3700 Hardware Configuration"
config EFM32GG_STK3700_BCEN
bool "Enable BC_EN"
default n
---help---
The kit contains a board controller that is responsible for
performing various board level tasks, such as handling the debugger
and the Advanced Energy Monitor. An interface is provided between
the EFM32 and the board controller in the form of a UART connection.
The connection is enabled by setting the EFM_BC_EN (PF7) line high,
and using the lines EFM_BC_TX (PE0) and EFM_BC_RX (PE1) for
communicating.
endif # ARCH_BOARD_EFM32GG_STK3700
+15 -6
View File
@@ -26,16 +26,16 @@ README
STATUS
======
This README now exists only as some analysis for a port to the EFM32 Giant
Gecko Starter Kit. That port has not yet been developed and I do not now
have hardware in hand. So the status is partially analyzed, but not yet implemented.
2014-11-02: Completed the basic NSH configuration for the EFM32 Giant Gecko
Starter Kit. The hardware is on order and the port will be verified sometime
thereafter.
LEDs and Buttons
================
LEDs
----
The EFM32 Giant Gecko Start Kit has two yellow LEDs marke LED0 and LED1.
The EFM32 Giant Gecko Start Kit has two yellow LEDs marked LED0 and LED1.
These LEDs are controlled by GPIO pins on the EFM32. The LEDs are
connected to pins PE2 and PE3 in an active high configuration:
@@ -74,6 +74,10 @@ LEDs and Buttons
LED_PANIC The system has crashed OFF Blinking
LED_IDLE STM32 is is sleep mode Not used
Thus if LED0 statically on, NuttX has successfully booted and is,
apparently, running normally. If LED1 is flashing at approximately
2Hz, then a fatal error has been detected and the system has halted.
Buttons
-------
The EFM32 Giant Gecko Start Kit has two buttons marked PB0 and PB1. They
@@ -94,7 +98,12 @@ Serial Console
Default Serial Console
----------------------
UART0 is configured as the default serial console at 115200 8N1
LEUART0 is configured as the default serial console at 2400 8N1
on pins PD5 and PD4. It certainly be possible to go to 4800 baud
and the documentation claims that 9600 baud is possible (although
I am not sure how).
It should also be possible to use UART0 is configured at 115200 8N1
on pins PE0 and PE1.
Communication through the Board Controller
@@ -126,7 +135,7 @@ Configurations
nsh:
---
Configures the NuttShell (nsh) located at apps/examples/nsh. The
Configuration enables the serial interfaces on UART0. Support for
Configuration enables the serial interfaces on LEUART0. Support for
built-in applications is enabled, but in the base configuration no
built-in applications are selected (see NOTES below).
+288
View File
@@ -0,0 +1,288 @@
/****************************************************************************
* configs/efm32gg-stk3700/include/board.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 __CONFIGS_EFM32GG_STK3700_INCLUDE_BOARD_H
#define __CONFIGS_EFM32GG_STK3700_INCLUDE_BOARD_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include "chip/efm32_cmu.h"
#include "chip/efm32_usart.h"
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Clocking *****************************************************************/
/* Clock Sources
* - 1-28 MHz High Frequency RC Oscillator (HFRCO)
* - 4-32 MHz High Frequency Crystal Oscillator (HFXO)
* - 32.768 kHz Low Frequency RC Oscillator (LFRCO)
* - 32.768 kHz Low Frequency Crystal Oscillator (LFXO)
* - 1KHz Ultra Low Frequency RC Oscillator (ULFRCO)
*
* The device boots with 14 MHz HFRCO as the HFCLK source.
*/
#define BOARD_HAVE_HFXO 1 /* Have High frequency crystal oscillator */
#define BOARD_HAVE_LFXO 1 /* Have Loq frequency crystal oscillator */
#define BOARD_HFRCO_FREQUENCY 14000000 /* 14MHz on reset */
#define BOARD_HFXO_FREQUENCY 48000000 /* 48MHz crystal on board */
#define BOARD_LFRCO_FREQUENCY 32768 /* Low frequency oscillator */
#define BOARD_LFXO_FREQUENCY 32768 /* 32MHz crystal on board */
#define BOARD_ULFRCO_FREQUNCY 1000 /* Ultra low frequency oscillator */
/* HFCLK - High Frequency Clock
*
* HFCLK is the selected High Frequency Clock. This clock is used by the CMU
* and drives the two prescalers that generate HFCORECLK and HFPERCLK. The
* HFCLK can be driven by a high-frequency oscillator (HFRCO or HFXO) or one
* of the low-frequency oscillators (LFRCO or LFXO). By default the HFRCO is
* selected.
*/
#define BOARD_HFCLKSEL _CMU_CMD_HFCLKSEL_HFXO
#define BOARD_HFCLKDIV 0 /* Does not apply to EFM32G */
#define BOARD_HFCLK_FREQUENCY BOARD_HFXO_FREQUENCY
/* HFCORECLK - High Frequency Core Clock
*
* HFCORECLK is a prescaled version of HFCLK. This clock drives the Core
* Modules, which consists of the CPU and modules that are tightly coupled
* to the CPU, e.g. MSC, DMA etc. The frequency of HFCORECLK is set using
* the CMU_HFCORECLKDIV register.
*/
#define BOARD_HFCORECLKDIV _CMU_HFCORECLKDIV_HFCORECLKDIV_DEFAULT
#define BOARD_HFCORECLK_FREQUENCY BOARD_HFXO_FREQUENCY
/* HFPERCLK - High Frequency Peripheral Clock
*
* Like HFCORECLK, HFPERCLK can also be a prescaled version of HFCLK. This
* clock drives the High-Frequency Peripherals. The frequency of HFPERCLK is
* set using the CMU_HFPERCLKDIV register.
*/
#define BOARD_HFPERCLKDIV _CMU_HFPERCLKDIV_HFPERCLKDIV_DEFAULT
#define BOARD_HFPERCLK_FREQUENCY BOARD_HFXO_FREQUENCY
/* LFACLK - Low Frequency A Clock
*
* LFACLK is the selected clock for the Low Energy A Peripherals. There are
* four selectable sources for LFACLK: LFRCO, LFXO, HFCORECLK/2 and ULFRCO.
* From reset, the LFACLK source is set to LFRCO. However, note that the
* LFRCO is disabled from reset. The selection is configured using the LFA
* field in CMU_LFCLKSEL. The HFCORECLK/2 setting allows the Low Energy A
* Peripherals to be used as high-frequency peripherals.
*
* Use _CMU_LFCLKSEL_LFA_DISABLED to disable.
* ULFRCO is a special case.
*/
#if BOARD_HAVE_LFXO
# define BOARD_LFACLKSEL _CMU_LFCLKSEL_LFA_LFXO
# undef BOARD_LFACLK_ULFRCO
# define BOARD_LFACLK_FREQUENCY BOARD_LFXO_FREQUENCY
#else
# define BOARD_LFACLKSEL _CMU_LFCLKSEL_LFA_LFRCO
# undef BOARD_LFACLK_ULFRCO
# define BOARD_LFACLK_FREQUENCY BOARD_LFRCO_FREQUENCY
#endif
/* LFBCLK - Low Frequency B Clock
*
* LFBCLK is the selected clock for the Low Energy B Peripherals. There are
* four selectable sources for LFBCLK: LFRCO, LFXO, HFCORECLK/2 and ULFRCO.
* From reset, the LFBCLK source is set to LFRCO. However, note that the
* LFRCO is disabled from reset. The selection is configured using the LFB
* field in CMU_LFCLKSEL. The HFCORECLK/2 setting allows the Low Energy B
* Peripherals to be used as high-frequency peripherals.
*
* Use _CMU_LFCLKSEL_LFA_DISABLED to disable.
* ULFRCO is a special case.
*/
#define BOARD_LFBCLKSEL _CMU_LFCLKSEL_LFB_LFXO
#undef BOARD_LFBCLK_ULFRCO
#define BOARD_LFBCLK_FREQUENCY BOARD_LFXO_FREQUENCY
/* PCNTnCLK - Pulse Counter n Clock
*
* Each available pulse counter is driven by its own clock, PCNTnCLK where
* n is the pulse counter instance number. Each pulse counter can be
* configured to use an external pin (PCNTn_S0) or LFACLK as PCNTnCLK.
*/
/* WDOGCLK - Watchdog Timer Clock
*
* The Watchdog Timer (WDOG) can be configured to use one of three different
* clock sources: LFRCO, LFXO or ULFRCO. ULFRCO (Ultra Low Frequency RC
* Oscillator) is a separate 1 kHz RC oscillator that also runs in EM3.
*/
/* AUXCLK - Auxiliary Clock
*
* AUXCLK is a 1-28 MHz clock driven by a separate RC oscillator, AUXHFRCO.
* This clock is used for flash programming and Serial Wire Output (SWO).
* During flash programming this clock will be active. If the AUXHFRCO has
* not been enabled explicitly by software, the MSC will automatically
* start and stop it. The AUXHFRCO is enabled by writing a 1 to AUXHFRCOEN
* in CMU_OSCENCMD. This explicit enabling is required when SWO is used.
*/
/* LEDs *********************************************************************/
/* The EFM32 Giant Gecko Start Kit has two yellow LEDs marked LED0 and LED1.
* These LEDs are controlled by GPIO pins on the EFM32. The LEDs are
* connected to pins PE2 and PE3 in an active high configuration:
*
* ------------------------------------- --------------------
* EFM32 PIN BOARD SIGNALS
* ------------------------------------- --------------------
* E2/BCK_VOUT/EBI_A09 #0/ MCU_PE2 UIF_LED0
* TIM3_CC2 #1/U1_TX #3/ACMP0_O #1
* E3/BCK_STAT/EBI_A10 #0/U1_RX #3/ MCU_PE3 UIF_LED1
* ACMP1_O #1
* ------------------------------------- --------------------
*
* All LEDs are grounded and so are illuminated by outputting a high
* value to the LED.
*/
/* LED index values for use with efm32_setled() */
#define BOARD_LED0 0
#define BOARD_LED1 1
#define BOARD_NLEDS 2
/* LED bits for use with efm32_setleds() */
#define BOARD_LED0_BIT (1 << BOARD_LED0)
#define BOARD_LED1_BIT (1 << BOARD_LED1)
/* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
* defined. In that case, the usage by the board port is defined in
* include/board.h and src/efm32_autoleds.c. The LEDs are used to
* encode OS-related events as follows:
*
* SYMBOL Val Meaning LED state
* LED0 LED1
* ----------------- --- ----------------------- -------- -------- */
#define LED_STARTED 0 /* NuttX has been started OFF OFF */
#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF */
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF */
#define LED_STACKCREATED 1 /* Idle stack created ON OFF */
#define LED_INIRQ 2 /* In an interrupt No change */
#define LED_SIGNAL 2 /* In a signal handler No change */
#define LED_ASSERTION 2 /* An assertion failed No change */
#define LED_PANIC 3 /* The system has crashed OFF Blinking */
#undef LED_IDLE /* MCU is is sleep mode Not used */
/* Buttons ******************************************************************/
/* The EFM32 Giant Gecko Start Kit has two buttons marked PB0 and PB1. They
* are connected to the EFM32, and are debounced by RC filters with a time
* constant of 1ms. The buttons are connected to pins PB9 and PB10:
*
* ------------------------------------- --------------------
* EFM32 PIN BOARD SIGNALS
* ------------------------------------- --------------------
* B9/EBI_A03/U1_TX #2 MCU_PB9 UIF_PB0
* B10/EBI_A04/U1_RX #2 MCU_PB10 UIF_PB1
* ------------------------------------- --------------------
*
* Buttons are connected to ground so they will read low when closed.
*/
#define BUTTON_PB0 0
#define BUTTON_PB1 1
#define NUM_BUTTONS 2
#define BUTTON_PB0_BIT (1 << BUTTON_PB0)
#define BUTTON_PB1_BIT (1 << BUTTON_PB1)
/* Pin routing **************************************************************/
/* UART0:
*
* The kit contains a board controller that is responsible for performing
* various board level tasks, such as handling the debugger and the Advanced
* Energy Monitor. An interface is provided between the EFM32 and the board
* controller in the form of a UART connection. The connection is enabled by
* setting the EFM_BC_EN (PF7) line high, and using the lines EFM_BC_TX
* (PE0) and EFM_BC_RX (PE1) for communicating.
*
* U0_TX #1 PE0 MCU_PE0, UART0_TX #0, EFM_BC_RX, BC_UART_RX
* U0_RX #1 PE1 MCU_PE1, UART0_TX #1, EFM_BC_TX, BC_UART_TX
*/
#define BOARD_UART0_RX_GPIO (GPIO_PORTE|GPIO_PIN1)
#define BOARD_UART0_TX_GPIO (GPIO_PORTE|GPIO_PIN0)
#define BOARD_UART0_ROUTE_LOCATION _USART_ROUTE_LOCATION_LOC1
/* LEUART0:
*
* LEU0_RX #0 PD4 Available on TP121 and EXP pin 12
* LEU0_TX #0 PD5 Available on TP122 and EXP pin 14
*/
#define BOARD_LEUART0_RX_GPIO (GPIO_PORTD|GPIO_PIN4)
#define BOARD_LEUART0_TX_GPIO (GPIO_PORTD|GPIO_PIN5)
#define BOARD_LEUART0_ROUTE_LOCATION _LEUART_ROUTE_LOCATION_LOC0
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: efm32_ledinit, efm32_setled, and efm32_setleds
*
* Description:
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
* LEDs. If CONFIG_ARCH_LEDS is not defined, then the following interfaces
* are available to control the LEDs from user applications.
*
****************************************************************************/
#ifndef CONFIG_ARCH_LEDS
void efm32_ledinit(void);
void efm32_setled(int led, bool ledon);
void efm32_setleds(uint8_t ledset);
#endif
#endif /* __CONFIGS_EFM32GG_STK3700_INCLUDE_BOARD_H */
+111
View File
@@ -0,0 +1,111 @@
############################################################################
# configs/efm32-g8xx-stk/nsh/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.
#
############################################################################
include ${TOPDIR}/.config
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
include ${TOPDIR}/tools/Config.mk
LDSCRIPT = ld.script
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/copydir.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
endif
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifneq ($(CROSSDEV),arm-nuttx-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
File diff suppressed because it is too large Load Diff
+63
View File
@@ -0,0 +1,63 @@
#!/bin/bash
# configs/efm32-g8xx-stk/nsh/setenv.sh
#
# 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.
#
if [ "$_" = "$0" ] ; then
echo "You must source this script, not run it!" 1>&2
exit 1
fi
WD=`pwd`
if [ ! -x "setenv.sh" ]; then
echo "This script must be executed from the top-level NuttX build directory"
exit 1
fi
if [ -z "${PATH_ORIG}" ]; then
export PATH_ORIG="${PATH}"
fi
# This is the Cygwin path to the location where I installed the CodeSourcery
# toolchain under windows. You will also have to edit this if you install
# the CodeSourcery toolchain in any other location
export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
#export TOOLCHAIN_BIN="/cygdrive/c/Users/MyName/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
# This is the Cygwin path to the location where I build the buildroot
# toolchain.
#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
# Add the path to the toolchain to the PATH varialble
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
echo "PATH : ${PATH}"
+110
View File
@@ -0,0 +1,110 @@
/****************************************************************************
* configs/efm32gg-stk3700/scripts/ld.script
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
*
* 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.
*
****************************************************************************/
MEMORY
{
flash (rx) : ORIGIN = 0x00000000, LENGTH = 1M
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 128M
}
OUTPUT_ARCH(arm)
EXTERN(_vectors)
ENTRY(_stext)
SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > flash
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > flash
.ARM.extab : {
*(.ARM.extab*)
} > flash
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} > flash
__exidx_end = ABSOLUTE(.);
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram AT > flash
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > sram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}
+2
View File
@@ -0,0 +1,2 @@
/.depend
/Make.dep
+83
View File
@@ -0,0 +1,83 @@
############################################################################
# configs/efm32gg-stk3700/src/Makefile
#
# 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.
#
############################################################################
-include $(TOPDIR)/Make.defs
CSRCS = efm32_boot.c
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += efm32_autoleds.c
else
CSRCS += efm32_userleds.c
endif
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
CFLAGS += -I$(ARCH_SRCDIR)\chip -I$(ARCH_SRCDIR)\common -I$(ARCH_SRCDIR)\armv7-m
else
ifeq ($(WINTOOL),y)
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
else
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
endif
endif
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
libboard$(LIBEXT): $(OBJS)
$(call ARCHIVE, $@, $(OBJS))
.depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@
depend: .depend
clean:
$(call DELFILE, libboard$(LIBEXT))
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep
@@ -0,0 +1,175 @@
/****************************************************************************
* configs/efm32gg-stk3700/include/efm32_autoleds.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.
*
****************************************************************************/
/* The EFM32 Giant Gecko Start Kit has two yellow LEDs marked LED0 and LED1.
* These LEDs are controlled by GPIO pins on the EFM32. The LEDs are
* connected to pins PE2 and PE3 in an active high configuration:
*
* ------------------------------------- --------------------
* EFM32 PIN BOARD SIGNALS
* ------------------------------------- --------------------
* E2/BCK_VOUT/EBI_A09 #0/ MCU_PE2 UIF_LED0
* TIM3_CC2 #1/U1_TX #3/ACMP0_O #1
* E3/BCK_STAT/EBI_A10 #0/U1_RX #3/ MCU_PE3 UIF_LED1
* ACMP1_O #1
* ------------------------------------- --------------------
*
* All LEDs are grounded and so are illuminated by outputting a high
* value to the LED.
*
* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
* defined. In that case, the usage by the board port is defined in
* include/board.h and src/efm32_autoleds.c. The LEDs are used to
* encode OS-related events as follows:
*
* SYMBOL Meaning LED state
* LED0 LED1
* ------------------- ----------------------- -------- --------
* LED_STARTED NuttX has been started OFF OFF
* LED_HEAPALLOCATE Heap has been allocated OFF OFF
* LED_IRQSENABLED Interrupts enabled OFF OFF
* LED_STACKCREATED Idle stack created ON OFF
* LED_INIRQ In an interrupt No change
* LED_SIGNAL In a signal handler No change
* LED_ASSERTION An assertion failed No change
* LED_PANIC The system has crashed OFF Blinking
* LED_IDLE STM32 is is sleep mode Not used
*
* Thus if LED0 statically on, NuttX has successfully booted and is,
* apparently, running normally. If LED1 is flashing at approximately
* 2Hz, then a fatal error has been detected and the system has halted.
*/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <arch/board/board.h>
#include "efm32_gpio.h"
#include "efm32gg-stk3700.h"
#ifdef CONFIG_ARCH_LEDS
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
* with CONFIG_DEBUG_VERBOSE too)
*/
#ifdef CONFIG_DEBUG_LEDS
# define leddbg lldbg
# define ledvdbg llvdbg
#else
# define leddbg(x...)
# define ledvdbg(x...)
#endif
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_led_initialize
****************************************************************************/
void board_led_initialize(void)
{
/* Configure LED PIOs for output */
efm32_configgpio(GPIO_LED0);
efm32_configgpio(GPIO_LED1);
}
/****************************************************************************
* Name: board_led_on
****************************************************************************/
void board_led_on(int led)
{
bool led0on = false; /* High illuminates */
bool led1on = false; /* High illuminates */
switch (led)
{
case 0: /* LED_STARTED, LED_HEAPALLOCATE, LED_IRQSENABLED */
break;
case 1: /* LED_STACKCREATED */
led0on = true;
break;
default:
case 2: /* LED_INIRQ, LED_SIGNAL, LED_ASSERTION */
return;
case 3: /* LED_PANIC */
led1on = true;
break;
}
efm32_gpiowrite(GPIO_LED0, led0on);
efm32_gpiowrite(GPIO_LED1, led1on);
}
/****************************************************************************
* Name: board_led_off
****************************************************************************/
void board_led_off(int led)
{
if (led != 2)
{
efm32_gpiowrite(GPIO_LED0, false); /* High illuminates */
efm32_gpiowrite(GPIO_LED1, false); /* High illuminates */
}
}
#endif /* CONFIG_ARCH_LEDS */
+98
View File
@@ -0,0 +1,98 @@
/*****************************************************************************
* configs/efm32gg-stk3700/src/efm32_boot.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 "efm32_gpio.h"
#include "efm32_start.h"
#include "efm32gg-stk3700.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)
{
#ifdef CONFIG_EFM32_UART0
/* The kit contains a board controller that is responsible for performing
* various board level tasks, such as handling the debugger and the Advanced
* Energy Monitor. An interface is provided between the EFM32 and the board
* controller in the form of a UART connection. The connection is enabled by
* setting the EFM_BC_EN (PF7) line high, and using the lines EFM_BC_TX
* (PE0) and EFM_BC_RX (PE1) for communicating.
*/
efm32_configgpio(GPIO_BC_EN);
#endif
#ifdef CONFIG_ARCH_LEDS
/* Configure on-board LEDs if LED support has been selected. */
board_led_initialize();
#endif
}
/****************************************************************************
* Name: board_initialize
*
* Description:
* If CONFIG_BOARD_INITIALIZE is selected, then an additional
* initialization call will be performed in the boot-up sequence to a
* function called board_initialize(). board_initialize() will be
* called immediately after up_initialize() is called and just before the
* initial application is started. This additional initialization phase
* may be used, for example, to initialize board-specific device drivers.
*
****************************************************************************/
#ifdef CONFIG_BOARD_INITIALIZE
void board_initialize(void)
{
}
#endif
@@ -0,0 +1,153 @@
/****************************************************************************
* configs/efm32gg-stk3700/include/efm32_userleds.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.
*
****************************************************************************/
/* The EFM32 Giant Gecko Start Kit has two yellow LEDs marked LED0 and LED1.
* These LEDs are controlled by GPIO pins on the EFM32. The LEDs are
* connected to pins PE2 and PE3 in an active high configuration:
*
* ------------------------------------- --------------------
* EFM32 PIN BOARD SIGNALS
* ------------------------------------- --------------------
* E2/BCK_VOUT/EBI_A09 #0/ MCU_PE2 UIF_LED0
* TIM3_CC2 #1/U1_TX #3/ACMP0_O #1
* E3/BCK_STAT/EBI_A10 #0/U1_RX #3/ MCU_PE3 UIF_LED1
* ACMP1_O #1
* ------------------------------------- --------------------
*
* All LEDs are grounded and so are illuminated by outputting a high
* value to the LED.
*/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <arch/board/board.h>
#include "efm32_gpio.h"
#include "efm32gg-stk3700.h"
#ifndef CONFIG_ARCH_LEDS
/****************************************************************************
* Definitions
****************************************************************************/
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
* with CONFIG_DEBUG_VERBOSE too)
*/
#ifdef CONFIG_DEBUG_LEDS
# define leddbg lldbg
# define ledvdbg llvdbg
#else
# define leddbg(x...)
# define ledvdbg(x...)
#endif
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: sam_ledinit
****************************************************************************/
void sam_ledinit(void)
{
/* Configure LED PIOs for output */
efm32_configgpio(GPIO_LED0);
efm32_configgpio(GPIO_LED1);
}
/****************************************************************************
* Name: sam_setled
****************************************************************************/
void sam_setled(int led, bool ledon)
{
uint32_t ledcfg;
if (led == BOARD_LED0)
{
ledcfg = GPIO_LED0;
}
else if (led == BOARD_LED1)
{
ledcfg = GPIO_LED1;
}
else
{
return;
}
efm32_gpiowrite(ledcfg, ledon); /* High illuminates */
}
/****************************************************************************
* Name: sam_setleds
****************************************************************************/
void sam_setleds(uint8_t ledset)
{
/* Hight illuminates */
efm32_gpiowrite(GPIO_LED0, (ledset & BOARD_LED0_BIT) != 0);
efm32_gpiowrite(GPIO_LED1, (ledset & BOARD_LED1_BIT) != 0);
}
#endif /* !CONFIG_ARCH_LEDS */
@@ -0,0 +1,100 @@
/****************************************************************************
* configs/efm32gg-stk3700/include/efm32gg-stk3700.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 __CONFIGS_EFM32GG_STK3700_SRC_EFM32GG_STK3700_H
#define __CONFIGS_EFM32GG_STK3700_SRC_EFM32GG_STK3700_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* UART0
*
* The kit contains a board controller that is responsible for performing
* various board level tasks, such as handling the debugger and the Advanced
* Energy Monitor. An interface is provided between the EFM32 and the board
* controller in the form of a UART connection. The connection is enabled by
* setting the EFM_BC_EN (PF7) line high, and using the lines EFM_BC_TX
* (PE0) and EFM_BC_RX (PE1) for communicating.
*/
#ifdef CONFIG_EFM32GG_STK3700_BCEN
# define GPIO_BC_EN (GPIO_OUTPUT_PUSHPULL|GPIO_OUTPUT_SET|\
GPIO_PORTF|GPIO_PIN7)
#else
# define GPIO_BC_EN (GPIO_OUTPUT_PUSHPULL|GPIO_OUTPUT_CLEAR|\
GPIO_PORTF|GPIO_PIN7)
#endif
/* LEDs
*
* The EFM32 Giant Gecko Start Kit has two yellow LEDs marked LED0 and LED1.
* These LEDs are controlled by GPIO pins on the EFM32. The LEDs are
* connected to pins PE2 and PE3 in an active high configuration:
*
* ------------------------------------- --------------------
* EFM32 PIN BOARD SIGNALS
* ------------------------------------- --------------------
* E2/BCK_VOUT/EBI_A09 #0/ MCU_PE2 UIF_LED0
* TIM3_CC2 #1/U1_TX #3/ACMP0_O #1
* E3/BCK_STAT/EBI_A10 #0/U1_RX #3/ MCU_PE3 UIF_LED1
* ACMP1_O #1
* ------------------------------------- --------------------
*
* All LEDs are grounded and so are illuminated by outputting a high
* value to the LED.
*/
#define GPIO_LED0 (GPIO_OUTPUT_WIREDOR_PULLDOWN|\
GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN2)
#define GPIO_LED1 (GPIO_OUTPUT_WIREDOR_PULLDOWN|\
GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN3)
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: board_led_initialize
****************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void board_led_initialize(void);
#endif
#endif /* __CONFIGS_EFM32GG_STK3700_SRC_EFM32GG_STK3700_H */