risc-v: Use _ebss instead of _default_stack_limit as idle stack base

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi 2022-02-13 11:12:51 +08:00 committed by Xiang Xiao
parent fc4ab4fd94
commit 64130b4775
15 changed files with 30 additions and 52 deletions

View File

@ -25,6 +25,8 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include "riscv_internal.h"
#include "hardware/c906_memorymap.h" #include "hardware/c906_memorymap.h"
#include "hardware/c906_uart.h" #include "hardware/c906_uart.h"
#include "hardware/c906_clint.h" #include "hardware/c906_clint.h"
@ -35,13 +37,12 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Idle thread stack starts from _default_stack_limit */ /* Idle thread stack starts from _ebss */
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern uintptr_t *_default_stack_limit; #define C906_IDLESTACK_BASE (uintptr_t)&_ebss
#define C906_IDLESTACK_BASE (uintptr_t)&_default_stack_limit
#else #else
#define C906_IDLESTACK_BASE _default_stack_limit #define C906_IDLESTACK_BASE _ebss
#endif #endif
#define C906_IDLESTACK0_TOP (C906_IDLESTACK_BASE + CONFIG_IDLETHREAD_STACKSIZE) #define C906_IDLESTACK0_TOP (C906_IDLESTACK_BASE + CONFIG_IDLETHREAD_STACKSIZE)

View File

@ -25,6 +25,8 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include "riscv_internal.h"
#include "hardware/fe310_memorymap.h" #include "hardware/fe310_memorymap.h"
#include "hardware/fe310_uart.h" #include "hardware/fe310_uart.h"
#include "hardware/fe310_clint.h" #include "hardware/fe310_clint.h"
@ -36,13 +38,12 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Idle thread stack starts from _default_stack_limit */ /* Idle thread stack starts from _ebss */
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern uintptr_t *_default_stack_limit; #define FE310_IDLESTACK_BASE (uintptr_t)&_ebss
#define FE310_IDLESTACK_BASE (uintptr_t)&_default_stack_limit
#else #else
#define FE310_IDLESTACK_BASE _default_stack_limit #define FE310_IDLESTACK_BASE _ebss
#endif #endif
#define FE310_IDLESTACK_TOP (FE310_IDLESTACK_BASE + CONFIG_IDLETHREAD_STACKSIZE) #define FE310_IDLESTACK_TOP (FE310_IDLESTACK_BASE + CONFIG_IDLETHREAD_STACKSIZE)

View File

@ -25,6 +25,8 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include "riscv_internal.h"
#include "hardware/k210_memorymap.h" #include "hardware/k210_memorymap.h"
#include "hardware/k210_uart.h" #include "hardware/k210_uart.h"
#include "hardware/k210_clint.h" #include "hardware/k210_clint.h"
@ -38,10 +40,9 @@
/* Idle thread stack starts from _ebss */ /* Idle thread stack starts from _ebss */
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern uintptr_t *_default_stack_limit; #define K210_IDLESTACK_BASE (uintptr_t)&_ebss
#define K210_IDLESTACK_BASE (uintptr_t)&_default_stack_limit
#else #else
#define K210_IDLESTACK_BASE _default_stack_limit #define K210_IDLESTACK_BASE _ebss
#endif #endif
#define K210_IDLESTACK0_BASE (K210_IDLESTACK_BASE) #define K210_IDLESTACK0_BASE (K210_IDLESTACK_BASE)

View File

@ -25,6 +25,8 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include "riscv_internal.h"
#include "hardware/mpfs_clint.h" #include "hardware/mpfs_clint.h"
#include "hardware/mpfs_memorymap.h" #include "hardware/mpfs_memorymap.h"
#include "hardware/mpfs_plic.h" #include "hardware/mpfs_plic.h"
@ -35,13 +37,12 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Idle thread stack starts from _default_stack_limit */ /* Idle thread stack starts from _ebss */
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern uintptr_t *_default_stack_limit; #define MPFS_IDLESTACK_BASE (uintptr_t)&_ebss
#define MPFS_IDLESTACK_BASE (uintptr_t)&_default_stack_limit
#else #else
#define MPFS_IDLESTACK_BASE _default_stack_limit #define MPFS_IDLESTACK_BASE _ebss
#endif #endif
#define MPFS_IDLESTACK_SIZE (CONFIG_IDLETHREAD_STACKSIZE & ~15) #define MPFS_IDLESTACK_SIZE (CONFIG_IDLETHREAD_STACKSIZE & ~15)

View File

@ -74,10 +74,8 @@ SECTIONS
*(.gnu.linkonce.b.*) *(.gnu.linkonce.b.*)
*(.gnu.linkonce.sb.*) *(.gnu.linkonce.sb.*)
*(COMMON) *(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
. = ALIGN(32); . = ALIGN(32);
_default_stack_limit = ABSOLUTE(.); _ebss = ABSOLUTE(.);
} > sram } > sram
/* Stabs debugging sections. */ /* Stabs debugging sections. */

View File

