diff --git a/configs/efm32-g8xx-stk/README.txt b/configs/efm32-g8xx-stk/README.txt index 46fa9400ddf..ed375c1c5f8 100644 --- a/configs/efm32-g8xx-stk/README.txt +++ b/configs/efm32-g8xx-stk/README.txt @@ -14,3 +14,73 @@ README • Reset button and a switch to disconnect the battery. • On-board SEGGER J-Link USB emulator • ARM 20 pin JTAG/SWD standard Debug in/out connector + +LEDs +==== + + The EFM32 Gecko Start Kithas four yellow LEDs. 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 LED1* LED2 LED3 LED4 + ----------------- ----------------------- ------ ----- ----- ------ + LED_STARTED NuttX has been started ON OFF OFF OFF + LED_HEAPALLOCATE Heap has been allocated OFF ON OFF OFF + LED_IRQSENABLED Interrupts enabled ON ON OFF OFF + LED_STACKCREATED Idle stack created OFF OFF ON OFF + LED_INIRQ In an interrupt** ON N/C N/C OFF + LED_SIGNAL In a signal handler*** N/C ON N/C OFF + LED_ASSERTION An assertion failed ON ON N/C OFF + LED_PANIC The system has crashed N/C N/C N/C ON + LED_IDLE STM32 is is sleep mode (Optional, not used) + + * If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot + and these LEDs will give you some indication of where the failure was + ** The normal state is LED3 ON and LED1 faintly glowing. This faint glow + is because of timer interrupt that result in the LED being illuminated + on a small proportion of the time. +*** LED2 may also flicker normally if signals are processed. + +Configurations +============== + Each EFM32 Gecko Starter Kit configuration is maintained in a sub-director + and can be selected as follow: + + cd tools + ./configure.sh efm32-g8xx-stk/ + cd - + . ./setenv.sh + + If this is a Windows native build, then configure.bat should be used + instead of configure.sh: + + configure.bat STM32F4Discovery\ + + Where is one of the following: + + nsh: + --- + Configures the NuttShell (nsh) located at apps/examples/nsh. The + Configuration enables the serial interfaces on USARTx. Support for + builtin applications is enabled, but in the base configuration no + builtin applications are selected (see NOTES below). + + NOTES: + + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. By default, this configuration uses the CodeSourcery toolchain + for Windows and builds under Cygwin (or probably MSYS). That + can easily be reconfigured, of course. + + CONFIG_HOST_WINDOWS=y : Builds under Windows + CONFIG_WINDOWS_CYGWIN=y : Using Cygwin + CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows diff --git a/configs/efm32-g8xx-stk/include/board.h b/configs/efm32-g8xx-stk/include/board.h index ddc32d0707b..eb2bb574f28 100644 --- a/configs/efm32-g8xx-stk/include/board.h +++ b/configs/efm32-g8xx-stk/include/board.h @@ -40,8 +40,72 @@ * Included Files ****************************************************************************/ +#include + +#include + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ +/* The EFM32 Gecko Starter Kit supports 4 yellow LEDs. One side is grounded + * so these LEDs are illuminated by outputting a high value. + * + * If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in + * any way. The following definitions are used to access individual LEDs. + */ + +/* LED index values for use with efm32_setled() */ + +#define BOARD_LED1 0 +#define BOARD_LED2 1 +#define BOARD_LED3 2 +#define BOARD_LED4 3 +#define BOARD_NLEDS 4 + +#define BOARD_LED_GREEN BOARD_LED1 +#define BOARD_LED_ORANGE BOARD_LED2 +#define BOARD_LED_RED BOARD_LED3 +#define BOARD_LED_BLUE BOARD_LED4 + +/* LED bits for use with efm32_setleds() */ + +#define BOARD_LED1_BIT (1 << BOARD_LED1) +#define BOARD_LED2_BIT (1 << BOARD_LED2) +#define BOARD_LED3_BIT (1 << BOARD_LED3) +#define BOARD_LED4_BIT (1 << BOARD_LED4) + +/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 4 LEDs on + * board the EFM32 Gecko Starter Kit. The following definitions describe + * how NuttX controls the LEDs in this configuration: + */ + +#define LED_STARTED 0 /* LED1 */ +#define LED_HEAPALLOCATE 1 /* LED2 */ +#define LED_IRQSENABLED 2 /* LED1 + LED2 */ +#define LED_STACKCREATED 3 /* LED3 */ +#define LED_INIRQ 4 /* LED1 + LED3 */ +#define LED_SIGNAL 5 /* LED2 + LED3 */ +#define LED_ASSERTION 6 /* LED1 + LED2 + LED3 */ +#define LED_PANIC 7 /* N/C + N/C + N/C + LED4 */ + /**************************************************************************** * 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_EFM32_DK3650_INCLUDE_BOARD_H */ diff --git a/configs/efm32-g8xx-stk/src/efm32_boot.c b/configs/efm32-g8xx-stk/src/efm32_boot.c index ebe9ad0df1c..b288be27b8d 100644 --- a/configs/efm32-g8xx-stk/src/efm32_boot.c +++ b/configs/efm32-g8xx-stk/src/efm32_boot.c @@ -1,8 +1,8 @@ /***************************************************************************** - * configs/efm32-dk3650/src/efm32_boot.c + * configs/efm32-g8xx-stk/src/efm32_boot.c * - * Copyright (C) 2014 Richard Cochran. All rights reserved. - * Author: Richard Cochran + * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -39,21 +39,23 @@ #include +#include "efm32_start.h" + #include "efm32-g8xx-stk.h" /**************************************************************************** * Public Functions ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: efm32_boardinitialize * * Description: - * All STM32 architectures must provide the following entry point. This entry point - * is called early in the initialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * 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) {