This is an automated email from the ASF dual-hosted git repository. masayuki pushed a commit to branch revert-12265-static-idlestack in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 6fcf65a7b469bccef93bf0f75120c26659e84cbf Author: Masayuki Ishikawa <[email protected]> AuthorDate: Sun May 12 08:43:50 2024 +0900 Revert "arch/risc-v: unify idle stack calculation" This reverts commit afb5a66847e31eebacb60ebbe1c1e42cfc70c7c5. --- arch/risc-v/src/bl602/bl602_start.c | 2 ++ arch/risc-v/src/bl808/bl808_start.c | 7 +++++++ arch/risc-v/src/c906/c906_start.c | 12 ++++++++++++ arch/risc-v/src/common/espressif/esp_start.c | 2 ++ arch/risc-v/src/common/riscv_cpuidlestack.c | 3 --- arch/risc-v/src/esp32c3-legacy/esp32c3_start.c | 2 ++ arch/risc-v/src/fe310/fe310_start.c | 12 ++++++++++++ arch/risc-v/src/hpm6000/hpm_start.c | 12 ++++++++++++ arch/risc-v/src/hpm6750/hpm6750_start.c | 12 ++++++++++++ arch/risc-v/src/jh7110/jh7110_start.c | 7 +++++++ arch/risc-v/src/k210/k210_start.c | 7 +++++++ arch/risc-v/src/k230/k230_start.c | 7 +++++++ arch/risc-v/src/litex/litex_start.c | 12 ++++++++++++ arch/risc-v/src/mpfs/mpfs_start.c | 12 ++++++++++++ arch/risc-v/src/qemu-rv/qemu_rv_start.c | 7 +++++++ arch/risc-v/src/rv32m1/rv32m1_start.c | 12 ++++++++++++ 16 files changed, 125 insertions(+), 3 deletions(-) diff --git a/arch/risc-v/src/bl602/bl602_start.c b/arch/risc-v/src/bl602/bl602_start.c index 63e99b6dec..464e2e20fc 100644 --- a/arch/risc-v/src/bl602/bl602_start.c +++ b/arch/risc-v/src/bl602/bl602_start.c @@ -66,6 +66,8 @@ static struct boot2_partition_table_s g_boot2_partition_table used_data; * Public Data ****************************************************************************/ +uintptr_t g_idle_topstack = (uintptr_t)_ebss + SMP_STACK_SIZE; + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/risc-v/src/bl808/bl808_start.c b/arch/risc-v/src/bl808/bl808_start.c index d882f0671b..b96cf2d7f8 100644 --- a/arch/risc-v/src/bl808/bl808_start.c +++ b/arch/risc-v/src/bl808/bl808_start.c @@ -58,6 +58,13 @@ extern void __trap_vec(void); * Public Data ****************************************************************************/ +/* NOTE: g_idle_topstack needs to point the top of the idle stack + * for last CPU and this value is used in up_initial_state() + */ + +uintptr_t g_idle_topstack = BL808_IDLESTACK_BASE + + SMP_STACK_SIZE * CONFIG_SMP_NCPUS; + /**************************************************************************** * Private Functions ****************************************************************************/ diff --git a/arch/risc-v/src/c906/c906_start.c b/arch/risc-v/src/c906/c906_start.c index d4774a2a01..8b7dd53c44 100644 --- a/arch/risc-v/src/c906/c906_start.c +++ b/arch/risc-v/src/c906/c906_start.c @@ -48,6 +48,18 @@ * Public Data ****************************************************************************/ +/* g_idle_topstack: _sbss is the start of the BSS region as defined by the + * linker script. _ebss lies at the end of the BSS region. The idle task + * stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. + * The IDLE thread is the thread that the system boots on and, eventually, + * becomes the IDLE, do nothing task that runs only when there is nothing + * else to run. The heap continues from there until the end of memory. + * g_idle_topstack is a read-only variable the provides this computed + * address. + */ + +uintptr_t g_idle_topstack = C906_IDLESTACK_TOP; + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/risc-v/src/common/espressif/esp_start.c b/arch/risc-v/src/common/espressif/esp_start.c index 28c33c53c3..bc18fe5d0e 100644 --- a/arch/risc-v/src/common/espressif/esp_start.c +++ b/arch/risc-v/src/common/espressif/esp_start.c @@ -174,6 +174,8 @@ HDR_ATTR static void (*_entry_point)(void) = __start; * Public Data ****************************************************************************/ +uintptr_t g_idle_topstack = (uintptr_t)_ebss + SMP_STACK_SIZE; + /**************************************************************************** * Private Functions ****************************************************************************/ diff --git a/arch/risc-v/src/common/riscv_cpuidlestack.c b/arch/risc-v/src/common/riscv_cpuidlestack.c index 18f211bfda..0358a3464e 100644 --- a/arch/risc-v/src/common/riscv_cpuidlestack.c +++ b/arch/risc-v/src/common/riscv_cpuidlestack.c @@ -47,9 +47,6 @@ * Public Data ****************************************************************************/ -uintptr_t g_idle_topstack = (uintptr_t)_ebss + - SMP_STACK_SIZE * CONFIG_SMP_NCPUS; - const uint8_t *g_cpux_idlestack[CONFIG_SMP_NCPUS]; /**************************************************************************** diff --git a/arch/risc-v/src/esp32c3-legacy/esp32c3_start.c b/arch/risc-v/src/esp32c3-legacy/esp32c3_start.c index ae808190f9..c2b2cc731f 100644 --- a/arch/risc-v/src/esp32c3-legacy/esp32c3_start.c +++ b/arch/risc-v/src/esp32c3-legacy/esp32c3_start.c @@ -127,6 +127,8 @@ HDR_ATTR static void (*_entry_point)(void) = __start; * Public Data ****************************************************************************/ +uintptr_t g_idle_topstack = (uintptr_t)_ebss + SMP_STACK_SIZE; + /**************************************************************************** * Private Functions ****************************************************************************/ diff --git a/arch/risc-v/src/fe310/fe310_start.c b/arch/risc-v/src/fe310/fe310_start.c index 7e08910d3f..279ce82d0f 100644 --- a/arch/risc-v/src/fe310/fe310_start.c +++ b/arch/risc-v/src/fe310/fe310_start.c @@ -47,6 +47,18 @@ * Public Data ****************************************************************************/ +/* g_idle_topstack: _sbss is the start of the BSS region as defined by the + * linker script. _ebss lies at the end of the BSS region. The idle task + * stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. + * The IDLE thread is the thread that the system boots on and, eventually, + * becomes the IDLE, do nothing task that runs only when there is nothing + * else to run. The heap continues from there until the end of memory. + * g_idle_topstack is a read-only variable the provides this computed + * address. + */ + +uintptr_t g_idle_topstack = FE310_IDLESTACK_TOP; + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/risc-v/src/hpm6000/hpm_start.c b/arch/risc-v/src/hpm6000/hpm_start.c index 331e5d2098..d368b9027a 100644 --- a/arch/risc-v/src/hpm6000/hpm_start.c +++ b/arch/risc-v/src/hpm6000/hpm_start.c @@ -42,6 +42,18 @@ * Public Data ****************************************************************************/ +/* g_idle_topstack: _sbss is the start of the BSS region as defined by the + * linker script. _ebss lies at the end of the BSS region. The idle task + * stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. + * The IDLE thread is the thread that the system boots on and, eventually, + * becomes the IDLE, do nothing task that runs only when there is nothing + * else to run. The heap continues from there until the end of memory. + * g_idle_topstack is a read-only variable the provides this computed + * address. + */ + +uintptr_t g_idle_topstack = HPM_IDLESTACK_TOP; + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/risc-v/src/hpm6750/hpm6750_start.c b/arch/risc-v/src/hpm6750/hpm6750_start.c index 108fe5ff28..a751c8cf4f 100644 --- a/arch/risc-v/src/hpm6750/hpm6750_start.c +++ b/arch/risc-v/src/hpm6750/hpm6750_start.c @@ -42,6 +42,18 @@ * Public Data ****************************************************************************/ +/* g_idle_topstack: _sbss is the start of the BSS region as defined by the + * linker script. _ebss lies at the end of the BSS region. The idle task + * stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. + * The IDLE thread is the thread that the system boots on and, eventually, + * becomes the IDLE, do nothing task that runs only when there is nothing + * else to run. The heap continues from there until the end of memory. + * g_idle_topstack is a read-only variable the provides this computed + * address. + */ + +uintptr_t g_idle_topstack = HPM6750_IDLESTACK_TOP; + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/risc-v/src/jh7110/jh7110_start.c b/arch/risc-v/src/jh7110/jh7110_start.c index 334bac41fa..1dac2fdf53 100644 --- a/arch/risc-v/src/jh7110/jh7110_start.c +++ b/arch/risc-v/src/jh7110/jh7110_start.c @@ -52,6 +52,13 @@ extern void __trap_vec(void); * Public Data ****************************************************************************/ +/* NOTE: g_idle_topstack needs to point the top of the idle stack + * for last CPU and this value is used in up_initial_state() + */ + +uintptr_t g_idle_topstack = JH7110_IDLESTACK_BASE + + SMP_STACK_SIZE * CONFIG_SMP_NCPUS; + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/risc-v/src/k210/k210_start.c b/arch/risc-v/src/k210/k210_start.c index 7d3fa35e03..b85525abf0 100644 --- a/arch/risc-v/src/k210/k210_start.c +++ b/arch/risc-v/src/k210/k210_start.c @@ -48,6 +48,13 @@ * Public Data ****************************************************************************/ +/* NOTE: g_idle_topstack needs to point the top of the idle stack + * for CPU0 and this value is used in up_initial_state() + */ + +uintptr_t g_idle_topstack = K210_IDLESTACK_BASE + + SMP_STACK_SIZE * CONFIG_SMP_NCPUS; + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/risc-v/src/k230/k230_start.c b/arch/risc-v/src/k230/k230_start.c index a389558f3c..aa56852270 100644 --- a/arch/risc-v/src/k230/k230_start.c +++ b/arch/risc-v/src/k230/k230_start.c @@ -101,6 +101,13 @@ static void k230_copy_init_data(void) * Public Data ****************************************************************************/ +/* NOTE: g_idle_topstack needs to point the top of the idle stack + * for last CPU and this value is used in up_initial_state() + */ + +uintptr_t g_idle_topstack = K230_IDLESTACK_BASE + + SMP_STACK_SIZE * CONFIG_SMP_NCPUS; + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/risc-v/src/litex/litex_start.c b/arch/risc-v/src/litex/litex_start.c index 8d5c0b6531..00f33769c1 100644 --- a/arch/risc-v/src/litex/litex_start.c +++ b/arch/risc-v/src/litex/litex_start.c @@ -56,6 +56,18 @@ * Public Data ****************************************************************************/ +/* g_idle_topstack: _sbss is the start of the BSS region as defined by the + * linker script. _ebss lies at the end of the BSS region. The idle task + * stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. + * The IDLE thread is the thread that the system boots on and, eventually, + * becomes the IDLE, do nothing task that runs only when there is nothing + * else to run. The heap continues from there until the end of memory. + * g_idle_topstack is a read-only variable the provides this computed + * address. + */ + +uintptr_t g_idle_topstack = LITEX_IDLESTACK_TOP; + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/risc-v/src/mpfs/mpfs_start.c b/arch/risc-v/src/mpfs/mpfs_start.c index 02b74cec06..eae7c5399b 100644 --- a/arch/risc-v/src/mpfs/mpfs_start.c +++ b/arch/risc-v/src/mpfs/mpfs_start.c @@ -57,6 +57,18 @@ * Public Data ****************************************************************************/ +/* g_idle_topstack: _sbss is the start of the BSS region as defined by the + * linker script. _ebss lies at the end of the BSS region. The idle task + * stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. + * The IDLE thread is the thread that the system boots on and, eventually, + * becomes the IDLE, do nothing task that runs only when there is nothing + * else to run. The heap continues from there until the end of memory. + * g_idle_topstack is a read-only variable the provides this computed + * address. + */ + +uintptr_t g_idle_topstack = MPFS_IDLESTACK_TOP; + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/risc-v/src/qemu-rv/qemu_rv_start.c b/arch/risc-v/src/qemu-rv/qemu_rv_start.c index 6335562beb..757e78d767 100644 --- a/arch/risc-v/src/qemu-rv/qemu_rv_start.c +++ b/arch/risc-v/src/qemu-rv/qemu_rv_start.c @@ -109,6 +109,13 @@ static bool boot_secondary = false; * Public Data ****************************************************************************/ +/* NOTE: g_idle_topstack needs to point the top of the idle stack + * for last CPU and this value is used in up_initial_state() + */ + +uintptr_t g_idle_topstack = QEMU_RV_IDLESTACK_BASE + + SMP_STACK_SIZE * CONFIG_SMP_NCPUS; + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/risc-v/src/rv32m1/rv32m1_start.c b/arch/risc-v/src/rv32m1/rv32m1_start.c index 2a841ddebe..fb9c6ef996 100644 --- a/arch/risc-v/src/rv32m1/rv32m1_start.c +++ b/arch/risc-v/src/rv32m1/rv32m1_start.c @@ -50,6 +50,18 @@ * Public Data ****************************************************************************/ +/* g_idle_topstack: _sbss is the start of the BSS region as defined by the + * linker script. _ebss lies at the end of the BSS region. The idle task + * stack starts at the end of BSS and is of size CONFIG_IDLETHREAD_STACKSIZE. + * The IDLE thread is the thread that the system boots on and, eventually, + * becomes the IDLE, do nothing task that runs only when there is nothing + * else to run. The heap continues from there until the end of memory. + * g_idle_topstack is a read-only variable the provides this computed + * address. + */ + +uintptr_t g_idle_topstack = RV32M1_IDLESTACK_TOP; + /**************************************************************************** * Public Functions ****************************************************************************/
