From 9546e4093d8a6f9b27c06db242894c3dc9d9f574 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Sun, 4 Oct 2009 08:49:23 +0000 Subject: Add STATICIRAM_NOT_MDCT as a workaround for the gcc bug where static functions are not long called. This is currently only an issue on the Nano2G (S5L8701 CPU) which is the only ARM target with enough IRAM for these functions. Also add multiple-inclusion protection for config-tremor.h. All plugins and codecs now compile cleanly for the Nano2G. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22914 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libtremor/config-tremor.h | 14 ++++++++++++++ apps/codecs/libtremor/framing.c | 17 +++++++++++------ apps/codecs/libtremor/vorbisfile.c | 4 ++-- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/apps/codecs/libtremor/config-tremor.h b/apps/codecs/libtremor/config-tremor.h index d360b5fd73..403fdfd88b 100644 --- a/apps/codecs/libtremor/config-tremor.h +++ b/apps/codecs/libtremor/config-tremor.h @@ -1,4 +1,8 @@ +#ifndef _CONFIG_TREMOR_H +#define _CONFIG_TREMOR_H + #include "codeclib.h" + #ifdef CPU_ARM #define _ARM_ASSEM_ #endif @@ -17,6 +21,14 @@ #define ICODE_ATTR_TREMOR_MDCT ICODE_ATTR #endif +/* Workaround for gcc bug where all static functions are called with short + calls */ +#if !defined(ICODE_ATTR_TREMOR_NOT_MDCT) && (CONFIG_CPU==S5L8701) +#define STATICIRAM_NOT_MDCT +#else +#define STATICIRAM_NOT_MDCT static +#endif + #ifndef ICODE_ATTR_TREMOR_NOT_MDCT #define ICODE_ATTR_TREMOR_NOT_MDCT ICODE_ATTR #endif @@ -47,3 +59,5 @@ #define CHANNELS 2 // #define _LOW_ACCURACY_ + +#endif /* _CONFIG_TREMOR_H */ diff --git a/apps/codecs/libtremor/framing.c b/apps/codecs/libtremor/framing.c index fb26b02709..ec1e4c34c2 100644 --- a/apps/codecs/libtremor/framing.c +++ b/apps/codecs/libtremor/framing.c @@ -104,9 +104,9 @@ static ogg_buffer *_fetch_buffer(ogg_buffer_state *bs,long bytes){ return ob; } -static ogg_reference *_fetch_ref(ogg_buffer_state *bs) +STATICIRAM_NOT_MDCT ogg_reference *_fetch_ref(ogg_buffer_state *bs) ICODE_ATTR_TREMOR_NOT_MDCT; -static ogg_reference *_fetch_ref(ogg_buffer_state *bs){ +STATICIRAM_NOT_MDCT ogg_reference *_fetch_ref(ogg_buffer_state *bs){ ogg_reference *or; bs->outstanding++; @@ -789,8 +789,9 @@ static void _next_lace(oggbyte_buffer *ob,ogg_stream_state *os){ } } -static void _span_queued_page(ogg_stream_state *os) ICODE_ATTR_TREMOR_NOT_MDCT; -static void _span_queued_page(ogg_stream_state *os){ +STATICIRAM_NOT_MDCT void _span_queued_page(ogg_stream_state *os) + ICODE_ATTR_TREMOR_NOT_MDCT; +STATICIRAM_NOT_MDCT void _span_queued_page(ogg_stream_state *os){ while( !(os->body_fill&FINFLAG) ){ if(!os->header_tail)break; @@ -948,9 +949,9 @@ int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno){ return OGG_SUCCESS; } -static int _packetout(ogg_stream_state *os,ogg_packet *op,int adv) +STATICIRAM_NOT_MDCT int _packetout(ogg_stream_state *os,ogg_packet *op,int adv) ICODE_ATTR_TREMOR_NOT_MDCT; -static int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){ +STATICIRAM_NOT_MDCT int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){ ogg_packet_release(op); _span_queued_page(os); @@ -1028,10 +1029,14 @@ static int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){ return 1; } +int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op) + ICODE_ATTR_TREMOR_NOT_MDCT; int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op){ return _packetout(os,op,1); } +int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op) + ICODE_ATTR_TREMOR_NOT_MDCT; int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op){ return _packetout(os,op,0); } diff --git a/apps/codecs/libtremor/vorbisfile.c b/apps/codecs/libtremor/vorbisfile.c index 8c81c63b7d..1e0336603c 100644 --- a/apps/codecs/libtremor/vorbisfile.c +++ b/apps/codecs/libtremor/vorbisfile.c @@ -684,10 +684,10 @@ static void _decode_clear(OggVorbis_File *vf){ 1) got a packet */ -static int _fetch_and_process_packet(OggVorbis_File *vf, +STATICIRAM_NOT_MDCT int _fetch_and_process_packet(OggVorbis_File *vf, int readp, int spanp) ICODE_ATTR_TREMOR_NOT_MDCT; -static int _fetch_and_process_packet(OggVorbis_File *vf, +STATICIRAM_NOT_MDCT int _fetch_and_process_packet(OggVorbis_File *vf, int readp, int spanp){ ogg_page og={0,0,0,0}; -- cgit