summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-06-05 15:11:43 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-06-05 15:47:36 +0200
commit5f3a8703b307aab697a8fa9045c7135f2c1956c7 (patch)
tree73113ddfb063d1e8799d350175f929ea3f543b2f
parentce8652930b188672b1e664cff8a7648675649a70 (diff)
Add RTEMS support
-rw-r--r--rtems/.gitignore1
-rw-r--r--rtems/Makefile87
-rw-r--r--rtems/README3
-rw-r--r--rtems/gtest-main.h90
-rwxr-xr-xrtems/install.sh25
5 files changed, 206 insertions, 0 deletions
diff --git a/rtems/.gitignore b/rtems/.gitignore
new file mode 100644
index 0000000..378eac2
--- /dev/null
+++ b/rtems/.gitignore
@@ -0,0 +1 @@
+build
diff --git a/rtems/Makefile b/rtems/Makefile
new file mode 100644
index 0000000..9df7f6a
--- /dev/null
+++ b/rtems/Makefile
@@ -0,0 +1,87 @@
+CXX = $(TARGET)-g++
+AR = $(TARGET)-ar
+RANLIB = $(TARGET)-ranlib
+
+TOPSRCDIR = ..
+
+SRCDIR = $(TOPSRCDIR)/src
+
+INCLUDEDIR = $(TOPSRCDIR)/include
+
+CPPFLAGS = -I $(TOPSRCDIR)/. -I $(INCLUDEDIR)
+
+DEPFLAGS = -MT $@ -MD -MP -MF $(basename $@).d
+
+WARNFLAGS = -Wall -Wextra -Wformat=2 -Wcast-qual -Wconversion
+
+BUILDDIR = build/$(TARGET)/$(MULTILIBDIR)
+
+LIB_SRCS =
+LIB_SRCS += $(SRCDIR)/gtest.cc
+LIB_SRCS += $(SRCDIR)/gtest-death-test.cc
+LIB_SRCS += $(SRCDIR)/gtest-filepath.cc
+LIB_SRCS += $(SRCDIR)/gtest-port.cc
+LIB_SRCS += $(SRCDIR)/gtest-printers.cc
+LIB_SRCS += $(SRCDIR)/gtest-test-part.cc
+LIB_SRCS += $(SRCDIR)/gtest-typed-test.cc
+
+LIB_OBJS = $(LIB_SRCS:$(SRCDIR)/%.cc=$(BUILDDIR)/%.o)
+LIB_DEPS = $(LIB_SRCS:$(SRCDIR)/%.cc=$(BUILDDIR)/%.d)
+
+LIB = $(BUILDDIR)/libgtest.a
+
+all: $(BUILDDIR) $(LIB)
+
+$(BUILDDIR):
+ mkdir -p $(BUILDDIR)
+
+$(LIB): $(LIB_OBJS)
+ $(AR) rcu $@ $^
+ $(RANLIB) $@
+
+$(BUILDDIR)/%.o: $(SRCDIR)/%.cc
+ $(CXX) $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) $(WARNFLAGS) -c $< -o $@
+
+install: all
+ install -m 644 -t $(PREFIX)/$(TARGET)/lib/$(MULTILIBDIR) $(LIB)
+
+RTEMS_HEADERS =
+RTEMS_HEADERS += $(TOPSRCDIR)/rtems/gtest-main.h
+
+GTEST_HEADERS =
+GTEST_HEADERS += $(INCLUDEDIR)/gtest/gtest.h
+GTEST_HEADERS += $(INCLUDEDIR)/gtest/gtest-death-test.h
+GTEST_HEADERS += $(INCLUDEDIR)/gtest/gtest-message.h
+GTEST_HEADERS += $(INCLUDEDIR)/gtest/gtest-param-test.h
+GTEST_HEADERS += $(INCLUDEDIR)/gtest/gtest_pred_impl.h
+GTEST_HEADERS += $(INCLUDEDIR)/gtest/gtest-printers.h
+GTEST_HEADERS += $(INCLUDEDIR)/gtest/gtest_prod.h
+GTEST_HEADERS += $(INCLUDEDIR)/gtest/gtest-spi.h
+GTEST_HEADERS += $(INCLUDEDIR)/gtest/gtest-test-part.h
+GTEST_HEADERS += $(INCLUDEDIR)/gtest/gtest-typed-test.h
+
+GTEST_INTERNAL_HEADERS =
+GTEST_INTERNAL_HEADERS += $(INCLUDEDIR)/gtest/internal/gtest-death-test-internal.h
+GTEST_INTERNAL_HEADERS += $(INCLUDEDIR)/gtest/internal/gtest-filepath.h
+GTEST_INTERNAL_HEADERS += $(INCLUDEDIR)/gtest/internal/gtest-internal.h
+GTEST_INTERNAL_HEADERS += $(INCLUDEDIR)/gtest/internal/gtest-linked_ptr.h
+GTEST_INTERNAL_HEADERS += $(INCLUDEDIR)/gtest/internal/gtest-param-util-generated.h
+GTEST_INTERNAL_HEADERS += $(INCLUDEDIR)/gtest/internal/gtest-param-util.h
+GTEST_INTERNAL_HEADERS += $(INCLUDEDIR)/gtest/internal/gtest-port.h
+GTEST_INTERNAL_HEADERS += $(INCLUDEDIR)/gtest/internal/gtest-string.h
+GTEST_INTERNAL_HEADERS += $(INCLUDEDIR)/gtest/internal/gtest-tuple.h
+GTEST_INTERNAL_HEADERS += $(INCLUDEDIR)/gtest/internal/gtest-type-util.h
+
+INSTALL_INCLUDEDIR = $(PREFIX)/$(TARGET)/include
+
+install-header:
+ mkdir -p $(INSTALL_INCLUDEDIR)/rtems
+ mkdir -p $(INSTALL_INCLUDEDIR)/gtest/internal
+ install -m 644 -t $(INSTALL_INCLUDEDIR)/rtems $(RTEMS_HEADERS)
+ install -m 644 -t $(INSTALL_INCLUDEDIR)/gtest $(GTEST_HEADERS)
+ install -m 644 -t $(INSTALL_INCLUDEDIR)/gtest/internal $(GTEST_INTERNAL_HEADERS)
+
+clean:
+ rm -rf $(BUILDDIR)
+
+-include $(LIB_DEPS)
diff --git a/rtems/README b/rtems/README
new file mode 100644
index 0000000..0ed4dc8
--- /dev/null
+++ b/rtems/README
@@ -0,0 +1,3 @@
+The "install.sh" script will install the Google C++ Testing Framework for all
+installed RTEMS targets with a C++ compiler. The libgtest.a is build for every
+multilib. The header files are installed per target.
diff --git a/rtems/gtest-main.h b/rtems/gtest-main.h
new file mode 100644
index 0000000..81ec91e
--- /dev/null
+++ b/rtems/gtest-main.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2010-2012 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <info@embedded-brains.de>
+ *
+ * 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.
+ *
+ * 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 GTEST_MAIN_H
+#define GTEST_MAIN_H
+
+#include <stdlib.h>
+
+#include <gtest/gtest.h>
+
+extern "C" {
+ void *POSIX_Init(void *)
+ {
+ int argc = 0;
+ char **argv = NULL;
+ testing::InitGoogleTest(&argc, argv);
+
+ int exit_status = RUN_ALL_TESTS();
+
+ exit(exit_status);
+
+ return NULL;
+ }
+}
+
+#define CONFIGURE_INIT
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
+
+#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+#define CONFIGURE_FILESYSTEM_IMFS
+#define CONFIGURE_FILESYSTEM_DOSFS
+
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 64
+
+#define CONFIGURE_MAXIMUM_DRIVERS 32
+
+#define CONFIGURE_MAXIMUM_TASK_VARIABLES 8
+
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 8
+
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 32
+
+#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 32
+
+#define CONFIGURE_UNLIMITED_OBJECTS
+
+#define CONFIGURE_UNIFIED_WORK_AREAS
+
+#define CONFIGURE_BDBUF_BUFFER_MIN_SIZE 512
+#define CONFIGURE_BDBUF_BUFFER_MAX_SIZE (128 * 1024)
+#define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE (8 * CONFIGURE_BDBUF_BUFFER_MAX_SIZE)
+#define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS 0
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#include <rtems.h>
+#include <rtems/confdefs.h>
+
+#endif /* GTEST_MAIN_H */
diff --git a/rtems/install.sh b/rtems/install.sh
new file mode 100755
index 0000000..9ec215b
--- /dev/null
+++ b/rtems/install.sh
@@ -0,0 +1,25 @@
+#! /bin/sh
+
+rtems_version="4.11"
+for target in arm-rtems$rtems_version arm-rtemseabi$rtems_version \
+ avr-rtems$rtems_version bfin-rtems$rtems_version \
+ h8300-rtems$rtems_version i386-rtems$rtems_version \
+ lm32-rtems$rtems_version m32c-rtems$rtems_version \
+ m32r-rtems$rtems_version m68k-rtems$rtems_version \
+ mips-rtems$rtems_version nios2-rtems$rtems_version \
+ powerpc-rtems$rtems_version sh-rtems$rtems_version \
+ sparc64-rtems$rtems_version sparc-rtems$rtems_version ; do
+ CXX="$target-g++"
+ if which "$CXX" ; then
+ prefix=`"$CXX" --verbose 2>&1 | grep 'Configured with' | sed 's/.*prefix=//' | sed 's/ .*//'`
+
+ for i in `"$CXX" --print-multi-lib` ; do
+ multilibdir=`echo $i | sed 's/;.*//'`
+ CFLAGS=`echo $i | sed 's/.*;//' | sed 's/@/ -/g'`
+ CFLAGS="$CFLAGS -O2 -g"
+ make -f Makefile PREFIX="$prefix" TARGET="$target" CFLAGS="$CFLAGS" MULTILIBDIR="$multilibdir" install
+ done
+
+ make -f Makefile PREFIX="$prefix" TARGET="$target" install-header
+ fi
+done