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
This commit is contained in:
patacongo 2012-05-02 15:36:19 +00:00
parent 9f5d403c57
commit a65d283e96
16 changed files with 118 additions and 58 deletions

View File

@ -1,8 +1,8 @@
/**************************************************************************
* up_setjmp.S
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2007, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,8 +1,8 @@
/****************************************************************************
* drivers/mmcsd/mmcsd_spi.c
*
* Copyright (C) 2008-2010, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2008-2010, 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@ -1,8 +1,8 @@
/****************************************************************************
* drivers/mtd/rammtd.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@ -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 <uros.platise@isotel.eu>
* Gregory Nutt <spudmonkey@racsa.co.cr>
* Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@ -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;

View File

@ -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 */

View File

@ -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);
- 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

View File

@ -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;

View File

@ -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 <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -39,6 +39,7 @@
#include <nuttx/config.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
@ -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);

View File

@ -1,8 +1,8 @@
/****************************************************************************
* sched/sem_open.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@ -1,8 +1,8 @@
/****************************************************************************
* sched/sig_deliver.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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);

View File

@ -1,8 +1,8 @@
/****************************************************************************
* sched/wd_start.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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);