More LPC1788 changes from Rommel Marcelo + a few kernel build fixes

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5715 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2013-03-07 01:52:30 +00:00
parent 235172b54e
commit dfed728304
5 changed files with 82 additions and 77 deletions

View File

@ -142,34 +142,28 @@
#define ETH_MCFG_CLKSEL_DIV ETH_MCFG_CLKSEL_DIV20
/* SDIO dividers. Note that slower clocking is required when DMA is disabled
/* SDIO dividers. Note that slower clocking is required when DMA is disabled
* in order to avoid RX overrun/TX underrun errors due to delayed responses
* to service FIFOs in interrupt driven mode. These values have not been
* tuned!!!
*
* SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(118+2)=400 KHz
* to service FIFOs in interrupt driven mode.
* SDCARD_CLOCK=PCLK/(2*(SDCARD_CLKDIV+1))
*/
#define SDCARD_INIT_CLKDIV (118 << SDCARD_CLOCK_CLKDIV_SHIFT)
/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
* DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
*/
#define SDCARD_SLOW_CLKDIV 74 /* 400Khz */
#define SDCARD_INIT_CLKDIV (BOARD_PCLK_FREQUENCY/(2*(SDCARD_SLOW_CLKDIV+1)))
#define SDCARD_NORMAL_CLKDIV 1 /* DMA ON: SDCARD_CLOCK=15MHz */
#define SDCARD_SLOW_CLKDIV 2 /* DMA OFF: SDCARD_CLOCK=10MHz */
#ifdef CONFIG_SDIO_DMA
# define SDCARD_MMCXFR_CLKDIV (1 << SDCARD_CLOCK_CLKDIV_SHIFT)
# define SDCARD_MMCXFR_CLKDIV (BOARD_PCLK_FREQUENCY/(2*(SDCARD_NORMAL_CLKDIV+1)))
#else
# define SDCARD_MMCXFR_CLKDIV (2 << SDCARD_CLOCK_CLKDIV_SHIFT)
# define SDCARD_MMCXFR_CLKDIV (BOARD_PCLK_FREQUENCY/(2*(SDCARD_SLOW_CLKDIV+1)))
#endif
/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
* DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
*/
#ifdef CONFIG_SDIO_DMA
# define SDCARD_SDXFR_CLKDIV (1 << SDCARD_CLOCK_CLKDIV_SHIFT)
# define SDCARD_SDXFR_CLKDIV (BOARD_PCLK_FREQUENCY/(2*(SDCARD_NORMAL_CLKDIV+1)))
#else
# define SDCARD_SDXFR_CLKDIV (2 << SDCARD_CLOCK_CLKDIV_SHIFT)
# define SDCARD_SDXFR_CLKDIV (BOARD_PCLK_FREQUENCY/(2*(SDCARD_SLOW_CLKDIV+1)))
#endif
/* Set EMC delay values:
@ -288,15 +282,31 @@
/* Alternate pin selections *********************************************************/
/* UART0:
*
* TX --- Connected to P0[2]
* RX --- Connected to P0[3]
*/
#define GPIO_UART0_TXD GPIO_UART0_TXD_2
#define GPIO_UART0_RXD GPIO_UART0_RXD_2
#define GPIO_SD_DAT0 GPIO_SD_DAT0_1 /* REVISIT */
#define GPIO_SD_DAT1 GPIO_SD_DAT1_1
#define GPIO_SD_DAT2 GPIO_SD_DAT2_1
#define GPIO_SD_DAT3 GPIO_SD_DAT3_1
#define GPIO_SD_CLK GPIO_SD_CLK_1
#define GPIO_SD_CMD GPIO_SD_CMD_1
/* MCI-SDIO:
*
* D0 --- Connected to P1[6]
* D1 --- Connected to P2[11]
* D2 --- Connected to P2[12]
* D3 --- Connected to P2[13]
* CLK--- Connected to P1[2]
* CMD--- Connected to P1[3]
*/
#define GPIO_SD_DAT0 GPIO_SD_DAT0_2
#define GPIO_SD_DAT1 GPIO_SD_DAT1_2
#define GPIO_SD_DAT2 GPIO_SD_DAT2_2
#define GPIO_SD_DAT3 GPIO_SD_DAT3_2
#define GPIO_SD_CLK GPIO_SD_CLK_2
#define GPIO_SD_CMD GPIO_SD_CMD_2
/************************************************************************************
* Public Types

View File

@ -202,11 +202,6 @@ static int nsh_sdinitialize(void)
FAR struct sdio_dev_s *sdio;
int ret;
/* Enable power to the SD/MMC via a GPIO. LOW enables SD/MMC. */
lpc17_gpiowrite(OPEN1788_MMC_PWR, false);
#warning "This is wrong"
/* First, get an instance of the SDIO interface */
sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
@ -225,7 +220,7 @@ static int nsh_sdinitialize(void)
message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret);
return ret;
}
/* Then let's guess and say that there is a card in the slot. I need to check to
* see if the STM3240G-EVAL board supports a GPIO to detect if there is a card in
* the slot.

View File

@ -89,7 +89,7 @@
****************************************************************************/
/* This array maps an LED number to GPIO pin configuration */
static uint32_t g_ledcfg[BOARD_NLEDS] =
static uint32_t g_ledcfg[BOARD_NLEDS] =
{
GPIO_LED1, GPIO_LED2, GPIO_LED3, GPIO_LED4
};

