board_r: Support calling the main program after ulib init
For boards where ulib starts first we need to jump to the main program afterwards. Add the logic for this. Drop the noreturn attribute from board_init_r() and board_init_f_r to avoid needing #ifdef in the C file. Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
@@ -129,7 +129,7 @@ void __noreturn board_init_f_r_trampoline(ulong sp);
|
||||
* This is used to jump from pre-relocation to post-relocation U-Boot. It
|
||||
* enables the cache and jump to the new location.
|
||||
*/
|
||||
void __noreturn board_init_f_r(void);
|
||||
void board_init_f_r(void);
|
||||
|
||||
/*
|
||||
* board_init_f_r_trampoline64() - jump to relocated address with new stack
|
||||
|
||||
@@ -773,10 +773,13 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
|
||||
|
||||
initcall_run_r();
|
||||
|
||||
#ifdef CONFIG_ULIB
|
||||
if (gd_ulib())
|
||||
return;
|
||||
if (gd_ulib()) {
|
||||
#ifdef CONFIG_ULIB /* handle __noreturn attribute */
|
||||
if (!IS_ENABLED(CONFIG_ULIB_JUMP_TO_MAIN))
|
||||
return;
|
||||
#endif
|
||||
main();
|
||||
}
|
||||
|
||||
/* NOTREACHED - run_main_loop() does not return */
|
||||
hang();
|
||||
|
||||
@@ -392,6 +392,13 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
|
||||
*/
|
||||
int ulib_init_with_data(char *progname, struct global_data *data);
|
||||
|
||||
/**
|
||||
* main() - main program called from ulib
|
||||
*
|
||||
* When ulib has to start up the machine, it calls main() when it is finished.
|
||||
*/
|
||||
int main(void);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
/* Put only stuff here that the assembler can digest */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user