1
0
Fork 0
forked from len0rd/rockbox

ARM targets: Making a few functions non-static allows us to get rid of -ffunction-sections, significantly decreasing binary size and making things run a bit faster because static functions are no longer long_call.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12349 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2007-02-17 11:19:14 +00:00
parent 5dd08e17e9
commit 471d881979
8 changed files with 56 additions and 40 deletions

View file

@ -75,8 +75,9 @@ static uint32_t enc_size;
static int32_t err IBSS_ATTR; static int32_t err IBSS_ATTR;
/* convert unsigned 32 bit value to 80-bit floating point number */ /* convert unsigned 32 bit value to 80-bit floating point number */
static void uint32_h_to_ieee754_extended_be(uint8_t f[10], uint32_t l) ICODE_ATTR; STATICIRAM void uint32_h_to_ieee754_extended_be(uint8_t f[10], uint32_t l)
static void uint32_h_to_ieee754_extended_be(uint8_t f[10], uint32_t l) ICODE_ATTR;
STATICIRAM void uint32_h_to_ieee754_extended_be(uint8_t f[10], uint32_t l)
{ {
int32_t exp; int32_t exp;
@ -192,8 +193,9 @@ static bool on_end_file(struct enc_file_event_data *data)
return true; return true;
} /* on_end_file */ } /* on_end_file */
static void enc_events_callback(enum enc_events event, void *data) ICODE_ATTR; STATICIRAM void enc_events_callback(enum enc_events event, void *data)
static void enc_events_callback(enum enc_events event, void *data) ICODE_ATTR;
STATICIRAM void enc_events_callback(enum enc_events event, void *data)
{ {
if (event == ENC_WRITE_CHUNK) if (event == ENC_WRITE_CHUNK)
{ {
@ -219,8 +221,8 @@ static void enc_events_callback(enum enc_events event, void *data)
} /* enc_events_callback */ } /* enc_events_callback */
/* convert native pcm samples to aiff format samples */ /* convert native pcm samples to aiff format samples */
static void chunk_to_aiff_format(uint32_t *src, uint32_t *dst) ICODE_ATTR; STATICIRAM void chunk_to_aiff_format(uint32_t *src, uint32_t *dst) ICODE_ATTR;
static void chunk_to_aiff_format(uint32_t *src, uint32_t *dst) STATICIRAM void chunk_to_aiff_format(uint32_t *src, uint32_t *dst)
{ {
if (num_channels == 1) if (num_channels == 1)
{ {

View file

@ -2044,8 +2044,8 @@ bool init_mp3_encoder_engine(int sample_rate,
return true; return true;
} }
static void to_mono_mm(void) ICODE_ATTR; STATICIRAM void to_mono_mm(void) ICODE_ATTR;
static void to_mono_mm(void) STATICIRAM void to_mono_mm(void)
{ {
/* |llllllllllllllll|rrrrrrrrrrrrrrrr| => /* |llllllllllllllll|rrrrrrrrrrrrrrrr| =>
* |mmmmmmmmmmmmmmmm|mmmmmmmmmmmmmmmm| * |mmmmmmmmmmmmmmmm|mmmmmmmmmmmmmmmm|
@ -2100,8 +2100,9 @@ static inline void byte_swap_frame32(uint32_t *dst, uint32_t *src,
} /* byte_swap_frame32 */ } /* byte_swap_frame32 */
#endif /* ROCKBOX_LITTLE_ENDIAN */ #endif /* ROCKBOX_LITTLE_ENDIAN */
static void encode_frame(char *buffer, struct enc_chunk_hdr *chunk) ICODE_ATTR; STATICIRAM void encode_frame(char *buffer, struct enc_chunk_hdr *chunk)
static void encode_frame(char *buffer, struct enc_chunk_hdr *chunk) ICODE_ATTR;
STATICIRAM void encode_frame(char *buffer, struct enc_chunk_hdr *chunk)
{ {
int gr, gr_cnt; int gr, gr_cnt;
int max, min; int max, min;
@ -2382,8 +2383,9 @@ static void on_rec_new_stream(struct enc_buffer_event_data *data)
} }
} /* on_rec_new_stream */ } /* on_rec_new_stream */
static void enc_events_callback(enum enc_events event, void *data) ICODE_ATTR; STATICIRAM void enc_events_callback(enum enc_events event, void *data)
static void enc_events_callback(enum enc_events event, void *data) ICODE_ATTR;
STATICIRAM void enc_events_callback(enum enc_events event, void *data)
{ {
if (event == ENC_WRITE_CHUNK) if (event == ENC_WRITE_CHUNK)
{ {

View file

@ -181,8 +181,9 @@ static bool on_end_file(struct enc_file_event_data *data)
return true; return true;
} /* on_end_file */ } /* on_end_file */
static void enc_events_callback(enum enc_events event, void *data) ICODE_ATTR; STATICIRAM void enc_events_callback(enum enc_events event, void *data)
static void enc_events_callback(enum enc_events event, void *data) ICODE_ATTR;
STATICIRAM void enc_events_callback(enum enc_events event, void *data)
{ {
if (event == ENC_WRITE_CHUNK) if (event == ENC_WRITE_CHUNK)
{ {
@ -208,8 +209,8 @@ static void enc_events_callback(enum enc_events event, void *data)
} /* enc_events_callback */ } /* enc_events_callback */
/* convert native pcm samples to wav format samples */ /* convert native pcm samples to wav format samples */
static void chunk_to_wav_format(uint32_t *src, uint32_t *dst) ICODE_ATTR; STATICIRAM void chunk_to_wav_format(uint32_t *src, uint32_t *dst) ICODE_ATTR;
static void chunk_to_wav_format(uint32_t *src, uint32_t *dst) STATICIRAM void chunk_to_wav_format(uint32_t *src, uint32_t *dst)
{ {
if (num_channels == 1) if (num_channels == 1)
{ {

View file

@ -99,8 +99,8 @@ static const struct riff_header riff_header =
/* (*) updated during ENC_END_FILE event */ /* (*) updated during ENC_END_FILE event */
}; };
static void chunk_to_int32(int32_t *src) ICODE_ATTR; STATICIRAM void chunk_to_int32(int32_t *src) ICODE_ATTR;
static void chunk_to_int32(int32_t *src) STATICIRAM void chunk_to_int32(int32_t *src)
{ {
int32_t *src_end, *dst; int32_t *src_end, *dst;
#ifdef USE_IRAM #ifdef USE_IRAM
@ -306,8 +306,9 @@ static bool on_end_file(struct enc_file_event_data *data)
return true; return true;
} /* on_end_file */ } /* on_end_file */
static void enc_events_callback(enum enc_events event, void *data) ICODE_ATTR; STATICIRAM void enc_events_callback(enum enc_events event, void *data)
static void enc_events_callback(enum enc_events event, void *data) ICODE_ATTR;
STATICIRAM void enc_events_callback(enum enc_events event, void *data)
{ {
if (event == ENC_WRITE_CHUNK) if (event == ENC_WRITE_CHUNK)
{ {

View file

@ -98,8 +98,8 @@ static int perform_soft_reset(void);
static int set_multiple_mode(int sectors); static int set_multiple_mode(int sectors);
static int set_features(void); static int set_features(void);
static int wait_for_bsy(void) ICODE_ATTR; STATICIRAM int wait_for_bsy(void) ICODE_ATTR;
static int wait_for_bsy(void) STATICIRAM int wait_for_bsy(void)
{ {
long timeout = current_tick + HZ*30; long timeout = current_tick + HZ*30;
while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY)) { while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY)) {
@ -113,8 +113,8 @@ static int wait_for_bsy(void)
return 0; /* timeout */ return 0; /* timeout */
} }
static int wait_for_rdy(void) ICODE_ATTR; STATICIRAM int wait_for_rdy(void) ICODE_ATTR;
static int wait_for_rdy(void) STATICIRAM int wait_for_rdy(void)
{ {
long timeout; long timeout;
@ -135,8 +135,8 @@ static int wait_for_rdy(void)
return 0; /* timeout */ return 0; /* timeout */
} }
static int wait_for_start_of_transfer(void) ICODE_ATTR; STATICIRAM int wait_for_start_of_transfer(void) ICODE_ATTR;
static int wait_for_start_of_transfer(void) STATICIRAM int wait_for_start_of_transfer(void)
{ {
if (!wait_for_bsy()) if (!wait_for_bsy())
return 0; return 0;
@ -144,8 +144,8 @@ static int wait_for_start_of_transfer(void)
return (ATA_ALT_STATUS & (STATUS_BSY|STATUS_DRQ)) == STATUS_DRQ; return (ATA_ALT_STATUS & (STATUS_BSY|STATUS_DRQ)) == STATUS_DRQ;
} }
static int wait_for_end_of_transfer(void) ICODE_ATTR; STATICIRAM int wait_for_end_of_transfer(void) ICODE_ATTR;
static int wait_for_end_of_transfer(void) STATICIRAM int wait_for_end_of_transfer(void)
{ {
if (!wait_for_bsy()) if (!wait_for_bsy())
return 0; return 0;
@ -166,8 +166,8 @@ static void ata_led(bool on)
#endif #endif
#ifndef ATA_OPTIMIZED_READING #ifndef ATA_OPTIMIZED_READING
static void copy_read_sectors(unsigned char* buf, int wordcount) ICODE_ATTR; STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount) ICODE_ATTR;
static void copy_read_sectors(unsigned char* buf, int wordcount) STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount)
{ {
unsigned short tmp = 0; unsigned short tmp = 0;
@ -365,8 +365,9 @@ int ata_read_sectors(IF_MV2(int drive,)
} }
#ifndef ATA_OPTIMIZED_WRITING #ifndef ATA_OPTIMIZED_WRITING
static void copy_write_sectors(const unsigned char* buf, int wordcount) ICODE_ATTR; STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount)
static void copy_write_sectors(const unsigned char* buf, int wordcount) ICODE_ATTR;
STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount)
{ {
if ( (unsigned long)buf & 1) if ( (unsigned long)buf & 1)
{ /* not 16-bit aligned, copy byte by byte */ { /* not 16-bit aligned, copy byte by byte */

View file

@ -298,11 +298,20 @@
#if CONFIG_CPU != SH7034 #if CONFIG_CPU != SH7034
#define IRAM_STEAL #define IRAM_STEAL
#endif #endif
#if defined(CPU_ARM)
/* GCC quirk workaround: arm-elf-gcc treats static functions as short_call
* when not compiling with -ffunction-sections, even when the function has
* a section attribute. */
#define STATICIRAM
#else
#define STATICIRAM static
#endif
#else #else
#define ICODE_ATTR #define ICODE_ATTR
#define ICONST_ATTR #define ICONST_ATTR
#define IDATA_ATTR #define IDATA_ATTR
#define IBSS_ATTR #define IBSS_ATTR
#define STATICIRAM static
#endif #endif
#ifndef IRAM_LCDFRAMEBUFFER #ifndef IRAM_LCDFRAMEBUFFER

View file

@ -234,10 +234,10 @@ void sd_wait_for_state(tSDCardInfo* card, unsigned int state)
} }
static void copy_read_sectors(unsigned char* buf, int wordcount) STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount)
NOINLINE_ATTR ICODE_ATTR; NOINLINE_ATTR ICODE_ATTR;
static void copy_read_sectors(unsigned char* buf, int wordcount) STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount)
{ {
unsigned int tmp = 0; unsigned int tmp = 0;
@ -262,10 +262,10 @@ static void copy_read_sectors(unsigned char* buf, int wordcount)
} }
} }
static void copy_write_sectors(const unsigned char* buf, int wordcount) STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount)
NOINLINE_ATTR ICODE_ATTR; NOINLINE_ATTR ICODE_ATTR;
static void copy_write_sectors(const unsigned char* buf, int wordcount) STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount)
{ {
unsigned short tmp = 0; unsigned short tmp = 0;
const unsigned char* bufend = buf + wordcount*2; const unsigned char* bufend = buf + wordcount*2;

4
tools/configure vendored
View file

@ -229,7 +229,7 @@ arm7tdmicc () {
prefixtools arm-elf- prefixtools arm-elf-
GCCOPTS="$CCOPTS -mcpu=arm7tdmi" GCCOPTS="$CCOPTS -mcpu=arm7tdmi"
if test "X$1" != "Xshort"; then if test "X$1" != "Xshort"; then
GCCOPTS="$GCCOPTS -ffunction-sections -mlong-calls" GCCOPTS="$GCCOPTS -mlong-calls"
fi fi
GCCOPTIMIZE="-fomit-frame-pointer" GCCOPTIMIZE="-fomit-frame-pointer"
endian="little" endian="little"
@ -237,7 +237,7 @@ arm7tdmicc () {
arm9tdmicc () { arm9tdmicc () {
prefixtools arm-elf- prefixtools arm-elf-
GCCOPTS="$CCOPTS -mcpu=arm9tdmi -ffunction-sections -mlong-calls" GCCOPTS="$CCOPTS -mcpu=arm9tdmi -mlong-calls"
GCCOPTIMIZE="-fomit-frame-pointer" GCCOPTIMIZE="-fomit-frame-pointer"
endian="little" endian="little"
} }