diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-03-03 23:20:32 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-03-03 23:20:32 +0000 |
commit | f8edc325896c9c24d7f32f4861a0b0d2a8b9f4cd (patch) | |
tree | b2682307d01fffb54dd68e54b8f2e2986fe6bcc6 /apps | |
parent | e479853f1542616dab56817c8f5326364b663c7c (diff) | |
download | rockbox-f8edc325896c9c24d7f32f4861a0b0d2a8b9f4cd.tar.gz rockbox-f8edc325896c9c24d7f32f4861a0b0d2a8b9f4cd.zip |
FS#10756 - Free unused init code
Introduce a new .init section for initialisation code, so that it can be copied to an area which is later overwritten before calling. The stack/bss can then overwrite that code, effectively freeing the code size that the initialisation routines need. Gives a few kB ram usage back.
Only implemented for PP and as3525 so far. More targets could be added, as well as more functions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25013 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/filetypes.h | 2 | ||||
-rw-r--r-- | apps/gui/statusbar-skinned.h | 2 | ||||
-rw-r--r-- | apps/gui/statusbar.h | 2 | ||||
-rw-r--r-- | apps/gui/viewport.h | 3 | ||||
-rw-r--r-- | apps/gui/wps.h | 2 | ||||
-rw-r--r-- | apps/main.c | 5 | ||||
-rw-r--r-- | apps/playlist.h | 2 | ||||
-rw-r--r-- | apps/recorder/radio.h | 2 | ||||
-rw-r--r-- | apps/tagcache.h | 2 | ||||
-rw-r--r-- | apps/tagtree.h | 2 | ||||
-rw-r--r-- | apps/tdspeed.h | 2 | ||||
-rw-r--r-- | apps/tree.h | 4 |
12 files changed, 16 insertions, 14 deletions
diff --git a/apps/filetypes.h b/apps/filetypes.h index 068ec3b259..0b4fb7b812 100644 --- a/apps/filetypes.h +++ b/apps/filetypes.h @@ -56,7 +56,7 @@ void tree_get_filetypes(const struct filetype**, int*); /* init the filetypes structs. uses audio buffer for storage, so call early in init... */ -void filetype_init(void); +void filetype_init(void) INIT_ATTR; void read_viewer_theme_file(void); #ifdef HAVE_LCD_COLOR void read_color_theme_file(void); diff --git a/apps/gui/statusbar-skinned.h b/apps/gui/statusbar-skinned.h index 35bde0bcc1..7558d5a6f8 100644 --- a/apps/gui/statusbar-skinned.h +++ b/apps/gui/statusbar-skinned.h @@ -35,7 +35,7 @@ void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile); void sb_create_from_settings(enum screen_type screen); -void sb_skin_init(void); +void sb_skin_init(void) INIT_ATTR; struct viewport *sb_skin_get_info_vp(enum screen_type screen); void sb_skin_update(enum screen_type screen, bool force); diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index 8a938d177c..0233b56baf 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h @@ -100,7 +100,7 @@ struct gui_syncstatusbar struct gui_statusbar statusbars[NB_SCREENS]; }; -extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars); +extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars) INIT_ATTR; extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw); void gui_statusbar_changed(enum screen_type screen, diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h index fffd2fedf2..6a4dd02654 100644 --- a/apps/gui/viewport.h +++ b/apps/gui/viewport.h @@ -42,8 +42,7 @@ int viewport_get_nb_lines(const struct viewport *vp); * Initialize the viewportmanager, which in turns initializes the UI vp and * statusbar stuff */ -void viewportmanager_init(void); - +void viewportmanager_init(void) INIT_ATTR; void viewport_set_defaults(struct viewport *vp, const enum screen_type screen); diff --git a/apps/gui/wps.h b/apps/gui/wps.h index 0aa496748b..50fb891a14 100644 --- a/apps/gui/wps.h +++ b/apps/gui/wps.h @@ -28,7 +28,7 @@ long gui_wps_show(void); /* wrapper for the wps to load the skin (.wps/.rwps) files */ void wps_data_load(enum screen_type, const char *, bool); -void gui_sync_wps_init(void); +void gui_sync_wps_init(void) INIT_ATTR; /* fades the volume, e.g. on pause or stop */ void fade(bool fade_in, bool updatewps); diff --git a/apps/main.c b/apps/main.c index 187f0cdd96..f0bd84cf95 100644 --- a/apps/main.c +++ b/apps/main.c @@ -127,7 +127,7 @@ static void init(void); #ifdef SIMULATOR void app_main(void) #else -int main(void) __attribute__((noreturn)); +int main(void) INIT_ATTR __attribute__((noreturn)); int main(void) #endif { @@ -164,6 +164,7 @@ int main(void) root_menu(); } +static int init_dircache(bool preinit) INIT_ATTR; static int init_dircache(bool preinit) { #ifdef HAVE_DIRCACHE @@ -239,6 +240,7 @@ static int init_dircache(bool preinit) } #ifdef HAVE_TAGCACHE +static void init_tagcache(void) INIT_ATTR; static void init_tagcache(void) { bool clear = false; @@ -372,6 +374,7 @@ static void init(void) #else +static void init(void) INIT_ATTR; static void init(void) { int rc; diff --git a/apps/playlist.h b/apps/playlist.h index 638e3949b4..331d2f9f2a 100644 --- a/apps/playlist.h +++ b/apps/playlist.h @@ -119,7 +119,7 @@ struct playlist_track_info }; /* Exported functions only for current playlist. */ -void playlist_init(void); +void playlist_init(void) INIT_ATTR; void playlist_shutdown(void); int playlist_create(const char *dir, const char *file); int playlist_resume(void); diff --git a/apps/recorder/radio.h b/apps/recorder/radio.h index 7277b46b42..129d1dda09 100644 --- a/apps/recorder/radio.h +++ b/apps/recorder/radio.h @@ -27,7 +27,7 @@ #if CONFIG_TUNER void radio_load_presets(char *filename); -void radio_init(void); +void radio_init(void) INIT_ATTR; int radio_screen(void); void radio_start(void); void radio_pause(void); diff --git a/apps/tagcache.h b/apps/tagcache.h index f238bc0902..1488c3bd39 100644 --- a/apps/tagcache.h +++ b/apps/tagcache.h @@ -239,7 +239,7 @@ bool tagcache_is_ramcache(void); bool tagcache_fill_tags(struct mp3entry *id3, const char *filename); void tagcache_unload_ramcache(void); #endif -void tagcache_init(void); +void tagcache_init(void) INIT_ATTR; bool tagcache_is_initialized(void); bool tagcache_is_usable(void); void tagcache_start_scan(void); diff --git a/apps/tagtree.h b/apps/tagtree.h index a08c7433a4..aaf5158e5b 100644 --- a/apps/tagtree.h +++ b/apps/tagtree.h @@ -38,7 +38,7 @@ struct tagentry { bool tagtree_export(void); bool tagtree_import(void); -void tagtree_init(void); +void tagtree_init(void) INIT_ATTR; int tagtree_enter(struct tree_context* c); void tagtree_exit(struct tree_context* c); int tagtree_load(struct tree_context* c); diff --git a/apps/tdspeed.h b/apps/tdspeed.h index 715963a4f0..c3b7fc4635 100644 --- a/apps/tdspeed.h +++ b/apps/tdspeed.h @@ -36,7 +36,7 @@ #define GET_STRETCH(pitch, speed) \ ((speed * PITCH_SPEED_100 + pitch / 2L) / pitch) -void tdspeed_init(void); +void tdspeed_init(void) INIT_ATTR; bool tdspeed_config(int samplerate, bool stereo, int32_t factor); long tdspeed_est_output_size(void); long tdspeed_est_input_size(long size); diff --git a/apps/tree.h b/apps/tree.h index 3b31d02451..f3057e81e4 100644 --- a/apps/tree.h +++ b/apps/tree.h @@ -71,8 +71,8 @@ struct tree_context { }; void tree_drawlists(void); -void tree_mem_init(void); -void tree_gui_init(void); +void tree_mem_init(void) INIT_ATTR; +void tree_gui_init(void) INIT_ATTR; void get_current_file(char* buffer, int buffer_len); void set_dirfilter(int l_dirfilter); void set_current_file(char *path); |