diff options
| author | Thomas Martitz <kugel@rockbox.org> | 2010-03-04 17:44:57 +0000 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2010-03-04 17:44:57 +0000 |
| commit | a62eced78a37b56cc804530fc73068d7c9a142ae (patch) | |
| tree | 95fb837026fff42abb76628a2e9a598e0ebed69d | |
| parent | 2ac962aceb0ea2199c9d89e94e474641013ba390 (diff) | |
| download | rockbox-a62eced78a37b56cc804530fc73068d7c9a142ae.zip rockbox-a62eced78a37b56cc804530fc73068d7c9a142ae.tar.gz rockbox-a62eced78a37b56cc804530fc73068d7c9a142ae.tar.bz2 rockbox-a62eced78a37b56cc804530fc73068d7c9a142ae.tar.xz | |
Add a few warning comments about the INIT_ATTR stuff.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25024 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/main.c | 6 | ||||
| -rw-r--r-- | firmware/export/config.h | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/apps/main.c b/apps/main.c index dbfd2dc..dd41559 100644 --- a/apps/main.c +++ b/apps/main.c @@ -127,6 +127,10 @@ static void init(void); #ifdef SIMULATOR void app_main(void) #else +/* main(), and various functions called by main() and init() may be + * be INIT_ATTR. These functions must not be called after the final call + * to root_menu() at the end of main() + * see definition of INIT_ATTR in config.h */ int main(void) INIT_ATTR __attribute__((noreturn)); int main(void) #endif @@ -161,6 +165,8 @@ int main(void) #endif /* #ifdef AUTOROCK */ global_status.last_volume_change = 0; + /* no calls INIT_ATTR functions after this point anymore! + * see definition of INIT_ATTR in config.h */ root_menu(); } diff --git a/firmware/export/config.h b/firmware/export/config.h index ef72784..739a859 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -748,6 +748,16 @@ Lyre prototype 1 */ #define STATICIRAM static #endif #if (defined(CPU_PP) || (CONFIG_CPU == AS3525)) && !defined(SIMULATOR) && !defined(BOOTLOADER) +/* Functions that have INIT_ATTR attached are NOT guaranteed to survive after + * root_menu() has been called. Their code may be overwritten by other data or + * code in order to save RAM, and references to them might point into + * zombie area. + * + * It is critical that you make sure these functions are only called before + * the final call to root_menu() (see apps/main.c) is called (i.e. basically + * only while main() runs), otherwise things may go wild, + * from crashes to freezes to exploding daps. + */ #define INIT_ATTR __attribute__ ((section(".init"))) #define HAVE_INIT_ATTR #else |