You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/04/14 18:53:24 UTC
[incubator-nuttx] 04/06: Add initialization for idle task.
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch pr789
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 437a937a8f836f1d241d1fed35973f7ea0a77e64
Author: zhongan <zh...@xiaomi.com>
AuthorDate: Thu Apr 2 11:21:53 2020 +0800
Add initialization for idle task.
Change-Id: I1be75d2d1d45f157c1c64626b39a8bd72c324be2
Signed-off-by: zhongan <zh...@xiaomi.com>
---
arch/risc-v/src/common/up_initialize.c | 10 ++++++++++
arch/risc-v/src/common/up_internal.h | 11 +++++++++++
2 files changed, 21 insertions(+)
diff --git a/arch/risc-v/src/common/up_initialize.c b/arch/risc-v/src/common/up_initialize.c
index 142115a..21b848f 100644
--- a/arch/risc-v/src/common/up_initialize.c
+++ b/arch/risc-v/src/common/up_initialize.c
@@ -49,6 +49,7 @@
#include <arch/board/board.h>
+#include "sched/sched.h"
#include "up_arch.h"
#include "up_internal.h"
@@ -105,6 +106,8 @@ static inline void up_color_intstack(void)
void up_initialize(void)
{
+ FAR struct tcb_s *idle;
+
/* Colorize the interrupt stack */
up_color_intstack();
@@ -113,6 +116,13 @@ void up_initialize(void)
up_addregion();
+ /* Initialize the idle task stack info */
+
+ idle = this_task(); /* It should be idle task */
+ idle->stack_alloc_ptr = _END_BSS;
+ idle->adj_stack_ptr = (FAR void *)g_idle_topstack;
+ idle->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
+
/* Register devices */
#if defined(CONFIG_DEV_NULL)
diff --git a/arch/risc-v/src/common/up_internal.h b/arch/risc-v/src/common/up_internal.h
index b28264c..ef9a9b2 100644
--- a/arch/risc-v/src/common/up_internal.h
+++ b/arch/risc-v/src/common/up_internal.h
@@ -77,6 +77,14 @@
#define up_restorestate(regs) (g_current_regs = regs)
#endif
+#define _START_TEXT &_stext
+#define _END_TEXT &_etext
+#define _START_BSS &_sbss
+#define _END_BSS &_ebss
+#define _DATA_INIT &_eronly
+#define _START_DATA &_sdata
+#define _END_DATA &_edata
+
/* Determine which (if any) console driver to use. If a console is enabled
* and no other console device is specified, then a serial console is
* assumed.
@@ -112,6 +120,7 @@ extern "C"
#define EXTERN extern
#endif
+#ifndef __ASSEMBLY__
#ifdef CONFIG_ARCH_RV64GC
#ifdef CONFIG_SMP
EXTERN volatile uint64_t *g_current_regs[CONFIG_SMP_NCPUS];
@@ -153,6 +162,8 @@ EXTERN uint32_t _edata; /* End+1 of .data */
EXTERN uint32_t _sbss; /* Start of .bss */
EXTERN uint32_t _ebss; /* End+1 of .bss */
+#endif /* __ASSEMBLY__ */
+
/****************************************************************************
* Public Functions
****************************************************************************/