View File

@ -39,28 +39,33 @@
BOARD_INCLUDE = $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)include
# The entry point name (if none is provided in the .config file)
CONFIG_USER_ENTRYPOINT ?= user_start
ENTRYPT = $(patsubst "%",%,$(CONFIG_USER_ENTRYPOINT))
# Get the paths to the libraries and the links script path in format that
# is appropriate for the host OS
ifeq ($(WINTOOL),y)
# Windows-native toolchains
USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)$(DELIM)$$path`;echo "-L\"`cygpath -w $$dir`\"";done}
USER_LDSCRIPT = -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)kernel$(DELIM)kernel.ld}"
USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)$(DELIM)$$path`;echo "-L\"`cygpath -w $$dir`\"";done}
USER_LDSCRIPT = -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)kernel$(DELIM)kernel.ld}"
else
# Linux/Cygwin-native toolchain
USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS)))
USER_LDSCRIPT = -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)kernel$(DELIM)kernel.ld
USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS)))
USER_LDSCRIPT = -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)kernel$(DELIM)kernel.ld
endif
USER_LDFLAGS = $(USER_LDSCRIPT)
USER_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(USERLIBS))))
USER_LIBGCC = "${shell $(CC) -print-libgcc-file-name}"
USER_LDFLAGS = --undefined=$(ENTRYPT) --entry=$(ENTRYPT) $(USER_LDSCRIPT)
USER_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(USERLIBS))))
USER_LIBGCC = "${shell $(CC) -print-libgcc-file-name}"
# Targets:
all: $(TOPDIR)$(DELIM)nuttx_user.elf $(TOPDIR)$(DELIM)User.map $(BOARD_INCLUDE)$(DELIM)user_map.h
.PHONY: depend clean distclean
.PHONY: depend clean distclean
# Create the nuttx_user.elf file containing all of the user-mode code
@ -90,38 +95,38 @@ $(TOPDIR)$(DELIM)User.map: nuttx_user.elf
$(BOARD_INCLUDE)$(DELIM)user_map.h: $(TOPDIR)$(DELIM)User.map
@echo "MK: user_map.h"
@echo "/* configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)include$(DELIM)user_map.h" > $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo " *" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo " * This is an auto-generated file.. Do not edit this file!" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo " */" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#ifndef __ARCH_BOARD_USER_MAP_H" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define __ARCH_BOARD_USER_MAP_H" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "/* General memory map */" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_ENTRYPOINT 0x`grep \" user_start$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_TEXTSTART 0x`grep \" _stext\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_TEXTEND 0x`grep \" _etext$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_DATASOURCE 0x`grep \" _eronly$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_DATADESTSTART 0x`grep \" _sdata$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_DATADESTEND 0x`grep \" _edata$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_BSSSTART 0x`grep \" _sbss\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_BSSEND 0x`grep \" _ebss$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "/* Memory manager entry points */" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_MMINIT 0x`grep \" mm_initialize$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_MMADDREGION 0x`grep \" mm_addregion$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_MMTRYSEM 0x`grep \" mm_trysemaphore$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_MMGIVESEM 0x`grep \" mm_givesemaphore$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_MALLOC 0x`grep \" malloc$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_REALLOC 0x`grep \" realloc$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_ZALLOC 0x`grep \" zalloc$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#define CONFIG_USER_FREE 0x`grep \" free$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
@echo "#endif /* __ARCH_BOARD_USER_MAP_H */" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "/* configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)include$(DELIM)user_map.h" > $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo " *" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo " * This is an auto-generated file.. Do not edit this file!" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo " */" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#ifndef __ARCH_BOARD_USER_MAP_H" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define __ARCH_BOARD_USER_MAP_H" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "/* General memory map */" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_ENTRYPOINT 0x`grep \" $(ENTRYPT)\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_TEXTSTART 0x`grep \" _stext\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_TEXTEND 0x`grep \" _etext$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_DATASOURCE 0x`grep \" _eronly$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_DATADESTSTART 0x`grep \" _sdata$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_DATADESTEND 0x`grep \" _edata$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_BSSSTART 0x`grep \" _sbss\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_BSSEND 0x`grep \" _ebss$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "/* Memory manager entry points */" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_MMINIT 0x`grep \" mm_initialize$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_MMADDREGION 0x`grep \" mm_addregion$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_MMTRYSEM 0x`grep \" mm_trysemaphore$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_MMGIVESEM 0x`grep \" mm_givesemaphore$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_MALLOC 0x`grep \" malloc$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_REALLOC 0x`grep \" realloc$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_ZALLOC 0x`grep \" zalloc$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#define CONFIG_USER_FREE 0x`grep \" free$\" $(TOPDIR)$(DELIM)User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
$(Q) echo "#endif /* __ARCH_BOARD_USER_MAP_H */" >> $(BOARD_INCLUDE)$(DELIM)user_map.h
.depend:

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/sam3u-ek/kernal/kernel.ld
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -62,10 +62,6 @@ MEMORY
sram2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16K
}
/* Force user_start into the link. This is the application entry point */
EXTERN(user_start)
/* Make sure that the critical memory management functions are in user-space.
* Currently, the plan is that the memory manager will reside in user-space
* but be usable both by kernel- and user-space code
@ -82,7 +78,6 @@ EXTERN(zalloc)
EXTERN(free)
OUTPUT_ARCH(arm)
ENTRY(user_start)
SECTIONS
{