summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-01-09 14:20:31 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-01-09 14:20:31 +0000
commita2c6c96d13de37908120dcae297530665836f8e8 (patch)
treed77644599c129cf8d3699215096e70c656916e32
parent5205351a1af35821a02ef91090375593e05415bc (diff)
downloadpx4-nuttx-a2c6c96d13de37908120dcae297530665836f8e8.tar.gz
px4-nuttx-a2c6c96d13de37908120dcae297530665836f8e8.tar.bz2
px4-nuttx-a2c6c96d13de37908120dcae297530665836f8e8.zip
Changes for ZNeo compile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@539 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/arch/z16/src/z16f/chip.h122
-rw-r--r--nuttx/configs/z16f2800100zcog/Make.defs20
-rw-r--r--nuttx/configs/z16f2800100zcog/defconfig8
-rw-r--r--nuttx/include/nuttx/sched.h6
-rw-r--r--nuttx/mm/mm_environment.h25
-rw-r--r--nuttx/mm/mm_sem.c50
-rw-r--r--nuttx/sched/os_internal.h2
7 files changed, 188 insertions, 45 deletions
diff --git a/nuttx/arch/z16/src/z16f/chip.h b/nuttx/arch/z16/src/z16f/chip.h
new file mode 100644
index 000000000..d8d5a4177
--- /dev/null
+++ b/nuttx/arch/z16/src/z16f/chip.h
@@ -0,0 +1,122 @@
+/************************************************************************************
+ * arch/z16/src/z16f/chip.h
+ * include/arch/chip/chip.h
+ *
+ * Copyright (C) 2008 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __Z16F_CHIP_H
+#define __Z16F_CHIP_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Z16F Chip Variants */
+
+#if defined(CONFIG_ARCH_CHIP_Z16F2810)
+# define Z16F_INVMEM_SIZE (128*1024)
+# define Z16F_IRAM_SIZE (4*1024)
+# undef Z16F_HAVE_EXTMEM
+#elif defined(CONFIG_ARCH_CHIP_Z16F2811)
+# define Z16F_INVMEM_SIZE (128*1024)
+# define Z16F_IRAM_SIZE (4*1024)
+# define Z16F_HAVE_EXTMEM 1
+#elif defined(CONFIG_ARCH_CHIP_Z16F3211)
+# define Z16F_INVMEM_SIZE (32*1024)
+# define Z16F_IRAM_SIZE (2*1024)
+# define Z16F_HAVE_EXTMEM 1
+#elif defined(CONFIG_ARCH_CHIP_Z16F6411)
+# define Z16F_INVMEM_SIZE (64*1024)
+# define Z16F_IRAM_SIZE (4*1024)
+# define Z16F_HAVE_EXTMEM 1
+#else
+# error "Z16F chip variant not specified"
+#endif
+
+/* Memory areas
+ *
+ * Internal non-volatile memory starts at address zero. The size
+ * of the internal non-volatile memory is chip-dependent.
+ */
+
+#define Z16F_INVMEM_BASE 0x000000
+
+/* Most chip variants support external memory */
+
+#ifdef Z16F_HAVE_EXTMEM
+# define Z16F_EXTMEMCS0_BASE 0x020000 /* External memory at CS0 */
+# define Z16F_EXTMEMCS0_SIZE 0x7e0000 /* (actual depends on board) */
+# define Z16F_EXTMEMCS1_BASE 0x800000 /* External memory at CS1 */
+# define Z16F_EXTMEMCS1_SIZE 0x700000 /* (actual depends on board) */
+# define Z16F_EXTMEMCS2A_BASE 0xf00000 /* External memory at CS2 */
+# define Z16F_EXTMEMCS2A_SIZE 0x0f8000 /* (actual depends on board) */
+# define Z16F_EXTMEMCS2B_BASE 0xffc000 /* External memory at CS2 */
+# define Z16F_EXTMEMCS2B_SIZE 0x000800 /* (actual depends on board) */
+#endif
+
+/* Internal RAM always ends at 0xffbfff. The IRAM base address depends
+ * on the size of the IRAM supported by the chip.
+ */
+
+#define Z16F_IRAM_BASE (0xffc000 - Z16F_IRAM_SIZE)
+
+/* External memory mapped peripherals, internal I/O memory and SFRS */
+
+#define Z16F_EXTIO_BASE 0xffc800 /* External peripherals CS3-5 */
+#define Z16F_EXTIO_SIZE 0x001800
+#define Z16F_IIO_BASE 0xffe000 /* Internal I/O memory and SFRs */
+#define Z16F_IIO_SIZE 0x001fff
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif /* __Z16F_CHIP_H */
diff --git a/nuttx/configs/z16f2800100zcog/Make.defs b/nuttx/configs/z16f2800100zcog/Make.defs
index ee7a692ce..3b11c96d0 100644
--- a/nuttx/configs/z16f2800100zcog/Make.defs
+++ b/nuttx/configs/z16f2800100zcog/Make.defs
@@ -37,10 +37,10 @@ include ${TOPDIR}/.config
# These are the directories where the ZNeo-II toolchain is installed
-ZDSINSTALLDIR = C:/Program\ Files/ZiLOG/ZDSII_ZNEO_4.10.2
-ZDSBINDIR = $(ZDSINSTALLDIR)/bin
-ZDSSTDINCDIR = $(ZDSINSTALLDIR)/include/std
-ZDSZILOGINCDIR = $(ZDSINSTALLDIR)/include/zilog
+ZDSINSTALLDIR := C:/Program\ Files/ZiLOG/ZDSII_ZNEO_4.10.2
+ZDSBINDIR := $(ZDSINSTALLDIR)/bin
+ZDSSTDINCDIR := $(ZDSINSTALLDIR)/include/std
+ZDSZILOGINCDIR := $(ZDSINSTALLDIR)/include/zilog
# These are the same directories but with the directory separator
# character swapped as needed by the ZNeo-II compiler
@@ -49,6 +49,12 @@ WTOPDIR := ${shell cygpath -w $(TOPDIR)}
WZDSSTDINCDIR := ${shell cygpath -w $(ZDSSTDINCDIR)}
WZDSZILOGINCDIR := ${shell cygpath -w $(ZDSZILOGINCDIR)}
+# Escaped versions
+
+ETOPDIR := ${shell echo "$(WTOPDIR)" | sed -e "s/ /%20/g"}
+EZDSSTDINCDIR := ${shell echo "$(WZDSSTDINCDIR)" | sed -e "s/ /%20/g"}
+EZDSZILOGINCDIR := ${shell echo "$(WZDSZILOGINCDIR)" | sed -e "s/ /%20/g"}
+
# Assembler definitions
ifeq ("${CONFIG_DEBUG}","y")
@@ -61,7 +67,7 @@ ARCHASMCPUFLAGS = -cpu:Z16F2811AL -NOigcase
ARCHASMLIST = -NOlistmac -name -pagelen:56 -pagewidth:80 -quiet
ARCHASMWARNINGS = -warn
ARCHASMDEFINES = -define:_Z16F2811AL=1 -define:_Z16K_SERIES=1 -define:_Z16F_SERIES=1 \ -define:__ASSEMBLY__
-ARCHASMINCLUDES = -include:'$(WTOPDIR)\include;$(WZDSSTDINCDIR);$(WZDSZILOGINCDIR)'
+ARCHASMINCLUDES = -include:'$(ETOPDIR)\include;$(EZDSSTDINCDIR);$(EZDSZILOGINCDIR)'
AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) \
$(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)
@@ -121,8 +127,8 @@ define ASSEMBLE
endef
define ARCHIVE
- @echo "AR: $2"; \
- @$(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
+ echo "AR: $2"; \
+ $(AR) $(ARFLAGS) $1=-+$2 || { echo "$(AR) $1=-+$2 FAILED!" ; exit 1 ; }
endef
# This is the tool to use for dependencies (i.e., none)
diff --git a/nuttx/configs/z16f2800100zcog/defconfig b/nuttx/configs/z16f2800100zcog/defconfig
index da6ecf503..7b6c85b31 100644
--- a/nuttx/configs/z16f2800100zcog/defconfig
+++ b/nuttx/configs/z16f2800100zcog/defconfig
@@ -40,6 +40,10 @@
# CONFIG_ARCH_Z16 - Set if processor is Z16
# CONFIG_ARCH_CHIP - Identifies the specific chip
# CONFIG_ARCH_CHIP_Z16F - Set if this the Z16F
+# CONFIG_ARCH_CHIP_Z16F2810 - Identifies chip variant
+# CONFIG_ARCH_CHIP_Z16F2811
+# CONFIG_ARCH_CHIP_Z16F3211
+# CONFIG_ARCH_CHIP_Z16F6411
# CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence,
# the board that supports the particular chip or SoC.
# CONFIG_ARCH_BOARD_name - for use in C code
@@ -49,6 +53,10 @@ CONFIG_ARCH=z16
CONFIG_ARCH_Z16=y
CONFIG_ARCH_CHIP=z16f
CONFIG_ARCH_CHIP_Z16F=y
+CONFIG_ARCH_CHIP_Z16F2810=n
+CONFIG_ARCH_CHIP_Z16F2811=y
+CONFIG_ARCH_CHIP_Z16F3211=n
+CONFIG_ARCH_CHIP_Z16F6411=n
CONFIG_ARCH_BOARD=z16f2800100zcog
CONFIG_ARCH_BOARD_Z16F2800100ZCOG=y
CONFIG_DRAM_SIZE=65536
diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h
index 3f7d1ae10..7386979c8 100644
--- a/nuttx/include/nuttx/sched.h
+++ b/nuttx/include/nuttx/sched.h
@@ -90,11 +90,13 @@ enum tstate_e
TSTATE_TASK_RUNNING = 3, /* READY_TO_RUN - And running */
TSTATE_TASK_INACTIVE = 4, /* BLOCKED - Initialized but not yet activated */
- TSTATE_WAIT_SEM = 5, /* BLOCKED - Waiting for a semaphore */
+ TSTATE_WAIT_SEM = 5 /* BLOCKED - Waiting for a semaphore */
#ifndef CONFIG_DISABLE_SIGNALS
- TSTATE_WAIT_SIG = 6, /* BLOCKED - Waiting for a signal */
+ ,
+ TSTATE_WAIT_SIG = 6 /* BLOCKED - Waiting for a signal */
#endif
#ifndef CONFIG_DISABLE_MQUEUE
+ ,
TSTATE_WAIT_MQNOTEMPTY, /* BLOCKED - Waiting for a MQ to become not empty. */
TSTATE_WAIT_MQNOTFULL /* BLOCKED - Waiting for a MQ to become not full. */
#endif
diff --git a/nuttx/mm/mm_environment.h b/nuttx/mm/mm_environment.h
index 973fe533c..b844c2133 100644
--- a/nuttx/mm/mm_environment.h
+++ b/nuttx/mm/mm_environment.h
@@ -1,7 +1,7 @@
-/************************************************************
+/****************************************************************************
* mm_environment.h
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
#ifndef __MM_ENVIRONMENT_H
#define __MM_ENVIRONMENT_H
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
/* The platform configuratioin file will not be included
* when the memory manager is built for the host-based
@@ -61,9 +61,9 @@
# include <assert.h>
#endif
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
/* Special definitions used when the memory mnager is built
* for the host-based test harness.
@@ -74,6 +74,7 @@
/* Fake NuttX dependencies */
# define FAR /* Normally in compiler.h */
+# define CONFIG_CPP_HAVE_VARARGS 1 /* Normally in compiler.h */
# define CONFIG_MM_REGIONS 2 /* Normally in config.h */
# define CONFIG_CAN_PASS_STRUCTS 1 /* Normally in config.h */
# undef CONFIG_SMALL_MEMORY /* Normally in config.h */
@@ -116,12 +117,12 @@ extern void mm_addregion(FAR void *heapstart, size_t heapsize);
# define mm_errno (*get_errno_ptr())
#endif
-/************************************************************
+/****************************************************************************
* Public Types
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Pulblic Function Prototypes
- ************************************************************/
+ ****************************************************************************/
#endif /* __MM_ENVIRONMENT_H */
diff --git a/nuttx/mm/mm_sem.c b/nuttx/mm/mm_sem.c
index 66c667061..74b24af56 100644
--- a/nuttx/mm/mm_sem.c
+++ b/nuttx/mm/mm_sem.c
@@ -1,7 +1,7 @@
-/************************************************************
+/****************************************************************************
* mm_sem.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include "mm_environment.h"
#include <unistd.h>
@@ -44,9 +44,9 @@
#include <assert.h>
#include "mm_internal.h"
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
/* Define the following to enable semaphore state monitoring */
//#define MONITOR_MM_SEMAPHORE 1
@@ -59,12 +59,16 @@
# define msemdbg printf
# endif
#else
-# define msemdbg(x...)
+# ifdef CONFIG_CPP_HAVE_VARARGS
+# define msemdbg(x...)
+# else
+# define msemdbg (void)
+# endif
#endif
-/************************************************************
+/****************************************************************************
* Private Data
- ************************************************************/
+ ****************************************************************************/
/* Mutually exclusive access to this data set is enforced with
* the following (un-named) semaphore. */
@@ -73,17 +77,17 @@ static sem_t g_mm_semaphore;
static pid_t g_holder;
static int g_counts_held;
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Name: mm_seminitialize
*
* Description:
* Initialize the MM mutex
*
- ************************************************************/
+ ****************************************************************************/
void mm_seminitialize(void)
{
@@ -97,7 +101,7 @@ void mm_seminitialize(void)
g_counts_held = 0;
}
-/************************************************************
+/****************************************************************************
* Name: mm_trysemaphore
*
* Description:
@@ -107,7 +111,7 @@ void mm_seminitialize(void)
* impossible to wait on a semaphore (e.g., the idle process
* when it performs its background memory cleanup).
*
- ************************************************************/
+ ****************************************************************************/
#ifndef MM_TEST
int mm_trysemaphore(void)
@@ -141,14 +145,14 @@ int mm_trysemaphore(void)
}
#endif
-/************************************************************
+/****************************************************************************
* Name: mm_takesemaphore
*
* Description:
* Take the MM mutex. This is the normal action before all
* memory management actions.
*
- ************************************************************/
+ ****************************************************************************/
void mm_takesemaphore(void)
{
@@ -186,13 +190,13 @@ void mm_takesemaphore(void)
g_holder, g_counts_held);
}
-/************************************************************
+/****************************************************************************
* Name: mm_givesemaphore
*
* Description:
* Release the MM mutex when it is not longer needed.
*
- ************************************************************/
+ ****************************************************************************/
void mm_givesemaphore(void)
{
@@ -223,14 +227,14 @@ void mm_givesemaphore(void)
}
}
-/************************************************************
+/****************************************************************************
* Name: mm_getsemaphore
*
* Description:
* Return the current value of the MM semaphore (for test
* purposes only)
*
- ************************************************************/
+ ****************************************************************************/
#ifdef MM_TEST
int mm_getsemaphore(void)
diff --git a/nuttx/sched/os_internal.h b/nuttx/sched/os_internal.h
index a54157cd8..f1ec07b56 100644
--- a/nuttx/sched/os_internal.h
+++ b/nuttx/sched/os_internal.h
@@ -74,7 +74,7 @@ enum os_crash_codes_e
OSERR_EXITFROMINTERRUPT, /* Interrupt code attempted to exit */
OSERR_BADUNBLOCKSTATE, /* Attempt to unblock from bad state */
OSERR_BADBLOCKSTATE, /* Attempt to block from bad state */
- OSERR_BADREPRIORITIZESTATE, /* Attempt to reprioritize in bad state or priority */
+ OSERR_BADREPRIORITIZESTATE /* Attempt to reprioritize in bad state or priority */
};
/* Special task IDS */