From 5ebf11ee63f1baaf070fd8484d99362810cd5bcc Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 2 May 2012 15:36:19 +0000 Subject: Fix some warnings and fix some simulator builds git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4688 42af7a65-404d-4744-a932-0658087f49c3 --- NxWidgets/UnitTests/README.txt | 2 +- nuttx/arch/sim/src/up_setjmp.S | 22 +++++++++++----------- nuttx/configs/sim/README.txt | 9 +++++++++ nuttx/configs/sim/nx11/Make.defs | 21 +++++++++++++++++++-- nuttx/configs/sim/nxwm/Make.defs | 21 +++++++++++++++++++-- nuttx/configs/sim/touchscreen/Make.defs | 21 +++++++++++++++++++-- nuttx/drivers/mmcsd/mmcsd_spi.c | 4 ++-- nuttx/drivers/mtd/rammtd.c | 4 ++-- nuttx/drivers/mtd/ramtron.c | 4 ++-- nuttx/fs/fat/fs_fat32.c | 6 ------ nuttx/fs/fs_fcntl.c | 4 ++-- nuttx/libxx/README.txt | 27 +++++++++++++++++++++++---- nuttx/sched/prctl.c | 2 +- nuttx/sched/pthread_exit.c | 5 +++-- nuttx/sched/sem_open.c | 4 ++-- nuttx/sched/sig_deliver.c | 11 ++--------- nuttx/sched/wd_start.c | 11 ++--------- 17 files changed, 119 insertions(+), 59 deletions(-) diff --git a/NxWidgets/UnitTests/README.txt b/NxWidgets/UnitTests/README.txt index b19ed4462..f501f30f6 100644 --- a/NxWidgets/UnitTests/README.txt +++ b/NxWidgets/UnitTests/README.txt @@ -35,7 +35,7 @@ Installing and Building the Unit Tests for the STM3210E-EVAL available. However, the unit test can be run on other configurations (see steps d and e below). - NOTE: The special configuratin sim/nxwm is recommended for unit-leveling + NOTE: Another special configuration, sim/nxwm, is recommended for unit-leveling testing of NxWM because the configuration is more complex in that case. We will assume the sim/nsh2 configuration in this discussion. The diff --git a/nuttx/arch/sim/src/up_setjmp.S b/nuttx/arch/sim/src/up_setjmp.S index 56c72370c..a65317c65 100644 --- a/nuttx/arch/sim/src/up_setjmp.S +++ b/nuttx/arch/sim/src/up_setjmp.S @@ -1,8 +1,8 @@ /************************************************************************** * up_setjmp.S * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2007, 2012 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 @@ -104,11 +104,11 @@ SYMBOL(up_setjmp): /* Save the framepointer */ - movl %ebp, (JB_EBP)(%eax) + movl %ebp, (JB_EBP)(%eax) /* And return 0 */ - xorl %eax, %eax + xorl %eax, %eax ret #ifndef __CYGWIN__ .size SYMBOL(up_setjmp), . - SYMBOL(up_setjmp) @@ -123,19 +123,19 @@ SYMBOL(up_longjmp): /* Save the return address now. */ - movl (JB_PC)(%ecx), %edx + movl (JB_PC)(%ecx), %edx /* Restore registers. */ - movl (JB_EBX)(%ecx), %ebx - movl (JB_ESI)(%ecx), %esi - movl (JB_EDI)(%ecx), %edi - movl (JB_EBP)(%ecx), %ebp - movl (JB_SP)(%ecx), %esp + movl (JB_EBX)(%ecx), %ebx + movl (JB_ESI)(%ecx), %esi + movl (JB_EDI)(%ecx), %edi + movl (JB_EBP)(%ecx), %ebp + movl (JB_SP)(%ecx), %esp /* Jump to saved PC. */ - jmp *%edx + jmp *%edx #ifndef __CYGWIN__ .size SYMBOL(up_longjmp), . - SYMBOL(up_longjmp) #endif diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt index 2ad8099f9..f02f44258 100644 --- a/nuttx/configs/sim/README.txt +++ b/nuttx/configs/sim/README.txt @@ -10,6 +10,7 @@ Contents o Debugging o Issues - 64-bit Issues + - Compiler differences - Stack Size Issues - Buffered I/O Issues - Networking Issues @@ -107,6 +108,14 @@ are included in the LDFLAGS. See the patch 0001-Quick-hacks-to-build-sim-nsh-ostest-on-x86_64-as-32-.patch that can be found at http://tech.groups.yahoo.com/group/nuttx/files. +Compiler differences +-------------------- + +operator new + + Problem: "'operator new' takes size_t ('...') as first parameter" + Workaround: Add -fpermissive to the compilation flags + Stack Size Issues ----------------- When you run the NuttX simulation, it uses stacks allocated by NuttX from the diff --git a/nuttx/configs/sim/nx11/Make.defs b/nuttx/configs/sim/nx11/Make.defs index 2dfda3e65..d385d823b 100644 --- a/nuttx/configs/sim/nx11/Make.defs +++ b/nuttx/configs/sim/nx11/Make.defs @@ -53,6 +53,11 @@ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx ARCHSCRIPT = +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + CROSSDEV = CC = $(CROSSDEV)gcc CXX = $(CROSSDEV)g++ @@ -79,8 +84,20 @@ else EXEEXT = endif -ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") - LDFLAGS += -g +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g +endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 endif define PREPROCESS diff --git a/nuttx/configs/sim/nxwm/Make.defs b/nuttx/configs/sim/nxwm/Make.defs index 89fc79cd3..958ded466 100644 --- a/nuttx/configs/sim/nxwm/Make.defs +++ b/nuttx/configs/sim/nxwm/Make.defs @@ -53,6 +53,11 @@ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx ARCHSCRIPT = +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + CROSSDEV = CC = $(CROSSDEV)gcc CXX = $(CROSSDEV)g++ @@ -79,8 +84,20 @@ else EXEEXT = endif -ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") - LDFLAGS += -g +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g +endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 endif define PREPROCESS diff --git a/nuttx/configs/sim/touchscreen/Make.defs b/nuttx/configs/sim/touchscreen/Make.defs index 599b37432..2ea9a3c89 100644 --- a/nuttx/configs/sim/touchscreen/Make.defs +++ b/nuttx/configs/sim/touchscreen/Make.defs @@ -53,6 +53,11 @@ ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx ARCHSCRIPT = +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + CROSSDEV = CC = $(CROSSDEV)gcc CXX = $(CROSSDEV)g++ @@ -79,8 +84,20 @@ else EXEEXT = endif -ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") - LDFLAGS += -g +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g +endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 endif define PREPROCESS diff --git a/nuttx/drivers/mmcsd/mmcsd_spi.c b/nuttx/drivers/mmcsd/mmcsd_spi.c index f7bbd64b4..c2321efc7 100644 --- a/nuttx/drivers/mmcsd/mmcsd_spi.c +++ b/nuttx/drivers/mmcsd/mmcsd_spi.c @@ -1,8 +1,8 @@ /**************************************************************************** * drivers/mmcsd/mmcsd_spi.c * - * Copyright (C) 2008-2010, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2008-2010, 2011-2012 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 diff --git a/nuttx/drivers/mtd/rammtd.c b/nuttx/drivers/mtd/rammtd.c index 72acc73e8..82a7191ea 100644 --- a/nuttx/drivers/mtd/rammtd.c +++ b/nuttx/drivers/mtd/rammtd.c @@ -1,8 +1,8 @@ /**************************************************************************** * drivers/mtd/rammtd.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2011-2012 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 diff --git a/nuttx/drivers/mtd/ramtron.c b/nuttx/drivers/mtd/ramtron.c index 0c922e69e..5615823d6 100644 --- a/nuttx/drivers/mtd/ramtron.c +++ b/nuttx/drivers/mtd/ramtron.c @@ -3,9 +3,9 @@ * Driver for SPI-based RAMTRON NVRAM Devices FM25V10 and others (not tested) * * Copyright (C) 2011 Uros Platise. All rights reserved. - * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved. * Author: Uros Platise - * Gregory Nutt + * Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c index 2c98368a1..f0845070b 100644 --- a/nuttx/fs/fat/fs_fat32.c +++ b/nuttx/fs/fat/fs_fat32.c @@ -377,7 +377,6 @@ errout_with_semaphore: static int fat_close(FAR struct file *filep) { struct inode *inode; - struct fat_mountpt_s *fs; struct fat_file_s *ff; int ret = OK; @@ -389,9 +388,6 @@ static int fat_close(FAR struct file *filep) ff = filep->f_priv; inode = filep->f_inode; - fs = inode->i_private; - - DEBUGASSERT(fs != NULL); /* Do not check if the mount is healthy. We must support closing of * the file even when there is healthy mount. @@ -1107,7 +1103,6 @@ static int fat_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { struct inode *inode; struct fat_mountpt_s *fs; - struct fat_file_s *ff; int ret; /* Sanity checks */ @@ -1116,7 +1111,6 @@ static int fat_ioctl(FAR struct file *filep, int cmd, unsigned long arg) /* Recover our private data from the struct file instance */ - ff = filep->f_priv; inode = filep->f_inode; fs = inode->i_private; diff --git a/nuttx/fs/fs_fcntl.c b/nuttx/fs/fs_fcntl.c index f0102ce8e..b7e688895 100644 --- a/nuttx/fs/fs_fcntl.c +++ b/nuttx/fs/fs_fcntl.c @@ -59,7 +59,7 @@ static inline int file_vfcntl(int fildes, int cmd, va_list ap) FAR struct filelist *list; FAR struct file *this_file; int err = 0; - int ret = 0; + int ret = OK; /* Get the thread-specific file list */ @@ -202,7 +202,7 @@ errout: errno = err; return ERROR; } - return OK; + return ret; } #endif /* CONFIG_NFILE_DESCRIPTORS > 0 */ diff --git a/nuttx/libxx/README.txt b/nuttx/libxx/README.txt index 7b292bff5..c97dae4ba 100644 --- a/nuttx/libxx/README.txt +++ b/nuttx/libxx/README.txt @@ -7,11 +7,30 @@ embedded world, that is probably all that is necessary. If you have a need for more extensive C++ support, the following libraries are recommended: - - libstdc++ (part of GCC) - - STLport http://www.stlport.org/ - - uClibc++ http://cxx.uclibc.org/ + - libstdc++ (part of GCC) + - STLport http://www.stlport.org/ + - uClibc++ http://cxx.uclibc.org/ At present, only the following are supported here: - void *operator new(std::size_t nbytes); - - void operator delete(void* ptr); \ No newline at end of file + - void operator delete(void* ptr); + - void operator delete[](void *ptr); + - void __cxa_pure_virtual(void); + - int __aeabi_atexit(void* object, void (*destroyer)(void*), void *dso_handle); + +operator new +------------ + + This operator should take a type of size_t. But size_t has an unknown underlying + type. In the nuttx sys/types.h header file, size_t is typed as uint32_t + (which is determined by architecture-specific logic). But the C++ + compiler may believe that size_t is of a different type resulting in + compilation errors in the operator. Using the underlying integer type + instead of size_t seems to resolve the compilation issues. Need to + REVISIT this. + + Once some C++ compilers, this will cause an error: + + Problem: "'operator new' takes size_t ('...') as first parameter" + Workaround: Add -fpermissive to the compilation flags diff --git a/nuttx/sched/prctl.c b/nuttx/sched/prctl.c index bc55992b4..817083561 100644 --- a/nuttx/sched/prctl.c +++ b/nuttx/sched/prctl.c @@ -140,7 +140,7 @@ int prctl(int option, ...) /* The returned value will be null-terminated, truncating if necessary */ strncpy(name, tcb->name, CONFIG_TASK_NAME_SIZE-1); - name[CONFIG_TASK_NAME_SIZE-1]; + name[CONFIG_TASK_NAME_SIZE-1] = '\0'; } } break; diff --git a/nuttx/sched/pthread_exit.c b/nuttx/sched/pthread_exit.c index 31ac62362..b8183142a 100644 --- a/nuttx/sched/pthread_exit.c +++ b/nuttx/sched/pthread_exit.c @@ -1,7 +1,7 @@ /************************************************************************ * sched/pthread_exit.c * - * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,7 @@ #include +#include #include #include #include @@ -92,7 +93,7 @@ void pthread_exit(FAR void *exit_value) { - int error_code = (int)exit_value; + int error_code = (int)((intptr_t)exit_value); int status; sdbg("exit_value=%p\n", exit_value); diff --git a/nuttx/sched/sem_open.c b/nuttx/sched/sem_open.c index cd9ca6129..d5b22f018 100644 --- a/nuttx/sched/sem_open.c +++ b/nuttx/sched/sem_open.c @@ -1,8 +1,8 @@ /**************************************************************************** * sched/sem_open.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2007, 2008, 2012 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 diff --git a/nuttx/sched/sig_deliver.c b/nuttx/sched/sig_deliver.c index 2244ca2fe..bbfe0965c 100644 --- a/nuttx/sched/sig_deliver.c +++ b/nuttx/sched/sig_deliver.c @@ -1,8 +1,8 @@ /**************************************************************************** * sched/sig_deliver.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2007, 2008, 2012 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 @@ -86,7 +86,6 @@ void sig_deliver(FAR _TCB *stcb) { - pid_t rpid; FAR sigq_t *sigq; FAR sigq_t *next; sigset_t savesigprocmask; @@ -129,12 +128,6 @@ void sig_deliver(FAR _TCB *stcb) savesigprocmask = stcb->sigprocmask; stcb->sigprocmask = savesigprocmask | sigq->mask | SIGNO2SET(sigq->info.si_signo); - /* The current tasks process.ID. We'll need this later to see if - * the signal handler caused a context switch. - */ - - rpid = getpid(); - /* Deliver the signal */ (*sigq->action.sighandler)(sigq->info.si_signo, &sigq->info, NULL); diff --git a/nuttx/sched/wd_start.c b/nuttx/sched/wd_start.c index 1f37dbf99..a2f19fbdc 100644 --- a/nuttx/sched/wd_start.c +++ b/nuttx/sched/wd_start.c @@ -1,8 +1,8 @@ /**************************************************************************** * sched/wd_start.c * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2007-2009, 2012 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 @@ -294,7 +294,6 @@ int wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...) void wd_timer(void) { - pid_t pid; FAR wdog_t *wdog; /* Check if there are any active watchdogs to process */ @@ -333,12 +332,6 @@ void wd_timer(void) wdog->active = false; - /* Get the current task's process ID. We'll need this later to - * see if the watchdog function caused a context switch. - */ - - pid = getpid(); - /* Execute the watchdog function */ up_setpicbase(wdog->picbase); -- cgit v1.2.3