arch/arm/src/imxrt: Add missing support for the Cortex-M7 caches; configs/imxrt1050-evk: Enable I- and D-Caches in the nsh configuration. Calibrate the delay loop. Add support for the on-board LED.

This commit is contained in:
Gregory Nutt 2018-05-15 10:05:16 -06:00
parent c681519720
commit c82724d462
6 changed files with 152 additions and 47 deletions

View File

@ -49,6 +49,12 @@ config ARCH_FAMILY_MIMXRT1052CVL5A
config ARCH_FAMILY_IMXRT105x
bool
default n
select ARCH_HAVE_FPU
select ARCH_HAVE_DPFPU # REVISIT
select ARMV7M_HAVE_ICACHE
select ARMV7M_HAVE_DCACHE
select ARMV7M_HAVE_ITCM
select ARMV7M_HAVE_DTCM
# Peripheral support

View File

@ -74,6 +74,15 @@ ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += up_checkstack.c
endif
ifeq ($(CONFIG_ARMV7M_DCACHE),y)
CMN_CSRCS += arch_enable_dcache.c arch_disable_dcache.c
CMN_CSRCS += arch_invalidate_dcache.c arch_invalidate_dcache_all.c
ifneq ($(CONFIG_ARMV7M_DCACHE_WRITETHROUGH),y)
CMN_CSRCS += arch_clean_dcache.c arch_clean_dcache_all.c
CMN_CSRCS += arch_flush_dcache.c arch_flush_dcache_all.c
endif
endif
ifeq ($(CONFIG_ARCH_FPU),y)
CMN_ASRCS += up_fpu.S
ifneq ($(CONFIG_ARMV7M_CMNVECTOR),y)

View File

@ -4,8 +4,11 @@ CONFIG_ARCH_BOARD_IMXRT1050_EVK=y
CONFIG_ARCH_CHIP_IMXRT=y
CONFIG_ARCH_CHIP_MIMXRT1052DVL6A=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_DCACHE=y
CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
CONFIG_ARMV7M_ICACHE=y
CONFIG_ARMV7M_USEBASEPRI=y
CONFIG_BOARD_LOOPSPERMSEC=20000
CONFIG_BOARD_LOOPSPERMSEC=104926
CONFIG_EXAMPLES_NSH=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
@ -16,6 +19,7 @@ CONFIG_MAX_TASKS=16
CONFIG_MAX_WDOGPARMS=2
CONFIG_NFILE_DESCRIPTORS=8
CONFIG_NFILE_STREAMS=8
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* configs/imxrt1050-evk/src/imxrt1050-evk.h
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __CONFIGS_IMXRT1050_EVK_SRC_IMXRT1050_EVK_H
#define __CONFIGS_IMXRT1050_EVK_SRC_IMXRT1050_EVK_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -50,29 +50,36 @@
#include "imxrt_gpio.h"
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* Configuration ********************************************************************/
****************************************************************************/
/* i.MX RT 1050 GPIO Pin Definitions ************************************************/
/* Configuration ************************************************************/
/* i.MX RT 1050 GPIO Pin Definitions ****************************************/
/* LEDs
*
* There is only 1 user LED available on the IMXRT board that
* can be turned on and off. The LEDs can be activated by driving the
* connected I/O line to GND..
* There are four LED status indicators located on the EVK Board. The
* functions of these LEDs include:
*
* ---------- ----------- ---------------------
* IMXRT Function Shared functionality
* GPIO
* ---------- ----------- ---------------------
* GPIO1 PIN9 USER LED
* ---------- ----------- ---------------------
* - Main Power Supply(D3)
* Green: DC 5V main supply is normal.
* Red: J2 input voltage is over 5.6V.
* Off: The board is not powered.
* - Reset RED LED(D15)
* - OpenSDA LED(D16)
* - USER LED(D18)
*
* Only a single LED, D18, is under software control. It connects to
* GPIO_AD_B0_09 which is shared with JTAG_TDI and ENET_RST. This pin
* must be configured as ALT5, GPIO1_IO09
*/
#define GPIO_LED0 (GPIO_OUTPUT | GPIO_OUTPUT_ZERO | \
GPIO_PORT1 | GPIO_PIN9)
#define IOMUX_LED (IOMUX_PULL_NONE | IOMUX_CMOS_OUTPUT | IOMUX_DRIVE_40OHM | \
IOMUX_SPEED_MEDIUM | IOMUX_SLEW_SLOW)
#define GPIO_LED (GPIO_OUTPUT | GPIO_OUTPUT_ZERO | GPIO_PORT1 | GPIO_PIN9 | \
IOMUX_LED)
/* Buttons
*
@ -85,27 +92,27 @@
#define GPIO_SW8 (GPIO_INTERRUPT | GPIO_INT_FALLINGEDGE | \
GPIO_PORT5 | GPIO_PIN0)
/************************************************************************************
/****************************************************************************
* Public Types
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Public data
************************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: imxrt_bringup
*
* Description:
* Bring up board features
*
************************************************************************************/
****************************************************************************/
#if defined(CONFIG_LIB_BOARDCTL) || defined(CONFIG_BOARD_INITIALIZE)
int imxrt_bringup(void);
@ -129,13 +136,13 @@ int imxrt_bringup(void);
void imxrt_autoled_initialize(void);
#endif
/************************************************************************************
/****************************************************************************
* Name: imxrt_spidev_initialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the SAMV71-XULT board.
*
************************************************************************************/
****************************************************************************/
#ifdef CONFIG_IMXRT_HAVE_SPI
void imxrt_spidev_initialize(void);

