This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit f9d3eb13c3f412426a2658227f2b332e21e3a526 Author: Andrew Yong <[email protected]> AuthorDate: Thu Nov 26 10:51:02 2026 +0800 arch/arm/pp502x: Finish start-up in the common no-MMU entry. Rename the chip entry to pp502x_start and end it, after the remap and the relocation, with a temporary stack, the store of g_pp502x_ramsize, pp502x_cache_init() and pp502x_lowsetup(), and a branch to __start of arm_nommuhead.S. Drop the idle stack set-up, the BSS loop, the call of nx_start() and g_idle_topstack from pp502x_head.S, add arm_nommuhead.S to the Make and CMake builds of the chip, and select CONFIG_BOOT_RUNFROMSDRAM in the nsh and ostest configurations so that the common entry does not copy .data. The tail of the chip file repeated what the common entry does. The vector table, the second core sleep, the SDRAM sizing, the remap and the relocation stay in the chip file. Assisted-by: Claude Code:claude-fable-5-2 Signed-off-by: Andrew Yong <[email protected]> --- arch/arm/src/pp502x/CMakeLists.txt | 5 +- arch/arm/src/pp502x/Make.defs | 4 +- arch/arm/src/pp502x/pp502x_head.S | 62 +++++----------------- .../pp502x/apple-ipod-video/configs/nsh/defconfig | 1 + .../apple-ipod-video/configs/ostest/defconfig | 1 + 5 files changed, 21 insertions(+), 52 deletions(-) diff --git a/arch/arm/src/pp502x/CMakeLists.txt b/arch/arm/src/pp502x/CMakeLists.txt index 019a6facfad..36168dd7a28 100644 --- a/arch/arm/src/pp502x/CMakeLists.txt +++ b/arch/arm/src/pp502x/CMakeLists.txt @@ -21,7 +21,8 @@ # ############################################################################## # The start-up file has the vector table (its reset slot must be a relative -# branch), so it replaces the common head and vector table. +# branch), so it replaces the common head and vector table, and ends in the +# common entry point without MMU. get_target_property(NUTTX_SRCS nuttx SOURCES) list(FILTER NUTTX_SRCS EXCLUDE REGEX "arm_head\\.S$") @@ -44,4 +45,4 @@ if(NOT CONFIG_ARCH_IDLE_CUSTOM) list(APPEND SRCS pp502x_idle.c) endif() -target_sources(arch PRIVATE ${SRCS}) +target_sources(arch PRIVATE ${SRCS} ../arm/arm_nommuhead.S) diff --git a/arch/arm/src/pp502x/Make.defs b/arch/arm/src/pp502x/Make.defs index b74d7e2997f..5b332c47d21 100644 --- a/arch/arm/src/pp502x/Make.defs +++ b/arch/arm/src/pp502x/Make.defs @@ -23,11 +23,13 @@ include arm/Make.defs # The vector table lives in the start-up file (its reset slot must be a -# relative branch) and the idle loop sleeps the core. +# relative branch), which ends in the common entry point, and the idle loop +# sleeps the core. HEAD_ASRC = pp502x_head.S CMN_ASRCS := $(filter-out arm_vectortab.S,$(CMN_ASRCS)) +CMN_ASRCS += arm_nommuhead.S CMN_CSRCS := $(filter-out arm_idle.c,$(CMN_CSRCS)) CHIP_CSRCS = pp502x_allocateheap.c pp502x_cache.c pp502x_decodeirq.c pp502x_irq.c diff --git a/arch/arm/src/pp502x/pp502x_head.S b/arch/arm/src/pp502x/pp502x_head.S index 206a8ad4587..74acacf6bda 100644 --- a/arch/arm/src/pp502x/pp502x_head.S +++ b/arch/arm/src/pp502x/pp502x_head.S @@ -56,7 +56,7 @@ .globl _vector_start .globl _vector_end - .globl __start + .globl pp502x_start /**************************************************************************** * Name: _vector_start @@ -69,7 +69,7 @@ ****************************************************************************/ _vector_start: - b __start /* 0x00: Reset */ + b pp502x_start /* 0x00: Reset */ b arm_vectorundefinsn /* 0x04: Undefined instruction */ b arm_vectorsvc /* 0x08: Software interrupt */ b arm_vectorprefetch /* 0x0c: Prefetch abort */ @@ -81,7 +81,7 @@ _vector_start: _vector_end: /**************************************************************************** - * Name: __start + * Name: pp502x_start * * Description: * Entry point for both cores. The COP masks its interrupts and sleeps @@ -93,9 +93,9 @@ _vector_end: * ****************************************************************************/ - .type __start, %function + .type pp502x_start, %function -__start: +pp502x_start: mov r0, #(PSR_MODE_SVC | PSR_I_BIT | PSR_F_BIT) msr cpsr_c, r0 @@ -200,67 +200,31 @@ __start: ldr pc, =.Lremapped .ltorg - .size __start, . - __start + .size pp502x_start, . - pp502x_start /**************************************************************************** * Name: .Lremapped * * Description: - * Runs at the link address: set up the idle stack in SYS mode, turn the - * cache on (it uses no static data), clear BSS and start the OS. + * Runs at the link address: store the SDRAM size, turn the cache on and + * set up the clocks and the console UART on a temporary stack (neither + * call uses static data), then continue in the common entry point, which + * sets the idle stack, clears BSS and starts the OS. * ****************************************************************************/ .text .Lremapped: - mov r0, #(PSR_MODE_SYS | PSR_I_BIT | PSR_F_BIT) - msr cpsr_c, r0 - - adr r0, .Linitparms - ldmia r0, {r4, r5, sp} - ldr r0, =g_pp502x_ramsize str fp, [r0] - bl pp502x_cache_init - - mov fp, #0 -1: cmp r4, r5 - strcc fp, [r4], #4 - bcc 1b + ldr sp, =(_ebss + CONFIG_IDLETHREAD_STACKSIZE) + bl pp502x_cache_init bl pp502x_lowsetup -#ifdef USE_EARLYSERIALINIT - bl arm_earlyserialinit -#endif - - mov lr, #0 - b nx_start - -.Linitparms: - .long _sbss - .long _ebss - .long _ebss + CONFIG_IDLETHREAD_STACKSIZE + b __start .ltorg - -/**************************************************************************** - * Name: g_idle_topstack - * - * Description: - * The idle task stack starts at the end of BSS. The heap continues from - * there until the end of RAM. - * - ****************************************************************************/ - - .data - .align 4 - .globl g_idle_topstack - .type g_idle_topstack, object - -g_idle_topstack: - .long _ebss + CONFIG_IDLETHREAD_STACKSIZE - .size g_idle_topstack, . - g_idle_topstack .end diff --git a/boards/arm/pp502x/apple-ipod-video/configs/nsh/defconfig b/boards/arm/pp502x/apple-ipod-video/configs/nsh/defconfig index 8474ade2ec6..97b348d2fd1 100644 --- a/boards/arm/pp502x/apple-ipod-video/configs/nsh/defconfig +++ b/boards/arm/pp502x/apple-ipod-video/configs/nsh/defconfig @@ -20,6 +20,7 @@ CONFIG_ARCH_CHIP="pp502x" CONFIG_ARCH_CHIP_PP502X=y CONFIG_ARCH_INTERRUPTSTACK=2048 CONFIG_ARCH_STACKDUMP=y +CONFIG_BOOT_RUNFROMSDRAM=y CONFIG_BUILTIN=y CONFIG_FS_PROCFS=y CONFIG_IDLETHREAD_STACKSIZE=2048 diff --git a/boards/arm/pp502x/apple-ipod-video/configs/ostest/defconfig b/boards/arm/pp502x/apple-ipod-video/configs/ostest/defconfig index be90914f1d9..b3f9abff9c5 100644 --- a/boards/arm/pp502x/apple-ipod-video/configs/ostest/defconfig +++ b/boards/arm/pp502x/apple-ipod-video/configs/ostest/defconfig @@ -20,6 +20,7 @@ CONFIG_ARCH_CHIP="pp502x" CONFIG_ARCH_CHIP_PP502X=y CONFIG_ARCH_INTERRUPTSTACK=2048 CONFIG_ARCH_STACKDUMP=y +CONFIG_BOOT_RUNFROMSDRAM=y CONFIG_BUILTIN=y CONFIG_IDLETHREAD_STACKSIZE=2048 CONFIG_INIT_ENTRYPOINT="ostest_main"
