From a57cc2353f87cc923f610c21130df9e67779db97 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 26 Apr 2011 23:11:02 +0000 Subject: [PATCH] Fixes to get clean i.MXADS build git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3533 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- apps/examples/ostest/timedmqueue.c | 16 ++++++------- apps/examples/ostest/timedwait.c | 10 ++++---- .../buildroot/configs/arm920t-defconfig-4.3.3 | 8 +++++-- nuttx/ChangeLog | 6 ++++- nuttx/arch/arm/src/arm/up_head.S | 3 +-- nuttx/arch/arm/src/imx/imx_boot.c | 2 +- nuttx/arch/arm/src/imx/imx_memorymap.h | 24 +++++++++---------- nuttx/drivers/mtd/rammtd.c | 4 +++- nuttx/fs/fat/fs_fat32.c | 2 +- nuttx/include/sys/stat.h | 2 +- 10 files changed, 43 insertions(+), 34 deletions(-) diff --git a/apps/examples/ostest/timedmqueue.c b/apps/examples/ostest/timedmqueue.c index 49fe1c4c6..84b8913b2 100644 --- a/apps/examples/ostest/timedmqueue.c +++ b/apps/examples/ostest/timedmqueue.c @@ -142,19 +142,19 @@ static void *sender_thread(void *arg) for (i = 0; i < TEST_SEND_NMSGS; i++) { - struct timespec time; - status = clock_gettime(CLOCK_REALTIME, &time); + struct timespec ts; + status = clock_gettime(CLOCK_REALTIME, &ts); if (status != 0) { printf("sender_thread: ERROR clock_gettime failed\n"); } - time.tv_sec += 5; + ts.tv_sec += 5; /* The first TEST_SEND_NMSGS-1 send should succeed. The last * one should fail with errno == ETIMEDOUT */ - status = mq_timedsend(mqfd, msg_buffer, TEST_MSGLEN, 42, &time); + status = mq_timedsend(mqfd, msg_buffer, TEST_MSGLEN, 42, &ts); if (status < 0) { if (i == TEST_SEND_NMSGS-1 && errno == ETIMEDOUT) @@ -232,20 +232,20 @@ static void *receiver_thread(void *arg) for (i = 0; i < TEST_RECEIVE_NMSGS; i++) { - struct timespec time; - int status = clock_gettime(CLOCK_REALTIME, &time); + struct timespec ts; + int status = clock_gettime(CLOCK_REALTIME, &ts); if (status != 0) { printf("sender_thread: ERROR clock_gettime failed\n"); } - time.tv_sec += 5; + ts.tv_sec += 5; /* The first TEST_SEND_NMSGS-1 send should succeed. The last * one should fail with errno == ETIMEDOUT */ memset(msg_buffer, 0xaa, TEST_MSGLEN); - nbytes = mq_timedreceive(mqfd, msg_buffer, TEST_MSGLEN, 0, &time); + nbytes = mq_timedreceive(mqfd, msg_buffer, TEST_MSGLEN, 0, &ts); if (nbytes < 0) { if (i == TEST_SEND_NMSGS-1 && errno == ETIMEDOUT) diff --git a/apps/examples/ostest/timedwait.c b/apps/examples/ostest/timedwait.c index 51622bad8..24edb463b 100644 --- a/apps/examples/ostest/timedwait.c +++ b/apps/examples/ostest/timedwait.c @@ -1,7 +1,7 @@ /*********************************************************************** * examples/ostest/timedwait.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -68,7 +68,7 @@ static pthread_cond_t cond; static void *thread_waiter(void *parameter) { - struct timespec time; + struct timespec ts; int status; /* Take the mutex */ @@ -82,16 +82,16 @@ static void *thread_waiter(void *parameter) printf("thread_waiter: Starting 5 second wait for condition\n"); - status = clock_gettime(CLOCK_REALTIME, &time); + status = clock_gettime(CLOCK_REALTIME, &ts); if (status != 0) { printf("thread_waiter: ERROR clock_gettime failed\n"); } - time.tv_sec += 5; + ts.tv_sec += 5; /* The wait -- no-one is ever going to awaken us */ - status = pthread_cond_timedwait(&cond, &mutex, &time); + status = pthread_cond_timedwait(&cond, &mutex, &ts); if (status != 0) { if (status == ETIMEDOUT) diff --git a/misc/buildroot/configs/arm920t-defconfig-4.3.3 b/misc/buildroot/configs/arm920t-defconfig-4.3.3 index 470506675..f6080a03c 100644 --- a/misc/buildroot/configs/arm920t-defconfig-4.3.3 +++ b/misc/buildroot/configs/arm920t-defconfig-4.3.3 @@ -14,6 +14,7 @@ BR2_arm=y # BR2_m68k is not set # BR2_m68hc11 is not set # BR2_m68hc12 is not set +# BR2_m9s12x is not set # BR2_mips is not set # BR2_mipsel is not set # BR2_nios2 is not set @@ -56,7 +57,7 @@ BR2_BZCAT="bzcat" BR2_TAR_OPTIONS="" BR2_DL_DIR="$(BASE_DIR)/../archives" BR2_STAGING_DIR="$(BUILD_DIR)/staging_dir" -BR2_NUTTX_DIR="$(TOPDIR)/../nuttx" +BR2_NUTTX_DIR="$(TOPDIR)/../../nuttx" BR2_TOPDIR_PREFIX="" BR2_TOPDIR_SUFFIX="" BR2_GNU_BUILD_SUFFIX="pc-elf" @@ -71,6 +72,7 @@ BR2_GNU_TARGET_SUFFIX="elf" # Binutils Options # # BR2_BINUTILS_VERSION_2_17 is not set +# BR2_BINUTILS_VERSION_2_18 is not set # BR2_BINUTILS_VERSION_2_19 is not set BR2_BINUTILS_VERSION_2_19_1=y BR2_BINUTILS_VERSION="2.19.1" @@ -80,6 +82,7 @@ BR2_EXTRA_BINUTILS_CONFIG_OPTIONS="" # GCC Options # BR2_PACKAGE_GCC=y +# BR2_GCC_VERSION_3_3_6 is not set # BR2_GCC_VERSION_3_4_6 is not set # BR2_GCC_VERSION_4_2_4 is not set BR2_GCC_VERSION_4_3_3=y @@ -102,7 +105,8 @@ BR2_INSTALL_LIBSTDCPP=y # # NuttX Binary Support # -# BR2_PACKAGE_NXFLAT is not set +BR2_PACKAGE_NXFLAT=y +BR2_PACKAGE_GENROMFS=y # # Common Toolchain Options diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 85edb20c0..075fa969e 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -1706,9 +1706,13 @@ * configs/lpcxpresso-lpc1668/nx: Add a NX graphics configuration for the LPCXPRESO board. * graphics/nxglib/nxglib_nonintersecting.c: Fix some single bit errors in - calculation of non-intersecting regions. This was causing an anomoaly + calculation of non-intersecting regions. This was causing an anomaly in examples/nx in column 0. * drivers/mtd/rammtd.c: Added a RAM based MTD driver. This RAM driver simulates FLASH and is useful for testing purposes. + * arch/arm/src/arm/up_head.S: Fix backward conditional compilation. This cause + the configs/mx1ads configuration to fail to build but does not appear to affect + any other ARM9 build. + diff --git a/nuttx/arch/arm/src/arm/up_head.S b/nuttx/arch/arm/src/arm/up_head.S index 6afdeeb17..7ed94bd9a 100644 --- a/nuttx/arch/arm/src/arm/up_head.S +++ b/nuttx/arch/arm/src/arm/up_head.S @@ -177,7 +177,7 @@ * to the base address of the section containing both. */ -#ifndef CONFIG_ARCH_LOWVECTORS +#ifdef CONFIG_ARCH_LOWVECTORS .macro mksection, section, pgtable bic \section, \pgtable, #0x000ff000 .endm @@ -306,7 +306,6 @@ __start: #endif /* CONFIG_PAGING */ #endif /* CONFIG_ARCH_ROMPGTABLE */ - /* The following logic will set up the ARM920/ARM926 for normal operation. * * Here we expect to have: diff --git a/nuttx/arch/arm/src/imx/imx_boot.c b/nuttx/arch/arm/src/imx/imx_boot.c index 9cd4d390e..65a6951ce 100644 --- a/nuttx/arch/arm/src/imx/imx_boot.c +++ b/nuttx/arch/arm/src/imx/imx_boot.c @@ -117,7 +117,7 @@ extern void imx_boardinitialize(void); static inline void up_setlevel1entry(uint32_t paddr, uint32_t vaddr, uint32_t mmuflags) { - uint32_t *pgtable = (uint32_t*)PGTABLE_VBASE; + uint32_t *pgtable = (uint32_t*)PGTABLE_BASE_VADDR; uint32_t index = vaddr >> 20; /* Save the page table entry */ diff --git a/nuttx/arch/arm/src/imx/imx_memorymap.h b/nuttx/arch/arm/src/imx/imx_memorymap.h index 0b7603bef..7eafc908a 100644 --- a/nuttx/arch/arm/src/imx/imx_memorymap.h +++ b/nuttx/arch/arm/src/imx/imx_memorymap.h @@ -233,19 +233,19 @@ * We will reuse this memory for coarse page tables as follows: */ -#define PGTABLE_PBASE IMX_SDRAM0_PSECTION -#define PGTABLE_SDRAM_PBASE PGTABLE_PBASE -#define PGTABLE_COARSE_PBASE (PGTABLE_PBASE+0x00000800) -#define PGTABLE_COARSE_PEND (PGTABLE_PBASE+0x00003000) -#define PTTABLE_PERIPHERALS_PBASE (PGTABLE_PBASE+0x00003000) -#define PGTABLE_PEND (PGTABLE_PBASE+0x00004000) +#define PGTABLE_BASE_PADDR IMX_SDRAM0_PSECTION +#define PGTABLE_SDRAM_PADDR PGTABLE_BASE_PADDR +#define PGTABLE_COARSE_PBASE (PGTABLE_BASE_PADDR+0x00000800) +#define PGTABLE_COARSE_PEND (PGTABLE_BASE_PADDR+0x00003000) +#define PTTABLE_PERIPHERALS_PBASE (PGTABLE_BASE_PADDR+0x00003000) +#define PGTABLE_PEND (PGTABLE_BASE_PADDR+0x00004000) -#define PGTABLE_VBASE IMX_SDRAM_VSECTION -#define PGTABLE_SDRAM_VBASE PGTABLE_VBASE -#define PGTABLE_COARSE_VBASE (PGTABLE_VBASE+0x00000800) -#define PGTABLE_COARSE_VEND (PGTABLE_VBASE+0x00003000) -#define PTTABLE_PERIPHERALS_VBASE (PGTABLE_VBASE+0x00003000) -#define PGTABLE_VEND (PGTABLE_VBASE+0x00004000) +#define PGTABLE_BASE_VADDR IMX_SDRAM_VSECTION +#define PGTABLE_SDRAM_VADDR PGTABLE_BASE_VADDR +#define PGTABLE_COARSE_VBASE (PGTABLE_BASE_VADDR+0x00000800) +#define PGTABLE_COARSE_VEND (PGTABLE_BASE_VADDR+0x00003000) +#define PTTABLE_PERIPHERALS_VBASE (PGTABLE_BASE_VADDR+0x00003000) +#define PGTABLE_VEND (PGTABLE_BASE_VADDR+0x00004000) #define PGTABLE_COARSE_TABLE_SIZE (4*256) #define PGTABLE_COARSE_ALLOC (PGTABLE_COARSE_VEND-PGTABLE_COARSE_VBASE) diff --git a/nuttx/drivers/mtd/rammtd.c b/nuttx/drivers/mtd/rammtd.c index 707192d88..5bdfa5017 100644 --- a/nuttx/drivers/mtd/rammtd.c +++ b/nuttx/drivers/mtd/rammtd.c @@ -44,7 +44,9 @@ #include #include #include +#include +#include #include #include @@ -316,7 +318,7 @@ FAR struct mtd_dev_s *rammtd_initialize(FAR uint8_t *start, size_t size) /* Create an instance of the RAM MTD device state structure */ - priv = (FAR struct ram_dev_s *)kzmalloc(sizeof(struct ram_dev_s)); + priv = (FAR struct ram_dev_s *)kmalloc(sizeof(struct ram_dev_s)); if (!priv) { fdbg("Failed to allocate the RAM MTD state structure\n"); diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c index 25354e936..2d880dabc 100644 --- a/nuttx/fs/fat/fs_fat32.c +++ b/nuttx/fs/fat/fs_fat32.c @@ -216,6 +216,7 @@ static int fat_open(FAR struct file *filep, const char *relpath, if ((oflags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL)) { /* Already exists -- can't create it exclusively */ + ret = -EEXIST; goto errout_with_semaphore; } @@ -251,7 +252,6 @@ static int fat_open(FAR struct file *filep, const char *relpath, } /* fall through to finish the file open operations */ - } else if (ret == -ENOENT) { diff --git a/nuttx/include/sys/stat.h b/nuttx/include/sys/stat.h index ec3715dc8..bb166e7e2 100644 --- a/nuttx/include/sys/stat.h +++ b/nuttx/include/sys/stat.h @@ -105,7 +105,7 @@ struct stat mode_t st_mode; /* File type, atributes, and access mode bits */ off_t st_size; /* Size of file/directory, in bytes */ blksize_t st_blksize; /* Blocksize used for filesystem I/O */ - blkcnt_t st_blocks; /* Number of blocks allocated*/ + blkcnt_t st_blocks; /* Number of blocks allocated */ time_t st_atime; /* Time of last access */ time_t st_mtime; /* Time of last modification */ time_t st_ctime; /* Time of last status change */