diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2013-04-16 17:47:58 -0400 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2013-04-26 00:11:04 +0200 |
commit | 95e23defb085ee1a846ec2d379368485921d5aee (patch) | |
tree | 0bdb31f562fef8c7ff5f3f7dba9c54f9c1e84a76 | |
parent | 8829e909b4e756bfb2ad9210eec61d0dc55e1731 (diff) | |
download | rockbox-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>
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 |
164 | audio_path.c | 164 | audio_path.c |
165 | #endif /* INPUT_SRC_CAPS != 0 */ | 165 | #endif /* INPUT_SRC_CAPS != 0 */ |
166 | fixedpoint.c | ||
167 | pcmbuf.c | 166 | pcmbuf.c |
168 | codec_thread.c | 167 | codec_thread.c |
169 | playback.c | 168 | 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 @@ | |||
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 | |||
4 | md5.c | 4 | md5.c |
5 | jhash.c | 5 | jhash.c |
6 | configfile.c | 6 | configfile.c |
7 | fixedpoint.c | ||
8 | playback_control.c | 7 | playback_control.c |
9 | rgb_hsv.c | 8 | rgb_hsv.c |
10 | highscore.c | 9 | 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 @@ | |||
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 | |||
53 | PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS) | 53 | PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS) |
54 | endif | 54 | endif |
55 | 55 | ||
56 | PLUGIN_LIBS := $(PLUGINLIB) $(PLUGINBITMAPLIB) $(SETJMPLIB) | 56 | PLUGIN_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 | ||
10 | SRC += $(call preprocess,$(APPSDIR)/SOURCES) | 10 | SRC += $(call preprocess,$(APPSDIR)/SOURCES) |
11 | 11 | ||
12 | CORE_GCSECTIONS = yes | ||
13 | |||
12 | # don't build rombox.ucl | 14 | # don't build rombox.ucl |
13 | ARCHOSROM= | 15 | 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 @@ | |||
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 | */ |
415 | static long fp_log10(long n, unsigned int fracbits) | 404 | long 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 */ |
458 | long fp_decibels(unsigned long factor, unsigned int fracbits) | 446 | long 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 */ |
467 | long fp_factor(long decibels, unsigned int fracbits) | 453 | long 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 | */ |
108 | long fp_exp10(long x, unsigned int fracbits); | 108 | long 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 | */ | ||
113 | long 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 */ | ||
120 | long fp_decibels(unsigned long factor, unsigned int fracbits); | ||
121 | |||
122 | /** CONVERT DECIBELS TO FACTOR */ | ||
114 | long fp_factor(long decibels, unsigned int fracbits); | 123 | long 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 | |||
8 | FIXEDPOINTLIB := $(BUILDDIR)/lib/libfixedpoint.a | ||
9 | FIXEDPOINTLIB_DIR := $(ROOTDIR)/lib/fixedpoint | ||
10 | FIXEDPOINTLIB_SRC := $(FIXEDPOINTLIB_DIR)/fixedpoint.c | ||
11 | FIXEDPOINTLIB_OBJ := $(call c2obj, $(FIXEDPOINTLIB_SRC)) | ||
12 | |||
13 | INCLUDES += -I$(FIXEDPOINTLIB_DIR) | ||
14 | OTHER_SRC += $(FIXEDPOINTLIB_SRC) | ||
15 | |||
16 | # If not SOFTWARECODECS, then only plugins depend upon us | ||
17 | ifdef SOFTWARECODECS | ||
18 | CORE_LIBS += $(FIXEDPOINTLIB) | ||
19 | CORE_GCSECTIONS := yes | ||
20 | endif | ||
21 | |||
22 | FIXEDPOINTLIB_FLAGS := $(CFLAGS) | ||
23 | |||
24 | # Do not use '-ffunction-sections' and '-fdata-sections' when compiling sdl-sim | ||
25 | ifneq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim) | ||
26 | FIXEDPOINTLIB_FLAGS += -ffunction-sections -fdata-sections | ||
27 | endif | ||
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 | ||
28 | CODEC_HEADER | 28 | CODEC_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 | |||
19 | OTHER_INC += -I$(RBCODECLIB_DIR)/codecs/lib | 19 | OTHER_INC += -I$(RBCODECLIB_DIR)/codecs/lib |
20 | 20 | ||
21 | # extra libraries | 21 | # extra libraries |
22 | CODEC_LIBS := $(CODECLIB) | 22 | CODEC_LIBS := $(CODECLIB) $(FIXEDPOINTLIB) |
23 | 23 | ||
24 | # the codec libraries | 24 | # the codec libraries |
25 | include $(RBCODECLIB_DIR)/codecs/demac/libdemac.make | 25 | 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 @@ | |||
1 | #if CONFIG_CODEC == SWCODEC /* software codec platforms */ | 1 | #if CONFIG_CODEC == SWCODEC /* software codec platforms */ |
2 | codeclib.c | 2 | codeclib.c |
3 | fixedpoint.c | ||
4 | ffmpeg_bitstream.c | 3 | ffmpeg_bitstream.c |
5 | 4 | ||
6 | mdct_lookup.c | 5 | 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 @@ | |||
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 | |||
15 | INCLUDES += -I$(RBCODECLIB_DIR) -I$(RBCODECLIB_DIR)/codecs \ | 15 | INCLUDES += -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 |
17 | OTHER_SRC += $(RBCODECLIB_SRC) | 17 | OTHER_SRC += $(RBCODECLIB_SRC) |
18 | CORE_LIBS += $(RBCODECLIB) | 18 | |
19 | # libfixedpoint must go after in lib list but be made first | ||
20 | CORE_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 @@ | |||
1 | database.c | 1 | database.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 | ||
39 | ifdef SOFTWARECODECS | ||
40 | OTHERLIBS := $(FIXEDPOINTLIB) | ||
41 | endif | ||
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) | |||
17 | CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS) | 17 | CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS) |
18 | PPCFLAGS = $(filter-out -g -Dmain=SDL_main,$(CFLAGS)) # cygwin sdl-config fix | 18 | PPCFLAGS = $(filter-out -g -Dmain=SDL_main,$(CFLAGS)) # cygwin sdl-config fix |
19 | ASMFLAGS = -D__ASSEMBLER__ # work around gcc 3.4.x bug with -std=gnu99, only meant for .S files | 19 | ASMFLAGS = -D__ASSEMBLER__ # work around gcc 3.4.x bug with -std=gnu99, only meant for .S files |
20 | CORE_LDOPTS = $(GLOBAL_LDOPTS) # linker ops specifically for core build | ||
20 | 21 | ||
21 | TOOLS = $(TOOLSDIR)/rdf2binary $(TOOLSDIR)/convbdf \ | 22 | TOOLS = $(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 |
91 | endif | 92 | endif |
92 | 93 | ||
94 | ifeq (,$(findstring bootloader,$(APPSDIR))) | ||
95 | ifeq (,$(findstring checkwps,$(APP_TYPE))) | ||
96 | include $(ROOTDIR)/lib/fixedpoint/fixedpoint.make | ||
97 | endif | ||
98 | endif | ||
99 | |||
93 | ifneq (,$(findstring bootloader,$(APPSDIR))) | 100 | ifneq (,$(findstring bootloader,$(APPSDIR))) |
94 | include $(APPSDIR)/bootloader.make | 101 | include $(APPSDIR)/bootloader.make |
95 | else ifneq (,$(findstring bootbox,$(APPSDIR))) | 102 | else ifneq (,$(findstring bootbox,$(APPSDIR))) |
96 | BOOTBOXLDOPTS = -Wl,--gc-sections | ||
97 | include $(APPSDIR)/bootbox.make | 103 | include $(APPSDIR)/bootbox.make |
98 | else ifneq (,$(findstring checkwps,$(APP_TYPE))) | 104 | else 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 |
107 | else | 113 | else # 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 | ||
133 | endif # bootloader | 139 | endif # bootloader |
134 | 140 | ||
141 | # One or more subdir makefiles requested --gc-sections? | ||
142 | ifdef 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 | ||
147 | endif # CORE_GCSECTIONS | ||
148 | |||
135 | OBJ := $(SRC:.c=.o) | 149 | OBJ := $(SRC:.c=.o) |
136 | OBJ := $(OBJ:.S=.o) | 150 | OBJ := $(OBJ:.S=.o) |
137 | OBJ += $(BMP:.bmp=.o) | 151 | OBJ += $(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,$<,$@) |