Skip to content

Commit

Permalink
arch/armv7: unifying boot flow for armv7-a/r
Browse files Browse the repository at this point in the history
This attempts to unify the boot flow of armv7-a and armv7-r so that
nx_start() is kicked by C-level arm_boot functions directly.

Signed-off-by: Yanfeng Liu <[email protected]>
  • Loading branch information
yf13 committed Jan 21, 2025
1 parent de4135a commit e5e3af5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
18 changes: 2 additions & 16 deletions arch/arm/src/armv7-a/arm_head.S
Original file line number Diff line number Diff line change
Expand Up @@ -682,25 +682,11 @@ __cpu0_start:
bl arm_data_initialize
#endif

/* Perform early C-level, platform-specific initialization. Logic
* within arm_boot() must configure SDRAM and call arm_data_initialize().
*/
/* C-level arm_boot() which calls nx_start() and never returns. */

mov lr, #0 /* LR = return address (none) */
bl arm_boot

/* finish busy wait */

#ifdef CONFIG_ARMV7A_SMP_BUSY_WAIT
ldr r0, =CONFIG_ARMV7A_SMP_BUSY_WAIT_FLAG_ADDR
mov r1, #1
str r1, [r0]
dsb sy
#endif

/* Finally branch to the OS entry point */

mov lr, #0 /* LR = return address (none) */
b nx_start /* Branch to nx_start */
.size .Lvstart, .-.Lvstart

/***************************************************************************
Expand Down
14 changes: 8 additions & 6 deletions arch/arm/src/qemu/qemu_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@
# include <nuttx/sched_note.h>
#endif

#ifdef CONFIG_ARCH_ARMV7R
# include <nuttx/init.h>
#endif
#include <nuttx/init.h>

#include <nuttx/syslog/syslog_rpmsg.h>

Expand Down Expand Up @@ -108,11 +106,15 @@ void arm_boot(void)
syslog_rpmsg_init_early(g_syslog_rpmsg_buf, sizeof(g_syslog_rpmsg_buf));
#endif

#ifdef CONFIG_ARCH_ARMV7R
/* dont return per armv7-r/arm_head.S design */
#ifdef CONFIG_ARM_SMP_BUSY_WAIT
uint32_t *address = (uint32_t *)CONFIG_ARM_SMP_BUSY_WAIT_FLAG_ADDR;
*address = 1;
up_flush_dcache((uintptr_t)address, (uintptr_t)address + sizeof(address));
#endif

/* jump to nx_start */

nx_start();
#endif
}

#if defined(CONFIG_ARM_PSCI) && defined(CONFIG_SMP)
Expand Down

0 comments on commit e5e3af5

Please sign in to comment.