summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2013-04-16 17:47:58 -0400
committerMichael Sevakis <jethead71@rockbox.org>2013-04-26 00:11:04 +0200
commit95e23defb085ee1a846ec2d379368485921d5aee (patch)
tree0bdb31f562fef8c7ff5f3f7dba9c54f9c1e84a76
parent8829e909b4e756bfb2ad9210eec61d0dc55e1731 (diff)
downloadrockbox-95e23defb085ee1a846ec2d379368485921d5aee.tar.gz
rockbox-95e23defb085ee1a846ec2d379368485921d5aee.zip
Make fixepoint.c as a shared library (libfixedpoint.a).
Change-Id: Icc10d6e85f890c432f191233a4d64e09f00be43d Reviewed-on: http://gerrit.rockbox.org/456 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
-rw-r--r--apps/SOURCES1
-rw-r--r--apps/plugins/bounce.c2
-rw-r--r--apps/plugins/bubbles.c2
-rw-r--r--apps/plugins/clock/clock_draw_analog.c2
-rw-r--r--apps/plugins/cube.c2
-rw-r--r--apps/plugins/fft/math.h2
-rw-r--r--apps/plugins/fire.c2
-rw-r--r--apps/plugins/lib/SOURCES1
-rw-r--r--apps/plugins/lib/fixedpoint.c1
-rw-r--r--apps/plugins/lib/fixedpoint.h26
-rw-r--r--apps/plugins/oscilloscope.c4
-rw-r--r--apps/plugins/plasma.c2
-rw-r--r--apps/plugins/plugins.make2
-rw-r--r--apps/plugins/vu_meter.c2
-rw-r--r--flash/bootbox/bootbox.make2
-rw-r--r--lib/fixedpoint/fixedpoint.c (renamed from apps/fixedpoint.c)17
-rw-r--r--lib/fixedpoint/fixedpoint.h (renamed from firmware/include/fixedpoint.h)11
-rw-r--r--lib/fixedpoint/fixedpoint.make36
-rw-r--r--lib/rbcodec/codecs/adx.c2
-rw-r--r--lib/rbcodec/codecs/codecs.make2
-rw-r--r--lib/rbcodec/codecs/lib/SOURCES1
-rw-r--r--lib/rbcodec/codecs/lib/fixedpoint.c1
-rw-r--r--lib/rbcodec/codecs/lib/fixedpoint.h26
-rw-r--r--lib/rbcodec/rbcodec.make4
-rw-r--r--lib/rbcodec/test/SOURCES1
-rw-r--r--tools/database/SOURCES1
-rw-r--r--tools/database/database.make9
-rw-r--r--tools/root.make28
28 files changed, 91 insertions, 101 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 6005460a5a..e8944d5907 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -163,7 +163,6 @@ radio/radioart.c
#if INPUT_SRC_CAPS != 0
audio_path.c
#endif /* INPUT_SRC_CAPS != 0 */
-fixedpoint.c
pcmbuf.c
codec_thread.c
playback.c
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c
index ece8440e53..9e0ae7b563 100644
--- a/apps/plugins/bounce.c
+++ b/apps/plugins/bounce.c
@@ -20,7 +20,7 @@
**************************************************************************/
#include "plugin.h"
#include "time.h"
-#include "lib/fixedpoint.h"
+#include "fixedpoint.h"
#include "lib/pluginlib_actions.h"
diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c
index eef4f4dc19..e796afd672 100644
--- a/apps/plugins/bubbles.c
+++ b/apps/plugins/bubbles.c
@@ -22,10 +22,10 @@
****************************************************************************/
#include "plugin.h"
+#include "fixedpoint.h"
#include "lib/xlcd.h"
#include "lib/pluginlib_actions.h"
-#include "lib/fixedpoint.h"
#include "lib/playback_control.h"
#include "lib/highscore.h"
diff --git a/apps/plugins/clock/clock_draw_analog.c b/apps/plugins/clock/clock_draw_analog.c
index bda7241d33..62ada08c34 100644
--- a/apps/plugins/clock/clock_draw_analog.c
+++ b/apps/plugins/clock/clock_draw_analog.c
@@ -19,9 +19,9 @@
*
****************************************************************************/
+#include "fixedpoint.h"
#include "clock_draw_analog.h"
#include "lib/xlcd.h"
-#include "lib/fixedpoint.h"
#include "clock_bitmaps.h"
#include "clock_bitmap_strings.h"
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c
index b6031af975..34252e857e 100644
--- a/apps/plugins/cube.c
+++ b/apps/plugins/cube.c
@@ -21,6 +21,7 @@
*
***************************************************************************/
#include "plugin.h"
+#include "fixedpoint.h"
#include "lib/playergfx.h"
#include "lib/pluginlib_exit.h"
#if LCD_DEPTH > 1
@@ -31,7 +32,6 @@
#include "lib/mylcd.h" /* MYLCD_CFG_GREYLIB or MYLCD_CFG_PGFX */
#endif
#include "lib/xlcd.h"
-#include "lib/fixedpoint.h"
/* Loops that the values are displayed */
#define DISP_TIME 30
diff --git a/apps/plugins/fft/math.h b/apps/plugins/fft/math.h
index ffacf1eedb..5545c497f2 100644
--- a/apps/plugins/fft/math.h
+++ b/apps/plugins/fft/math.h
@@ -3,7 +3,7 @@
#include <inttypes.h>
#include <math.h>
-#include "lib/fixedpoint.h"
+#include "fixedpoint.h"
#define Q_MUL(a, b, bits) (( (int64_t) (a) * (int64_t) (b) ) >> (bits))
#define Q15_MUL(a, b) Q_MUL(a,b,15)
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c
index 5813894d4f..478296b5f8 100644
--- a/apps/plugins/fire.c
+++ b/apps/plugins/fire.c
@@ -22,10 +22,10 @@
****************************************************************************/
#include "plugin.h"
+#include "fixedpoint.h"
#include "lib/helper.h"
#include "lib/pluginlib_actions.h"
-#include "lib/fixedpoint.h"
#ifndef HAVE_LCD_COLOR
#include "lib/grey.h"
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES
index d49605f1ad..0a125dbbe4 100644
--- a/apps/plugins/lib/SOURCES
+++ b/apps/plugins/lib/SOURCES
@@ -4,7 +4,6 @@ helper.c
md5.c
jhash.c
configfile.c
-fixedpoint.c
playback_control.c
rgb_hsv.c
highscore.c
diff --git a/apps/plugins/lib/fixedpoint.c b/apps/plugins/lib/fixedpoint.c
deleted file mode 100644
index 352e246673..0000000000
--- a/apps/plugins/lib/fixedpoint.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../fixedpoint.c"
diff --git a/apps/plugins/lib/fixedpoint.h b/apps/plugins/lib/fixedpoint.h
deleted file mode 100644
index 811a1d9b81..0000000000
--- a/apps/plugins/lib/fixedpoint.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2006 Jens Arnold
- *
- * Fixed point library for plugins
- *
- * 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.
- *
- ****************************************************************************/
-#ifndef _FIXEDPOINT_H_PLUGINS
-#define _FIXEDPOINT_H_PLUGINS
-#include "../../../firmware/include/fixedpoint.h"
-#endif /* _FIXEDPOINT_H_PLUGINS */
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c
index 13cc359a5d..a4ec6a8789 100644
--- a/apps/plugins/oscilloscope.c
+++ b/apps/plugins/oscilloscope.c
@@ -22,13 +22,11 @@
****************************************************************************/
#include "plugin.h"
+#include "fixedpoint.h"
#include "lib/helper.h"
#include "lib/pluginlib_exit.h"
-
#include "lib/xlcd.h"
#include "lib/configfile.h"
-#include "fixedpoint.h"
-#include "lib/fixedpoint.h"
#include "lib/osd.h"
/* variable button definitions */
diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c
index 88afb858f5..5b2b3ae94d 100644
--- a/apps/plugins/plasma.c
+++ b/apps/plugins/plasma.c
@@ -25,6 +25,7 @@
****************************************************************************/
#include "plugin.h"
+#include "fixedpoint.h"
#include "lib/helper.h"
#include "lib/pluginlib_actions.h"
#include "lib/pluginlib_exit.h"
@@ -32,7 +33,6 @@
#ifndef HAVE_LCD_COLOR
#include "lib/grey.h"
#endif
-#include "lib/fixedpoint.h"
/******************************* Globals ***********************************/
diff --git a/apps/plugins/plugins.make b/apps/plugins/plugins.make
index 0fc8ba7dc1..92769d770a 100644
--- a/apps/plugins/plugins.make
+++ b/apps/plugins/plugins.make
@@ -53,7 +53,7 @@ else
PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
endif
-PLUGIN_LIBS := $(PLUGINLIB) $(PLUGINBITMAPLIB) $(SETJMPLIB)
+PLUGIN_LIBS := $(PLUGINLIB) $(PLUGINBITMAPLIB) $(SETJMPLIB) $(FIXEDPOINTLIB)
# include <dir>.make from each subdir (yay!)
$(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make))
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c
index ec884442d4..107d46bd67 100644
--- a/apps/plugins/vu_meter.c
+++ b/apps/plugins/vu_meter.c
@@ -18,7 +18,7 @@
*
**************************************************************************/
#include "plugin.h"
-#include "lib/fixedpoint.h"
+#include "fixedpoint.h"
#include "lib/playback_control.h"
diff --git a/flash/bootbox/bootbox.make b/flash/bootbox/bootbox.make
index 0c05eec056..38a664d57d 100644
--- a/flash/bootbox/bootbox.make
+++ b/flash/bootbox/bootbox.make
@@ -9,5 +9,7 @@
SRC += $(call preprocess,$(APPSDIR)/SOURCES)
+CORE_GCSECTIONS = yes
+
# don't build rombox.ucl
ARCHOSROM=
diff --git a/apps/fixedpoint.c b/lib/fixedpoint/fixedpoint.c
index b212929245..b5bbe68a95 100644
--- a/apps/fixedpoint.c
+++ b/lib/fixedpoint/fixedpoint.c
@@ -20,7 +20,6 @@
* KIND, either express or implied.
*
****************************************************************************/
-
#include "fixedpoint.h"
#include <stdlib.h>
#include <stdbool.h>
@@ -143,8 +142,6 @@ long fp_sincos(unsigned long phase, long *cos)
return y;
}
-
-#if defined(PLUGIN) || defined(CODEC)
/**
* Fixed point square root via Newton-Raphson.
* @param x square root argument.
@@ -207,10 +204,7 @@ unsigned long isqrt(unsigned long x)
return g;
}
-#endif /* PLUGIN or CODEC */
-
-#if defined(PLUGIN)
/**
* Fixed point sinus using a lookup table
* don't forget to divide the result by 16384 to get the actual sinus value
@@ -325,10 +319,7 @@ long fp16_exp(int x)
return y;
}
-#endif /* PLUGIN */
-
-#if (!defined(PLUGIN) && !defined(CODEC))
/** MODIFIED FROM replaygain.c */
#define FP_MUL_FRAC(x, y) fp_mul(x, y, fracbits)
@@ -407,12 +398,10 @@ long fp_exp10(long x, unsigned int fracbits)
return FP_MUL_FRAC(k, xp);
}
-
-#if 0 /* useful code, but not currently used */
/** FIXED POINT LOG10
* Return log10(x) as FP integer. Argument is FP integer.
*/
-static long fp_log10(long n, unsigned int fracbits)
+long fp_log10(long n, unsigned int fracbits)
{
/* Calculate log2 of argument */
@@ -453,15 +442,12 @@ static long fp_log10(long n, unsigned int fracbits)
return FP_MUL_FRAC(log2, (FP28_LOG10OF2 >> (28 - fracbits)));
}
-
/** CONVERT FACTOR TO DECIBELS */
long fp_decibels(unsigned long factor, unsigned int fracbits)
{
/* decibels = 20 * log10(factor) */
return FP_MUL_FRAC((20L << fracbits), fp_log10(factor, fracbits));
}
-#endif /* unused code */
-
/** CONVERT DECIBELS TO FACTOR */
long fp_factor(long decibels, unsigned int fracbits)
@@ -469,4 +455,3 @@ long fp_factor(long decibels, unsigned int fracbits)
/* factor = 10 ^ (decibels / 20) */
return fp_exp10(FP_DIV_FRAC(decibels, (20L << fracbits)), fracbits);
}
-#endif /* !PLUGIN and !CODEC */
diff --git a/firmware/include/fixedpoint.h b/lib/fixedpoint/fixedpoint.h
index 584bd58d84..31d60eca4b 100644
--- a/firmware/include/fixedpoint.h
+++ b/lib/fixedpoint/fixedpoint.h
@@ -107,10 +107,19 @@ unsigned long isqrt(unsigned long x);
*/
long fp_exp10(long x, unsigned int fracbits);
+/** FIXED POINT LOG10
+ * Return log10(x) as FP integer. Argument is FP integer.
+ */
+long fp_log10(long n, unsigned int fracbits);
+
/* fracbits in range 12 - 22 work well. Higher is better for
* calculating dB, lower is better for calculating factor.
*/
-/* long fp_decibels(unsigned long factor, unsigned int fracbits); */
+
+/** CONVERT FACTOR TO DECIBELS */
+long fp_decibels(unsigned long factor, unsigned int fracbits);
+
+/** CONVERT DECIBELS TO FACTOR */
long fp_factor(long decibels, unsigned int fracbits);
#endif /* FIXEDPOINT_H */
diff --git a/lib/fixedpoint/fixedpoint.make b/lib/fixedpoint/fixedpoint.make
new file mode 100644
index 0000000000..9ee0e1f0c7
--- /dev/null
+++ b/lib/fixedpoint/fixedpoint.make
@@ -0,0 +1,36 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+
+FIXEDPOINTLIB := $(BUILDDIR)/lib/libfixedpoint.a
+FIXEDPOINTLIB_DIR := $(ROOTDIR)/lib/fixedpoint
+FIXEDPOINTLIB_SRC := $(FIXEDPOINTLIB_DIR)/fixedpoint.c
+FIXEDPOINTLIB_OBJ := $(call c2obj, $(FIXEDPOINTLIB_SRC))
+
+INCLUDES += -I$(FIXEDPOINTLIB_DIR)
+OTHER_SRC += $(FIXEDPOINTLIB_SRC)
+
+# If not SOFTWARECODECS, then only plugins depend upon us
+ifdef SOFTWARECODECS
+CORE_LIBS += $(FIXEDPOINTLIB)
+CORE_GCSECTIONS := yes
+endif
+
+FIXEDPOINTLIB_FLAGS := $(CFLAGS)
+
+# Do not use '-ffunction-sections' and '-fdata-sections' when compiling sdl-sim
+ifneq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim)
+ FIXEDPOINTLIB_FLAGS += -ffunction-sections -fdata-sections
+endif
+
+$(FIXEDPOINTLIB_OBJ): $(FIXEDPOINTLIB_SRC)
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \
+ $(FIXEDPOINTLIB_FLAGS) -c $< -o $@
+
+$(FIXEDPOINTLIB): $(FIXEDPOINTLIB_OBJ)
+ $(SILENT)$(shell rm -f $@)
+ $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
diff --git a/lib/rbcodec/codecs/adx.c b/lib/rbcodec/codecs/adx.c
index 0c67fc8d6e..83ced5add0 100644
--- a/lib/rbcodec/codecs/adx.c
+++ b/lib/rbcodec/codecs/adx.c
@@ -23,7 +23,7 @@
#include "codeclib.h"
#include "inttypes.h"
#include "math.h"
-#include "lib/fixedpoint.h"
+#include "fixedpoint.h"
CODEC_HEADER
diff --git a/lib/rbcodec/codecs/codecs.make b/lib/rbcodec/codecs/codecs.make
index eea8950d0d..21bb9332b3 100644
--- a/lib/rbcodec/codecs/codecs.make
+++ b/lib/rbcodec/codecs/codecs.make
@@ -19,7 +19,7 @@ include $(RBCODECLIB_DIR)/codecs/lib/libcodec.make
OTHER_INC += -I$(RBCODECLIB_DIR)/codecs/lib
# extra libraries
-CODEC_LIBS := $(CODECLIB)
+CODEC_LIBS := $(CODECLIB) $(FIXEDPOINTLIB)
# the codec libraries
include $(RBCODECLIB_DIR)/codecs/demac/libdemac.make
diff --git a/lib/rbcodec/codecs/lib/SOURCES b/lib/rbcodec/codecs/lib/SOURCES
index 257dcb5838..f4b951a5eb 100644
--- a/lib/rbcodec/codecs/lib/SOURCES
+++ b/lib/rbcodec/codecs/lib/SOURCES
@@ -1,6 +1,5 @@
#if CONFIG_CODEC == SWCODEC /* software codec platforms */
codeclib.c
-fixedpoint.c
ffmpeg_bitstream.c
mdct_lookup.c
diff --git a/lib/rbcodec/codecs/lib/fixedpoint.c b/lib/rbcodec/codecs/lib/fixedpoint.c
deleted file mode 100644
index a66dcb1270..0000000000
--- a/lib/rbcodec/codecs/lib/fixedpoint.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../apps/fixedpoint.c"
diff --git a/lib/rbcodec/codecs/lib/fixedpoint.h b/lib/rbcodec/codecs/lib/fixedpoint.h
deleted file mode 100644
index 3d8e77cd89..0000000000
--- a/lib/rbcodec/codecs/lib/fixedpoint.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2006 Jens Arnold
- *
- * Fixed point library for codecs
- *
- * 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.
- *
- ****************************************************************************/
-#ifndef _FIXEDPOINT_H_CODECS
-#define _FIXEDPOINT_H_CODECS
-#include "../../../../firmware/include/fixedpoint.h"
-#endif /* _FIXEDPOINT_H_CODECS */
diff --git a/lib/rbcodec/rbcodec.make b/lib/rbcodec/rbcodec.make
index 7aac57b87d..bc4e54fddf 100644
--- a/lib/rbcodec/rbcodec.make
+++ b/lib/rbcodec/rbcodec.make
@@ -15,7 +15,9 @@ RBCODECLIB := $(BUILDDIR)/lib/librbcodec.a
INCLUDES += -I$(RBCODECLIB_DIR) -I$(RBCODECLIB_DIR)/codecs \
-I$(RBCODECLIB_DIR)/dsp -I$(RBCODECLIB_DIR)/metadata
OTHER_SRC += $(RBCODECLIB_SRC)
-CORE_LIBS += $(RBCODECLIB)
+
+# libfixedpoint must go after in lib list but be made first
+CORE_LIBS := $(RBCODECLIB) $(CORE_LIBS)
$(RBCODECLIB): $(RBCODECLIB_OBJ)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
diff --git a/lib/rbcodec/test/SOURCES b/lib/rbcodec/test/SOURCES
index a89af238ca..d1413c758a 100644
--- a/lib/rbcodec/test/SOURCES
+++ b/lib/rbcodec/test/SOURCES
@@ -2,5 +2,4 @@ warble.c
../../../firmware/common/strlcpy.c
../../../firmware/common/unicode.c
../../../firmware/common/structec.c
-../../../apps/fixedpoint.c
../../../uisimulator/common/io.c
diff --git a/tools/database/SOURCES b/tools/database/SOURCES
index 9c60fb1e7d..5c9b971583 100644
--- a/tools/database/SOURCES
+++ b/tools/database/SOURCES
@@ -1,5 +1,4 @@
database.c
-../../apps/fixedpoint.c
../../apps/misc.c
../../apps/tagcache.c
../../firmware/common/crc32.c
diff --git a/tools/database/database.make b/tools/database/database.make
index 89a4aa7d85..8eae4925d5 100644
--- a/tools/database/database.make
+++ b/tools/database/database.make
@@ -35,10 +35,13 @@ INCLUDES += -I$(ROOTDIR)/apps/gui \
-I$(ROOTDIR)/lib/rbcodec/dsp \
-I$(APPSDIR) \
-I$(BUILDDIR)
-
+
+ifdef SOFTWARECODECS
+OTHERLIBS := $(FIXEDPOINTLIB)
+endif
.SECONDEXPANSION: # $$(OBJ) is not populated until after this
-$(BUILDDIR)/$(BINARY): $$(DATABASE_OBJ)
+$(BUILDDIR)/$(BINARY): $$(DATABASE_OBJ) $(OTHERLIBS)
$(call PRINTS,LD $(BINARY))
- $(SILENT)$(HOSTCC) -o $@ $+
+ $(SILENT)$(HOSTCC) $(call a2lnk $(OTHERLIBS)) -o $@ $+
diff --git a/tools/root.make b/tools/root.make
index c2d061b0eb..6d623595fa 100644
--- a/tools/root.make
+++ b/tools/root.make
@@ -17,6 +17,7 @@ INCLUDES = -I$(BUILDDIR) -I$(BUILDDIR)/lang $(TARGET_INC)
CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS)
PPCFLAGS = $(filter-out -g -Dmain=SDL_main,$(CFLAGS)) # cygwin sdl-config fix
ASMFLAGS = -D__ASSEMBLER__ # work around gcc 3.4.x bug with -std=gnu99, only meant for .S files
+CORE_LDOPTS = $(GLOBAL_LDOPTS) # linker ops specifically for core build
TOOLS = $(TOOLSDIR)/rdf2binary $(TOOLSDIR)/convbdf \
$(TOOLSDIR)/codepages $(TOOLSDIR)/scramble $(TOOLSDIR)/bmp2rb \
@@ -90,10 +91,15 @@ ifndef APP_TYPE
endif
endif
+ifeq (,$(findstring bootloader,$(APPSDIR)))
+ ifeq (,$(findstring checkwps,$(APP_TYPE)))
+ include $(ROOTDIR)/lib/fixedpoint/fixedpoint.make
+ endif
+endif
+
ifneq (,$(findstring bootloader,$(APPSDIR)))
include $(APPSDIR)/bootloader.make
else ifneq (,$(findstring bootbox,$(APPSDIR)))
- BOOTBOXLDOPTS = -Wl,--gc-sections
include $(APPSDIR)/bootbox.make
else ifneq (,$(findstring checkwps,$(APP_TYPE)))
include $(APPSDIR)/checkwps.make
@@ -104,10 +110,10 @@ else ifneq (,$(findstring warble,$(APP_TYPE)))
include $(ROOTDIR)/lib/rbcodec/test/warble.make
include $(ROOTDIR)/lib/tlsf/libtlsf.make
include $(ROOTDIR)/lib/rbcodec/rbcodec.make
-else
+else # core
include $(APPSDIR)/apps.make
- include $(ROOTDIR)/lib/rbcodec/rbcodec.make
include $(APPSDIR)/lang/lang.make
+ include $(ROOTDIR)/lib/rbcodec/rbcodec.make
ifdef ENABLEDPLUGINS
include $(APPSDIR)/plugins/bitmaps/pluginbitmaps.make
@@ -132,6 +138,14 @@ else
endif # bootloader
+# One or more subdir makefiles requested --gc-sections?
+ifdef CORE_GCSECTIONS
+ # Do not use '--gc-sections' when compiling sdl-sim
+ ifneq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim)
+ CORE_LDOPTS += -Wl,--gc-sections
+ endif
+endif # CORE_GCSECTIONS
+
OBJ := $(SRC:.c=.o)
OBJ := $(OBJ:.S=.o)
OBJ += $(BMP:.bmp=.o)
@@ -205,16 +219,16 @@ $(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LI
-L$(BUILDDIR)/firmware -lfirmware \
-L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
-L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \
- -lgcc $(BOOTBOXLDOPTS) $(GLOBAL_LDOPTS) \
- -T$(LINKRAM) -Wl,-Map,$(BUILDDIR)/rockbox.map
+ -lgcc -T$(LINKRAM) \
+ $(CORE_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map
$(BUILDDIR)/rombox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LINKROM)
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \
-L$(BUILDDIR)/firmware -lfirmware \
-L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
-L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \
- -lgcc $(BOOTBOXLDOPTS) $(GLOBAL_LDOPTS) \
- -T$(LINKROM) -Wl,-Map,$(BUILDDIR)/rombox.map
+ -lgcc -T$(LINKROM) \
+ $(CORE_LDOPTS) -Wl,-Map,$(BUILDDIR)/rombox.map
$(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf
$(call PRINTS,OC $(@F))$(call objcopy,$<,$@)