summaryrefslogtreecommitdiff
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
163#if INPUT_SRC_CAPS != 0 163#if INPUT_SRC_CAPS != 0
164audio_path.c 164audio_path.c
165#endif /* INPUT_SRC_CAPS != 0 */ 165#endif /* INPUT_SRC_CAPS != 0 */
166fixedpoint.c
167pcmbuf.c 166pcmbuf.c
168codec_thread.c 167codec_thread.c
169playback.c 168playback.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 @@
20 **************************************************************************/ 20 **************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22#include "time.h" 22#include "time.h"
23#include "lib/fixedpoint.h" 23#include "fixedpoint.h"
24#include "lib/pluginlib_actions.h" 24#include "lib/pluginlib_actions.h"
25 25
26 26
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 @@
22****************************************************************************/ 22****************************************************************************/
23 23
24#include "plugin.h" 24#include "plugin.h"
25#include "fixedpoint.h"
25 26
26#include "lib/xlcd.h" 27#include "lib/xlcd.h"
27#include "lib/pluginlib_actions.h" 28#include "lib/pluginlib_actions.h"
28#include "lib/fixedpoint.h"
29#include "lib/playback_control.h" 29#include "lib/playback_control.h"
30#include "lib/highscore.h" 30#include "lib/highscore.h"
31 31
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 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#include "fixedpoint.h"
22#include "clock_draw_analog.h" 23#include "clock_draw_analog.h"
23#include "lib/xlcd.h" 24#include "lib/xlcd.h"
24#include "lib/fixedpoint.h"
25#include "clock_bitmaps.h" 25#include "clock_bitmaps.h"
26#include "clock_bitmap_strings.h" 26#include "clock_bitmap_strings.h"
27 27
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 @@
21* 21*
22***************************************************************************/ 22***************************************************************************/
23#include "plugin.h" 23#include "plugin.h"
24#include "fixedpoint.h"
24#include "lib/playergfx.h" 25#include "lib/playergfx.h"
25#include "lib/pluginlib_exit.h" 26#include "lib/pluginlib_exit.h"
26#if LCD_DEPTH > 1 27#if LCD_DEPTH > 1
@@ -31,7 +32,6 @@
31#include "lib/mylcd.h" /* MYLCD_CFG_GREYLIB or MYLCD_CFG_PGFX */ 32#include "lib/mylcd.h" /* MYLCD_CFG_GREYLIB or MYLCD_CFG_PGFX */
32#endif 33#endif
33#include "lib/xlcd.h" 34#include "lib/xlcd.h"
34#include "lib/fixedpoint.h"
35 35
36/* Loops that the values are displayed */ 36/* Loops that the values are displayed */
37#define DISP_TIME 30 37#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 @@
3 3
4#include <inttypes.h> 4#include <inttypes.h>
5#include <math.h> 5#include <math.h>
6#include "lib/fixedpoint.h" 6#include "fixedpoint.h"
7 7
8#define Q_MUL(a, b, bits) (( (int64_t) (a) * (int64_t) (b) ) >> (bits)) 8#define Q_MUL(a, b, bits) (( (int64_t) (a) * (int64_t) (b) ) >> (bits))
9#define Q15_MUL(a, b) Q_MUL(a,b,15) 9#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 @@
22****************************************************************************/ 22****************************************************************************/
23 23
24#include "plugin.h" 24#include "plugin.h"
25#include "fixedpoint.h"
25#include "lib/helper.h" 26#include "lib/helper.h"
26 27
27#include "lib/pluginlib_actions.h" 28#include "lib/pluginlib_actions.h"
28#include "lib/fixedpoint.h"
29 29
30#ifndef HAVE_LCD_COLOR 30#ifndef HAVE_LCD_COLOR
31#include "lib/grey.h" 31#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
4md5.c 4md5.c
5jhash.c 5jhash.c
6configfile.c 6configfile.c
7fixedpoint.c
8playback_control.c 7playback_control.c
9rgb_hsv.c 8rgb_hsv.c
10highscore.c 9highscore.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 @@
1#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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 Jens Arnold
11 *
12 * Fixed point library for plugins
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23#ifndef _FIXEDPOINT_H_PLUGINS
24#define _FIXEDPOINT_H_PLUGINS
25#include "../../../firmware/include/fixedpoint.h"
26#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 @@
22****************************************************************************/ 22****************************************************************************/
23 23
24#include "plugin.h" 24#include "plugin.h"
25#include "fixedpoint.h"
25#include "lib/helper.h" 26#include "lib/helper.h"
26#include "lib/pluginlib_exit.h" 27#include "lib/pluginlib_exit.h"
27
28#include "lib/xlcd.h" 28#include "lib/xlcd.h"
29#include "lib/configfile.h" 29#include "lib/configfile.h"
30#include "fixedpoint.h"
31#include "lib/fixedpoint.h"
32#include "lib/osd.h" 30#include "lib/osd.h"
33 31
34/* variable button definitions */ 32/* 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 @@
25****************************************************************************/ 25****************************************************************************/
26 26
27#include "plugin.h" 27#include "plugin.h"
28#include "fixedpoint.h"
28#include "lib/helper.h" 29#include "lib/helper.h"
29#include "lib/pluginlib_actions.h" 30#include "lib/pluginlib_actions.h"
30#include "lib/pluginlib_exit.h" 31#include "lib/pluginlib_exit.h"
@@ -32,7 +33,6 @@
32#ifndef HAVE_LCD_COLOR 33#ifndef HAVE_LCD_COLOR
33#include "lib/grey.h" 34#include "lib/grey.h"
34#endif 35#endif
35#include "lib/fixedpoint.h"
36 36
37 37
38/******************************* Globals ***********************************/ 38/******************************* 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
53PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS) 53PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
54endif 54endif
55 55
56PLUGIN_LIBS := $(PLUGINLIB) $(PLUGINBITMAPLIB) $(SETJMPLIB) 56PLUGIN_LIBS := $(PLUGINLIB) $(PLUGINBITMAPLIB) $(SETJMPLIB) $(FIXEDPOINTLIB)
57 57
58# include <dir>.make from each subdir (yay!) 58# include <dir>.make from each subdir (yay!)
59$(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make)) 59$(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 @@
18 * 18 *
19 **************************************************************************/ 19 **************************************************************************/
20#include "plugin.h" 20#include "plugin.h"
21#include "lib/fixedpoint.h" 21#include "fixedpoint.h"
22#include "lib/playback_control.h" 22#include "lib/playback_control.h"
23 23
24 24
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 @@
9 9
10SRC += $(call preprocess,$(APPSDIR)/SOURCES) 10SRC += $(call preprocess,$(APPSDIR)/SOURCES)
11 11
12CORE_GCSECTIONS = yes
13
12# don't build rombox.ucl 14# don't build rombox.ucl
13ARCHOSROM= 15ARCHOSROM=
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 @@
20 * KIND, either express or implied. 20 * KIND, either express or implied.
21 * 21 *
22 ****************************************************************************/ 22 ****************************************************************************/
23
24#include "fixedpoint.h" 23#include "fixedpoint.h"
25#include <stdlib.h> 24#include <stdlib.h>
26#include <stdbool.h> 25#include <stdbool.h>
@@ -143,8 +142,6 @@ long fp_sincos(unsigned long phase, long *cos)
143 return y; 142 return y;
144} 143}
145 144
146
147#if defined(PLUGIN) || defined(CODEC)
148/** 145/**
149 * Fixed point square root via Newton-Raphson. 146 * Fixed point square root via Newton-Raphson.
150 * @param x square root argument. 147 * @param x square root argument.
@@ -207,10 +204,7 @@ unsigned long isqrt(unsigned long x)
207 204
208 return g; 205 return g;
209} 206}
210#endif /* PLUGIN or CODEC */
211 207
212
213#if defined(PLUGIN)
214/** 208/**
215 * Fixed point sinus using a lookup table 209 * Fixed point sinus using a lookup table
216 * don't forget to divide the result by 16384 to get the actual sinus value 210 * don't forget to divide the result by 16384 to get the actual sinus value
@@ -325,10 +319,7 @@ long fp16_exp(int x)
325 319
326 return y; 320 return y;
327} 321}
328#endif /* PLUGIN */
329
330 322
331#if (!defined(PLUGIN) && !defined(CODEC))
332/** MODIFIED FROM replaygain.c */ 323/** MODIFIED FROM replaygain.c */
333 324
334#define FP_MUL_FRAC(x, y) fp_mul(x, y, fracbits) 325#define FP_MUL_FRAC(x, y) fp_mul(x, y, fracbits)
@@ -407,12 +398,10 @@ long fp_exp10(long x, unsigned int fracbits)
407 return FP_MUL_FRAC(k, xp); 398 return FP_MUL_FRAC(k, xp);
408} 399}
409 400
410
411#if 0 /* useful code, but not currently used */
412/** FIXED POINT LOG10 401/** FIXED POINT LOG10
413 * Return log10(x) as FP integer. Argument is FP integer. 402 * Return log10(x) as FP integer. Argument is FP integer.
414 */ 403 */
415static long fp_log10(long n, unsigned int fracbits) 404long fp_log10(long n, unsigned int fracbits)
416{ 405{
417 /* Calculate log2 of argument */ 406 /* Calculate log2 of argument */
418 407
@@ -453,15 +442,12 @@ static long fp_log10(long n, unsigned int fracbits)
453 return FP_MUL_FRAC(log2, (FP28_LOG10OF2 >> (28 - fracbits))); 442 return FP_MUL_FRAC(log2, (FP28_LOG10OF2 >> (28 - fracbits)));
454} 443}
455 444
456
457/** CONVERT FACTOR TO DECIBELS */ 445/** CONVERT FACTOR TO DECIBELS */
458long fp_decibels(unsigned long factor, unsigned int fracbits) 446long fp_decibels(unsigned long factor, unsigned int fracbits)
459{ 447{
460 /* decibels = 20 * log10(factor) */ 448 /* decibels = 20 * log10(factor) */
461 return FP_MUL_FRAC((20L << fracbits), fp_log10(factor, fracbits)); 449 return FP_MUL_FRAC((20L << fracbits), fp_log10(factor, fracbits));
462} 450}
463#endif /* unused code */
464
465 451
466/** CONVERT DECIBELS TO FACTOR */ 452/** CONVERT DECIBELS TO FACTOR */
467long fp_factor(long decibels, unsigned int fracbits) 453long fp_factor(long decibels, unsigned int fracbits)
@@ -469,4 +455,3 @@ long fp_factor(long decibels, unsigned int fracbits)
469 /* factor = 10 ^ (decibels / 20) */ 455 /* factor = 10 ^ (decibels / 20) */
470 return fp_exp10(FP_DIV_FRAC(decibels, (20L << fracbits)), fracbits); 456 return fp_exp10(FP_DIV_FRAC(decibels, (20L << fracbits)), fracbits);
471} 457}
472#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);
107 */ 107 */
108long fp_exp10(long x, unsigned int fracbits); 108long fp_exp10(long x, unsigned int fracbits);
109 109
110/** FIXED POINT LOG10
111 * Return log10(x) as FP integer. Argument is FP integer.
112 */
113long fp_log10(long n, unsigned int fracbits);
114
110/* fracbits in range 12 - 22 work well. Higher is better for 115/* fracbits in range 12 - 22 work well. Higher is better for
111 * calculating dB, lower is better for calculating factor. 116 * calculating dB, lower is better for calculating factor.
112 */ 117 */
113/* long fp_decibels(unsigned long factor, unsigned int fracbits); */ 118
119/** CONVERT FACTOR TO DECIBELS */
120long fp_decibels(unsigned long factor, unsigned int fracbits);
121
122/** CONVERT DECIBELS TO FACTOR */
114long fp_factor(long decibels, unsigned int fracbits); 123long fp_factor(long decibels, unsigned int fracbits);
115 124
116#endif /* FIXEDPOINT_H */ 125#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 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7
8FIXEDPOINTLIB := $(BUILDDIR)/lib/libfixedpoint.a
9FIXEDPOINTLIB_DIR := $(ROOTDIR)/lib/fixedpoint
10FIXEDPOINTLIB_SRC := $(FIXEDPOINTLIB_DIR)/fixedpoint.c
11FIXEDPOINTLIB_OBJ := $(call c2obj, $(FIXEDPOINTLIB_SRC))
12
13INCLUDES += -I$(FIXEDPOINTLIB_DIR)
14OTHER_SRC += $(FIXEDPOINTLIB_SRC)
15
16# If not SOFTWARECODECS, then only plugins depend upon us
17ifdef SOFTWARECODECS
18CORE_LIBS += $(FIXEDPOINTLIB)
19CORE_GCSECTIONS := yes
20endif
21
22FIXEDPOINTLIB_FLAGS := $(CFLAGS)
23
24# Do not use '-ffunction-sections' and '-fdata-sections' when compiling sdl-sim
25ifneq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim)
26 FIXEDPOINTLIB_FLAGS += -ffunction-sections -fdata-sections
27endif
28
29$(FIXEDPOINTLIB_OBJ): $(FIXEDPOINTLIB_SRC)
30 $(SILENT)mkdir -p $(dir $@)
31 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \
32 $(FIXEDPOINTLIB_FLAGS) -c $< -o $@
33
34$(FIXEDPOINTLIB): $(FIXEDPOINTLIB_OBJ)
35 $(SILENT)$(shell rm -f $@)
36 $(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 @@
23#include "codeclib.h" 23#include "codeclib.h"
24#include "inttypes.h" 24#include "inttypes.h"
25#include "math.h" 25#include "math.h"
26#include "lib/fixedpoint.h" 26#include "fixedpoint.h"
27 27
28CODEC_HEADER 28CODEC_HEADER
29 29
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
19OTHER_INC += -I$(RBCODECLIB_DIR)/codecs/lib 19OTHER_INC += -I$(RBCODECLIB_DIR)/codecs/lib
20 20
21# extra libraries 21# extra libraries
22CODEC_LIBS := $(CODECLIB) 22CODEC_LIBS := $(CODECLIB) $(FIXEDPOINTLIB)
23 23
24# the codec libraries 24# the codec libraries
25include $(RBCODECLIB_DIR)/codecs/demac/libdemac.make 25include $(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 @@
1#if CONFIG_CODEC == SWCODEC /* software codec platforms */ 1#if CONFIG_CODEC == SWCODEC /* software codec platforms */
2codeclib.c 2codeclib.c
3fixedpoint.c
4ffmpeg_bitstream.c 3ffmpeg_bitstream.c
5 4
6mdct_lookup.c 5mdct_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 @@
1#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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 Jens Arnold
11 *
12 * Fixed point library for codecs
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23#ifndef _FIXEDPOINT_H_CODECS
24#define _FIXEDPOINT_H_CODECS
25#include "../../../../firmware/include/fixedpoint.h"
26#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
15INCLUDES += -I$(RBCODECLIB_DIR) -I$(RBCODECLIB_DIR)/codecs \ 15INCLUDES += -I$(RBCODECLIB_DIR) -I$(RBCODECLIB_DIR)/codecs \
16 -I$(RBCODECLIB_DIR)/dsp -I$(RBCODECLIB_DIR)/metadata 16 -I$(RBCODECLIB_DIR)/dsp -I$(RBCODECLIB_DIR)/metadata
17OTHER_SRC += $(RBCODECLIB_SRC) 17OTHER_SRC += $(RBCODECLIB_SRC)
18CORE_LIBS += $(RBCODECLIB) 18
19# libfixedpoint must go after in lib list but be made first
20CORE_LIBS := $(RBCODECLIB) $(CORE_LIBS)
19 21
20$(RBCODECLIB): $(RBCODECLIB_OBJ) 22$(RBCODECLIB): $(RBCODECLIB_OBJ)
21 $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null 23 $(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
2../../../firmware/common/strlcpy.c 2../../../firmware/common/strlcpy.c
3../../../firmware/common/unicode.c 3../../../firmware/common/unicode.c
4../../../firmware/common/structec.c 4../../../firmware/common/structec.c
5../../../apps/fixedpoint.c
6../../../uisimulator/common/io.c 5../../../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 @@
1database.c 1database.c
2../../apps/fixedpoint.c
3../../apps/misc.c 2../../apps/misc.c
4../../apps/tagcache.c 3../../apps/tagcache.c
5../../firmware/common/crc32.c 4../../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 \
35 -I$(ROOTDIR)/lib/rbcodec/dsp \ 35 -I$(ROOTDIR)/lib/rbcodec/dsp \
36 -I$(APPSDIR) \ 36 -I$(APPSDIR) \
37 -I$(BUILDDIR) 37 -I$(BUILDDIR)
38 38
39ifdef SOFTWARECODECS
40OTHERLIBS := $(FIXEDPOINTLIB)
41endif
39 42
40.SECONDEXPANSION: # $$(OBJ) is not populated until after this 43.SECONDEXPANSION: # $$(OBJ) is not populated until after this
41 44
42$(BUILDDIR)/$(BINARY): $$(DATABASE_OBJ) 45$(BUILDDIR)/$(BINARY): $$(DATABASE_OBJ) $(OTHERLIBS)
43 $(call PRINTS,LD $(BINARY)) 46 $(call PRINTS,LD $(BINARY))
44 $(SILENT)$(HOSTCC) -o $@ $+ 47 $(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)
17CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS) 17CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS)
18PPCFLAGS = $(filter-out -g -Dmain=SDL_main,$(CFLAGS)) # cygwin sdl-config fix 18PPCFLAGS = $(filter-out -g -Dmain=SDL_main,$(CFLAGS)) # cygwin sdl-config fix
19ASMFLAGS = -D__ASSEMBLER__ # work around gcc 3.4.x bug with -std=gnu99, only meant for .S files 19ASMFLAGS = -D__ASSEMBLER__ # work around gcc 3.4.x bug with -std=gnu99, only meant for .S files
20CORE_LDOPTS = $(GLOBAL_LDOPTS) # linker ops specifically for core build
20 21
21TOOLS = $(TOOLSDIR)/rdf2binary $(TOOLSDIR)/convbdf \ 22TOOLS = $(TOOLSDIR)/rdf2binary $(TOOLSDIR)/convbdf \
22 $(TOOLSDIR)/codepages $(TOOLSDIR)/scramble $(TOOLSDIR)/bmp2rb \ 23 $(TOOLSDIR)/codepages $(TOOLSDIR)/scramble $(TOOLSDIR)/bmp2rb \
@@ -90,10 +91,15 @@ ifndef APP_TYPE
90 endif 91 endif
91endif 92endif
92 93
94ifeq (,$(findstring bootloader,$(APPSDIR)))
95 ifeq (,$(findstring checkwps,$(APP_TYPE)))
96 include $(ROOTDIR)/lib/fixedpoint/fixedpoint.make
97 endif
98endif
99
93ifneq (,$(findstring bootloader,$(APPSDIR))) 100ifneq (,$(findstring bootloader,$(APPSDIR)))
94 include $(APPSDIR)/bootloader.make 101 include $(APPSDIR)/bootloader.make
95else ifneq (,$(findstring bootbox,$(APPSDIR))) 102else ifneq (,$(findstring bootbox,$(APPSDIR)))
96 BOOTBOXLDOPTS = -Wl,--gc-sections
97 include $(APPSDIR)/bootbox.make 103 include $(APPSDIR)/bootbox.make
98else ifneq (,$(findstring checkwps,$(APP_TYPE))) 104else ifneq (,$(findstring checkwps,$(APP_TYPE)))
99 include $(APPSDIR)/checkwps.make 105 include $(APPSDIR)/checkwps.make
@@ -104,10 +110,10 @@ else ifneq (,$(findstring warble,$(APP_TYPE)))
104 include $(ROOTDIR)/lib/rbcodec/test/warble.make 110 include $(ROOTDIR)/lib/rbcodec/test/warble.make
105 include $(ROOTDIR)/lib/tlsf/libtlsf.make 111 include $(ROOTDIR)/lib/tlsf/libtlsf.make
106 include $(ROOTDIR)/lib/rbcodec/rbcodec.make 112 include $(ROOTDIR)/lib/rbcodec/rbcodec.make
107else 113else # core
108 include $(APPSDIR)/apps.make 114 include $(APPSDIR)/apps.make
109 include $(ROOTDIR)/lib/rbcodec/rbcodec.make
110 include $(APPSDIR)/lang/lang.make 115 include $(APPSDIR)/lang/lang.make
116 include $(ROOTDIR)/lib/rbcodec/rbcodec.make
111 117
112 ifdef ENABLEDPLUGINS 118 ifdef ENABLEDPLUGINS
113 include $(APPSDIR)/plugins/bitmaps/pluginbitmaps.make 119 include $(APPSDIR)/plugins/bitmaps/pluginbitmaps.make
@@ -132,6 +138,14 @@ else
132 138
133endif # bootloader 139endif # bootloader
134 140
141# One or more subdir makefiles requested --gc-sections?
142ifdef CORE_GCSECTIONS
143 # Do not use '--gc-sections' when compiling sdl-sim
144 ifneq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim)
145 CORE_LDOPTS += -Wl,--gc-sections
146 endif
147endif # CORE_GCSECTIONS
148
135OBJ := $(SRC:.c=.o) 149OBJ := $(SRC:.c=.o)
136OBJ := $(OBJ:.S=.o) 150OBJ := $(OBJ:.S=.o)
137OBJ += $(BMP:.bmp=.o) 151OBJ += $(BMP:.bmp=.o)
@@ -205,16 +219,16 @@ $(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LI
205 -L$(BUILDDIR)/firmware -lfirmware \ 219 -L$(BUILDDIR)/firmware -lfirmware \
206 -L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \ 220 -L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
207 -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \ 221 -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \
208 -lgcc $(BOOTBOXLDOPTS) $(GLOBAL_LDOPTS) \ 222 -lgcc -T$(LINKRAM) \
209 -T$(LINKRAM) -Wl,-Map,$(BUILDDIR)/rockbox.map 223 $(CORE_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map
210 224
211$(BUILDDIR)/rombox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LINKROM) 225$(BUILDDIR)/rombox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LINKROM)
212 $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \ 226 $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \
213 -L$(BUILDDIR)/firmware -lfirmware \ 227 -L$(BUILDDIR)/firmware -lfirmware \
214 -L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \ 228 -L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
215 -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \ 229 -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \
216 -lgcc $(BOOTBOXLDOPTS) $(GLOBAL_LDOPTS) \ 230 -lgcc -T$(LINKROM) \
217 -T$(LINKROM) -Wl,-Map,$(BUILDDIR)/rombox.map 231 $(CORE_LDOPTS) -Wl,-Map,$(BUILDDIR)/rombox.map
218 232
219$(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf 233$(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf
220 $(call PRINTS,OC $(@F))$(call objcopy,$<,$@) 234 $(call PRINTS,OC $(@F))$(call objcopy,$<,$@)