From 471d881979e0027737a435fd03efea493ea696f3 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sat, 17 Feb 2007 11:19:14 +0000 Subject: 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 --- firmware/drivers/ata.c | 25 ++++++++++++----------- firmware/export/config.h | 9 ++++++++ firmware/target/arm/sandisk/sansa-e200/ata-e200.c | 12 +++++------ 3 files changed, 28 insertions(+), 18 deletions(-) (limited to 'firmware') diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 349f76c0ec..91aae158c6 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -98,8 +98,8 @@ static int perform_soft_reset(void); static int set_multiple_mode(int sectors); static int set_features(void); -static int wait_for_bsy(void) ICODE_ATTR; -static int wait_for_bsy(void) +STATICIRAM int wait_for_bsy(void) ICODE_ATTR; +STATICIRAM int wait_for_bsy(void) { long timeout = current_tick + HZ*30; while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY)) { @@ -113,8 +113,8 @@ static int wait_for_bsy(void) return 0; /* timeout */ } -static int wait_for_rdy(void) ICODE_ATTR; -static int wait_for_rdy(void) +STATICIRAM int wait_for_rdy(void) ICODE_ATTR; +STATICIRAM int wait_for_rdy(void) { long timeout; @@ -135,8 +135,8 @@ static int wait_for_rdy(void) return 0; /* timeout */ } -static 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) ICODE_ATTR; +STATICIRAM int wait_for_start_of_transfer(void) { if (!wait_for_bsy()) return 0; @@ -144,8 +144,8 @@ static int wait_for_start_of_transfer(void) return (ATA_ALT_STATUS & (STATUS_BSY|STATUS_DRQ)) == STATUS_DRQ; } -static 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) ICODE_ATTR; +STATICIRAM int wait_for_end_of_transfer(void) { if (!wait_for_bsy()) return 0; @@ -166,8 +166,8 @@ static void ata_led(bool on) #endif #ifndef ATA_OPTIMIZED_READING -static 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) ICODE_ATTR; +STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount) { unsigned short tmp = 0; @@ -365,8 +365,9 @@ int ata_read_sectors(IF_MV2(int drive,) } #ifndef ATA_OPTIMIZED_WRITING -static void copy_write_sectors(const unsigned char* buf, int wordcount) ICODE_ATTR; -static void copy_write_sectors(const unsigned char* buf, int wordcount) +STATICIRAM 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) { /* not 16-bit aligned, copy byte by byte */ diff --git a/firmware/export/config.h b/firmware/export/config.h index 5e127b430d..4d7a3aecdf 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -298,11 +298,20 @@ #if CONFIG_CPU != SH7034 #define IRAM_STEAL #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 #define ICODE_ATTR #define ICONST_ATTR #define IDATA_ATTR #define IBSS_ATTR +#define STATICIRAM static #endif #ifndef IRAM_LCDFRAMEBUFFER diff --git a/firmware/target/arm/sandisk/sansa-e200/ata-e200.c b/firmware/target/arm/sandisk/sansa-e200/ata-e200.c index bfb0d27f97..56f351c001 100644 --- a/firmware/target/arm/sandisk/sansa-e200/ata-e200.c +++ b/firmware/target/arm/sandisk/sansa-e200/ata-e200.c @@ -234,10 +234,10 @@ void sd_wait_for_state(tSDCardInfo* card, unsigned int state) } -static void copy_read_sectors(unsigned char* buf, int wordcount) - NOINLINE_ATTR ICODE_ATTR; +STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount) + 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; @@ -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) - NOINLINE_ATTR ICODE_ATTR; +STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount) + 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; const unsigned char* bufend = buf + wordcount*2; -- cgit v1.2.3