summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2009-01-24 03:47:09 +0000
committerMichael Sevakis <jethead71@rockbox.org>2009-01-24 03:47:09 +0000
commitb0befadad1d9ec691ba647b948422e66a43f3674 (patch)
tree92f5fe47e0826daab66d2e321c96412841392058 /apps/plugins
parentef8413eb4fd7fead45d33b3ecae003210978b85d (diff)
Include divide-by-zero handling within plugins and codecs for ARM processors.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19834 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/lib/SOURCES4
-rw-r--r--apps/plugins/lib/gcc-support.c30
-rw-r--r--apps/plugins/plugins.make6
-rw-r--r--apps/plugins/test_codec.c3
4 files changed, 42 insertions, 1 deletions
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES
index bb7da12e8b..c90613623c 100644
--- a/apps/plugins/lib/SOURCES
+++ b/apps/plugins/lib/SOURCES
@@ -1,3 +1,7 @@
+#ifdef CPU_ARM
+/* For now, only ARM uses this for __div0 */
+gcc-support.c
+#endif
oldmenuapi.c
configfile.c
fixedpoint.c
diff --git a/apps/plugins/lib/gcc-support.c b/apps/plugins/lib/gcc-support.c
new file mode 100644
index 0000000000..91744d7fbc
--- /dev/null
+++ b/apps/plugins/lib/gcc-support.c
@@ -0,0 +1,30 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Copyright (C) 2009 by Michael Sevakis
+*
+* Miscellaneous compiler support routines.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied
+*
+****************************************************************************/
+#include "plugin.h"
+
+#ifdef CPU_ARM
+void __attribute__((naked)) __div0(void)
+{
+ asm volatile("bx %0" : : "r"(rb->__div0));
+}
+#endif
diff --git a/apps/plugins/plugins.make b/apps/plugins/plugins.make
index c6c399db48..0f6804d591 100644
--- a/apps/plugins/plugins.make
+++ b/apps/plugins/plugins.make
@@ -17,6 +17,10 @@ ROCKS := $(subst $(ROOTDIR),$(BUILDDIR),$(ROCKS))
PLUGINLIB := $(BUILDDIR)/apps/plugins/libplugin.a
PLUGINLIB_SRC = $(call preprocess, $(APPSDIR)/plugins/lib/SOURCES)
OTHER_SRC += $(PLUGINLIB_SRC)
+# include gcc-support routines for linking first if in SOURCES
+ifneq "$(findstring gcc-support.c,$(PLUGINLIB_SRC))" ""
+GCCSUPPORT_OBJ := $(BUILDDIR)/apps/plugins/lib/gcc-support.o
+endif
PLUGINLIB_OBJ := $(PLUGINLIB_SRC:.c=.o)
PLUGINLIB_OBJ := $(PLUGINLIB_OBJ:.S=.o)
@@ -70,7 +74,7 @@ else
PLUGINLDFLAGS = -T$(PLUGINLINK_LDS) -Wl,--gc-sections -Wl,-Map,$*.map
endif
-$(BUILDDIR)/%.rock: $(BUILDDIR)/%.o $(PLUGINLINK_LDS)
+$(BUILDDIR)/%.rock: $(GCCSUPPORT_OBJ) $(BUILDDIR)/%.o $(PLUGINLINK_LDS)
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(BUILDDIR)/$*.elf \
$(filter %.o, $^) \
$(filter %.a, $^) \
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c
index 48fceb9cf2..ec5c8e9800 100644
--- a/apps/plugins/test_codec.c
+++ b/apps/plugins/test_codec.c
@@ -494,6 +494,9 @@ static void init_ci(void)
ci.semaphore_release = rb->semaphore_release;
#endif
+#ifdef CPU_ARM
+ ci.__div0 = rb->__div0;
+#endif
}
static void codec_thread(void)