Add INIT_ATTR to system_init()

On single-core targets, system_init() is only called from init()
in main.c, which is also INIT_ATTR, so this is safe.

Multi-core targets additionally call system_init() from cop_main(),
which isn't marked INIT_ATTR. I'm fairly certain that it would be
safe to add INIT_ATTR to cop_main() with a bit of refactoring, but
I don't have a way of testing it. So for now, leave INIT_ATTR off
for multi-core targets.

Change-Id: I8fe4358f975880ca317d46bda01d7d9db529d3e3
This commit is contained in:
Aidan MacDonald 2022-12-03 15:55:41 +00:00
parent 541960a110
commit 39439f6909
2 changed files with 7 additions and 1 deletions

View file

@ -31,7 +31,13 @@ extern void system_reboot (void);
/* Called from any UIE handler and panicf - wait for a key and return /* Called from any UIE handler and panicf - wait for a key and return
* to reboot system. */ * to reboot system. */
extern void system_exception_wait(void); extern void system_exception_wait(void);
#if NUM_CORES == 1
extern void system_init(void) INIT_ATTR;
#else
/* TODO: probably safe to use INIT_ATTR on multicore but this needs checking */
extern void system_init(void); extern void system_init(void);
#endif
extern long cpu_frequency; extern long cpu_frequency;

View file

@ -199,7 +199,7 @@ void system_exception_wait(void)
system_halt(); system_halt();
} }
void INIT_ATTR system_init(void) void system_init(void)
{ {
static const enum IMX31_CG_LIST disable_clocks[] INITDATA_ATTR = static const enum IMX31_CG_LIST disable_clocks[] INITDATA_ATTR =
{ {