diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-07 01:52:30 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-07 01:52:30 +0000 |
commit | ce376ed9e145fe7b9c0215e93bfebf0893ecf7b3 (patch) | |
tree | 425cec7640f89663994f2a3646ca35e54db91df6 | |
parent | 5332fb0e659549272ed5527c26964b22d31da3bc (diff) | |
download | px4-nuttx-ce376ed9e145fe7b9c0215e93bfebf0893ecf7b3.tar.gz px4-nuttx-ce376ed9e145fe7b9c0215e93bfebf0893ecf7b3.tar.bz2 px4-nuttx-ce376ed9e145fe7b9c0215e93bfebf0893ecf7b3.zip |
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
-rw-r--r-- | apps/nshlib/nsh.h | 9 | ||||
-rw-r--r-- | apps/nshlib/nsh_mntcmds.c | 8 | ||||
-rw-r--r-- | apps/nshlib/nsh_parse.c | 4 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv6-m/up_svcall.c | 5 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv7-m/up_svcall.c | 5 | ||||
-rw-r--r-- | nuttx/arch/arm/src/lpc17xx/chip/lpc17_sdcard.h | 104 | ||||
-rw-r--r-- | nuttx/arch/arm/src/lpc17xx/lpc17_sdcard.c | 73 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c | 16 | ||||
-rw-r--r-- | nuttx/configs/open1788/include/board.h | 58 | ||||
-rw-r--r-- | nuttx/configs/open1788/src/lpc17_nsh.c | 7 | ||||
-rw-r--r-- | nuttx/configs/open1788/src/lpc17_userleds.c | 2 | ||||
-rw-r--r-- | nuttx/configs/sam3u-ek/kernel/Makefile | 85 | ||||
-rw-r--r-- | nuttx/configs/sam3u-ek/kernel/kernel.ld | 7 | ||||
-rw-r--r-- | nuttx/syscall/syscall_funclookup.c | 3 | ||||
-rw-r--r-- | nuttx/syscall/syscall_lookup.h | 2 | ||||
-rw-r--r-- | nuttx/syscall/syscall_stublookup.c | 2 |
16 files changed, 221 insertions, 169 deletions
diff --git a/apps/nshlib/nsh.h b/apps/nshlib/nsh.h index 23209dba5..3afbce8f9 100644 --- a/apps/nshlib/nsh.h +++ b/apps/nshlib/nsh.h @@ -403,6 +403,15 @@ # define IOBUFFERSIZE (PATH_MAX + 1) #endif +/* Certain commands are not availalbe in a kernel build because they depend + * on interfaces that are not exported by the kernel. + */ + +#ifdef CONFIG_NUTTX_KERNEL +# undef CONFIG_NSH_DISABLE_DF +# define CONFIG_NSH_DISABLE_DF 1 +#endif + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/apps/nshlib/nsh_mntcmds.c b/apps/nshlib/nsh_mntcmds.c index f8e3a142a..8e62229fa 100644 --- a/apps/nshlib/nsh_mntcmds.c +++ b/apps/nshlib/nsh_mntcmds.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/nshlib/nsh_mntcmds.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -107,6 +107,7 @@ static int df_handler(FAR const char *mountpoint, #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \ defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT) +#ifndef CONFIG_NUTTX_KERNEL static int mount_handler(FAR const char *mountpoint, FAR struct statfs *statbuf, FAR void *arg) { @@ -158,6 +159,7 @@ static int mount_handler(FAR const char *mountpoint, return OK; } #endif +#endif /**************************************************************************** * Name: mount_show @@ -165,11 +167,13 @@ static int mount_handler(FAR const char *mountpoint, #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \ defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT) +#ifndef CONFIG_NUTTX_KERNEL static inline int mount_show(FAR struct nsh_vtbl_s *vtbl, FAR const char *progname) { return foreach_mountpoint(mount_handler, (FAR void *)vtbl); } #endif +#endif /**************************************************************************** * Public Functions @@ -209,10 +213,12 @@ int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) /* The mount command behaves differently if no parameters are provided */ +#ifndef CONFIG_NUTTX_KERNEL if (argc < 2) { return mount_show(vtbl, argv[0]); } +#endif /* Get the mount options. NOTE: getopt() is not thread safe nor re-entrant. * To keep its state proper for the next usage, it is necessary to parse to diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index 4ee86b4cc..d5ffd81ee 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -302,7 +302,11 @@ static const struct cmdmap_s g_cmdmap[] = #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) # ifndef CONFIG_NSH_DISABLE_MOUNT +# ifdef CONFIG_NUTTX_KERNEL + { "mount", cmd_mount, 5, 5, "-t <fstype> [<block-device>] <mount-point>" }, +# else { "mount", cmd_mount, 1, 5, "[-t <fstype> [<block-device>] <mount-point>]" }, +# endif # endif #endif diff --git a/nuttx/arch/arm/src/armv6-m/up_svcall.c b/nuttx/arch/arm/src/armv6-m/up_svcall.c index aac16d489..9ce756213 100644 --- a/nuttx/arch/arm/src/armv6-m/up_svcall.c +++ b/nuttx/arch/arm/src/armv6-m/up_svcall.c @@ -119,7 +119,6 @@ static void dispatch_syscall(void) " mov r2, r0\n" /* R2=Saves return value in R0 */ " mov r0, #3\n" /* R0=SYS_syscall_return */ " svc 0" /* Return from the syscall */ - ::: ); } #endif @@ -261,7 +260,7 @@ int up_svcall(int irq, FAR void *context) current_regs[REG_PC] = rtcb->xcp.sysreturn; current_regs[REG_EXC_RETURN] = EXC_RETURN_UNPRIVTHR; - rtcb->sysreturn = NULL; + rtcb->xcp.sysreturn = NULL; /* The return value must be in R0-R1. dispatch_syscall() temporarily * moved the value to R2. @@ -295,7 +294,7 @@ int up_svcall(int irq, FAR void *context) /* Setup to return to dispatch_syscall in privileged mode. */ - rtcb->sysreturn = regs[REG_PC] + rtcb->xcp.sysreturn = regs[REG_PC]; regs[REG_PC] = (uint32_t)dispatch_syscall; current_regs[REG_EXC_RETURN] = EXC_RETURN_PRIVTHR; diff --git a/nuttx/arch/arm/src/armv7-m/up_svcall.c b/nuttx/arch/arm/src/armv7-m/up_svcall.c index 078f85606..4da466934 100644 --- a/nuttx/arch/arm/src/armv7-m/up_svcall.c +++ b/nuttx/arch/arm/src/armv7-m/up_svcall.c @@ -118,7 +118,6 @@ static void dispatch_syscall(void) " mov r2, r0\n" /* R2=Saved return value in R0 */ " mov r0, #3\n" /* R0=SYS_syscall_return */ " svc 0" /* Return from the syscall */ - ::: ); } #endif @@ -260,7 +259,7 @@ int up_svcall(int irq, FAR void *context) current_regs[REG_PC] = rtcb->xcp.sysreturn; current_regs[REG_EXC_RETURN] = EXC_RETURN_UNPRIVTHR; - rtcb->sysreturn = NULL; + rtcb->xcp.sysreturn = NULL; /* The return value must be in R0-R1. dispatch_syscall() temporarily * moved the value to R2. @@ -294,7 +293,7 @@ int up_svcall(int irq, FAR void *context) /* Setup to return to dispatch_syscall in privileged mode. */ - rtcb->sysreturn = regs[REG_PC] + rtcb->xcp.sysreturn = regs[REG_PC]; regs[REG_PC] = (uint32_t)dispatch_syscall; current_regs[REG_EXC_RETURN] = EXC_RETURN_PRIVTHR; diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_sdcard.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_sdcard.h index c962e4f8d..eecabc346 100644 --- a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_sdcard.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_sdcard.h @@ -86,62 +86,83 @@ /* Register Bitfield Definitions ****************************************************/ +/* MCI Power Control Registers - PWR - 0x400c 0000*/ + #define SDCARD_PWR_CTRL_SHIFT (0) /* Bits 0-1: Power supply control bits */ #define SDCARD_PWR_CTRL_MASK (3 << SDCARD_PWR_CTRL_SHIFT) # define SDCARD_PWR_CTRL_OFF (0 << SDCARD_PWR_CTRL_SHIFT) /* 00: Power-off: card clock stopped */ # define SDCARD_PWR_CTRL_PWRUP (2 << SDCARD_PWR_CTRL_SHIFT) /* 10: Reserved power-up */ # define SDCARD_PWR_CTRL_ON (3 << SDCARD_PWR_CTRL_SHIFT) /* 11: Power-on: card is clocked */ - + /* Bits 2-5 Reserved */ +#define SDCARD_PWR_OPENDRAIN (1 << 6) /* SD_CMD Output Control */ +#define SDCARD_PWR_ROD (1 << 7) /* Rod Control */ + /* Bits 8-31: Reserved */ #define SDCARD_PWR_RESET (0) /* Reset value */ +/* MCI Clock Control Register - CLOCK - 0x400c 0004 */ + #define SDCARD_CLOCK_CLKDIV_SHIFT (0) /* Bits 7-0: Clock divide factor */ #define SDCARD_CLOCK_CLKDIV_MASK (0xff << SDCARD_CLOCK_CLKDIV_SHIFT) #define SDCARD_CLOCK_CLKEN (1 << 8) /* Bit 8: Clock enable bit */ #define SDCARD_CLOCK_PWRSAV (1 << 9) /* Bit 9: Power saving configuration bit */ #define SDCARD_CLOCK_BYPASS (1 << 10) /* Bit 10: Clock divider bypass enable bit */ -#define SDCARD_CLOCK_WIDBUS_SHIFT (11) /* Bits 12-11: Wide bus mode enable bits */ -#define SDCARD_CLOCK_WIDBUS_MASK (3 << SDCARD_CLOCK_WIDBUS_SHIFT) -# define SDCARD_CLOCK_WIDBUS_D1 (0 << SDCARD_CLOCK_WIDBUS_SHIFT) /* 00: Default (SDIO_D0) */ -# define SDCARD_CLOCK_WIDBUS_D4 (1 << SDCARD_CLOCK_WIDBUS_SHIFT) /* 01: 4-wide (SDIO_D[3:0]) */ -# define SDCARD_CLOCK_WIDBUS_D8 (2 << SDCARD_CLOCK_WIDBUS_SHIFT) /* 10: 8-wide (SDIO_D[7:0]) */ -#define SDCARD_CLOCK_NEGEDGE (1 << 13) /* Bit 13: SDIO_CK dephasing selection bit */ -#define SDCARD_CLOCK_HWFC_EN (1 << 14) /* Bit 14: HW Flow Control enable */ +#define SDCARD_CLOCK_WIDBUS (1 << 11) /* Bit 11: Wide bus mode enable bit */ +# define SDCARD_CLOCK_WIDBUS_D1 (0) /* 0: Default (SDIO_D0) */ +# define SDCARD_CLOCK_WIDBUS_D4 (SDCARD_CLOCK_WIDBUS) /* 1: 4-wide (SDIO_D[3:0]) */ + /* Bits 12-31: Reserved */ #define SDCARD_CLOCK_RESET (0) /* Reset value */ + +/* MCI Argument Register - ARGUMENT - 0x400c 0008 has no bitfields */ + #define SDCARD_ARG_RESET (0) /* Reset value */ -#define SDCARD_CMD_INDEX_SHIFT (0) +/* MCI Command Register - COMMAND - 0x400c 000c */ + +#define SDCARD_CMD_INDEX_SHIFT (0) /* Bits 0-5: Command Index */ #define SDCARD_CMD_INDEX_MASK (0x3f << SDCARD_CMD_INDEX_SHIFT) #define SDCARD_CMD_WAITRESP_SHIFT (6) /* Bits 7-6: Wait for response bits */ #define SDCARD_CMD_WAITRESP_MASK (3 << SDCARD_CMD_WAITRESP_SHIFT) -# define SDCARD_CMD_NORESPONSE (0 << SDCARD_CMD_WAITRESP_SHIFT) /* 00/10: No response */ -# define SDCARD_CMD_SHORTRESPONSE (1 << SDCARD_CMD_WAITRESP_SHIFT) /* 01: Short response */ +# define SDCARD_CMD_NORESPONSE (0 << SDCARD_CMD_WAITRESP_SHIFT) /* 00/01: No response */ +# define SDCARD_CMD_SHORTRESPONSE (1 << SDCARD_CMD_WAITRESP_SHIFT) /* 10: Short response */ # define SDCARD_CMD_LONGRESPONSE (3 << SDCARD_CMD_WAITRESP_SHIFT) /* 11: Long response */ #define SDCARD_CMD_WAITINT (1 << 8) /* Bit 8: CPSM waits for interrupt request */ #define SDCARD_CMD_WAITPEND (1 << 9) /* Bit 9: CPSM Waits for ends of data transfer */ #define SDCARD_CMD_CPSMEN (1 << 10) /* Bit 10: Command path state machine enable */ -#define SDCARD_CMD_SUSPEND (1 << 11) /* Bit 11: SD I/O suspend command */ -#define SDCARD_CMD_ENDCMD (1 << 12) /* Bit 12: Enable CMD completion */ -#define SDCARD_CMD_NIEN (1 << 13) /* Bit 13: not Interrupt Enable */ -#define SDCARD_CMD_ATACMD (1 << 14) /* Bit 14: CE-ATA command */ + /* Bits 11-31: Reserved */ #define SDCARD_CMD_RESET (0) /* Reset value */ -#define SDCARD_RESPCMD_SHIFT (0) +/* MCI Command Response Register - RESPCOMMAND - 0x400c 0010 */ + +#define SDCARD_RESPCMD_SHIFT (0) /* Bits 0-5: Resopnse Command index */ #define SDCARD_RESPCMD_MASK (0x3f << SDCARD_RESPCMD_SHIFT) + /* Bits 6-31: Reserved */ + +/* MCI Response Registers RESPONSE0-3 - 0x400c 0014, 0x400c 0018, + No bitfields 0x400c 001c, 0x400c 0020 */ + + +/* MCI - Data Timer Register DATATIMER - 0x400c 0024 */ +/* No bitfields */ #define SDCARD_DTIMER_RESET (0) /* Reset value */ -#define SDCARD_DLEN_SHIFT (0) -#define SDCARD_DLEN_MASK (0x01ffffff << SDCARD_DLEN_SHIFT) +/* MCI - Data Length Register DATALENGTH - 0x400C 0028 */ + +#define SDCARD_DATALENGTH_SHIFT (0) /* Bits 0-15: Data length value */ +#define SDCARD_DATALENGTH_MASK (0xffff << SDCARD_DATALENGTH_MASK) + /* Bits 16-31: Reserved */ #define SDCARD_DLEN_RESET (0) /* Reset value */ +/* MCI - Data Control Register - DATACTRL - 0x400c 002c */ + #define SDCARD_DCTRL_DTEN (1 << 0) /* Bit 0: Data transfer enabled bit */ #define SDCARD_DCTRL_DTDIR (1 << 1) /* Bit 1: Data transfer direction */ #define SDCARD_DCTRL_DTMODE (1 << 2) /* Bit 2: Data transfer mode */ #define SDCARD_DCTRL_DMAEN (1 << 3) /* Bit 3: DMA enable bit */ -#define SDCARD_DCTRL_DBLOCKSIZE_SHIFT (4) /* Bits 7-4: Data block size */ +#define SDCARD_DCTRL_DBLOCKSIZE_SHIFT (4) /* Bits 4-7: Data block size */ #define SDCARD_DCTRL_DBLOCKSIZE_MASK (15 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT) # define SDCARD_DCTRL_1BYTE (0 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT) # define SDCARD_DCTRL_2BYTES (1 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT) @@ -155,18 +176,17 @@ # define SDCARD_DCTRL_512BYTES (9 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT) # define SDCARD_DCTRL_1KBYTE (10 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT) # define SDCARD_DCTRL_2KBYTES (11 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT) -# define SDCARD_DCTRL_4KBYTES (12 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT) -# define SDCARD_DCTRL_8KBYTES (13 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT) -# define SDCARD_DCTRL_16KBYTES (14 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT) -#define SDCARD_DCTRL_RWSTART (1 << 8) /* Bit 8: Read wait start */ -#define SDCARD_DCTRL_RWSTOP (1 << 9) /* Bit 9: Read wait stop */ -#define SDCARD_DCTRL_RWMOD (1 << 10) /* Bit 10: Read wait mode */ -#define SDCARD_DCTRL_SDIOEN (1 << 11) /* Bit 11: SD I/O enable functions */ + /* Bits 8-31: Reserved */ #define SDCARD_DCTRL_RESET (0) /* Reset value */ -#define SDCARD_DATACOUNT_SHIFT (0) -#define SDCARD_DATACOUNT_MASK (0x01ffffff << SDCARD_DATACOUNT_SHIFT) +/* MCI - Data Length Register DATALENGTH - 0x400c 0028 */ + +#define SDCARD_DATACOUNT_SHIFT (0) /* Bits 0-15: Remaining data */ +#define SDCARD_DATACOUNT_MASK (0xffff << SDCARD_DATACOUNT_SHIFT) + /* Bits 16-31: Reserved */ + +/* MCI - Status Register -Status - 0x400c 0034 */ #define SDCARD_STATUS_CCRCFAIL (1 << 0) /* Bit 0: Command response CRC fail */ #define SDCARD_STATUS_DCRCFAIL (1 << 1) /* Bit 1: Data block CRC fail */ @@ -190,8 +210,9 @@ #define SDCARD_STATUS_RXFIFOE (1 << 19) /* Bit 19: Receive FIFO empty */ #define SDCARD_STATUS_TXDAVL (1 << 20) /* Bit 20: Data available in transmit FIFO */ #define SDCARD_STATUS_RXDAVL (1 << 21) /* Bit 21: Data available in receive FIFO */ -#define SDCARD_STATUS_SDIOIT (1 << 22) /* Bit 22: SDIO interrupt received */ -#define SDCARD_STATUS_CEATAEND (1 << 23) /* Bit 23: CMD6 CE-ATA command completion */ + /* Bits 22-31: Reserved */ + +/* MCI - Clear Register CLEAR - 0x400c 0038 */ #define SDCARD_CLEAR_CCRCFAILC (1 << 0) /* Bit 0: CCRCFAIL flag clear bit */ #define SDCARD_CLEAR_DCRCFAILC (1 << 1) /* Bit 1: DCRCFAIL flag clear bit */ @@ -204,12 +225,13 @@ #define SDCARD_CLEAR_DATAENDC (1 << 8) /* Bit 8: DATAEND flag clear bit */ #define SDCARD_CLEAR_STBITERRC (1 << 9) /* Bit 9: STBITERR flag clear bit */ #define SDCARD_CLEAR_DBCKENDC (1 << 10) /* Bit 10: DBCKEND flag clear bit */ -#define SDCARD_CLEAR_SDIOITC (1 << 22) /* Bit 22: SDIOIT flag clear bit */ -#define SDCARD_CLEAR_CEATAENDC (1 << 23) /* Bit 23: CEATAEND flag clear bit */ + /* Bits 11-31: Reserved */ -#define SDCARD_CLEAR_RESET 0x00c007ff +#define SDCARD_CLEAR_RESET 0x000005ff #define SDCARD_CLEAR_STATICFLAGS 0x000005ff +/* MCI - Interrupt Mask Registers - MASK0 - 0x400c 003c */ + #define SDCARD_MASK0_CCRCFAILIE (1 << 0) /* Bit 0: Command CRC fail interrupt enable */ #define SDCARD_MASK0_DCRCFAILIE (1 << 1) /* Bit 1: Data CRC fail interrupt enable */ #define SDCARD_MASK0_CTIMEOUTIE (1 << 2) /* Bit 2: Command timeout interrupt enable */ @@ -232,13 +254,19 @@ #define SDCARD_MASK0_RXFIFOEIE (1 << 19) /* Bit 19: Rx FIFO empty interrupt enable */ #define SDCARD_MASK0_TXDAVLIE (1 << 20) /* Bit 20: Data available in Tx FIFO interrupt enable */ #define SDCARD_MASK0_RXDAVLIE (1 << 21) /* Bit 21: Data available in Rx FIFO interrupt enable */ -#define SDCARD_MASK0_SDIOITIE (1 << 22) /* Bit 22: SDIO mode interrupt received interrupt enable */ -#define SDCARD_MASK0_CEATAENDIE (1 << 23) /* Bit 23: CE-ATA command completion interrupt enable */ - + /* Bits 22-31: Reserved */ #define SDCARD_MASK0_RESET (0) -#define SDCARD_FIFOCNT_SHIFT (0) -#define SDCARD_FIFOCNT_MASK (0x01ffffff << SDCARD_FIFOCNT_SHIFT) +/* MCI - FIFO Counter Register (FIFOCNT - 0x400c 0048 */ + +#define SDCARD_FIFOCNT_SHIFT (0) /* Bits 0-14: Remaining data */ +#define SDCARD_FIFOCNT_MASK (0x7fff << SDCARD_FIFOCNT_SHIFT) + /* Bits 15-31: Reserved */ + +/* MCI - Data FIFO Register - FIFO - 0x400c 0080 to 0x400c 00bc */ +/* The receive and transmit FIFOs can be read or written as 32 bit wide registers. + * The FIFOs contain 16 entries on 16 sequential addresses. + */ #endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_SDCARD_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_sdcard.c b/nuttx/arch/arm/src/lpc17xx/lpc17_sdcard.c index ae37a1a4f..2a0e81b27 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_sdcard.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_sdcard.c @@ -64,6 +64,7 @@ #include "lpc17_gpio.h" #include "lpc17_sdcard.h" +#include "chip/lpc17_syscon.h" #include "chip/lpc17_pinconfig.h" #if CONFIG_LPC17_SDCARD @@ -123,22 +124,16 @@ /* Friendly CLKCR bit re-definitions ****************************************/ -#define SDCARD_CLOCK_RISINGEDGE (0) -#define SDCARD_CLOCK_FALLINGEDGE SDCARD_CLOCK_NEGEDGE - /* Mode dependent settings. These depend on clock devisor settings that must * be defined in the board-specific board.h header file: SDCARD_INIT_CLKDIV, * SDCARD_MMCXFR_CLKDIV, and SDCARD_SDXFR_CLKDIV. */ -#define LPC17_CLCKCR_INIT (SDCARD_INIT_CLKDIV|SDCARD_CLOCK_RISINGEDGE|\ - SDCARD_CLOCK_WIDBUS_D1) -#define SDCARD_CLOCK_MMCXFR (SDCARD_MMCXFR_CLKDIV|SDCARD_CLOCK_RISINGEDGE|\ - SDCARD_CLOCK_WIDBUS_D1) -#define SDCARD_CLOCK_SDXFR (SDCARD_SDXFR_CLKDIV|SDCARD_CLOCK_RISINGEDGE|\ - SDCARD_CLOCK_WIDBUS_D1) -#define SDCARD_CLOCK_SDWIDEXFR (SDCARD_SDXFR_CLKDIV|SDCARD_CLOCK_RISINGEDGE|\ - SDCARD_CLOCK_WIDBUS_D4) +#define LPC17_CLCKCR_INIT (SDCARD_INIT_CLKDIV|SDCARD_CLOCK_WIDBUS_D1) +#define SDCARD_CLOCK_MMCXFR (SDCARD_MMCXFR_CLKDIV|SDCARD_CLOCK_WIDBUS_D1) +#define SDCARD_CLOCK_SDXFR (SDCARD_SDXFR_CLKDIV|SDCARD_CLOCK_WIDBUS_D1) +#define SDCARD_CLOCK_SDWIDEXFR (SDCARD_SDXFR_CLKDIV|SDCARD_CLOCK_WIDBUS_D4) + /* Timing */ #define SDCARD_CMDTIMEOUT (100000) @@ -250,7 +245,7 @@ struct lpc17_dev_s { struct sdio_dev_s dev; /* Standard, base SD card interface */ - + /* LPC17XX-specific extensions */ /* Event support */ @@ -511,7 +506,7 @@ static void lpc17_takesem(struct lpc17_dev_s *priv) * Modify oft-changed bits in the CLKCR register. Only the following bit- * fields are changed: * - * CLKDIV, PWRSAV, BYPASS, WIDBUS, NEGEDGE, and HWFC_EN + * CLKDIV, PWRSAV, BYPASS, and WIDBUS * * Input Parameters: * clkcr - A new CLKCR setting for the above mentions bits (other bits @@ -525,18 +520,16 @@ static void lpc17_takesem(struct lpc17_dev_s *priv) static inline void lpc17_setclock(uint32_t clkcr) { uint32_t regval = getreg32(LPC17_SDCARD_CLOCK); - - /* Clear CLKDIV, PWRSAV, BYPASS, WIDBUS, NEGEDGE, HWFC_EN bits */ + + /* Clear CLKDIV, PWRSAV, BYPASS, and WIDBUS bits */ regval &= ~(SDCARD_CLOCK_CLKDIV_MASK|SDCARD_CLOCK_PWRSAV|SDCARD_CLOCK_BYPASS| - SDCARD_CLOCK_WIDBUS_MASK|SDCARD_CLOCK_NEGEDGE|SDCARD_CLOCK_HWFC_EN| - SDCARD_CLOCK_CLKEN); + SDCARD_CLOCK_WIDBUS|SDCARD_CLOCK_CLKEN); /* Replace with user provided settings */ clkcr &= (SDCARD_CLOCK_CLKDIV_MASK|SDCARD_CLOCK_PWRSAV|SDCARD_CLOCK_BYPASS| - SDCARD_CLOCK_WIDBUS_MASK|SDCARD_CLOCK_NEGEDGE|SDCARD_CLOCK_HWFC_EN| - SDCARD_CLOCK_CLKEN); + SDCARD_CLOCK_WIDBUS|SDCARD_CLOCK_CLKEN); regval |= clkcr; putreg32(regval, LPC17_SDCARD_CLOCK); @@ -979,7 +972,7 @@ static void lpc17_sendfifo(struct lpc17_dev_s *priv) { data.b[i] = *ptr++; } - + /* Now the transfer is finished */ priv->remaining = 0; @@ -1147,7 +1140,7 @@ static void lpc17_endtransfer(struct lpc17_dev_s *priv, sdio_eventset_t wkupeven lpc17_configxfrints(priv, 0); /* Clearing pending interrupt status on all transfer related interrupts */ - + putreg32(SDCARD_XFRDONE_ICR, LPC17_SDCARD_CLEAR); /* If this was a DMA transfer, make sure that DMA is stopped */ @@ -1407,7 +1400,7 @@ static int lpc17_interrupt(int irq, void *context) #ifdef CONFIG_SDIO_MUXBUS static int lpc17_lock(FAR struct sdio_dev_s *dev, bool lock) -{ +{ /* Single SD card instance so there is only one possibility. The multiplex * bus is part of board support package. */ @@ -1441,6 +1434,8 @@ static void lpc17_reset(FAR struct sdio_dev_s *dev) flags = irqsave(); + /* Disable the SD Interface */ + regval = getreg32(LPC17_SDCARD_CLOCK); regval &= ~SDCARD_CLOCK_CLKEN; putreg32(regval, LPC17_SDCARD_CLOCK); @@ -1475,9 +1470,9 @@ static void lpc17_reset(FAR struct sdio_dev_s *dev) priv->dmamode = false; /* true: DMA mode transfer */ #endif - /* Configure the SD card peripheral */ + /* Configure and enable the SD card peripheral */ - lpc17_setclock(LPC17_CLCKCR_INIT | SDCARD_CLOCK_CLKEN); + lpc17_setclock(LPC17_CLCKCR_INIT|SDCARD_CLOCK_CLKEN); lpc17_setpwrctrl(SDCARD_PWR_CTRL_ON); irqrestore(flags); @@ -1558,7 +1553,7 @@ static void lpc17_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate) /* Enable in initial ID mode clocking (<400KHz) */ - case CLOCK_IDMODE: + case CLOCK_IDMODE: clock = (LPC17_CLCKCR_INIT | SDCARD_CLOCK_CLKEN); break; @@ -1687,7 +1682,7 @@ static int lpc17_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg) cmdidx = (cmd & MMCSD_CMDIDX_MASK) >> MMCSD_CMDIDX_SHIFT; regval |= cmdidx | SDCARD_CMD_CPSMEN; - + fvdbg("cmd: %08x arg: %08x regval: %08x\n", cmd, arg, regval); /* Write the SD card CMD */ @@ -1836,7 +1831,7 @@ static int lpc17_cancel(FAR struct sdio_dev_s *dev) /* Clearing pending interrupt status on all transfer- and event- related * interrupts */ - + putreg32(SDCARD_WAITALL_ICR, LPC17_SDCARD_CLEAR); /* Cancel any watchdog timeout */ @@ -2075,7 +2070,7 @@ static int lpc17_recvlong(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t rlo ret = -EIO; } } - + /* Return the long response */ putreg32(SDCARD_RESPDONE_ICR|SDCARD_CMDDONE_ICR, LPC17_SDCARD_CLEAR); @@ -2172,7 +2167,7 @@ static void lpc17_waitenable(FAR struct sdio_dev_s *dev, { struct lpc17_dev_s *priv = (struct lpc17_dev_s*)dev; uint32_t waitmask; - + DEBUGASSERT(priv != NULL); /* Disable event-related interrupts */ @@ -2286,7 +2281,7 @@ static sdio_eventset_t lpc17_eventwait(FAR struct sdio_dev_s *dev, lpc17_takesem(priv); wkupevent = priv->wkupevent; - + /* Check if the event has occurred. When the event has occurred, then * evenset will be set to 0 and wkupevent will be set to a nonzero value. */ @@ -2468,7 +2463,7 @@ static int lpc17_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, lpc17_dmasetup(priv->dma, LPC17_SDCARD_FIFO, (uint32_t)buffer, (buflen + 3) >> 2, SDCARD_RXDMA32_CONFIG); - + /* Start the DMA */ lpc17_sample(priv, SAMPLENDX_BEFORE_ENABLE); @@ -2683,10 +2678,18 @@ static void lpc17_default(void) FAR struct sdio_dev_s *sdio_initialize(int slotno) { + uint32_t regval; + /* There is only one slot */ struct lpc17_dev_s *priv = &g_scard_dev; + /* Enable power on SD Interface */ + + regval = getreg32(LPC17_SYSCON_PCONP); + regval |= SYSCON_PCONP_PCSDC; + putreg32(regval, LPC17_SYSCON_PCONP); + /* Initialize the SD card slot structure */ sem_init(&priv->waitsem, 0, 0); @@ -2700,9 +2703,8 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) DEBUGASSERT(priv->dma); #endif - /* Configure GPIOs for 4-bit, wide-bus operation (the chip is capable of - * 8-bit wide bus operation but D4-D7 are not configured). - * + /* Configure GPIOs for 4-bit, wide-bus operation. + * * If bus is multiplexed then there is a custom bus configuration utility * in the scope of the board support package. */ @@ -2723,6 +2725,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) */ lpc17_reset(&priv->dev); + return &g_scard_dev.dev; } @@ -2736,7 +2739,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) * * Input Parameters: * dev - An instance of the SD card driver device state structure. - * cardinslot - true is a card has been detected in the slot; false if a + * cardinslot - true is a card has been detected in the slot; false if a * card has been removed from the slot. Only transitions * (inserted->removed or removed->inserted should be reported) * diff --git a/nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c b/nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c index c6788d3b5..ef8553e9c 100644 --- a/nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c +++ b/nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c @@ -38,7 +38,11 @@ ****************************************************************************/ #include <nuttx/config.h> + +#include <assert.h> + #include <arch/board/user_map.h> + #include "mpu.h" #ifdef CONFIG_NUTTX_KERNEL @@ -78,19 +82,11 @@ void sam3u_mpuinitialize(void) { - uintptr_t datastart = MIN(ONFIG_USER_DATADESTSTART, CONFIG_USER_BSSSTART); - uintptr_t dataend = MAX(ONFIG_USER_DATADESTEND, CONFIG_USER_BSSEND); + uintptr_t datastart = MIN(CONFIG_USER_DATADESTSTART, CONFIG_USER_BSSSTART); + uintptr_t dataend = MAX(CONFIG_USER_DATADESTEND, CONFIG_USER_BSSEND); DEBUGASSERT(CONFIG_USER_TEXTEND >= CONFIG_USER_TEXTSTART && dataend >= datastart); - @echo "#define C 0x`grep \" _stext\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h - @echo "#define 0x`grep \" _etext$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h - @echo "#define CONFIG_USER_DATASOURCE 0x`grep \" _eronly$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h - @echo "#define C 0x`grep \" _sdata$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h - @echo "#define CONFIG_USER_ 0x`grep \" _edata$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h - @echo "#define 0x`grep \" _sbss\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h - @echo "#define CONFIG_USER_ 0x`grep \" _ebss$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h - /* Show MPU information */ mpu_showtype(); diff --git a/nuttx/configs/open1788/include/board.h b/nuttx/configs/open1788/include/board.h index 5ed6b1a45..7991d3c09 100644 --- a/nuttx/configs/open1788/include/board.h +++ b/nuttx/configs/open1788/include/board.h @@ -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 diff --git a/nuttx/configs/open1788/src/lpc17_nsh.c b/nuttx/configs/open1788/src/lpc17_nsh.c index 85165b220..a8b95a6d1 100644 --- a/nuttx/configs/open1788/src/lpc17_nsh.c +++ b/nuttx/configs/open1788/src/lpc17_nsh.c @@ -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. diff --git a/nuttx/configs/open1788/src/lpc17_userleds.c b/nuttx/configs/open1788/src/lpc17_userleds.c index bf0300e25..08ad837b3 100644 --- a/nuttx/configs/open1788/src/lpc17_userleds.c +++ b/nuttx/configs/open1788/src/lpc17_userleds.c @@ -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 }; diff --git a/nuttx/configs/sam3u-ek/kernel/Makefile b/nuttx/configs/sam3u-ek/kernel/Makefile index e9a7ef7ff..8a2646094 100644 --- a/nuttx/configs/sam3u-ek/kernel/Makefile +++ b/nuttx/configs/sam3u-ek/kernel/Makefile @@ -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: diff --git a/nuttx/configs/sam3u-ek/kernel/kernel.ld b/nuttx/configs/sam3u-ek/kernel/kernel.ld index 93d16124a..c288ab047 100644 --- a/nuttx/configs/sam3u-ek/kernel/kernel.ld +++ b/nuttx/configs/sam3u-ek/kernel/kernel.ld @@ -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 { diff --git a/nuttx/syscall/syscall_funclookup.c b/nuttx/syscall/syscall_funclookup.c index e127dc5c9..553381cd7 100644 --- a/nuttx/syscall/syscall_funclookup.c +++ b/nuttx/syscall/syscall_funclookup.c @@ -49,6 +49,7 @@ #include <sys/stat.h> #include <sys/wait.h> #include <sys/ioctl.h> +#include <sys/time.h> #include <sys/select.h> #include <sys/mman.h> #include <sys/stat.h> @@ -73,6 +74,8 @@ #include <assert.h> #include <errno.h> +#include <nuttx/clock.h> + /**************************************************************************** * Pre-processor definitions ****************************************************************************/ diff --git a/nuttx/syscall/syscall_lookup.h b/nuttx/syscall/syscall_lookup.h index 928194642..1a958143c 100644 --- a/nuttx/syscall/syscall_lookup.h +++ b/nuttx/syscall/syscall_lookup.h @@ -192,7 +192,7 @@ SYSCALL_LOOKUP(up_assert_code, 3, STUB_up_assert_code) SYSCALL_LOOKUP(rename, 2, STUB_rename) SYSCALL_LOOKUP(rmdir, 1, STUB_rmdir) SYSCALL_LOOKUP(umount, 1, STUB_umount) - SYSCALL_LOOKUP(unlink 1, STUB_unlink) + SYSCALL_LOOKUP(unlink, 1, STUB_unlink) # endif #endif diff --git a/nuttx/syscall/syscall_stublookup.c b/nuttx/syscall/syscall_stublookup.c index 13eb57fc9..0cb70d0a0 100644 --- a/nuttx/syscall/syscall_stublookup.c +++ b/nuttx/syscall/syscall_stublookup.c @@ -109,7 +109,7 @@ uintptr_t STUB_posix_spawn(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm6); uintptr_t STUB_posix_spawnp(int nbr, uintptr_t parm1, uintptr_t parm2, - uintptr_t parm3, uintptr_t parm4, uintptr_t parm6, + uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm6); uintptr_t STUB_execv(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_execl(int nbr, uintptr_t parm1, uintptr_t parm2, |