You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/04/19 06:05:48 UTC

[incubator-nuttx] branch master updated (7fb73db -> 44bc681)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 7fb73db  boards/raspberrypi-pico: Pico Audio Pack (I2S) support
     new 17149fb  boards: hifive1-revb: Add _default_stack_limit to the linker scripts
     new 44bc681  arch: fe310: Add coloration for the idle stack

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/risc-v/src/fe310/fe310_head.S                 | 23 +++++++++++++++++-----
 arch/risc-v/src/fe310/fe310_memorymap.h            |  7 ++++---
 .../fe310/hifive1-revb/scripts/ld-qemu.script      |  2 ++
 boards/risc-v/fe310/hifive1-revb/scripts/ld.script |  2 ++
 4 files changed, 26 insertions(+), 8 deletions(-)

[incubator-nuttx] 01/02: boards: hifive1-revb: Add _default_stack_limit to the linker scripts

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 17149fbb38f23094860d88e06cb69c4a31adaa38
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Mon Apr 19 07:58:45 2021 +0900

    boards: hifive1-revb: Add _default_stack_limit to the linker scripts
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 boards/risc-v/fe310/hifive1-revb/scripts/ld-qemu.script | 2 ++
 boards/risc-v/fe310/hifive1-revb/scripts/ld.script      | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/boards/risc-v/fe310/hifive1-revb/scripts/ld-qemu.script b/boards/risc-v/fe310/hifive1-revb/scripts/ld-qemu.script
index efb9b60..743af7a 100644
--- a/boards/risc-v/fe310/hifive1-revb/scripts/ld-qemu.script
+++ b/boards/risc-v/fe310/hifive1-revb/scripts/ld-qemu.script
@@ -74,6 +74,8 @@ SECTIONS
         *(COMMON)
         . = ALIGN(4);
         _ebss = ABSOLUTE(.);
+        . = ALIGN(32);
+        _default_stack_limit = ABSOLUTE(.);
     } > sram
 
     /* Stabs debugging sections. */
diff --git a/boards/risc-v/fe310/hifive1-revb/scripts/ld.script b/boards/risc-v/fe310/hifive1-revb/scripts/ld.script
index 67b28a2..aa70f30 100644
--- a/boards/risc-v/fe310/hifive1-revb/scripts/ld.script
+++ b/boards/risc-v/fe310/hifive1-revb/scripts/ld.script
@@ -74,6 +74,8 @@ SECTIONS
         *(COMMON)
         . = ALIGN(4);
         _ebss = ABSOLUTE(.);
+        . = ALIGN(32);
+        _default_stack_limit = ABSOLUTE(.);
     } > sram
 
     /* Stabs debugging sections. */

[incubator-nuttx] 02/02: arch: fe310: Add coloration for the idle stack

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 44bc681daac643bc2456381f49152a1769f6602c
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Mon Apr 19 08:00:10 2021 +0900

    arch: fe310: Add coloration for the idle stack
    
    Summary:
    - This commit adds coloration for the idle stack
    - Also, apply la pseudo-instruction instead of lui and addi
    
    Impact:
    - fe310 only
    
    Testing:
    - Tested with nsh with QEMU and dev board
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 arch/risc-v/src/fe310/fe310_head.S      | 23 ++++++++++++++++++-----
 arch/risc-v/src/fe310/fe310_memorymap.h |  7 ++++---
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/arch/risc-v/src/fe310/fe310_head.S b/arch/risc-v/src/fe310/fe310_head.S
index 86f9116..53790f7 100644
--- a/arch/risc-v/src/fe310/fe310_head.S
+++ b/arch/risc-v/src/fe310/fe310_head.S
@@ -26,6 +26,8 @@
 #include <arch/rv32im/irq.h>
 
 #include "chip.h"
+#include "fe310_memorymap.h"
+#include "riscv_internal.h"
 
 /****************************************************************************
  * Public Symbols
@@ -44,8 +46,7 @@ __start:
 
   /* Set stack pointer to the idle thread stack */
 
-  lui  sp, %hi(FE310_IDLESTACK_TOP)
-  addi sp, sp, %lo(FE310_IDLESTACK_TOP)
+  la   sp, FE310_IDLESTACK_TOP
 
   /* Disable all interrupts (i.e. timer, external) in mie */
 
@@ -53,9 +54,21 @@ __start:
 
   /* Initialize the Machine Trap Vector */
 
-  lui  t0, %hi(__trap_vec)
-  addi t0, t0, %lo(__trap_vec)
-  csrw  mtvec, t0
+  la   t0, __trap_vec
+  csrw mtvec, t0
+
+#ifdef CONFIG_STACK_COLORATION
+  /* t0 = start of IDLE stack; t1 = top of the stack; t2 = coloration */
+
+  la   t0, FE310_IDLESTACK_BASE
+  la   t1, FE310_IDLESTACK_TOP
+  li   t2, STACK_COLOR
+
+1:
+  sw   t2, 0(t0)
+  addi t0, t0, 4
+  bne  t0, t1, 1b
+#endif
 
   /* Jump to __fe310_start */
 
diff --git a/arch/risc-v/src/fe310/fe310_memorymap.h b/arch/risc-v/src/fe310/fe310_memorymap.h
index 74ed375..31792f1 100644
--- a/arch/risc-v/src/fe310/fe310_memorymap.h
+++ b/arch/risc-v/src/fe310/fe310_memorymap.h
@@ -36,12 +36,13 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-/* Idle thread stack starts from _ebss */
+/* Idle thread stack starts from _default_stack_limit */
 
 #ifndef __ASSEMBLY__
-#define FE310_IDLESTACK_BASE  (uint32_t)&_ebss
+extern uintptr_t *_default_stack_limit;
+#define FE310_IDLESTACK_BASE  (uintptr_t)&_default_stack_limit
 #else
-#define FE310_IDLESTACK_BASE  _ebss
+#define FE310_IDLESTACK_BASE  _default_stack_limit
 #endif
 
 #define FE310_IDLESTACK_TOP  (FE310_IDLESTACK_BASE + CONFIG_IDLETHREAD_STACKSIZE)