@ -74,10 +74,8 @@ SECTIONS
*(.gnu.linkonce.b.*) *(.gnu.linkonce.b.*)
*(.gnu.linkonce.sb.*) *(.gnu.linkonce.sb.*)
*(COMMON) *(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
. = ALIGN(32); . = ALIGN(32);
_default_stack_limit = ABSOLUTE(.); _ebss = ABSOLUTE(.);
} > sram } > sram
/* Stabs debugging sections. */ /* Stabs debugging sections. */

View File

@ -72,10 +72,8 @@ SECTIONS
*(.gnu.linkonce.b.*) *(.gnu.linkonce.b.*)
*(.gnu.linkonce.sb.*) *(.gnu.linkonce.sb.*)
*(COMMON) *(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
. = ALIGN(32); . = ALIGN(32);
_default_stack_limit = ABSOLUTE(.); _ebss = ABSOLUTE(.);
} > sram } > sram
/* Stabs debugging sections. */ /* Stabs debugging sections. */

View File

@ -72,10 +72,8 @@ SECTIONS
*(.gnu.linkonce.b.*) *(.gnu.linkonce.b.*)
*(.gnu.linkonce.sb.*) *(.gnu.linkonce.sb.*)
*(COMMON) *(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
. = ALIGN(32); . = ALIGN(32);
_default_stack_limit = ABSOLUTE(.); _ebss = ABSOLUTE(.);
} > sram } > sram
/* Stabs debugging sections. */ /* Stabs debugging sections. */

View File

@ -79,10 +79,8 @@ SECTIONS
*(.gnu.linkonce.b.*) *(.gnu.linkonce.b.*)
*(.gnu.linkonce.sb.*) *(.gnu.linkonce.sb.*)
*(COMMON) *(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
. = ALIGN(32); . = ALIGN(32);
_default_stack_limit = ABSOLUTE(.); _ebss = ABSOLUTE(.);
} > sram } > sram
/* Stabs debugging sections. */ /* Stabs debugging sections. */

View File

@ -91,16 +91,10 @@ SECTIONS
/* Page tables here, align to 4K boundary */ /* Page tables here, align to 4K boundary */
.pgtables : ALIGN(0x1000) { .pgtables : ALIGN(0x1000) {
*(.pgtables) *(.pgtables)
. = ALIGN(4); . = ALIGN(32);
_ebss = ABSOLUTE(.); _ebss = ABSOLUTE(.);
} > ksram } > ksram
/* Stack top */
.stack_top : {
. = ALIGN(32);
_default_stack_limit = ABSOLUTE(.);
} > ksram
/* Stabs debugging sections. */ /* Stabs debugging sections. */
.stab 0 : { *(.stab) } .stab 0 : { *(.stab) }

View File

@ -101,10 +101,8 @@ SECTIONS
*(.gnu.linkonce.b.*) *(.gnu.linkonce.b.*)
*(.gnu.linkonce.sb.*) *(.gnu.linkonce.sb.*)
*(COMMON) *(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
. = ALIGN(32); . = ALIGN(32);
_default_stack_limit = ABSOLUTE(.); _ebss = ABSOLUTE(.);
} > l2lim } > l2lim
PROVIDE(__mpfs_nuttx_end = .); PROVIDE(__mpfs_nuttx_end = .);

View File

@ -75,10 +75,8 @@ SECTIONS
*(.gnu.linkonce.b.*) *(.gnu.linkonce.b.*)
*(.gnu.linkonce.sb.*) *(.gnu.linkonce.sb.*)
*(COMMON) *(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
. = ALIGN(32); . = ALIGN(32);
_default_stack_limit = ABSOLUTE(.); _ebss = ABSOLUTE(.);
} > lim } > lim
/* Stabs debugging sections. */ /* Stabs debugging sections. */

View File

@ -74,10 +74,8 @@ SECTIONS
*(.gnu.linkonce.b.*) *(.gnu.linkonce.b.*)
*(.gnu.linkonce.sb.*) *(.gnu.linkonce.sb.*)
*(COMMON) *(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
. = ALIGN(32); . = ALIGN(32);
_default_stack_limit = ABSOLUTE(.); _ebss = ABSOLUTE(.);
} > sram } > sram
/* Stabs debugging sections. */ /* Stabs debugging sections. */

View File

@ -75,10 +75,8 @@ SECTIONS
*(.gnu.linkonce.b.*) *(.gnu.linkonce.b.*)
*(.gnu.linkonce.sb.*) *(.gnu.linkonce.sb.*)
*(COMMON) *(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
. = ALIGN(32); . = ALIGN(32);
_default_stack_limit = ABSOLUTE(.); _ebss = ABSOLUTE(.);
} > lim } > lim
/* Stabs debugging sections. */ /* Stabs debugging sections. */

View File

@ -74,10 +74,8 @@ SECTIONS
*(.gnu.linkonce.b.*) *(.gnu.linkonce.b.*)
*(.gnu.linkonce.sb.*) *(.gnu.linkonce.sb.*)
*(COMMON) *(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
. = ALIGN(32); . = ALIGN(32);
_default_stack_limit = ABSOLUTE(.); _ebss = ABSOLUTE(.);
} > sram } > sram
/* Stabs debugging sections. */ /* Stabs debugging sections. */