View File

@ -33,6 +33,43 @@
*
****************************************************************************/
/* There are four LED status indicators located on the EVK Board. The
* functions of these LEDs include:
*
* - Main Power Supply(D3)
* Green: DC 5V main supply is normal.
* Red: J2 input voltage is over 5.6V.
* Off: The board is not powered.
* - Reset RED LED(D15)
* - OpenSDA LED(D16)
* - USER LED(D18)
*
* Only a single LED, D18, is under software control.
*
* This LED is 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/sam_autoleds.c. The LED is used to encode
* OS-related events as follows:
*
* -------------------- ----------------------- ------
* SYMBOL Meaning LED
* -------------------- ----------------------- ------
*
* LED_STARTED 0 NuttX has been started OFF
* LED_HEAPALLOCATE 0 Heap has been allocated OFF
* LED_IRQSENABLED 0 Interrupts enabled OFF
* LED_STACKCREATED 1 Idle stack created ON
* LED_INIRQ 2 In an interrupt N/C
* LED_SIGNAL 2 In a signal handler N/C
* LED_ASSERTION 2 An assertion failed N/C
* LED_PANIC 3 The system has crashed FLASH
* LED_IDLE Not used
*
* Thus if the LED is statically on, NuttX has successfully booted and is,
* apparently, running normally. If the LED is flashing at approximately
* 2Hz, then a fatal error has been detected and the system has halted.
*/
/****************************************************************************
* Included Files
****************************************************************************/
@ -40,10 +77,13 @@
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "imxrt_gpio.h"
#include "imxrt_iomuxc.h"
#include "imxrt1050-evk.h"
#include <arch/board/board.h>
#ifdef CONFIG_ARCH_LEDS
/****************************************************************************
@ -66,8 +106,9 @@
void imxrt_autoled_initialize(void)
{
/* Configure LED GPIOs for output */
#warning Missing logic
/* Configure LED GPIO for output */
imxrt_config_gpio(GPIO_LED);
}
/****************************************************************************
@ -87,7 +128,23 @@ void imxrt_autoled_initialize(void)
void board_autoled_on(int led)
{
#warning Missing logic
bool ledoff = false;
switch (led)
{
case 0: /* LED Off */
ledoff = true;
break;
case 2: /* LED No change */
return;
case 1: /* LED On */
case 3: /* LED On */
break;
}
imxrt_gpio_write(GPIO_LED, ledoff); /* Low illuminates */
}
/****************************************************************************
@ -107,7 +164,18 @@ void board_autoled_on(int led)
void board_autoled_off(int led)
{
#warning Missing logic
switch (led)
{
case 0: /* LED Off */
case 1: /* LED Off */
case 3: /* LED Off */
break;
case 2: /* LED No change */
return;
}
imxrt_gpio_write(GPIO_LED, true); /* Low illuminates */
}
#endif /* CONFIG_ARCH_LEDS */

View File

@ -33,24 +33,33 @@
*
****************************************************************************/
/* There are four LED status indicators located on the EVK Board. The
* functions of these LEDs include:
*
* - Main Power Supply(D3)
* Green: DC 5V main supply is normal.
* Red: J2 input voltage is over 5.6V.
* Off: The board is not powered.
* - Reset RED LED(D15)
* - OpenSDA LED(D16)
* - USER LED(D18)
*
* Only a single LED, D18, is under software control.
*/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <arch/board/board.h>
#include "imxrt_gpio.h"
#include "imxrt_iomuxc.h"
#include "imxrt1050-evk.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#include <arch/board/board.h>
/****************************************************************************
* Private Functions
****************************************************************************/
#ifndef CONFIG_ARCH_LEDS
/****************************************************************************
* Public Functions
@ -62,9 +71,9 @@
void board_userled_initialize(void)
{
/* Configure LED GPIOs for output */
/* Configure LED GPIO for output */
imxrt_config_gpio(GPIO_LED0);
imxrt_config_gpio(GPIO_LED);
}
/****************************************************************************
@ -73,7 +82,7 @@ void board_userled_initialize(void)
void board_userled(int led, bool ledon)
{
imxrt_gpio_write(GPIO_LED0, !ledon); /* Low illuminates */
imxrt_gpio_write(GPIO_LED, !ledon); /* Low illuminates */
}
/****************************************************************************
@ -84,5 +93,7 @@ void board_userled_all(uint8_t ledset)
{
/* Low illuminates */
imxrt_gpio_write(GPIO_LED0, (ledset & BOARD_USERLED_BIT) == 0);
imxrt_gpio_write(GPIO_LED, (ledset & BOARD_USERLED_BIT) == 0);
}
#endif /* !CONFIG_ARCH_LEDS */