[incubator-nuttx] 02/04: arch/armv7-r: unify switch context from software interrupt

2022-02-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit db3a40ac25d0845e9118746bfdf996846a368728
Author: chao.an 
AuthorDate: Wed Feb 16 13:01:47 2022 +0800

arch/armv7-r: unify switch context from software interrupt

Signed-off-by: chao.an 
---
 arch/arm/src/armv7-r/arm_blocktask.c  | 27 +-
 arch/arm/src/armv7-r/arm_fullcontextrestore.S | 74 ---
 arch/arm/src/armv7-r/arm_releasepending.c | 28 +-
 arch/arm/src/armv7-r/arm_reprioritizertr.c| 29 ++-
 arch/arm/src/armv7-r/arm_syscall.c| 50 --
 arch/arm/src/armv7-r/arm_unblocktask.c| 29 +--
 arch/arm/src/armv7-r/svcall.h | 68 +---
 7 files changed, 129 insertions(+), 176 deletions(-)

diff --git a/arch/arm/src/armv7-r/arm_blocktask.c 
b/arch/arm/src/armv7-r/arm_blocktask.c
index 6dafcc1..7e5dacb 100644
--- a/arch/arm/src/armv7-r/arm_blocktask.c
+++ b/arch/arm/src/armv7-r/arm_blocktask.c
@@ -123,26 +123,27 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
   arm_restorestate(rtcb->xcp.regs);
 }
 
-  /* Copy the user C context into the TCB at the (old) head of the
-   * ready-to-run Task list. if arm_saveusercontext returns a non-zero
-   * value, then this is really the previously running task restarting!
-   */
+  /* No, then we will need to perform the user context switch */
 
-  else if (!arm_saveusercontext(rtcb->xcp.regs))
+  else
 {
-  /* Restore the exception context of the rtcb at the (new) head
-   * of the ready-to-run task list.
-   */
-
-  rtcb = this_task();
+  struct tcb_s *nexttcb = this_task();
 
   /* Reset scheduler parameters */
 
-  nxsched_resume_scheduler(rtcb);
+  nxsched_resume_scheduler(nexttcb);
+
+  /* Switch context to the context of the task at the head of the
+   * ready to run list.
+   */
 
-  /* Then switch contexts */
+  arm_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
 
-  arm_fullcontextrestore(rtcb->xcp.regs);
+  /* arm_switchcontext forces a context switch to the task at the
+   * head of the ready-to-run list.  It does not 'return' in the
+   * normal sense.  When it does return, it is because the blocked
+   * task is again ready to run and has execution priority.
+   */
 }
 }
 }
diff --git a/arch/arm/src/armv7-r/arm_fullcontextrestore.S 
b/arch/arm/src/armv7-r/arm_fullcontextrestore.S
index 1d806be..9af7219 100644
--- a/arch/arm/src/armv7-r/arm_fullcontextrestore.S
+++ b/arch/arm/src/armv7-r/arm_fullcontextrestore.S
@@ -62,44 +62,6 @@
.type   arm_fullcontextrestore, function
 arm_fullcontextrestore:
 
-   /* On entry, a1 (r0) holds address of the register save area.  All other
-* registers are available for use.
-*/
-
-#ifdef CONFIG_ARCH_FPU
-   /* First, restore the floating point registers.  Lets do this before we
-* restore the ARM registers so that we have plenty of registers to
-* work with.
-*/
-
-   add r1, r0, #(4*REG_S0) /* r1=Address of FP 
register storage */
-
-   /* Load all floating point registers.  Registers are loaded in numeric 
order,
-* s0, s1, ... in increasing address order.
-*/
-
-#ifdef CONFIG_ARM_HAVE_FPU_D32
-   vldmia.64   r1!, {d0-d15}   /* Restore the full FP 
context */
-   vldmia.64   r1!, {d16-d31}
-#else
-   vldmia  r1!, {s0-s31}   /* Restore the full FP 
context */
-#endif
-
-   /* Load the floating point control and status register.   At the end of 
the
-* vstmia, r1 will point to the FPSCR storage location.
-*/
-
-   ldr r2, [r1], #4/* Fetch the floating 
point control and status register */
-   vmsrfpscr, r2   /* Restore the FPSCR */
-#endif
-
-#ifdef CONFIG_BUILD_PROTECTED
-   /* For the protected build, we need to be able to transition gracefully
-* between kernel- and user-mode tasks.  Here we do that with a system
-* call; the system call will execute in kernel mode and but can return
-* to either user or kernel mode.
-*/
-
/* Perform the System call with R0=1 and R1=regs */
 
mov r1, r0  /* R1: regs */
@@ -109,41 +71,5 @@ arm_fullcontextrestore:
/* This call should not return */
 
bx  lr  /* Unnecessary ... will 
not return */
-
-#else
-   /* For a flat build, we can do all of this here... Just think of this as
-* a 

[incubator-nuttx] 01/04: arch/armv7-a: unify switch context from software interrupt

2022-02-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 61cd9dfca176d9f9b5f60cedf17d4d01866befb8
Author: chao.an 
AuthorDate: Wed Feb 16 13:01:22 2022 +0800

arch/armv7-a: unify switch context from software interrupt

Signed-off-by: chao.an 
---
 arch/arm/src/armv7-a/arm_blocktask.c  | 29 +-
 arch/arm/src/armv7-a/arm_fullcontextrestore.S | 79 ---
 arch/arm/src/armv7-a/arm_releasepending.c | 30 +-
 arch/arm/src/armv7-a/arm_reprioritizertr.c| 31 ++-
 arch/arm/src/armv7-a/arm_syscall.c| 50 +++--
 arch/arm/src/armv7-a/arm_unblocktask.c| 31 +--
 arch/arm/src/armv7-a/svcall.h | 62 -
 7 files changed, 130 insertions(+), 182 deletions(-)

diff --git a/arch/arm/src/armv7-a/arm_blocktask.c 
b/arch/arm/src/armv7-a/arm_blocktask.c
index 0acadcc..5c22093 100644
--- a/arch/arm/src/armv7-a/arm_blocktask.c
+++ b/arch/arm/src/armv7-a/arm_blocktask.c
@@ -125,18 +125,11 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
   arm_restorestate(rtcb->xcp.regs);
 }
 
-  /* Copy the user C context into the TCB at the (old) head of the
-   * ready-to-run Task list. if arm_saveusercontext returns a non-zero
-   * value, then this is really the previously running task restarting!
-   */
+  /* No, then we will need to perform the user context switch */
 
-  else if (!arm_saveusercontext(rtcb->xcp.regs))
+  else
 {
-  /* Restore the exception context of the rtcb at the (new) head
-   * of the ready-to-run task list.
-   */
-
-  rtcb = this_task();
+  struct tcb_s *nexttcb = this_task();
 
 #ifdef CONFIG_ARCH_ADDRENV
   /* Make sure that the address environment for the previously
@@ -145,15 +138,23 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
* thread at the head of the ready-to-run list.
*/
 
-  group_addrenv(rtcb);
+  group_addrenv(nexttcb);
 #endif
   /* Reset scheduler parameters */
 
-  nxsched_resume_scheduler(rtcb);
+  nxsched_resume_scheduler(nexttcb);
+
+  /* Switch context to the context of the task at the head of the
+   * ready to run list.
+   */
 
-  /* Then switch contexts */
+  arm_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
 
-  arm_fullcontextrestore(rtcb->xcp.regs);
+  /* arm_switchcontext forces a context switch to the task at the
+   * head of the ready-to-run list.  It does not 'return' in the
+   * normal sense.  When it does return, it is because the blocked
+   * task is again ready to run and has execution priority.
+   */
 }
 }
 }
diff --git a/arch/arm/src/armv7-a/arm_fullcontextrestore.S 
b/arch/arm/src/armv7-a/arm_fullcontextrestore.S
index 2902e39..12063b3 100644
--- a/arch/arm/src/armv7-a/arm_fullcontextrestore.S
+++ b/arch/arm/src/armv7-a/arm_fullcontextrestore.S
@@ -63,44 +63,6 @@
.type   arm_fullcontextrestore, function
 arm_fullcontextrestore:
 
-   /* On entry, a1 (r0) holds address of the register save area.  All other
-* registers are available for use.
-*/
-
-#ifdef CONFIG_ARCH_FPU
-   /* First, restore the floating point registers.  Lets do this before we
-* restore the ARM registers so that we have plenty of registers to
-* work with.
-*/
-
-   add r1, r0, #(4*REG_S0) /* r1=Address of FP 
register storage */
-
-   /* Load all floating point registers.  Registers are loaded in numeric 
order,
-* s0, s1, ... in increasing address order.
-*/
-
-#ifdef CONFIG_ARM_HAVE_FPU_D32
-   vldmia.64   r1!, {d0-d15}   /* Restore the full FP 
context */
-   vldmia.64   r1!, {d16-d31}
-#else
-   vldmia  r1!, {s0-s31}   /* Restore the full FP 
context */
-#endif
-
-   /* Load the floating point control and status register.   At the end of 
the
-* vstmia, r1 will point to the FPSCR storage location.
-*/
-
-   ldr r2, [r1], #4/* Fetch the floating 
point control and status register */
-   vmsrfpscr, r2   /* Restore the FPSCR */
-#endif
-
-#ifdef CONFIG_BUILD_KERNEL
-   /* For the kernel build, we need to be able to transition gracefully
-* between kernel- and user-mode tasks.  Here we do that with a system
-* call; the system call will execute in kernel mode and but can return
-* to either user or kernel mode.
-*/
-
/* Perform the System call with R0=1 and R1=regs */
 
mov r1, r0  

[incubator-nuttx] 03/04: arch/arm: unify switch context from software interrupt

2022-02-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 6cc0aaf5b9f133dd040991c02d789a75d394d34e
Author: chao.an 
AuthorDate: Wed Feb 16 13:01:53 2022 +0800

arch/arm: unify switch context from software interrupt

Signed-off-by: chao.an 
---
 arch/arm/src/a1x/Make.defs|   1 +
 arch/arm/src/am335x/Make.defs |   1 +
 arch/arm/src/arm/arm_blocktask.c  |  29 +++
 arch/arm/src/arm/arm_fullcontextrestore.S |  39 +++--
 arch/arm/src/arm/arm_releasepending.c |  30 +++
 arch/arm/src/arm/arm_reprioritizertr.c|  31 
 arch/arm/src/arm/arm_syscall.c|  77 +-
 arch/arm/src/arm/arm_unblocktask.c|  31 
 arch/arm/src/arm/svcall.h | 127 ++
 arch/arm/src/c5471/Make.defs  |   1 +
 arch/arm/src/common/arm_internal.h|   2 +-
 arch/arm/src/dm320/Make.defs  |   2 +-
 arch/arm/src/imx1/Make.defs   |   2 +-
 arch/arm/src/imx6/Make.defs   |   1 +
 arch/arm/src/lpc214x/Make.defs|   1 +
 arch/arm/src/lpc2378/Make.defs|   1 +
 arch/arm/src/lpc31xx/Make.defs|   2 +-
 arch/arm/src/moxart/Make.defs |   2 +-
 arch/arm/src/sama5/Make.defs  |   1 +
 arch/arm/src/str71x/Make.defs |   1 +
 arch/arm/src/tms570/Make.defs |   1 +
 21 files changed, 284 insertions(+), 99 deletions(-)

diff --git a/arch/arm/src/a1x/Make.defs b/arch/arm/src/a1x/Make.defs
index 0f84c93..82af1ff 100644
--- a/arch/arm/src/a1x/Make.defs
+++ b/arch/arm/src/a1x/Make.defs
@@ -60,6 +60,7 @@ CMN_CSRCS += arm_doirq.c arm_initialstate.c arm_mmu.c 
arm_prefetchabort.c
 CMN_CSRCS += arm_releasepending.c arm_reprioritizertr.c
 CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c arm_syscall.c
 CMN_CSRCS += arm_unblocktask.c arm_undefinedinsn.c arm_tcbinfo.c
+CMN_CSRCS += arm_switchcontext.c
 
 # Use common heap allocation for now (may need to be customized later)
 
diff --git a/arch/arm/src/am335x/Make.defs b/arch/arm/src/am335x/Make.defs
index fa4ed3f..4423854 100644
--- a/arch/arm/src/am335x/Make.defs
+++ b/arch/arm/src/am335x/Make.defs
@@ -60,6 +60,7 @@ CMN_CSRCS += arm_doirq.c arm_initialstate.c arm_mmu.c 
arm_prefetchabort.c
 CMN_CSRCS += arm_releasepending.c arm_reprioritizertr.c
 CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c arm_syscall.c
 CMN_CSRCS += arm_unblocktask.c arm_undefinedinsn.c arm_tcbinfo.c
+CMN_CSRCS += arm_switchcontext.c
 
 # Use common heap allocation for now (may need to be customized later)
 
diff --git a/arch/arm/src/arm/arm_blocktask.c b/arch/arm/src/arm/arm_blocktask.c
index dd8378a..af41372 100644
--- a/arch/arm/src/arm/arm_blocktask.c
+++ b/arch/arm/src/arm/arm_blocktask.c
@@ -125,18 +125,11 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
   arm_restorestate(rtcb->xcp.regs);
 }
 
-  /* Copy the user C context into the TCB at the (old) head of the
-   * ready-to-run Task list. if arm_saveusercontext returns a non-zero
-   * value, then this is really the previously running task restarting!
-   */
+  /* No, then we will need to perform the user context switch */
 
-  else if (!arm_saveusercontext(rtcb->xcp.regs))
+  else
 {
-  /* Restore the exception context of the rtcb at the (new) head
-   * of the ready-to-run task list.
-   */
-
-  rtcb = this_task();
+  struct tcb_s *nexttcb = this_task();
 
 #ifdef CONFIG_ARCH_ADDRENV
   /* Make sure that the address environment for the previously
@@ -145,15 +138,23 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
* thread at the head of the ready-to-run list.
*/
 
-  group_addrenv(rtcb);
+  group_addrenv(nexttcb);
 #endif
   /* Reset scheduler parameters */
 
-  nxsched_resume_scheduler(rtcb);
+  nxsched_resume_scheduler(nexttcb);
+
+  /* Switch context to the context of the task at the head of the
+   * ready to run list.
+   */
 
-  /* Then switch contexts */
+  arm_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
 
-  arm_fullcontextrestore(rtcb->xcp.regs);
+  /* arm_switchcontext forces a context switch to the task at the
+   * head of the ready-to-run list.  It does not 'return' in the
+   * normal sense.  When it does return, it is because the blocked
+   * task is again ready to run and has execution priority.
+   */
 }
 }
 }
diff --git a/arch/arm/src/arm/arm_fullcontextrestore.S 
b/arch/arm/src/arm/arm_fullcontextrestore.S
index 426098f..9c6f8e0 100644
--- a/arch/arm/src/arm/arm_fullcontextrestore.S
+++ b/arch/arm/src/arm/arm_fullcontextrestore.S
@@

[incubator-nuttx] 04/04: boards/sama5: update the reserved syscall count

2022-02-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit d93fb526c7174ea8aa7516e1796eb5bf646cf002
Author: chao.an 
AuthorDate: Mon Feb 21 22:19:40 2022 +0800

boards/sama5: update the reserved syscall count

Signed-off-by: chao.an 
---
 boards/arm/sama5/sama5d4-ek/configs/elf/defconfig  | 2 +-
 boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/boards/arm/sama5/sama5d4-ek/configs/elf/defconfig 
b/boards/arm/sama5/sama5d4-ek/configs/elf/defconfig
index 59ce948..3f356e8 100644
--- a/boards/arm/sama5/sama5d4-ek/configs/elf/defconfig
+++ b/boards/arm/sama5/sama5d4-ek/configs/elf/defconfig
@@ -75,5 +75,5 @@ CONFIG_SCHED_HPWORKPRIORITY=192
 CONFIG_SCHED_WAITPID=y
 CONFIG_SYMTAB_ORDEREDBYNAME=y
 CONFIG_SYSTEM_READLINE=y
-CONFIG_SYS_RESERVED=1
+CONFIG_SYS_RESERVED=4
 CONFIG_USART3_SERIAL_CONSOLE=y
diff --git a/boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig 
b/boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig
index 2685ee3..0efc437 100644
--- a/boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig
+++ b/boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig
@@ -84,5 +84,5 @@ CONFIG_SCHED_WAITPID=y
 CONFIG_SDIO_BLOCKSETUP=y
 CONFIG_SYSTEM_NSH=y
 CONFIG_SYSTEM_NSH_PROGNAME="init"
-CONFIG_SYS_RESERVED=6
+CONFIG_SYS_RESERVED=7
 CONFIG_USART3_SERIAL_CONSOLE=y


[incubator-nuttx] branch master updated (29c55cd -> d93fb52)

2022-02-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 29c55cd  ci: harmonize rust installation paths.
 new 61cd9df  arch/armv7-a: unify switch context from software interrupt
 new db3a40a  arch/armv7-r: unify switch context from software interrupt
 new 6cc0aaf  arch/arm: unify switch context from software interrupt
 new d93fb52  boards/sama5: update the reserved syscall count

The 4 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/arm/src/a1x/Make.defs |  1 +
 arch/arm/src/am335x/Make.defs  |  1 +
 arch/arm/src/arm/arm_blocktask.c   | 29 
 arch/arm/src/arm/arm_fullcontextrestore.S  | 39 +++
 arch/arm/src/arm/arm_releasepending.c  | 30 
 arch/arm/src/arm/arm_reprioritizertr.c | 31 +
 arch/arm/src/arm/arm_syscall.c | 77 +++--
 arch/arm/src/arm/arm_unblocktask.c | 31 -
 arch/arm/src/{armv7-a => arm}/svcall.h | 70 ++-
 arch/arm/src/armv7-a/arm_blocktask.c   | 29 
 arch/arm/src/armv7-a/arm_fullcontextrestore.S  | 79 --
 arch/arm/src/armv7-a/arm_releasepending.c  | 30 
 arch/arm/src/armv7-a/arm_reprioritizertr.c | 31 +
 arch/arm/src/armv7-a/arm_syscall.c | 50 +-
 arch/arm/src/armv7-a/arm_unblocktask.c | 31 -
 arch/arm/src/armv7-a/svcall.h  | 62 +
 arch/arm/src/armv7-r/arm_blocktask.c   | 27 
 arch/arm/src/armv7-r/arm_fullcontextrestore.S  | 74 
 arch/arm/src/armv7-r/arm_releasepending.c  | 28 
 arch/arm/src/armv7-r/arm_reprioritizertr.c | 29 
 arch/arm/src/armv7-r/arm_syscall.c | 50 +-
 arch/arm/src/armv7-r/arm_unblocktask.c | 29 
 arch/arm/src/armv7-r/svcall.h  | 68 +++
 arch/arm/src/c5471/Make.defs   |  1 +
 arch/arm/src/common/arm_internal.h |  2 +-
 arch/arm/src/dm320/Make.defs   |  2 +-
 arch/arm/src/imx1/Make.defs|  2 +-
 arch/arm/src/imx6/Make.defs|  1 +
 arch/arm/src/lpc214x/Make.defs |  1 +
 arch/arm/src/lpc2378/Make.defs |  1 +
 arch/arm/src/lpc31xx/Make.defs |  2 +-
 arch/arm/src/moxart/Make.defs  |  2 +-
 arch/arm/src/sama5/Make.defs   |  1 +
 arch/arm/src/str71x/Make.defs  |  1 +
 arch/arm/src/tms570/Make.defs  |  1 +
 boards/arm/sama5/sama5d4-ek/configs/elf/defconfig  |  2 +-
 boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig |  2 +-
 37 files changed, 457 insertions(+), 490 deletions(-)
 copy arch/arm/src/{armv7-a => arm}/svcall.h (74%)


[incubator-nuttx] branch master updated (1dada85 -> 61a0453)

2022-02-23 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 1dada85  drivers: Giorgio Gross : update licenses to Apache
 add 61a0453  os init_state: add new state OSINIT_IDLELOOP

No new revisions were added by this update.

Summary of changes:
 include/nuttx/init.h  | 4 +++-
 sched/init/nx_start.c | 4 
 sched/semaphore/sem_trywait.c | 4 +++-
 sched/semaphore/sem_wait.c| 4 +++-
 4 files changed, 13 insertions(+), 3 deletions(-)


[incubator-nuttx] branch master updated: arch/xtensa/esp32s2_irq.c: Correctly enable the software interrupt.

2022-02-24 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new dc130b4  arch/xtensa/esp32s2_irq.c: Correctly enable the software 
interrupt.
dc130b4 is described below

commit dc130b48304691d0e825b90ac9ea0d3d920c69ca
Author: Abdelatif Guettouche 
AuthorDate: Thu Feb 24 20:39:14 2022 +0100

arch/xtensa/esp32s2_irq.c: Correctly enable the software interrupt.

Signed-off-by: Abdelatif Guettouche 
---
 arch/xtensa/src/esp32s2/esp32s2_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/xtensa/src/esp32s2/esp32s2_irq.c 
b/arch/xtensa/src/esp32s2/esp32s2_irq.c
index 67f1b2a..598a499 100644
--- a/arch/xtensa/src/esp32s2/esp32s2_irq.c
+++ b/arch/xtensa/src/esp32s2/esp32s2_irq.c
@@ -112,6 +112,6 @@ void up_irqinitialize(void)
 
   /* Enable the software interrupt. */
 
-  up_enable_irq(XTENSA_IRQ_SWINT);
+  up_enable_irq(ESP32S2_CPUINT_SOFTWARE1);
 }
 


[incubator-nuttx] branch master updated: arch/arm: Remove the empty spinlock.h file

2022-02-24 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 25213c4  arch/arm: Remove the empty spinlock.h file
25213c4 is described below

commit 25213c42a59ea738b0bcb1e607dd8c11576a7c6a
Author: Xiang Xiao 
AuthorDate: Fri Feb 25 02:20:30 2022 +0800

arch/arm: Remove the empty spinlock.h file

Signed-off-by: Xiang Xiao 
---
 arch/arm/include/arm/spinlock.h | 24 
 arch/arm/include/armv6-m/spinlock.h | 24 
 arch/arm/include/armv7-a/spinlock.h | 24 
 arch/arm/include/armv7-m/spinlock.h | 24 
 arch/arm/include/armv7-r/spinlock.h | 24 
 arch/arm/include/armv8-m/spinlock.h | 24 
 arch/arm/include/spinlock.h | 18 --
 7 files changed, 162 deletions(-)

diff --git a/arch/arm/include/arm/spinlock.h b/arch/arm/include/arm/spinlock.h
deleted file mode 100644
index 66ae2b7..000
--- a/arch/arm/include/arm/spinlock.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/
- * arch/arm/include/arm/spinlock.h
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- /
-
-#ifndef __ARCH_ARM_INCLUDE_ARM_SPINLOCK_H
-#define __ARCH_ARM_INCLUDE_ARM_SPINLOCK_H
-
-#endif /* __ARCH_ARM_INCLUDE_ARM_SPINLOCK_H */
diff --git a/arch/arm/include/armv6-m/spinlock.h 
b/arch/arm/include/armv6-m/spinlock.h
deleted file mode 100644
index b6769fa..000
--- a/arch/arm/include/armv6-m/spinlock.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/
- * arch/arm/include/armv6-m/spinlock.h
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- /
-
-#ifndef __ARCH_ARM_INCLUDE_ARMV6_M_SPINLOCK_H
-#define __ARCH_ARM_INCLUDE_ARMV6_M_SPINLOCK_H
-
-#endif /* __ARCH_ARM_INCLUDE_ARMV6_M_SPINLOCK_H */
diff --git a/arch/arm/include/armv7-a/spinlock.h 
b/arch/arm/include/armv7-a/spinlock.h
deleted file mode 100644
index d306029..000
--- a/arch/arm/include/armv7-a/spinlock.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/
- * arch/arm/include/armv7-a/spinlock.h
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- 

[incubator-nuttx] branch master updated: arm/armv7-a: Remove CONFIG_SMP guard from arm_scu.c

2022-02-25 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new b95022f  arm/armv7-a: Remove CONFIG_SMP guard from arm_scu.c
b95022f is described below

commit b95022f8def6b320a87c26300033665d2175f3ed
Author: Xiang Xiao 
AuthorDate: Sat Feb 26 02:14:12 2022 +0800

arm/armv7-a: Remove CONFIG_SMP guard from arm_scu.c

since ACTLR.SMP need enable to make cache work on Cortex A7:
https://developer.arm.com/documentation/ddi0464/f/CHDBIEIF

Signed-off-by: Xiang Xiao 
---
 arch/arm/src/armv7-a/arm_scu.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/arch/arm/src/armv7-a/arm_scu.c b/arch/arm/src/armv7-a/arm_scu.c
index 8fb1483..4fd63c9 100644
--- a/arch/arm/src/armv7-a/arm_scu.c
+++ b/arch/arm/src/armv7-a/arm_scu.c
@@ -32,8 +32,6 @@
 #include "sctlr.h"
 #include "scu.h"
 
-#ifdef CONFIG_SMP
-
 /
  * Private Functions
  /
@@ -208,5 +206,3 @@ void arm_enable_smp(int cpu)
   regval |= SCTLR_C;
   arm_set_sctlr(regval);
 }
-
-#endif


[incubator-nuttx] branch master updated (fac10b6 -> b57e0b6)

2022-02-27 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from fac10b6  stm32f103re has a dac module.but the pinmap file has no 
corresponding definition
 new c369e47  arm/armv7-a/r: handle swi on interrupt stack
 new b57e0b6  arm/armv7-a/r: check ARMV7A_DECODEFIQ on dataabort

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/arm/src/armv7-a/arm_vectors.S | 26 ++
 arch/arm/src/armv7-r/arm_vectors.S | 26 ++
 2 files changed, 52 insertions(+)


[incubator-nuttx] 02/02: arm/armv7-a/r: check ARMV7A_DECODEFIQ on dataabort

2022-02-27 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit b57e0b6118feab02d88cce39cacb745950f02a0d
Author: chao.an 
AuthorDate: Sun Feb 27 12:55:08 2022 +0800

arm/armv7-a/r: check ARMV7A_DECODEFIQ on dataabort

Signed-off-by: chao.an 
---
 arch/arm/src/armv7-a/arm_vectors.S | 12 
 arch/arm/src/armv7-r/arm_vectors.S | 12 
 2 files changed, 24 insertions(+)

diff --git a/arch/arm/src/armv7-a/arm_vectors.S 
b/arch/arm/src/armv7-a/arm_vectors.S
index f3a2319..0036fba 100644
--- a/arch/arm/src/armv7-a/arm_vectors.S
+++ b/arch/arm/src/armv7-a/arm_vectors.S
@@ -423,7 +423,11 @@ arm_vectordata:
 * r13 and r14
 */
 
+#ifdef CONFIG_ARMV7A_DECODEFIQ
mov r13, #(PSR_MODE_SVC | PSR_I_BIT | PSR_F_BIT)
+#else
+   mov r13, #(PSR_MODE_SVC | PSR_I_BIT)
+#endif
msr cpsr_c, r13 /* Switch to SVC mode */
 
/* Create a context structure.  First set aside a stack frame
@@ -433,7 +437,11 @@ arm_vectordata:
sub sp, sp, #XCPTCONTEXT_SIZE
stmia   sp, {r0-r12}/* Save the SVC mode 
regs */
 
+#ifdef CONFIG_ARMV7A_DECODEFIQ
mov r0, #(PSR_MODE_ABT | PSR_I_BIT | PSR_F_BIT)
+#else
+   mov r0, #(PSR_MODE_ABT | PSR_I_BIT)
+#endif
msr cpsr_c, r0  /* Switch back ABT mode 
*/
 
/* Get the values for r15(pc) and CPSR in r3 and r4 */
@@ -443,7 +451,11 @@ arm_vectordata:
 
/* Then switch back to SVC mode */
 
+#ifdef CONFIG_ARMV7A_DECODEFIQ
mov r0, #(PSR_MODE_SVC | PSR_I_BIT | PSR_F_BIT)
+#else
+   mov r0, #(PSR_MODE_SVC | PSR_I_BIT)
+#endif
msr cpsr_c, r0
 
 #ifdef CONFIG_BUILD_KERNEL
diff --git a/arch/arm/src/armv7-r/arm_vectors.S 
b/arch/arm/src/armv7-r/arm_vectors.S
index 64d1190..8c5f88c 100644
--- a/arch/arm/src/armv7-r/arm_vectors.S
+++ b/arch/arm/src/armv7-r/arm_vectors.S
@@ -377,7 +377,11 @@ arm_vectordata:
 * r13 and r14
 */
 
+#ifdef CONFIG_ARMV7A_DECODEFIQ
mov r13, #(PSR_MODE_SVC | PSR_I_BIT | PSR_F_BIT)
+#else
+   mov r13, #(PSR_MODE_SVC | PSR_I_BIT)
+#endif
msr cpsr_c, r13 /* Switch to SVC mode */
 
/* Create a context structure.  First set aside a stack frame
@@ -387,7 +391,11 @@ arm_vectordata:
sub sp, sp, #XCPTCONTEXT_SIZE
stmia   sp, {r0-r12}/* Save the SVC mode 
regs */
 
+#ifdef CONFIG_ARMV7A_DECODEFIQ
mov r0, #(PSR_MODE_ABT | PSR_I_BIT | PSR_F_BIT)
+#else
+   mov r0, #(PSR_MODE_ABT | PSR_I_BIT)
+#endif
msr cpsr_c, r0  /* Switch back ABT mode 
*/
 
/* Get the values for r15(pc) and CPSR in r3 and r4 */
@@ -397,7 +405,11 @@ arm_vectordata:
 
/* Then switch back to SVC mode */
 
+#ifdef CONFIG_ARMV7A_DECODEFIQ
mov r0, #(PSR_MODE_SVC | PSR_I_BIT | PSR_F_BIT)
+#else
+   mov r0, #(PSR_MODE_SVC | PSR_I_BIT)
+#endif
msr cpsr_c, r0
 
 #ifdef CONFIG_BUILD_PROTECTED


[incubator-nuttx] 01/02: arm/armv7-a/r: handle swi on interrupt stack

2022-02-27 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit c369e471072e9204db83ad5bfbd0a621a8c69f83
Author: chao.an 
AuthorDate: Sun Feb 27 12:38:22 2022 +0800

arm/armv7-a/r: handle swi on interrupt stack

Signed-off-by: chao.an 
---
 arch/arm/src/armv7-a/arm_vectors.S | 14 ++
 arch/arm/src/armv7-r/arm_vectors.S | 14 ++
 2 files changed, 28 insertions(+)

diff --git a/arch/arm/src/armv7-a/arm_vectors.S 
b/arch/arm/src/armv7-a/arm_vectors.S
index 237bf43..f3a2319 100644
--- a/arch/arm/src/armv7-a/arm_vectors.S
+++ b/arch/arm/src/armv7-a/arm_vectors.S
@@ -343,10 +343,24 @@ arm_vectorsvc:
 
mov fp, #0  /* Init frame pointer */
mov r0, sp  /* Get r0=xcp */
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
+   /* Call arm_syscall() on the interrupt stack */
+
+   setirqstack r1, r3  /* SP = interrupt stack 
top */
+   str r0, [sp, #-4]!  /* Save the xcp address 
at SP-4 then update SP */
+   mov r4, sp  /* Save the SP in a 
preserved register */
+   bic sp, sp, #7  /* Force 8-byte 
alignment */
+   bl  arm_syscall /* Call the handler */
+   ldr sp, [r4]/* Restore the user 
stack pointer */
+#else
+   /* Call arm_syscall() on the user stack */
+
mov r4, sp  /* Save the SP in a 
preserved register */
bic sp, sp, #7  /* Force 8-byte 
alignment */
bl  arm_syscall /* Call the handler */
mov sp, r4  /* Restore the possibly 
unaligned stack pointer */
+#endif
 
/* Upon return from arm_syscall, r0 holds the pointer to the register
 * state save area to use to restore the registers.  This may or may not
diff --git a/arch/arm/src/armv7-r/arm_vectors.S 
b/arch/arm/src/armv7-r/arm_vectors.S
index d4865b0..64d1190 100644
--- a/arch/arm/src/armv7-r/arm_vectors.S
+++ b/arch/arm/src/armv7-r/arm_vectors.S
@@ -297,10 +297,24 @@ arm_vectorsvc:
 
mov fp, #0  /* Init frame pointer */
mov r0, sp  /* Get r0=xcp */
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
+   /* Call arm_syscall() on the interrupt stack */
+
+   ldr sp, .Lirqstacktop   /* SP = interrupt stack 
top */
+   str r0, [sp, #-4]!  /* Save the xcp address 
at SP-4 then update SP */
+   mov r4, sp  /* Save the SP in a 
preserved register */
+   bic sp, sp, #7  /* Force 8-byte 
alignment */
+   bl  arm_syscall /* Call the handler */
+   ldr sp, [r4]/* Restore the user 
stack pointer */
+#else
+   /* Call arm_syscall() on the user stack */
+
mov r4, sp  /* Save the SP in a 
preserved register */
bic sp, sp, #7  /* Force 8-byte 
alignment */
bl  arm_syscall /* Call the handler */
mov sp, r4  /* Restore the possibly 
unaligned stack pointer */
+#endif
 
/* Upon return from arm_syscall, r0 holds the pointer to the register
 * state save area to use to restore the registers.  This may or may not


[incubator-nuttx] branch master updated (8caa496 -> fe6aa4a)

2022-03-02 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 8caa496  ekk-lm3s9b96: Remove unused mmcsd option
 add eb1cc02  sched/group: Move files_initlist/lib_stream_initialize to 
group_alloc
 add fe6aa4a  sim: add loop thread to handle dev loops

No new revisions were added by this update.

Summary of changes:
 arch/sim/src/sim/up_idle.c | 40 --
 arch/sim/src/sim/up_initialize.c   | 70 ++
 sched/group/group_create.c | 12 +++
 sched/group/group_setupidlefiles.c |  4 ---
 sched/group/group_setupstreams.c   |  5 ---
 sched/group/group_setuptaskfiles.c |  4 ---
 sched/init/nx_start.c  | 14 
 7 files changed, 89 insertions(+), 60 deletions(-)


[incubator-nuttx] branch master updated: sched/group: Simplify the allocation and deallocation logic

2022-03-03 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new a50d87d  sched/group: Simplify the allocation and deallocation logic
a50d87d is described below

commit a50d87d5b73c5440399aa4510e06523c57373f40
Author: Xiang Xiao 
AuthorDate: Wed Mar 2 02:24:05 2022 +0800

sched/group: Simplify the allocation and deallocation logic

1.Move tg_membe allocation to group_alloc
2.Merge group_deallocate to group_release

Signed-off-by: Xiang Xiao 
Signed-off-by: chao.an 
---
 sched/group/group.h|   3 +-
 sched/group/group_create.c | 130 ++---
 sched/group/group_leave.c  |  38 -
 sched/group/group_waiter.c |   2 +-
 sched/init/nx_start.c  |   2 +-
 sched/task/task_init.c |  15 +-
 sched/task/task_vfork.c|   9 +---
 7 files changed, 71 insertions(+), 128 deletions(-)

diff --git a/sched/group/group.h b/sched/group/group.h
index 9436b42..3b9fa98 100644
--- a/sched/group/group.h
+++ b/sched/group/group.h
@@ -73,8 +73,7 @@ void weak_function task_initialize(void);
 /* Task group data structure management */
 
 int  group_allocate(FAR struct task_tcb_s *tcb, uint8_t ttype);
-void group_deallocate(FAR struct task_group_s *group);
-int  group_initialize(FAR struct task_tcb_s *tcb);
+void group_initialize(FAR struct task_tcb_s *tcb);
 #ifndef CONFIG_DISABLE_PTHREAD
 int  group_bind(FAR struct pthread_tcb_s *tcb);
 int  group_join(FAR struct pthread_tcb_s *tcb);
diff --git a/sched/group/group_create.c b/sched/group/group_create.c
index f97eba3..acfc79b 100644
--- a/sched/group/group_create.c
+++ b/sched/group/group_create.c
@@ -152,7 +152,6 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t 
ttype)
 }
 
 # if defined(CONFIG_FILE_STREAM)
-
   /* In a flat, single-heap build.  The stream list is allocated with the
* group structure.  But in a kernel build with a kernel allocator, it
* must be separately allocated using a user-space allocator.
@@ -163,7 +162,6 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t 
ttype)
 
   group->tg_streamlist = (FAR struct streamlist *)
 group_zalloc(group, sizeof(struct streamlist));
-
   if (!group->tg_streamlist)
 {
   goto errout_with_group;
@@ -172,20 +170,29 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t 
ttype)
 # endif /* defined(CONFIG_FILE_STREAM) */
 #endif /* defined(CONFIG_MM_KERNEL_HEAP) */
 
+#ifdef HAVE_GROUP_MEMBERS
+  /* Allocate space to hold GROUP_INITIAL_MEMBERS members of the group */
+
+  group->tg_members = kmm_malloc(GROUP_INITIAL_MEMBERS * sizeof(pid_t));
+  if (!group->tg_members)
+{
+  goto errout_with_stream;
+}
+
+  /* Number of members in allocation */
+
+  group->tg_mxmembers = GROUP_INITIAL_MEMBERS;
+#endif
+
   /* Alloc task info for group  */
 
   group->tg_info = (FAR struct task_info_s *)
 group_zalloc(group, sizeof(struct task_info_s));
-
   if (!group->tg_info)
 {
-  goto errout_with_stream;
+  goto errout_with_member;
 }
 
-  /* Initial user space semaphore */
-
-  nxsem_init(&group->tg_info->ta_sem, 0, 1);
-
   /* Attach the group to the TCB */
 
   tcb->cmn.group = group;
@@ -200,9 +207,13 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t 
ttype)
   if (ret < 0)
 {
   tcb->cmn.group = NULL;
-  goto errout_with_group;
+  goto errout_with_taskinfo;
 }
 
+  /* Initial user space semaphore */
+
+  nxsem_init(&group->tg_info->ta_sem, 0, 1);
+
   /* Initialize file descriptors for the TCB */
 
   files_initlist(&group->tg_filelist);
@@ -232,64 +243,19 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t 
ttype)
 
   return OK;
 
+errout_with_taskinfo:
+  group_free(group, group->tg_info);
+errout_with_member:
+#ifdef HAVE_GROUP_MEMBERS
+  kmm_free(group->tg_members);
 errout_with_stream:
+#endif
 #if defined(CONFIG_FILE_STREAM) && defined(CONFIG_MM_KERNEL_HEAP)
   group_free(group, group->tg_streamlist);
-#endif
 errout_with_group:
-  group_deallocate(group);
-  return ret;
-}
-
-/
- * Name: group_deallocate
- *
- * Description:
- *   Free an existing task group structure.
- *
- * Input Parameters:
- *   group  = The group structure
- *
- /
-
-void group_deallocate(FAR struct task_group_s *group)
-{
-  if (group)
-{
-#ifdef CONFIG_ARCH_ADDRENV
-  save_addrenv_t oldenv;
-
-  /* NOTE: switch the addrenv before accessing group->tg_info
-   * located in the userland, also save the current addrenv
-   */
-
-  up_addrenv_select(&group->tg_addrenv, &oldenv);
-#endif
-
-  if (group->t

[incubator-nuttx] branch master updated: arm/armv7-a/r: set the default CPU mode to System

2022-03-14 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 7c02432  arm/armv7-a/r: set the default CPU mode to System
7c02432 is described below

commit 7c02432f0e9872408c8681d614d6b3c083c90da7
Author: chao.an 
AuthorDate: Mon Mar 14 10:34:51 2022 +0800

arm/armv7-a/r: set the default CPU mode to System

In SVC mode, the banked register will be inconsistent with the user mode 
register:

arch/arm/src/armv7-a/arm_vectors.S

 276   .globl  arm_syscall
 277   .globl  arm_vectorsvc
 278   .type arm_vectorsvc, %function
 279
 280 arm_vectorsvc:
...
 286   sub   sp, sp, #XCPTCONTEXT_SIZE// < SVC mode SP
...
 308   stmia   r0, {r13, r14}^// < USR mode SP/LR
...

[2.20] [ 4] [ ALERT] SYSCALL Entry: regs: 0x80202708 cmd: 4
[2.20] [ 4] [ ALERT]   R0: 0004 80001229 0001 80202018 
   802027d0
[2.20] [ 4] [ ALERT]   R8:     
 802027d0 1080f710 1080f710
[2.20] [ 4] [ ALERT] CPSR: 0073
[2.20] [ 4] [ ALERT] SYSCALL Exit: regs: 0x80202708
[2.20] [ 4] [ ALERT]   R0: 1 80202018 1 80202018 0 0 0 802027d0
[2.20] [ 4] [ ALERT]   R8: 0 0 0 0 0 802027d0 1080f710 80001229
[2.20] [ 4] [ ALERT] CPSR: 0070

SVC SP is 0x80202708
USR SP is 0x802027d0
0x802027d0 - 0x80202708 should be XCPTCONTEXT_SIZE

[2.20] [ 4] [ ALERT] SYSCALL Entry: regs: 0x80202708 cmd: 51
[2.20] [ 4] [ ALERT]   R0: 0033  80202780  
   80202710
[2.20] [ 4] [ ALERT]   R8:     
 80202710 800039d5 800039b2
[2.20] [ 4] [ ALERT] CPSR: 0070
[2.20] [ 4] [ ALERT] SYSCALL Exit: regs: 0x80202708
[2.20] [ 4] [ ALERT]   R0: 2b 0 80202780 0 0 0 0 80202710
[2.20] [ 4] [ ALERT]   R8: 0 0 0 0 0 10843d80 800039d5 10801425
[2.20] [ 4] [ ALERT] CPSR: 0073

SVC SP is 0x80202708
USR SP is 0x80202710
SP overlap in SVC and USR mode

This commit change the default CPU mode to System and ensure the 
consistency of SP/LR in USR/SYS mode during syscall.

Signed-off-by: chao.an 
---
 arch/arm/src/arm/arm_head.S  |   4 +-
 arch/arm/src/arm/arm_initialstate.c  |   4 +-
 arch/arm/src/arm/arm_nommuhead.S |   2 +-
 arch/arm/src/arm/arm_schedulesigaction.c |   4 +-
 arch/arm/src/arm/arm_vectors.S   | 374 +++--
 arch/arm/src/armv7-a/arm_cpuhead.S   |  20 +-
 arch/arm/src/armv7-a/arm_head.S  |   4 +-
 arch/arm/src/armv7-a/arm_initialstate.c  |   2 +-
 arch/arm/src/armv7-a/arm_pghead.S|   4 +-
 arch/arm/src/armv7-a/arm_schedulesigaction.c |  10 +-
 arch/arm/src/armv7-a/arm_syscall.c   |   4 +-
 arch/arm/src/armv7-a/arm_vectors.S   | 471 ---
 arch/arm/src/armv7-r/arm_head.S  |   4 +-
 arch/arm/src/armv7-r/arm_initialstate.c  |   2 +-
 arch/arm/src/armv7-r/arm_schedulesigaction.c |   4 +-
 arch/arm/src/armv7-r/arm_syscall.c   |   4 +-
 arch/arm/src/armv7-r/arm_vectors.S   | 471 ---
 arch/arm/src/c5471/c5471_irq.c   |   2 +-
 arch/arm/src/c5471/c5471_vectors.S   |  56 ++--
 arch/arm/src/dm320/dm320_irq.c   |   2 +-
 arch/arm/src/dm320/dm320_restart.S   |   4 +-
 arch/arm/src/imx1/imx_irq.c  |   2 +-
 arch/arm/src/lpc214x/lpc214x_head.S  |   2 +-
 arch/arm/src/lpc214x/lpc214x_irq.c   |   2 +-
 arch/arm/src/lpc2378/lpc23xx_head.S  |   2 +-
 arch/arm/src/lpc2378/lpc23xx_irq.c   |   2 +-
 arch/arm/src/lpc31xx/lpc31_irq.c |   2 +-
 arch/arm/src/moxart/moxart_irq.c |   2 +-
 arch/arm/src/str71x/str71x_head.S|   2 +-
 arch/arm/src/str71x/str71x_irq.c |   2 +-
 30 files changed, 264 insertions(+), 1206 deletions(-)

diff --git a/arch/arm/src/arm/arm_head.S b/arch/arm/src/arm/arm_head.S
index 6c33467..9d2f23c 100644
--- a/arch/arm/src/arm/arm_head.S
+++ b/arch/arm/src/arm/arm_head.S
@@ -220,9 +220,9 @@
.type   __start, #function
 
 __start:
-   /* Make sure that we are in SVC mode with all IRQs disabled */
+   /* Make sure that we are in SYS mode with all IRQs disabled */
 
-   mov r0, #(PSR_MODE_SVC | PSR_I_BIT | PSR_F_BIT)
+   mov r0, #(PSR_MODE_SYS | PSR_I_BIT | PSR_F_BIT)
msr cpsr_c, r0
 
/* Initialize DRAM using a macro provided by board-specific logic */
diff --git a/arch/arm/src/arm/arm_initials

[incubator-nuttx] branch master updated (f30fa2f -> 81130bc)

2022-03-15 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from f30fa2f  drivers/timers/timer: Add option for non-periodic notification
 add 7b99788  arch/arm: optimize context switch speed
 add 81130bc  arch/arm: remove unused arm_copyfullstate/arm_copyarmstate

No new revisions were added by this update.

Summary of changes:
 arch/arm/include/arm/irq.h   |  18 ++--
 arch/arm/include/armv6-m/irq.h   |  22 ++--
 arch/arm/include/armv7-a/irq.h   |  19 ++--
 arch/arm/include/armv7-m/irq.h   |  26 ++---
 arch/arm/include/armv7-r/irq.h   |  19 ++--
 arch/arm/include/armv8-m/irq.h   |  26 ++---
 arch/arm/include/syscall.h   |   2 +-
 arch/arm/src/a1x/Make.defs   |   3 +-
 arch/arm/src/am335x/Make.defs|   3 +-
 arch/arm/src/arm/arm_copyfullstate.c |  66 
 arch/arm/src/arm/arm_initialstate.c  |  22 +++-
 arch/arm/src/arm/arm_schedulesigaction.c |  51 ++---
 arch/arm/src/arm/arm_sigdeliver.c|  10 +-
 arch/arm/src/arm/arm_syscall.c   |   5 +-
 arch/arm/src/arm/arm_vectors.S   |  19 +++-
 arch/arm/src/armv6-m/arm_copyfullstate.c |  70 -
 arch/arm/src/armv6-m/arm_exception.S |  17 +++
 arch/arm/src/armv6-m/arm_initialstate.c  |  20 +++-
 arch/arm/src/armv6-m/arm_schedulesigaction.c | 131 +++
 arch/arm/src/armv6-m/arm_sigdeliver.c|  17 +--
 arch/arm/src/armv6-m/arm_svcall.c|   5 +-
 arch/arm/src/armv7-a/arm_copyarmstate.c  |  76 --
 arch/arm/src/armv7-a/arm_copyfullstate.c |  58 --
 arch/arm/src/armv7-a/arm_cpuhead.S   |   5 +
 arch/arm/src/armv7-a/arm_initialstate.c  |  20 +++-
 arch/arm/src/armv7-a/arm_schedulesigaction.c | 111 
 arch/arm/src/armv7-a/arm_sigdeliver.c|  10 +-
 arch/arm/src/armv7-a/arm_syscall.c   |  10 +-
 arch/arm/src/armv7-a/arm_vectors.S   |  26 +
 arch/arm/src/armv7-m/arm_copyarmstate.c  |  90 
 arch/arm/src/armv7-m/arm_copyfullstate.c |  62 ---
 arch/arm/src/armv7-m/arm_initialstate.c  |  20 +++-
 arch/arm/src/armv7-m/arm_schedulesigaction.c | 151 ---
 arch/arm/src/armv7-m/arm_sigdeliver.c|  18 +---
 arch/arm/src/armv7-m/arm_svcall.c|  11 +-
 arch/arm/src/armv7-m/gnu/arm_exception.S |  20 +++-
 arch/arm/src/armv7-m/gnu/arm_lazyexception.S |  20 +++-
 arch/arm/src/armv7-r/arm_copyarmstate.c  |  76 --
 arch/arm/src/armv7-r/arm_copyfullstate.c |  58 --
 arch/arm/src/armv7-r/arm_initialstate.c  |  20 +++-
 arch/arm/src/armv7-r/arm_schedulesigaction.c |  51 ++---
 arch/arm/src/armv7-r/arm_sigdeliver.c|   8 +-
 arch/arm/src/armv7-r/arm_syscall.c   |  10 +-
 arch/arm/src/armv7-r/arm_vectors.S   |  26 +
 arch/arm/src/armv8-m/arm_copyarmstate.c  |  90 
 arch/arm/src/armv8-m/arm_copyfullstate.c |  62 ---
 arch/arm/src/armv8-m/arm_exception.S |  20 +++-
 arch/arm/src/armv8-m/arm_initialstate.c  |  20 +++-
 arch/arm/src/armv8-m/arm_lazyexception.S |  20 +++-
 arch/arm/src/armv8-m/arm_schedulesigaction.c | 151 ---
 arch/arm/src/armv8-m/arm_sigdeliver.c|  18 +---
 arch/arm/src/armv8-m/arm_svcall.c|  11 +-
 arch/arm/src/c5471/Make.defs |   2 +-
 arch/arm/src/c5471/c5471_vectors.S   |  16 ++-
 arch/arm/src/common/arm_blocktask.c  |   2 +-
 arch/arm/src/common/arm_internal.h   |  23 ++--
 arch/arm/src/common/arm_releasepending.c |   2 +-
 arch/arm/src/common/arm_reprioritizertr.c|   2 +-
 arch/arm/src/common/arm_switchcontext.c  |   2 +-
 arch/arm/src/common/arm_unblocktask.c|   2 +-
 arch/arm/src/common/arm_vfork.c  |   6 +-
 arch/arm/src/cxd56xx/Make.defs   |   3 +-
 arch/arm/src/dm320/Make.defs |   2 +-
 arch/arm/src/efm32/Make.defs |   3 +-
 arch/arm/src/eoss3/Make.defs |   2 +-
 arch/arm/src/imx1/Make.defs  |   2 +-
 arch/arm/src/imx6/Make.defs  |   3 +-
 arch/arm/src/imxrt/Make.defs |   3 +-
 arch/arm/src/kinetis/Make.defs   |   3 +-
 arch/arm/src/kl/Make.defs|   2 +-
 arch/arm/src/lc823450/Make.defs  |   2 +-
 arch/arm/src/lpc17xx_40xx/Make.defs  |   3 +-
 arch/arm/src/lpc214x/Make.defs   |   2 +-
 arch/arm/src/lpc2378/Make.defs   |   2 +-
 arch/arm/src/lpc31xx/Make.defs   |   2 +-
 arch/arm/src/lpc43xx/Make.defs   |   3 +-
 arch/arm/src/lpc54xx/Make.defs   |   3 +-
 arch/arm/src/max326xx/Make.defs

[incubator-nuttx] branch master updated (81130bc -> 40f056e)

2022-03-15 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 81130bc  arch/arm: remove unused arm_copyfullstate/arm_copyarmstate
 add 40f056e  net/local: correct the socket flags from server socket

No new revisions were added by this update.

Summary of changes:
 net/local/local_accept.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


[incubator-nuttx] branch master updated (bbf12f3 -> c05ace5)

2022-03-16 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from bbf12f3  boards/sim/adb: Enable CONFIG_ADBD_SOCKET_SERVICE
 add c05ace5  arch: cxd56xx: Fix critical section in serial transmission

No new revisions were added by this update.

Summary of changes:
 arch/arm/src/cxd56xx/cxd56_serial.c | 4 
 1 file changed, 4 insertions(+)


[incubator-nuttx] branch master updated (bfe29c8 -> 19119a9)

2022-03-17 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from bfe29c8  driver/uinput: add uinput keyboard support
 add 19119a9  arch/arm: set the SP to stack top

No new revisions were added by this update.

Summary of changes:
 arch/arm/src/arm/arm_initialstate.c | 10 +-
 arch/arm/src/armv6-m/arm_initialstate.c | 10 +-
 arch/arm/src/armv7-a/arm_initialstate.c | 10 +-
 arch/arm/src/armv7-m/arm_initialstate.c | 10 +-
 arch/arm/src/armv7-r/arm_initialstate.c | 10 +-
 arch/arm/src/armv8-m/arm_initialstate.c | 10 +-
 6 files changed, 30 insertions(+), 30 deletions(-)


[incubator-nuttx] 01/03: xtensa/esp32s3: Add support for GPIO read/write operations

2022-03-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 0e67dc8637638908303a5cb08dc9f939f704fc87
Author: Gustavo Henrique Nihei 
AuthorDate: Fri Mar 18 17:34:02 2022 -0300

xtensa/esp32s3: Add support for GPIO read/write operations

Signed-off-by: Gustavo Henrique Nihei 
---
 arch/xtensa/src/esp32s3/esp32s3_gpio.c | 90 +++---
 arch/xtensa/src/esp32s3/esp32s3_gpio.h | 37 +-
 2 files changed, 119 insertions(+), 8 deletions(-)

diff --git a/arch/xtensa/src/esp32s3/esp32s3_gpio.c 
b/arch/xtensa/src/esp32s3/esp32s3_gpio.c
index a562dc0..c8f499d 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_gpio.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_gpio.c
@@ -24,21 +24,20 @@
 
 #include 
 
-#include 
-#include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
-#include 
 
 #include "xtensa.h"
+#include "esp32s3_gpio.h"
 #include "esp32s3_irq.h"
-#include "hardware/esp32s3_iomux.h"
 #include "hardware/esp32s3_gpio.h"
-
-#include "esp32s3_gpio.h"
+#include "hardware/esp32s3_iomux.h"
 
 /
  * Pre-processor Definitions
@@ -199,11 +198,88 @@ int esp32s3_configgpio(uint32_t pin, gpio_pinattr_t attr)
 }
 
 /
+ * Name: esp32s3_gpiowrite
+ *
+ * Description:
+ *   Write one or zero to the selected GPIO pin.
+ *
+ * Input Parameters:
+ *   pin   - GPIO pin to be written.
+ *   value - Value to be written to the GPIO pin. True will output
+ *   1 (one) to the GPIO, while false will output 0 (zero).
+ *
+ * Returned Value:
+ *   None.
+ *
+ /
+
+void esp32s3_gpiowrite(int pin, bool value)
+{
+  DEBUGASSERT(is_valid_gpio(pin));
+
+  if (value)
+{
+  if (pin < 32)
+{
+  putreg32(UINT32_C(1) << pin, GPIO_OUT_W1TS_REG);
+}
+  else
+{
+  putreg32(UINT32_C(1) << (pin - 32), GPIO_OUT1_W1TS_REG);
+}
+}
+  else
+{
+  if (pin < 32)
+{
+  putreg32(UINT32_C(1) << pin, GPIO_OUT_W1TC_REG);
+}
+  else
+{
+  putreg32(UINT32_C(1) << (pin - 32), GPIO_OUT1_W1TC_REG);
+}
+}
+}
+
+/
+ * Name: esp32s3_gpioread
+ *
+ * Description:
+ *   Read one or zero from the selected GPIO pin.
+ *
+ * Input Parameters:
+ *   pin   - GPIO pin to be read.
+ *
+ * Returned Value:
+ *   True in case the read value is 1 (one). If 0 (zero), then false will be
+ *   returned.
+ *
+ /
+
+bool esp32s3_gpioread(int pin)
+{
+  uint32_t regval;
+
+  DEBUGASSERT(is_valid_gpio(pin));
+
+  if (pin < 32)
+{
+  regval = getreg32(GPIO_IN_REG);
+  return ((regval >> pin) & 1) != 0;
+}
+  else
+{
+  regval = getreg32(GPIO_IN1_REG);
+  return ((regval >> (pin - 32)) & 1) != 0;
+}
+}
+
+/
  * Name: esp32s3_gpio_matrix_in
  *
  * Description:
  *   Set GPIO input to a signal.
- *   NOTE: one GPIO can input to several signals.
+ *   NOTE: one GPIO can receive inputs from several signals.
  *
  * Input Parameters:
  *   pin   - GPIO pin to be configured.
diff --git a/arch/xtensa/src/esp32s3/esp32s3_gpio.h 
b/arch/xtensa/src/esp32s3/esp32s3_gpio.h
index b173e04..35367d2 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_gpio.h
+++ b/arch/xtensa/src/esp32s3/esp32s3_gpio.h
@@ -155,11 +155,46 @@ extern "C"
 int esp32s3_configgpio(uint32_t pin, gpio_pinattr_t attr);
 
 /
+ * Name: esp32s3_gpiowrite
+ *
+ * Description:
+ *   Write one or zero to the selected GPIO pin.
+ *
+ * Input Parameters:
+ *   pin   - GPIO pin to be written.
+ *   value - Value to be written to the GPIO pin. True will output
+ *   1 (one) to the GPIO, while false will output 0 (zero).
+ *
+ * Returned Value:
+ *   None.
+ *
+ /
+
+void esp32s3_gpiowrite(int pin, bool value);
+
+/
+ * Name: esp32s3_gpioread
+ *
+ * Description:
+ *   Read one or zero from the selected GPIO pin.
+ *
+ * Input Parameters:
+ *   pin   - GPIO pin to be read.
+ *
+ * Returned Value:
+ *   True in case the read value is 1 (one). If 0 (zero), then false will be

[incubator-nuttx] branch master updated (68902d8 -> 23cfded)

2022-03-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 68902d8  pid_t: unify usage of special task IDs
 new 0e67dc8  xtensa/esp32s3: Add support for GPIO read/write operations
 new 024364eb xtensa/esp32s3: Add support for GPIO pin interrupts
 new 23cfded  esp32s3-devkit: Add support for BOOT button as user button

The 3 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/xtensa/include/esp32s3/irq.h  |  27 +-
 arch/xtensa/src/esp32s3/Kconfig|   6 +
 arch/xtensa/src/esp32s3/esp32s3_gpio.c | 313 -
 arch/xtensa/src/esp32s3/esp32s3_gpio.h | 119 +++-
 arch/xtensa/src/esp32s3/esp32s3_irq.c  |   5 +
 boards/Kconfig |   2 +
 .../configs/{nsh => buttons}/defconfig |  11 +-
 boards/xtensa/esp32s3/esp32s3-devkit/src/Make.defs |   4 +
 .../esp32s3/esp32s3-devkit/src/esp32s3-devkit.h|   6 +
 .../esp32s3/esp32s3-devkit/src/esp32s3_bringup.c   |  14 +
 .../esp32s3-devkit/src/esp32s3_buttons.c}  |  28 +-
 11 files changed, 491 insertions(+), 44 deletions(-)
 copy boards/xtensa/esp32s3/esp32s3-devkit/configs/{nsh => buttons}/defconfig 
(82%)
 copy boards/xtensa/{esp32/esp32-devkitc/src/esp32_buttons.c => 
esp32s3/esp32s3-devkit/src/esp32s3_buttons.c} (88%)


[incubator-nuttx] 03/03: esp32s3-devkit: Add support for BOOT button as user button

2022-03-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 23cfded18fb7f53c3de5fc545b7f032a1b9e9275
Author: Gustavo Henrique Nihei 
AuthorDate: Mon Mar 21 16:32:55 2022 -0300

esp32s3-devkit: Add support for BOOT button as user button

Signed-off-by: Gustavo Henrique Nihei 
---
 boards/Kconfig |   2 +
 .../esp32s3-devkit/configs/buttons/defconfig   |  57 +++
 boards/xtensa/esp32s3/esp32s3-devkit/src/Make.defs |   4 +
 .../esp32s3/esp32s3-devkit/src/esp32s3-devkit.h|   6 +
 .../esp32s3/esp32s3-devkit/src/esp32s3_bringup.c   |  14 ++
 .../esp32s3/esp32s3-devkit/src/esp32s3_buttons.c   | 164 +
 6 files changed, 247 insertions(+)

diff --git a/boards/Kconfig b/boards/Kconfig
index 4d8c449..a571070 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -283,6 +283,8 @@ config ARCH_BOARD_ESP32S3_DEVKIT
bool "Espressif ESP32-S3 DevKit"
depends on ARCH_CHIP_ESP32S3WROOM1 || ARCH_CHIP_ESP32S3MINI1
select ARCH_HAVE_LEDS
+   select ARCH_HAVE_BUTTONS
+   select ARCH_HAVE_IRQBUTTONS if ESP32S3_GPIO_IRQ
---help---
The ESP32-S3 DevKit features the ESP32-S3 CPU with dual Xtensa 
LX7 cores.
It comes in two flavors, the ESP32-S3-DevKitM-1 and the 
ESP32-S3-DevKitC-1.
diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/buttons/defconfig 
b/boards/xtensa/esp32s3/esp32s3-devkit/configs/buttons/defconfig
new file mode 100644
index 000..3ecc366
--- /dev/null
+++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/buttons/defconfig
@@ -0,0 +1,57 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed 
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that 
includes your
+# modifications.
+#
+# CONFIG_ARCH_LEDS is not set
+# CONFIG_NSH_ARGCAT is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+# CONFIG_NSH_CMDPARMS is not set
+CONFIG_ARCH="xtensa"
+CONFIG_ARCH_BOARD="esp32s3-devkit"
+CONFIG_ARCH_BOARD_COMMON=y
+CONFIG_ARCH_BOARD_ESP32S3_DEVKIT=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CHIP="esp32s3"
+CONFIG_ARCH_CHIP_ESP32S3=y
+CONFIG_ARCH_CHIP_ESP32S3WROOM1=y
+CONFIG_ARCH_IRQBUTTONS=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_XTENSA=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_BUILTIN=y
+CONFIG_DEBUG_FULLOPT=y
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_ESP32S3_GPIO_IRQ=y
+CONFIG_ESP32S3_UART0=y
+CONFIG_EXAMPLES_BUTTONS=y
+CONFIG_EXAMPLES_BUTTONS_NAME0="BOOT"
+CONFIG_EXAMPLES_BUTTONS_NAMES=y
+CONFIG_EXAMPLES_BUTTONS_QTD=1
+CONFIG_FS_PROCFS=y
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_IDLETHREAD_STACKSIZE=3072
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INPUT=y
+CONFIG_INPUT_BUTTONS=y
+CONFIG_INPUT_BUTTONS_LOWER=y
+CONFIG_INTELHEX_BINARY=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_READLINE=y
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_RAM_SIZE=114688
+CONFIG_RAM_START=0x2000
+CONFIG_RAW_BINARY=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_WAITPID=y
+CONFIG_START_DAY=6
+CONFIG_START_MONTH=12
+CONFIG_START_YEAR=2011
+CONFIG_SYSTEM_NSH=y
+CONFIG_UART0_SERIAL_CONSOLE=y
diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/src/Make.defs 
b/boards/xtensa/esp32s3/esp32s3-devkit/src/Make.defs
index 25297e8..6599361 100644
--- a/boards/xtensa/esp32s3/esp32s3-devkit/src/Make.defs
+++ b/boards/xtensa/esp32s3/esp32s3-devkit/src/Make.defs
@@ -33,6 +33,10 @@ CSRCS += esp32s3_reset.c
 endif
 endif
 
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += esp32s3_buttons.c
+endif
+
 SCRIPTIN = $(SCRIPTDIR)$(DELIM)esp32s3.template.ld
 SCRIPTOUT = $(SCRIPTDIR)$(DELIM)esp32s3_out.ld
 
diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3-devkit.h 
b/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3-devkit.h
index 5588ecc..be39476 100644
--- a/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3-devkit.h
+++ b/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3-devkit.h
@@ -33,6 +33,12 @@
  * Pre-processor Definitions
  /
 
+/* ESP32-S3-DEVKIT GPIOs /
+
+/* BOOT Button */
+
+#define BUTTON_BOOT  0
+
 /
  * Public Types
  /
diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_bringup.c 
b/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_bringup.c
index 8813a64d..555c010 100644
--- a/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_bringup.c
+++ b/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_bringup.c
@@ -50,6 +50,10 @@
 #  include "esp32s3_board_wd

[incubator-nuttx] 02/03: xtensa/esp32s3: Add support for GPIO pin interrupts

2022-03-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 024364ebbd0b0cac0cd467a7ad232616f8c22c45
Author: Gustavo Henrique Nihei 
AuthorDate: Fri Mar 18 17:35:05 2022 -0300

xtensa/esp32s3: Add support for GPIO pin interrupts

Signed-off-by: Gustavo Henrique Nihei 
---
 arch/xtensa/include/esp32s3/irq.h  |  27 ++--
 arch/xtensa/src/esp32s3/Kconfig|   6 +
 arch/xtensa/src/esp32s3/esp32s3_gpio.c | 223 +
 arch/xtensa/src/esp32s3/esp32s3_gpio.h |  82 ++--
 arch/xtensa/src/esp32s3/esp32s3_irq.c  |   5 +
 5 files changed, 323 insertions(+), 20 deletions(-)

diff --git a/arch/xtensa/include/esp32s3/irq.h 
b/arch/xtensa/include/esp32s3/irq.h
index fecdb3c..b379a22 100644
--- a/arch/xtensa/include/esp32s3/irq.h
+++ b/arch/xtensa/include/esp32s3/irq.h
@@ -26,6 +26,12 @@
 #define __ARCH_XTENSA_INCLUDE_ESP32S3_IRQ_H
 
 /
+ * Included Files
+ /
+
+#include 
+
+/
  * Pre-processor Definitions
  /
 
@@ -309,19 +315,20 @@
 
 #define ESP32S3_NIRQ_PERIPH ESP32S3_NPERIPHERALS
 
-/* Second level GPIO interrupts.  GPIO interrupts are decoded and dispatched
- * as a second level of decoding:  The first level dispatches to the GPIO
- * interrupt handler.  The second to the decoded GPIO interrupt handler.
+#ifdef CONFIG_ESP32S3_GPIO_IRQ
+
+/* Second level GPIO interrupts. GPIO interrupts are decoded and dispatched
+ * as a second level of decoding: The first level dispatches to the GPIO
+ * interrupt handler. The second to the decoded GPIO interrupt handler.
  */
 
-#ifdef CONFIG_ESP32S3_GPIO_IRQ
-#  define ESP32S3_NIRQ_GPIO   40
-#  define ESP32S3_FIRST_GPIOIRQ   (XTENSA_NIRQ_INTERNAL + 
ESP32S3_NIRQ_PERIPH)
-#  define ESP32S3_LAST_GPIOIRQ(ESP32S3_FIRST_GPIOIRQ + 
ESP32S3_NIRQ_GPIO - 1)
-#  define ESP32S3_PIN2IRQ(p)  ((p) + ESP32S3_FIRST_GPIOIRQ)
-#  define ESP32S3_IRQ2PIN(i)  ((i) - ESP32S3_FIRST_GPIOIRQ)
+#  define ESP32S3_NIRQ_GPIO 49
+#  define ESP32S3_FIRST_GPIOIRQ (XTENSA_NIRQ_INTERNAL + 
ESP32S3_NIRQ_PERIPH)
+#  define ESP32S3_LAST_GPIOIRQ  (ESP32S3_FIRST_GPIOIRQ + 
ESP32S3_NIRQ_GPIO - 1)
+#  define ESP32S3_PIN2IRQ(p)((p) + ESP32S3_FIRST_GPIOIRQ)
+#  define ESP32S3_IRQ2PIN(i)((i) - ESP32S3_FIRST_GPIOIRQ)
 #else
-#  define ESP32S3_NIRQ_GPIO   0
+#  define ESP32S3_NIRQ_GPIO 0
 #endif
 
 /* Total number of interrupts */
diff --git a/arch/xtensa/src/esp32s3/Kconfig b/arch/xtensa/src/esp32s3/Kconfig
index ab7a142..d9896ab 100644
--- a/arch/xtensa/src/esp32s3/Kconfig
+++ b/arch/xtensa/src/esp32s3/Kconfig
@@ -511,6 +511,12 @@ config ESP32S3_SPIRAM_IGNORE_NOTFOUND
 
 endmenu # SPI RAM Configuration
 
+config ESP32S3_GPIO_IRQ
+   bool "GPIO pin interrupts"
+   default n
+   ---help---
+   Enable support for interrupting GPIO pins.
+
 menu "UART Configuration"
depends on ESP32S3_UART
 
diff --git a/arch/xtensa/src/esp32s3/esp32s3_gpio.c 
b/arch/xtensa/src/esp32s3/esp32s3_gpio.c
index c8f499d..c10948a 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_gpio.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_gpio.c
@@ -49,6 +49,10 @@
  * Private Data
  /
 
+#ifdef CONFIG_ESP32S3_GPIO_IRQ
+static int g_gpio_cpuint;
+#endif
+
 /
  * Private Functions
  /
@@ -75,6 +79,94 @@ static inline bool is_valid_gpio(uint32_t pin)
 }
 
 /
+ * Name: gpio_dispatch
+ *
+ * Description:
+ *   Second level dispatch for GPIO interrupt handling.
+ *
+ * Input Parameters:
+ *   irq   - GPIO IRQ number.
+ *   status- Value from the GPIO interrupt status clear register.
+ *   regs  - Saved CPU context.
+ *
+ * Returned Value:
+ *   None.
+ *
+ /
+
+#ifdef CONFIG_ESP32S3_GPIO_IRQ
+static void gpio_dispatch(int irq, uint32_t status, uint32_t *regs)
+{
+  uint32_t mask;
+  int i;
+
+  /* Check each bit in the status register */
+
+  for (i = 0; i < 32 && status != 0; i++)
+{
+  /* Check if there is an interrupt pending for this pin */
+
+  mask = UINT32_C(1) << i;
+  if ((status & mask) != 0)
+{
+  /* Yes... perform the second level dispatch *

[incubator-nuttx] branch master updated (23cfded -> 0fcb457)

2022-03-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 23cfded  esp32s3-devkit: Add support for BOOT button as user button
 add 0fcb457  sched/dumpstack: Print "backtrace:" only in the first 
iteration

No new revisions were added by this update.

Summary of changes:
 libs/libc/sched/sched_dumpstack.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)


[incubator-nuttx] 03/03: arm/schedulesigaction: update the SP to signal context top

2022-03-23 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 7b736063004bf65445afaad26e9b9acee01daaba
Author: chao.an 
AuthorDate: Wed Mar 23 13:13:03 2022 +0800

arm/schedulesigaction: update the SP to signal context top

Signed-off-by: chao.an 
---
 arch/arm/src/arm/arm_schedulesigaction.c | 18 ++-
 arch/arm/src/armv6-m/arm_schedulesigaction.c | 45 +++-
 arch/arm/src/armv7-a/arm_schedulesigaction.c | 45 +++-
 arch/arm/src/armv7-m/arm_schedulesigaction.c | 45 +++-
 arch/arm/src/armv7-r/arm_schedulesigaction.c | 18 ++-
 arch/arm/src/armv8-m/arm_schedulesigaction.c | 45 +++-
 6 files changed, 120 insertions(+), 96 deletions(-)

diff --git a/arch/arm/src/arm/arm_schedulesigaction.c 
b/arch/arm/src/arm/arm_schedulesigaction.c
index 9e37043..2d37ec6 100644
--- a/arch/arm/src/arm/arm_schedulesigaction.c
+++ b/arch/arm/src/arm/arm_schedulesigaction.c
@@ -134,13 +134,14 @@ void up_schedule_sigaction(struct tcb_s *tcb, 
sig_deliver_t sigdeliver)
* delivered.
*/
 
-  CURRENT_REGS   =
-(FAR void *)STACK_ALIGN_DOWN((uint32_t)CURRENT_REGS -
- (uint32_t)XCPTCONTEXT_SIZE);
+  CURRENT_REGS   = (FAR void *)
+   ((uint32_t)CURRENT_REGS -
+(uint32_t)XCPTCONTEXT_SIZE);
   memcpy((FAR uint32_t *)CURRENT_REGS, tcb->xcp.saved_regs,
  XCPTCONTEXT_SIZE);
 
-  CURRENT_REGS[REG_SP]   = (uint32_t)CURRENT_REGS;
+  CURRENT_REGS[REG_SP]   = (uint32_t)CURRENT_REGS +
+   (uint32_t)XCPTCONTEXT_SIZE;
 
   /* Then set up to vector to the trampoline with interrupts
* disabled
@@ -175,12 +176,13 @@ void up_schedule_sigaction(struct tcb_s *tcb, 
sig_deliver_t sigdeliver)
* delivered.
*/
 
-  tcb->xcp.regs   =
-(FAR void *)STACK_ALIGN_DOWN((uint32_t)tcb->xcp.regs -
- (uint32_t)XCPTCONTEXT_SIZE);
+  tcb->xcp.regs   = (FAR void *)
+((uint32_t)tcb->xcp.regs -
+ (uint32_t)XCPTCONTEXT_SIZE);
   memcpy(tcb->xcp.regs, tcb->xcp.saved_regs, XCPTCONTEXT_SIZE);
 
-  tcb->xcp.regs[REG_SP]   = (uint32_t)tcb->xcp.regs;
+  tcb->xcp.regs[REG_SP]   = (uint32_t)tcb->xcp.regs +
+(uint32_t)XCPTCONTEXT_SIZE;
 
   /* Then set up to vector to the trampoline with interrupts
* disabled
diff --git a/arch/arm/src/armv6-m/arm_schedulesigaction.c 
b/arch/arm/src/armv6-m/arm_schedulesigaction.c
index 23e4290..1f30fed 100644
--- a/arch/arm/src/armv6-m/arm_schedulesigaction.c
+++ b/arch/arm/src/armv6-m/arm_schedulesigaction.c
@@ -136,13 +136,14 @@ void up_schedule_sigaction(struct tcb_s *tcb, 
sig_deliver_t sigdeliver)
* delivered.
*/
 
-  CURRENT_REGS =
-(FAR void *)STACK_ALIGN_DOWN((uint32_t)CURRENT_REGS -
- (uint32_t)XCPTCONTEXT_SIZE);
+  CURRENT_REGS = (FAR void *)
+ ((uint32_t)CURRENT_REGS -
+  (uint32_t)XCPTCONTEXT_SIZE);
   memcpy((FAR uint32_t *)CURRENT_REGS, tcb->xcp.saved_regs,
  XCPTCONTEXT_SIZE);
 
-  CURRENT_REGS[REG_SP] = (uint32_t)CURRENT_REGS;
+  CURRENT_REGS[REG_SP] = (uint32_t)CURRENT_REGS +
+ (uint32_t)XCPTCONTEXT_SIZE;
 
   /* Then set up to vector to the trampoline with interrupts
* disabled.  The kernel-space trampoline must run in
@@ -182,12 +183,13 @@ void up_schedule_sigaction(struct tcb_s *tcb, 
sig_deliver_t sigdeliver)
* delivered.
*/
 
-  tcb->xcp.regs  =
-(FAR void *)STACK_ALIGN_DOWN((uint32_t)tcb->xcp.regs -
- (uint32_t)XCPTCONTEXT_SIZE);
+  tcb->xcp.regs  = (FAR void *)
+   ((uint32_t)tcb->xcp.regs -
+(uint32_t)XCPTCONTEXT_SIZE);
   memcpy(tcb->xcp.regs, tcb->xcp.saved_regs, XCPTCONTEXT_SIZE);
 
-  tcb->xcp.regs[REG_SP]  = (uint32_t)tcb->xcp.regs;
+  tcb->xcp.regs[REG_SP]  = (uint32_t)tcb->xcp.regs +
+   (uint32_t)XCPTCON

[incubator-nuttx] 01/03: arch/arm: Remove the code copy register from xcpt to stack

2022-03-23 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 9ae0dcd4a231424f4968947988cb2865ef90681b
Author: Xiang Xiao 
AuthorDate: Thu Mar 17 02:38:03 2022 +0800

arch/arm: Remove the code copy register from xcpt to stack

since xcpt always point to the stack after the below change:
commit 7b9978883c46569068ba5dac5755f998fbd237b2
Author: chao.an 
Date:   Tue Mar 1 01:06:24 2022 +0800

arch/arm: optimize context switch speed

The current context save implementation saves registers of each task
to xcp context, which is unnecessary because most of the arm registers 
are
already saved in the task stack, this commit replace the xcp context 
with
stack context to improve context switching performance and reduce the 
tcb
space occupation of tcb instance.

Signed-off-by: Xiang Xiao 
---
 arch/arm/src/armv6-m/arm_exception.S |  65 -
 arch/arm/src/armv7-m/gnu/arm_exception.S |  92 +---
 arch/arm/src/armv7-m/gnu/arm_lazyexception.S |  77 ++--
 arch/arm/src/armv8-m/arm_exception.S | 104 ++-
 arch/arm/src/armv8-m/arm_lazyexception.S |  87 +++---
 5 files changed, 99 insertions(+), 326 deletions(-)

diff --git a/arch/arm/src/armv6-m/arm_exception.S 
b/arch/arm/src/armv6-m/arm_exception.S
index c438bf5..224ecdd 100644
--- a/arch/arm/src/armv6-m/arm_exception.S
+++ b/arch/arm/src/armv6-m/arm_exception.S
@@ -167,10 +167,7 @@ exception_common:
 */
 
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
-   setintstack r7, r6  /* SP = IRQ 
stack top */
-   push{r1}/* Save the MSP 
on the interrupt stack */
-   bl  arm_doirq   /* R0=IRQ, 
R1=register save area on stack */
-   pop {r1}/* Recover 
R1=main stack pointer */
+   setintstack r7, r6  /* SP = IRQ 
stack top */
 #else
/* If the interrupt stack is disabled, reserve xcpcontext to ensure
 * that signal processing can have a separate xcpcontext to handle
@@ -183,64 +180,30 @@ exception_common:
 * also the sp should be restore after arm_doirq()
 */
 
-   sub r1, r1, #XCPTCONTEXT_SIZE   /* Reserve 
signal context */
-
-   msr msp, r1 /* We are using 
the main stack pointer */
-
-   add r1, r1, #XCPTCONTEXT_SIZE   /* Restore 
signal context */
+   mov r2, r1  /* Reserve 
signal context */
+   sub r2, r2, #XCPTCONTEXT_SIZE
+   msr msp, r2 /* We are using 
the main stack pointer */
+#endif
 
bl  arm_doirq   /* R0=IRQ, 
R1=register save area on stack */
 
-   mrs r1, msp /* Recover 
R1=main stack pointer */
-#endif
-
/* On return from arm_doirq, R0 will hold a pointer to register context
-* array to use for the interrupt return.  If that return value is the 
same
-* as current stack pointer, then things are relatively easy.
-*/
-
-   cmp r0, r1  /* Context 
switch? */
-   beq 3f  /* Branch if no 
context switch */
-
-   /* We are returning with a pending context switch.  This case is 
different
-* because in this case, the register save structure does not lie on the
-* stack but, rather within a TCB structure.  We'll have to copy some
-* values to the stack.
-*/
-
-   /* Copy the hardware-saved context to the new stack */
-
-   mov r2, #SW_XCPT_SIZE   /* R2=Size of 
software-saved portion of the context array */
-   add r1, r0, r2  /* R1=Address of HW 
save area in reg array */
-   ldr r2, [r0, #(4*REG_SP)]   /* R2=Value of SP 
before the interrupt */
-   sub r2, #HW_XCPT_SIZE   /* R2=Address of HW 
save area on the return stack */
-   ldmia   r1!, {r4-r7}/* Fetch four registers 
from the HW save area */
-   stmia   r2!, {r4-r7}/* Copy four registers 
to the return stack */
-   ldmia   r1!, {r4-r7}/* Fetch four registers 
from the HW save area */
-   stmia   r2!, {r4-r7}/* Copy four registers 
to the return stack */
-
-   /* Restore the register contents */
-
-   mov   

[incubator-nuttx] 02/03: arm/vfork: update the SP to stack top

2022-03-23 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit a770ff20174c4d8fdcf60f8147f768d65a367292
Author: chao.an 
AuthorDate: Fri Mar 18 21:54:01 2022 +0800

arm/vfork: update the SP to stack top

Signed-off-by: chao.an 
---
 arch/arm/src/common/arm_vfork.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/arm/src/common/arm_vfork.c b/arch/arm/src/common/arm_vfork.c
index f265aaf..edad4cc 100644
--- a/arch/arm/src/common/arm_vfork.c
+++ b/arch/arm/src/common/arm_vfork.c
@@ -137,10 +137,18 @@ pid_t up_vfork(const struct vfork_s *context)
* effort is overkill.
*/
 
-  newtop = STACK_ALIGN_DOWN((uint32_t)child->cmn.stack_base_ptr +
-  child->cmn.adj_stack_size -
-  XCPTCONTEXT_SIZE);
+  newtop = (uint32_t)child->cmn.stack_base_ptr +
+ child->cmn.adj_stack_size;
+
   newsp = newtop - stackutil;
+
+  /* Move the register context to newtop. */
+
+  memcpy((void *)(newsp - XCPTCONTEXT_SIZE),
+ child->cmn.xcp.regs, XCPTCONTEXT_SIZE);
+
+  child->cmn.xcp.regs = (void *)(newsp - XCPTCONTEXT_SIZE);
+
   memcpy((void *)newsp, (const void *)context->sp, stackutil);
 
   /* Was there a frame pointer in place before? */


[incubator-nuttx] branch master updated (9288ed8 -> 7b73606)

2022-03-23 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 9288ed8  RISC-V: Add/fix implementation for arch_elf.c
 new 9ae0dcd  arch/arm: Remove the code copy register from xcpt to stack
 new a770ff2  arm/vfork: update the SP to stack top
 new 7b73606  arm/schedulesigaction: update the SP to signal context top

The 3 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/arm/src/arm/arm_schedulesigaction.c |  18 ++---
 arch/arm/src/armv6-m/arm_exception.S |  65 -
 arch/arm/src/armv6-m/arm_schedulesigaction.c |  45 ++--
 arch/arm/src/armv7-a/arm_schedulesigaction.c |  45 ++--
 arch/arm/src/armv7-m/arm_schedulesigaction.c |  45 ++--
 arch/arm/src/armv7-m/gnu/arm_exception.S |  92 +---
 arch/arm/src/armv7-m/gnu/arm_lazyexception.S |  77 ++--
 arch/arm/src/armv7-r/arm_schedulesigaction.c |  18 ++---
 arch/arm/src/armv8-m/arm_exception.S | 104 ++-
 arch/arm/src/armv8-m/arm_lazyexception.S |  87 +++---
 arch/arm/src/armv8-m/arm_schedulesigaction.c |  45 ++--
 arch/arm/src/common/arm_vfork.c  |  14 +++-
 12 files changed, 230 insertions(+), 425 deletions(-)


[incubator-nuttx] branch master updated (b59dd92 -> 494230a)

2022-03-25 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from b59dd92  net/rpmsg: fix compile-time warning
 add 494230a  arch/risc-v: Improve performance of context switch

No new revisions were added by this update.

Summary of changes:
 arch/risc-v/include/irq.h|   5 +-
 arch/risc-v/include/syscall.h|   4 +-
 arch/risc-v/src/bl602/Make.defs  |   2 +-
 arch/risc-v/src/c906/Make.defs   |   2 +-
 arch/risc-v/src/common/riscv_blocktask.c |   2 +-
 arch/risc-v/src/common/riscv_copyfullstate.c |  62 ---
 arch/risc-v/src/common/riscv_exception_common.S  |  15 ++-
 arch/risc-v/src/common/riscv_initialstate.c  |  11 +-
 arch/risc-v/src/common/riscv_internal.h  |   7 +-
 arch/risc-v/src/common/riscv_releasepending.c|   2 +-
 arch/risc-v/src/common/riscv_reprioritizertr.c   |   2 +-
 arch/risc-v/src/common/riscv_schedulesigaction.c | 136 ---
 arch/risc-v/src/common/riscv_sigdeliver.c|   8 +-
 arch/risc-v/src/common/riscv_swint.c |  10 +-
 arch/risc-v/src/common/riscv_unblocktask.c   |   2 +-
 arch/risc-v/src/esp32c3/Make.defs|   2 +-
 arch/risc-v/src/fe310/Make.defs  |   2 +-
 arch/risc-v/src/k210/Make.defs   |   2 +-
 arch/risc-v/src/k210/k210_head.S |  11 +-
 arch/risc-v/src/litex/Make.defs  |   2 +-
 arch/risc-v/src/mpfs/Make.defs   |   2 +-
 arch/risc-v/src/qemu-rv/Make.defs|   2 +-
 arch/risc-v/src/qemu-rv/qemu_rv_head.S   |  10 +-
 arch/risc-v/src/rv32m1/Make.defs |   2 +-
 24 files changed, 167 insertions(+), 138 deletions(-)
 delete mode 100644 arch/risc-v/src/common/riscv_copyfullstate.c


[incubator-nuttx] branch master updated (0f0f859 -> 052c071)

2022-03-26 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 0f0f859  sim: Enable CXX_EXCEPTION and CXX_RTTI on C++ defconfigs
 add 052c071  arch/risc-v: Minor style change

No new revisions were added by this update.

Summary of changes:
 arch/risc-v/src/common/riscv_exception_common.S  | 12 ++--
 arch/risc-v/src/common/riscv_schedulesigaction.c | 12 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)


[incubator-nuttx] branch master updated (b0e0f9d -> a98a599)

2022-03-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from b0e0f9d  opendir: use inode_find() instead when opendir()
 add a98a599  arm/cortex-[a|r]: IRQ Switch return should with shadow SPSR

No new revisions were added by this update.

Summary of changes:
 arch/arm/src/arm/arm_vectors.S |  65 +++--
 arch/arm/src/armv7-a/arm_vectors.S | 112 +++--
 arch/arm/src/armv7-r/arm_vectors.S | 112 +++--
 3 files changed, 250 insertions(+), 39 deletions(-)


[incubator-nuttx] branch master updated (a98a599 -> e9f1794)

2022-03-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from a98a599  arm/cortex-[a|r]: IRQ Switch return should with shadow SPSR
 add 0c1f636  signal: Don't do schedule_sigaction when there is no action
 add e9f1794  task: don't set default signal in kernal thread

No new revisions were added by this update.

Summary of changes:
 sched/signal/sig_dispatch.c | 14 +++---
 sched/task/task_start.c |  7 +--
 2 files changed, 12 insertions(+), 9 deletions(-)


[incubator-nuttx] branch master updated: usrsock: Move event field to usrsock_message_common_s

2022-04-02 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 451c53d  usrsock: Move event field to usrsock_message_common_s
451c53d is described below

commit 451c53daa41b5fe1693556197c7c43781d8866c2
Author: zhanghongyu 
AuthorDate: Tue Mar 22 21:59:46 2022 +0800

usrsock: Move event field to usrsock_message_common_s

Signed-off-by: zhanghongyu 
---
 arch/sim/src/sim/up_usrsock.c | 6 +++---
 include/nuttx/net/usrsock.h   | 3 +--
 net/usrsock/usrsock_dev.c | 4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/sim/src/sim/up_usrsock.c b/arch/sim/src/sim/up_usrsock.c
index 0d4121b..6381d77 100644
--- a/arch/sim/src/sim/up_usrsock.c
+++ b/arch/sim/src/sim/up_usrsock.c
@@ -138,11 +138,11 @@ static int usrsock_send_event(FAR struct usrsock_s 
*usrsock,
 {
   struct usrsock_message_socket_event_s event;
 
-  event.head.msgid = USRSOCK_MESSAGE_SOCKET_EVENT;
-  event.head.flags = USRSOCK_MESSAGE_FLAG_EVENT;
+  event.head.msgid  = USRSOCK_MESSAGE_SOCKET_EVENT;
+  event.head.flags  = USRSOCK_MESSAGE_FLAG_EVENT;
+  event.head.events = events;
 
   event.usockid = usockid;
-  event.events  = events;
 
   return usrsock_send(usrsock, &event, sizeof(event));
 }
diff --git a/include/nuttx/net/usrsock.h b/include/nuttx/net/usrsock.h
index 540c2dc..49f295d 100644
--- a/include/nuttx/net/usrsock.h
+++ b/include/nuttx/net/usrsock.h
@@ -220,6 +220,7 @@ begin_packed_struct struct usrsock_message_common_s
 {
   int8_t msgid;
   int8_t flags;
+  uint16_t events;
 } end_packed_struct;
 
 /* Request acknowledgment/completion message */
@@ -228,7 +229,6 @@ begin_packed_struct struct usrsock_message_req_ack_s
 {
   struct usrsock_message_common_s head;
 
-  int16_t  reserved;
   int32_t  result;
   uint64_t xid;
 } end_packed_struct;
@@ -253,7 +253,6 @@ begin_packed_struct struct usrsock_message_socket_event_s
   struct usrsock_message_common_s head;
 
   int16_t usockid;
-  uint16_t events;
 } end_packed_struct;
 
 #endif /* __INCLUDE_NUTTX_NET_USRSOCK_H */
diff --git a/net/usrsock/usrsock_dev.c b/net/usrsock/usrsock_dev.c
index 9d92cb6..723ed64 100644
--- a/net/usrsock/usrsock_dev.c
+++ b/net/usrsock/usrsock_dev.c
@@ -479,13 +479,13 @@ static ssize_t usrsockdev_handle_event(FAR struct 
usrsockdev_s *dev,
 #ifdef CONFIG_DEV_RANDOM
 /* Add randomness. */
 
-add_sw_randomness((hdr->events << 16) - hdr->usockid);
+add_sw_randomness((hdr->head.events << 16) - hdr->usockid);
 #endif
 
 /* Handle event. */
 
 ret = usrsock_event(conn,
-hdr->events & ~USRSOCK_EVENT_INTERNAL_MASK);
+hdr->head.events & ~USRSOCK_EVENT_INTERNAL_MASK);
 if (ret < 0)
   {
 return ret;


[incubator-nuttx-apps] branch master updated: usrsock: Move event field to usrsock_message_common_s

2022-04-02 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 16c1fec  usrsock: Move event field to usrsock_message_common_s
16c1fec is described below

commit 16c1fec99dbd5b4282325b1a60c51ad8618cdac2
Author: zhanghongyu 
AuthorDate: Tue Mar 22 22:35:01 2022 +0800

usrsock: Move event field to usrsock_message_common_s

Zero the events field for all response message

Signed-off-by: zhanghongyu 
---
 examples/usrsocktest/usrsocktest_daemon.c | 42 +--
 netutils/usrsock_rpmsg/usrsock_rpmsg_server.c | 16 +-
 wireless/gs2200m/gs2200m_main.c   | 32 +++-
 3 files changed, 54 insertions(+), 36 deletions(-)

diff --git a/examples/usrsocktest/usrsocktest_daemon.c 
b/examples/usrsocktest/usrsocktest_daemon.c
index e4fbad2..f948395 100644
--- a/examples/usrsocktest/usrsocktest_daemon.c
+++ b/examples/usrsocktest/usrsocktest_daemon.c
@@ -253,7 +253,7 @@ static int tsock_send_event(int fd, FAR struct 
daemon_priv_s *priv,
 }
 
   event.usockid = i + TEST_SOCKET_SOCKID_BASE;
-  event.events = events;
+  event.head.events = events;
 
   wlen = write(fd, &event, sizeof(event));
   if (wlen < 0)
@@ -377,8 +377,9 @@ static int socket_request(int fd, FAR struct daemon_priv_s 
*priv,
 
   /* Prepare response. */
 
-  resp.head.msgid = USRSOCK_MESSAGE_RESPONSE_ACK;
-  resp.head.flags = 0;
+  resp.head.msgid  = USRSOCK_MESSAGE_RESPONSE_ACK;
+  resp.head.flags  = 0;
+  resp.head.events = 0;
   resp.xid = req->head.xid;
   resp.result = socketid;
 
@@ -413,7 +414,8 @@ static int close_request(int fd, FAR struct daemon_priv_s 
*priv,
 
   /* Prepare response. */
 
-  resp.head.msgid = USRSOCK_MESSAGE_RESPONSE_ACK;
+  resp.head.msgid  = USRSOCK_MESSAGE_RESPONSE_ACK;
+  resp.head.events = 0;
   resp.xid = req->head.xid;
   if (priv->conf->delay_all_responses)
 {
@@ -551,8 +553,9 @@ prepare:
   /* Prepare response. */
 
   resp.xid = req->head.xid;
-  resp.head.msgid = USRSOCK_MESSAGE_RESPONSE_ACK;
-  resp.head.flags = 0;
+  resp.head.msgid  = USRSOCK_MESSAGE_RESPONSE_ACK;
+  resp.head.flags  = 0;
+  resp.head.events = 0;
 
   if (priv->conf->endpoint_block_connect)
 {
@@ -744,8 +747,9 @@ prepare:
   /* Prepare response. */
 
   resp.xid = req->head.xid;
-  resp.head.msgid = USRSOCK_MESSAGE_RESPONSE_ACK;
-  resp.head.flags = 0;
+  resp.head.msgid  = USRSOCK_MESSAGE_RESPONSE_ACK;
+  resp.head.flags  = 0;
+  resp.head.events = 0;
 
   if (priv->conf->delay_all_responses)
 {
@@ -880,8 +884,9 @@ prepare:
   /* Prepare response. */
 
   resp.reqack.xid = req->head.xid;
-  resp.reqack.head.msgid = USRSOCK_MESSAGE_RESPONSE_DATA_ACK;
-  resp.reqack.head.flags = 0;
+  resp.reqack.head.msgid  = USRSOCK_MESSAGE_RESPONSE_DATA_ACK;
+  resp.reqack.head.flags  = 0;
+  resp.reqack.head.events = 0;
 
   if (priv->conf->delay_all_responses)
 {
@@ -1071,8 +1076,9 @@ prepare:
   /* Prepare response. */
 
   resp.xid = req->head.xid;
-  resp.head.msgid = USRSOCK_MESSAGE_RESPONSE_ACK;
-  resp.head.flags = 0;
+  resp.head.msgid  = USRSOCK_MESSAGE_RESPONSE_ACK;
+  resp.head.flags  = 0;
+  resp.head.events = 0;
 
   if (priv->conf->delay_all_responses)
 {
@@ -1177,8 +1183,9 @@ prepare:
   /* Prepare response. */
 
   resp.reqack.xid = req->head.xid;
-  resp.reqack.head.msgid = USRSOCK_MESSAGE_RESPONSE_DATA_ACK;
-  resp.reqack.head.flags = 0;
+  resp.reqack.head.msgid  = USRSOCK_MESSAGE_RESPONSE_DATA_ACK;
+  resp.reqack.head.flags  = 0;
+  resp.reqack.head.events = 0;
 
   if (priv->conf->delay_all_responses)
 {
@@ -1288,8 +1295,9 @@ prepare:
   /* Prepare response. */
 
   resp.reqack.xid = req->head.xid;
-  resp.reqack.head.msgid = USRSOCK_MESSAGE_RESPONSE_DATA_ACK;
-  resp.reqack.head.flags = 0;
+  resp.reqack.head.msgid  = USRSOCK_MESSAGE_RESPONSE_DATA_ACK;
+  resp.reqack.head.flags  = 0;
+  resp.reqack.head.events = 0;
 
   if (priv->conf->delay_all_responses)
 {
@@ -1549,6 +1557,7 @@ static int establish_blocked_connection(int fd,
 
   priv->sockets_waiting_connect--;
   resp->head.flags &= ~USRSOCK_MESSAGE_FLAG_REQ_IN_PROGRESS;
+  resp->head.events = 0;
 
   wlen = write(fd, resp, sizeof(*resp));
   if (wlen < 0)
@@ -1600,6 +1609,7 @@ static int fail_blocked_connection(int fd, FAR struct 
daemon_priv_s *priv,
 
   priv->sockets_waiting_connect--;
   resp->head.flags &= ~USRSOCK_MESSAGE_FLAG_REQ_IN_PROGRESS;
+  resp->head.events = 0;
 
   wlen = write(fd, resp, sizeof(*resp));
   if (wlen < 0)
diff --git a/netutils/usrsock_rpmsg/usrsock_rpmsg_server.c 
b/netutils/usrsock_rpmsg/usrsock_rpmsg_server.c
index d3c9abc..3fe22a5 100644
--- a/netutils/usrsock_rpmsg/usrsock_rpmsg_server.c
+++ b/n

[incubator-nuttx] 02/02: sched/sched/remove_readytorun.c: Fix CPU affinity issues in SMP

2021-09-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit dfc08a0b6600c611f06a4b96c5870807c2e988cc
Author: chenhonglin 
AuthorDate: Tue Sep 28 11:28:05 2021 +0800

sched/sched/remove_readytorun.c: Fix CPU affinity issues in SMP

the logical may choose the head of g_readytorun(the greatest priority)
task as the next while ignoring the cpu affinity of it.

Signed-off-by: chenhonglin 
---
 sched/sched/sched_removereadytorun.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/sched/sched/sched_removereadytorun.c 
b/sched/sched/sched_removereadytorun.c
index 170e18b..398a348 100644
--- a/sched/sched/sched_removereadytorun.c
+++ b/sched/sched/sched_removereadytorun.c
@@ -209,20 +209,16 @@ bool nxsched_remove_readytorun(FAR struct tcb_s *rtcb)
 
   if (rtrtcb != NULL && rtrtcb->sched_priority >= nxttcb->sched_priority)
 {
-  FAR struct tcb_s *tmptcb;
-
-  /* The TCB at the head of the ready to run list has the higher
-   * priority.  Remove that task from the head of the g_readytorun
+  /* The TCB rtrtcb has the higher priority and it can be run on
+   * target CPU. Remove that task (rtrtcb) from the g_readytorun
* list and add to the head of the g_assignedtasks[cpu] list.
*/
 
-  tmptcb = (FAR struct tcb_s *)
-dq_remfirst((FAR dq_queue_t *)&g_readytorun);
-
-  dq_addfirst((FAR dq_entry_t *)tmptcb, tasklist);
+  dq_rem((FAR dq_entry_t *)rtrtcb, (FAR dq_queue_t *)&g_readytorun);
+  dq_addfirst((FAR dq_entry_t *)rtrtcb, tasklist);
 
-  tmptcb->cpu = cpu;
-  nxttcb = tmptcb;
+  rtrtcb->cpu = cpu;
+  nxttcb = rtrtcb;
 }
 
   /* Will pre-emption be disabled after the switch?  If the lockcount is


[incubator-nuttx] branch master updated (8a142f4 -> dfc08a0)

2021-09-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 8a142f4  xtensa/esp32-s2/rttimer: Disable alarm before setting a new 
value and enabling it
 new cb38060  sched/sched_setpriority.c: Fix CPU affinity issues in SMP
 new dfc08a0  sched/sched/remove_readytorun.c: Fix CPU affinity issues in 
SMP

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:
 sched/sched/sched_removereadytorun.c | 16 ++--
 sched/sched/sched_setpriority.c  |  9 -
 2 files changed, 10 insertions(+), 15 deletions(-)


[incubator-nuttx] 01/02: sched/sched_setpriority.c: Fix CPU affinity issues in SMP

2021-09-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit cb38060db2540fec59459ca7f85e857f82e4f709
Author: chenhonglin 
AuthorDate: Tue Sep 28 11:23:06 2021 +0800

sched/sched_setpriority.c: Fix CPU affinity issues in SMP

In "nxsched_nexttcb": the task may not running on this_cpu,
and rtrtcb->affinity(the affinity of the task in g_readytorun)
may not include the current cpu which should be the tcb->cpu.

Signed-off-by: chenhonglin 
---
 sched/sched/sched_setpriority.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sched/sched/sched_setpriority.c b/sched/sched/sched_setpriority.c
index 842926f..e07cbad 100644
--- a/sched/sched/sched_setpriority.c
+++ b/sched/sched/sched_setpriority.c
@@ -58,23 +58,22 @@ static FAR struct tcb_s *nxsched_nexttcb(FAR struct tcb_s 
*tcb)
 {
   FAR struct tcb_s *nxttcb = (FAR struct tcb_s *)tcb->flink;
   FAR struct tcb_s *rtrtcb;
-  int cpu = this_cpu();
 
   /* Which task should run next?  It will be either the next tcb in the
* assigned task list (nxttcb) or a TCB in the g_readytorun list.  We can
* only select a task from that list if the affinity mask includes the
-   * current CPU.
+   * tcb->cpu.
*
* If pre-emption is locked or another CPU is in a critical section,
* then use the 'nxttcb' which will probably be the IDLE thread.
*/
 
-  if (!nxsched_islocked_global() && !irq_cpu_locked(cpu))
+  if (!nxsched_islocked_global() && !irq_cpu_locked(this_cpu()))
 {
-  /* Search for the highest priority task that can run on this CPU. */
+  /* Search for the highest priority task that can run on tcb->cpu. */
 
   for (rtrtcb = (FAR struct tcb_s *)g_readytorun.head;
-   rtrtcb != NULL && !CPU_ISSET(cpu, &rtrtcb->affinity);
+   rtrtcb != NULL && !CPU_ISSET(tcb->cpu, &rtrtcb->affinity);
rtrtcb = (FAR struct tcb_s *)rtrtcb->flink);
 
   /* Return the TCB from the readyt-to-run list if it is the next


[incubator-nuttx] branch master updated: power/battery: Move the enumurate to the common place

2021-09-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 77bc1d1  power/battery: Move the enumurate to the common place
77bc1d1 is described below

commit 77bc1d1bdfd1312270d3b4f556bbe08cfb151c27
Author: Xiang Xiao 
AuthorDate: Wed Sep 29 12:03:20 2021 +0800

power/battery: Move the enumurate to the common place

so the userspace program can handle the different battery driver equally

Signed-off-by: Xiang Xiao 
---
 arch/arm/src/cxd56xx/cxd56_charger.c  | 16 ++---
 arch/arm/src/cxd56xx/cxd56_gauge.c|  6 ++---
 include/nuttx/power/battery_charger.h | 44 ---
 include/nuttx/power/battery_gauge.h   | 15 ++--
 include/nuttx/power/battery_ioctl.h   | 39 +++
 include/nuttx/power/battery_monitor.h | 44 ---
 6 files changed, 61 insertions(+), 103 deletions(-)

diff --git a/arch/arm/src/cxd56xx/cxd56_charger.c 
b/arch/arm/src/cxd56xx/cxd56_charger.c
index 1bd3970..b853ff2 100644
--- a/arch/arm/src/cxd56xx/cxd56_charger.c
+++ b/arch/arm/src/cxd56xx/cxd56_charger.c
@@ -79,8 +79,8 @@ struct charger_dev_s
  * Private Function Prototypes
  /
 
-static int charger_get_status(FAR enum battery_charger_status_e *status);
-static int charger_get_health(FAR enum battery_charger_health_e *health);
+static int charger_get_status(FAR enum battery_status_e *status);
+static int charger_get_health(FAR enum battery_health_e *health);
 static int charger_online(FAR bool *online);
 static int charger_get_temptable(FAR struct battery_temp_table_s *table);
 static int charger_set_temptable(FAR struct battery_temp_table_s *table);
@@ -210,7 +210,7 @@ static int charger_therm2temp(int val)
  * Name: charger_get_status
  /
 
-static int charger_get_status(FAR enum battery_charger_status_e *status)
+static int charger_get_status(FAR enum battery_status_e *status)
 {
   uint8_t state;
   int ret;
@@ -269,7 +269,7 @@ static int charger_get_status(FAR enum 
battery_charger_status_e *status)
  * Name: charger_get_health
  /
 
-static int charger_get_health(FAR enum battery_charger_health_e *health)
+static int charger_get_health(FAR enum battery_health_e *health)
 {
   FAR struct pmic_gauge_s gauge;
   uint8_t state;
@@ -495,16 +495,16 @@ static int charger_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
 {
   case BATIOC_STATE:
 {
-  FAR enum battery_charger_status_e *status =
-(FAR enum battery_charger_status_e *)(uintptr_t)arg;
+  FAR enum battery_status_e *status =
+(FAR enum battery_status_e *)(uintptr_t)arg;
   ret = charger_get_status(status);
 }
 break;
 
   case BATIOC_HEALTH:
 {
-  FAR enum battery_charger_health_e *health =
-(FAR enum battery_charger_health_e *)(uintptr_t)arg;
+  FAR enum battery_health_e *health =
+(FAR enum battery_health_e *)(uintptr_t)arg;
   ret = charger_get_health(health);
 }
 break;
diff --git a/arch/arm/src/cxd56xx/cxd56_gauge.c 
b/arch/arm/src/cxd56xx/cxd56_gauge.c
index 769838a..683b7fa 100644
--- a/arch/arm/src/cxd56xx/cxd56_gauge.c
+++ b/arch/arm/src/cxd56xx/cxd56_gauge.c
@@ -111,7 +111,7 @@ static struct bat_gauge_dev_s g_gaugedev;
  * Name: gauge_get_status
  /
 
-static int gauge_get_status(FAR enum battery_gauge_status_e *status)
+static int gauge_get_status(FAR enum battery_status_e *status)
 {
   uint8_t state;
   int ret;
@@ -325,8 +325,8 @@ static int gauge_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
 {
   case BATIOC_STATE:
 {
-  FAR enum battery_gauge_status_e *status =
-(FAR enum battery_gauge_status_e *)(uintptr_t)arg;
+  FAR enum battery_status_e *status =
+(FAR enum battery_status_e *)(uintptr_t)arg;
   ret = gauge_get_status(status);
 }
 break;
diff --git a/include/nuttx/power/battery_charger.h 
b/include/nuttx/power/battery_charger.h
index 692f3ab..bd841b1 100644
--- a/include/nuttx/power/battery_charger.h
+++ b/include/nuttx/power/battery_charger.h
@@ -61,10 +61,10 @@
  * lower half as summarized below:
  *
  * BATIOC_STATE - Return the current state of the battery (see
- *   enum battery_charger_status_e).
+ *   enum battery_status_e).
  *   Input value:  A pointer to type int.
  * BATIOC_HEALTH - Return the current health of the battery (see
- *   enum battery_charger_health_e).
+ *   enum

[incubator-nuttx-apps] branch master updated: examples/charger: Update enum type usage per kernel change

2021-09-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 8d3a536  examples/charger: Update enum type usage per kernel change
8d3a536 is described below

commit 8d3a536650d59fb2540f338e058c08cfbab883e4
Author: Xiang Xiao 
AuthorDate: Thu Sep 30 13:25:46 2021 +0800

examples/charger: Update enum type usage per kernel change

Signed-off-by: Xiang Xiao 
---
 examples/charger/charger_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/charger/charger_main.c b/examples/charger/charger_main.c
index ef91abc..3e90046 100644
--- a/examples/charger/charger_main.c
+++ b/examples/charger/charger_main.c
@@ -129,8 +129,8 @@ static int show_charge_setting(int fd)
 
 static int show_bat_status(int fd)
 {
-  enum battery_charger_status_e status;
-  enum battery_charger_health_e health;
+  enum battery_status_e status;
+  enum battery_health_e health;
   const char *statestr[] =
 {
   "UNKNOWN",


[incubator-nuttx] branch master updated (535fb12 -> 1bc3ab5)

2021-10-13 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 535fb12  AUTHORS: add Elfaro Lab SL
 add 1bc3ab5  boards: risc-v: k210: Fix -march and -mabi

No new revisions were added by this update.

Summary of changes:
 boards/risc-v/k210/maix-bit/scripts/Make.defs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[incubator-nuttx] branch master updated: sched: Check g_pidhash[hash_ndx] isn't NULL before access pid field in nxsched_get_tcb

2021-10-17 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 4a7915e  sched: Check g_pidhash[hash_ndx] isn't NULL before access pid 
field in nxsched_get_tcb
4a7915e is described below

commit 4a7915e72ba037ddadb1347c9f2fda1388be37d8
Author: Xiang Xiao 
AuthorDate: Sun Oct 17 14:20:07 2021 +0800

sched: Check g_pidhash[hash_ndx] isn't NULL before access pid field in 
nxsched_get_tcb

Fix the regression by commit:
commit 8b67944c75b81d17174bd207ad63acfa22da8983
Author: Xiang Xiao 
Date:   Thu Oct 14 11:03:07 2021 +0800

sched: Remove pidhash_s and move ticks to tcb_s

simplify the code logic and reduce memory a little bit

Signed-off-by: Xiang Xiao 

Signed-off-by: Xiang Xiao 
---
 sched/sched/sched_gettcb.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sched/sched/sched_gettcb.c b/sched/sched/sched_gettcb.c
index 9ee502c..3e38f51 100644
--- a/sched/sched/sched_gettcb.c
+++ b/sched/sched/sched_gettcb.c
@@ -56,6 +56,8 @@ FAR struct tcb_s *nxsched_get_tcb(pid_t pid)
   irqstate_t flags;
   int hash_ndx;
 
+  flags = enter_critical_section();
+
   /* Verify whether g_pidhash hash table has already been allocated and
* whether the PID is within range.
*/
@@ -68,24 +70,22 @@ FAR struct tcb_s *nxsched_get_tcb(pid_t pid)
* terminating asynchronously.
*/
 
-  flags = enter_critical_section();
-
   /* Get the hash_ndx associated with the pid */
 
   hash_ndx = PIDHASH(pid);
 
   /* Verify that the correct TCB was found. */
 
-  if (g_pidhash && pid == g_pidhash[hash_ndx]->pid)
+  if (g_pidhash[hash_ndx] != NULL && pid == g_pidhash[hash_ndx]->pid)
 {
   /* Return the TCB associated with this pid (if any) */
 
   ret = g_pidhash[hash_ndx];
 }
-
-  leave_critical_section(flags);
 }
 
+  leave_critical_section(flags);
+
   /* Return the TCB. */
 
   return ret;


[incubator-nuttx] branch master updated: boards: k210: Add initial gpio user space support

2021-10-17 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 5c15fe6  boards: k210: Add initial gpio user space support
5c15fe6 is described below

commit 5c15fe6ec104798cd656ea498abd0593d1c83f78
Author: Matheus Castello 
AuthorDate: Sun Oct 17 00:36:41 2021 -0300

boards: k210: Add initial gpio user space support

Signed-off-by: Matheus Castello 
---
 boards/risc-v/k210/maix-bit/include/board.h|   5 +
 boards/risc-v/k210/maix-bit/src/Makefile   |   4 +
 boards/risc-v/k210/maix-bit/src/k210_bringup.c |  10 ++
 boards/risc-v/k210/maix-bit/src/k210_gpio.c| 173 +
 boards/risc-v/k210/maix-bit/src/maix-bit.h |   4 +
 5 files changed, 196 insertions(+)

diff --git a/boards/risc-v/k210/maix-bit/include/board.h 
b/boards/risc-v/k210/maix-bit/include/board.h
index 796c9e6..bf69b83 100644
--- a/boards/risc-v/k210/maix-bit/include/board.h
+++ b/boards/risc-v/k210/maix-bit/include/board.h
@@ -55,6 +55,11 @@
 #define LED_ASSERTION 6  /* N/C */
 #define LED_PANIC 7  /* blink */
 
+/* GPIO pins used by the GPIO Subsystem */
+
+#define BOARD_NGPIOOUT2 /* Amount of GPIO Output pins */
+#define BOARD_NGPIOINT0 /* Amount of GPIO Input */
+
 /
  * Public Types
  /
diff --git a/boards/risc-v/k210/maix-bit/src/Makefile 
b/boards/risc-v/k210/maix-bit/src/Makefile
index e70a4d1..8c2db77 100644
--- a/boards/risc-v/k210/maix-bit/src/Makefile
+++ b/boards/risc-v/k210/maix-bit/src/Makefile
@@ -30,4 +30,8 @@ ifeq ($(CONFIG_ARCH_LEDS),y)
 CSRCS += k210_leds.c
 endif
 
+ifeq ($(CONFIG_DEV_GPIO),y)
+CSRCS += k210_gpio.c
+endif
+
 include $(TOPDIR)/boards/Board.mk
diff --git a/boards/risc-v/k210/maix-bit/src/k210_bringup.c 
b/boards/risc-v/k210/maix-bit/src/k210_bringup.c
index 2dc3d09..c722275 100644
--- a/boards/risc-v/k210/maix-bit/src/k210_bringup.c
+++ b/boards/risc-v/k210/maix-bit/src/k210_bringup.c
@@ -33,6 +33,7 @@
 #include 
 
 #include "k210.h"
+#include "maix-bit.h"
 
 /
  * Public Functions
@@ -56,5 +57,14 @@ int k210_bringup(void)
 }
 #endif
 
+#ifdef CONFIG_DEV_GPIO
+  ret = k210_gpio_init();
+  if (ret < 0)
+{
+  syslog(LOG_ERR, "Failed to initialize GPIO Driver: %d\n", ret);
+  return ret;
+}
+#endif
+
   return ret;
 }
diff --git a/boards/risc-v/k210/maix-bit/src/k210_gpio.c 
b/boards/risc-v/k210/maix-bit/src/k210_gpio.c
new file mode 100644
index 000..0e631dc
--- /dev/null
+++ b/boards/risc-v/k210/maix-bit/src/k210_gpio.c
@@ -0,0 +1,173 @@
+/
+ * boards/risc-v/k210/maix-bit/src/k210_gpio.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+/
+ * Included Files
+ /
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include "k210_fpioa.h"
+#include "k210_gpiohs.h"
+
+#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF)
+
+/
+ * Pre-processor Definitions
+ /
+
+/* Pin 1 and 2 are used for this example as GPIO outputs. */
+
+#define GPIO_OUT1  12
+#define GPIO_OUT2  13
+
+/
+ * Private Types
+ /
+
+struct k210gpio_dev_s
+{
+  struct gpio_dev_s gpio;
+  uint8_t id;
+};
+
+/

[incubator-nuttx] branch master updated (643e34e -> 7549de4)

2021-10-17 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 643e34e  sdio: Update the defintion to the latest spec
 add 7549de4  arch/*_cpupause:Allow a spin before taking the g_cpu_wait 
spinlock.

No new revisions were added by this update.

Summary of changes:
 arch/arm/src/armv7-a/arm_cpupause.c   | 6 --
 arch/arm/src/cxd56xx/cxd56_cpupause.c | 6 --
 arch/arm/src/lc823450/lc823450_cpupause.c | 6 --
 arch/arm/src/rp2040/rp2040_cpupause.c | 6 --
 arch/arm/src/sam34/sam4cm_cpupause.c  | 6 --
 arch/risc-v/src/k210/k210_cpupause.c  | 6 --
 6 files changed, 24 insertions(+), 12 deletions(-)


[incubator-nuttx] branch master updated: mqueue: fix memory leak cause by lost inode_release

2021-10-25 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new e3d20d2  mqueue: fix memory leak cause by lost inode_release
e3d20d2 is described below

commit e3d20d2c5495827b4e2b2181aac1931975ed9411
Author: ligd 
AuthorDate: Mon Oct 25 15:52:19 2021 +0800

mqueue: fix memory leak cause by lost inode_release

Signed-off-by: ligd 
---
 fs/mqueue/mq_unlink.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/mqueue/mq_unlink.c b/fs/mqueue/mq_unlink.c
index 679b47e..a0a5afe 100644
--- a/fs/mqueue/mq_unlink.c
+++ b/fs/mqueue/mq_unlink.c
@@ -64,6 +64,8 @@ static void mq_inode_release(FAR struct inode *inode)
   nxmq_free_msgq(msgq);
   inode->i_private = NULL;
 }
+
+  inode_release(inode);
 }
 }
 


[incubator-nuttx] 01/03: elf: add elf define of Note Section

2021-11-23 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit f33c46af21830f5e350594ac7cc03292d8cfb32b
Author: chao.an 
AuthorDate: Wed Nov 17 23:28:21 2021 +0800

elf: add elf define of Note Section

Signed-off-by: chao.an 
---
 include/elf.h   | 134 +++-
 include/elf32.h |  11 +
 include/elf64.h |  11 +
 3 files changed, 155 insertions(+), 1 deletion(-)

diff --git a/include/elf.h b/include/elf.h
index 8f599d7..1eb05d3 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -103,13 +103,20 @@
 #define EI_CLASS   4  /* File class */
 #define EI_DATA5  /* Data encoding */
 #define EI_VERSION 6  /* File version */
-#define EI_PAD 7  /* Start of padding bytes */
+#define EI_OSABI   7  /* OS ABI */
+#define EI_PAD 8  /* Start of padding bytes */
 
 /* EI_NIDENT is defined in "Included Files" section */
 
 #define EI_MAGIC_SIZE  4
 #define EI_MAGIC   {0x7f, 'E', 'L', 'F'}
 
+#define ELFMAG00x7f/* EI_MAG */
+#define ELFMAG1'E'
+#define ELFMAG2'L'
+#define ELFMAG3'F'
+#define ELFMAG "\177ELF"
+
 /* Table 3. Values for EI_CLASS */
 
 #define ELFCLASSNONE   0  /* Invalid class */
@@ -122,6 +129,30 @@
 #define ELFDATA2LSB1 /* Least significant byte occupying the 
lowest address */
 #define ELFDATA2MSB2 /* Most significant byte occupying the lowest 
address */
 
+/* Table 6. Values for EI_OSABI */
+
+#define ELFOSABI_NONE  0 /* UNIX System V ABI */
+#define ELFOSABI_SYSV  0 /* Alias.  */
+#define ELFOSABI_HPUX  1 /* HP-UX */
+#define ELFOSABI_NETBSD2 /* NetBSD.  */
+#define ELFOSABI_GNU   3 /* Object uses GNU ELF extensions.  */
+#define ELFOSABI_LINUX ELFOSABI_GNU
+ /* Compatibility alias.  */
+#define ELFOSABI_SOLARIS   6 /* Sun Solaris.  */
+#define ELFOSABI_AIX   7 /* IBM AIX.  */
+#define ELFOSABI_IRIX  8 /* SGI Irix.  */
+#define ELFOSABI_FREEBSD   9 /* FreeBSD.  */
+#define ELFOSABI_TRU64 10/* Compaq TRU64 UNIX.  */
+#define ELFOSABI_MODESTO   11/* Novell Modesto.  */
+#define ELFOSABI_OPENBSD   12/* OpenBSD.  */
+#define ELFOSABI_ARM_AEABI 64/* ARM EABI */
+#define ELFOSABI_ARM   97/* ARM */
+#define ELFOSABI_STANDALONE 255  /* Standalone (embedded) application */
+
+#ifndef ELF_OSABI
+#define ELF_OSABI  ELFOSABI_NONE
+#endif
+
 /* Table 7: Special Section Indexes */
 
 #define SHN_UNDEF  0
@@ -223,4 +254,105 @@
 #define DT_LOPROC  0x7000 /* d_un=unspecified */
 #define DT_HIPROC  0x7fff /* d_un= unspecified */
 
+/* Legal values for note segment descriptor types for core files. */
+
+#define NT_PRSTATUS1  /* Contains copy of prstatus struct */
+#define NT_PRFPREG 2  /* Contains copy of fpregset struct. */
+#define NT_FPREGSET2  /* Contains copy of fpregset struct */
+#define NT_PRPSINFO3  /* Contains copy of prpsinfo struct */
+#define NT_PRXREG  4  /* Contains copy of prxregset struct */
+#define NT_TASKSTRUCT  4  /* Contains copy of task structure */
+#define NT_PLATFORM5  /* String from sysinfo(SI_PLATFORM) */
+#define NT_AUXV6  /* Contains copy of auxv array */
+#define NT_GWINDOWS7  /* Contains copy of gwindows struct */
+#define NT_ASRS8  /* Contains copy of asrset struct */
+#define NT_PSTATUS 10 /* Contains copy of pstatus struct */
+#define NT_PSINFO  13 /* Contains copy of psinfo struct */
+#define NT_PRCRED  14 /* Contains copy of prcred struct */
+#define NT_UTSNAME 15 /* Contains copy of utsname struct */
+#define NT_LWPSTATUS   16 /* Contains copy of lwpstatus struct */
+#define NT_LWPSINFO17 /* Contains copy of lwpinfo struct */
+#define NT_PRFPXREG20 /* Contains copy of fprxregset struct */
+#define NT_SIGINFO 0x53494749
+  /* Contains copy of siginfo_t,
+   * size might increase
+   */
+#define NT_FILE0x46494c45
+  /* Contains information about mapped
+   * files
+   */
+#define NT_PRXFPREG0x46e62b7f
+  /* Contains copy of user_fxsr_struct */
+#define NT_PPC_VMX 0x100  /* PowerPC Altivec/VMX registers */
+#define NT_PPC_SPE 0x101  /* PowerPC SPE/EVR registers */
+#define NT_PPC_VSX 0x102  /* PowerP

[incubator-nuttx] 02/03: arch/arm: add more arch elf define

2021-11-23 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 4c76c356ef55c7e4f2bb26dad3a69a3ceead6a92
Author: chao.an 
AuthorDate: Mon Nov 22 10:08:31 2021 +0800

arch/arm: add more arch elf define

Signed-off-by: chao.an 
---
 arch/arm/include/elf.h | 24 ++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/elf.h b/arch/arm/include/elf.h
index fb87e2c..e74fbf4 100644
--- a/arch/arm/include/elf.h
+++ b/arch/arm/include/elf.h
@@ -37,8 +37,13 @@
  * ELFDATA2MSB (big endian)
  */
 
-#if 0 /* Defined in include/elf32.h */
-#define EM_ARM   40
+#define EM_ARCH  EM_ARM
+#define ELF_CLASSELFCLASS32
+
+#ifdef CONFIG_ENDIAN_BIG
+#  define ELF_DATA   ELFDATA2MSB
+#else
+#  define ELF_DATA   ELFDATA2LSB
 #endif
 
 /* Table 4-2, ARM-specific e_flags */
@@ -53,6 +58,21 @@
 
 #define EF_ARM_BE8   0x0080
 
+#define EF_ARM_ABI_FLOAT_SOFT0x0200
+#define EF_ARM_ABI_FLOAT_HARD0x0400
+
+#ifdef __VFP_FP__
+#  ifdef __ARM_PCS_VFP
+#define EF_ARM_ABI_FLOAT EF_ARM_ABI_FLOAT_HARD
+#  else
+#define EF_ARM_ABI_FLOAT EF_ARM_ABI_FLOAT_SOFT
+#  endif
+#else
+#  define EF_ARM_ABI_FLOAT   0
+#endif
+
+#define EF_FLAG  (EF_ARM_EABI_VER5 | EF_ARM_ABI_FLOAT)
+
 /* Table 4-4, Processor specific section types */
 
 #define SHT_ARM_EXIDX0x7001 /* Exception Index table */


[incubator-nuttx] branch master updated (627eb08 -> 0f76ff4)

2021-11-23 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 627eb08  boards/raspberrypi-pico: Fix some typos in README.txt
 new f33c46a  elf: add elf define of Note Section
 new 4c76c35  arch/arm: add more arch elf define
 new 0f76ff4  arch/sim: add arch elf define

The 3 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/arm/include/elf.h |  24 +++-
 .../libc/net/lib_htonl.c => arch/sim/include/elf.h |  47 
 include/elf.h  | 134 -
 include/elf32.h|  11 ++
 include/elf64.h|  11 ++
 5 files changed, 200 insertions(+), 27 deletions(-)
 copy libs/libc/net/lib_htonl.c => arch/sim/include/elf.h (62%)


[incubator-nuttx] 03/03: arch/sim: add arch elf define

2021-11-23 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 0f76ff42eb7ea87a34a3cd7aac9c933ba61f111c
Author: chao.an 
AuthorDate: Wed Nov 17 23:48:44 2021 +0800

arch/sim: add arch elf define

Signed-off-by: chao.an 
---
 arch/sim/include/elf.h | 52 ++
 1 file changed, 52 insertions(+)

diff --git a/arch/sim/include/elf.h b/arch/sim/include/elf.h
new file mode 100644
index 000..800894a
--- /dev/null
+++ b/arch/sim/include/elf.h
@@ -0,0 +1,52 @@
+/
+ * arch/sim/include/elf.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+#ifndef __ARCH_SIM_INCLUDE_ELF_H
+#define __ARCH_SIM_INCLUDE_ELF_H
+
+/
+ * Pre-processor Prototypes
+ /
+
+/* 4.3.1 ELF Identification.  Should have:
+ *
+ * e_machine = EM_386
+ * e_ident[EI_CLASS] = ELFCLASS32
+ * e_ident[EI_DATA]  = ELFDATA2LSB (little endian) or
+ * ELFDATA2MSB (big endian)
+ */
+
+#ifdef CONFIG_SIM_M32
+#  define EM_ARCHEM_386
+#  define ELF_CLASS  ELFCLASS32
+#else
+#  define EM_ARCHEM_X86_64
+#  define ELF_CLASS  ELFCLASS32
+#endif
+
+#ifdef CONFIG_ENDIAN_BIG
+#  define ELF_DATA   ELFDATA2MSB
+#else
+#  define ELF_DATA   ELFDATA2LSB
+#endif
+
+#define EF_FLAG  0
+
+#endif /* __ARCH_SIM_INCLUDE_ELF_H */


[incubator-nuttx] branch master updated: libc/stdoutstream: restore the output method to fputc()

2021-11-23 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new f3b019d  libc/stdoutstream: restore the output method to fputc()
f3b019d is described below

commit f3b019d1d25eb6f0979802728058c4f67d7589cd
Author: chao.an 
AuthorDate: Wed Nov 24 13:09:31 2021 +0800

libc/stdoutstream: restore the output method to fputc()

keep the default behavior for stdoutstream since the character
needs to flush every output

Signed-off-by: chao.an 
---
 libs/libc/stdio/lib_rawsostream.c  |  4 ++--
 libs/libc/stdio/lib_stdoutstream.c | 48 ++
 2 files changed, 19 insertions(+), 33 deletions(-)

diff --git a/libs/libc/stdio/lib_rawsostream.c 
b/libs/libc/stdio/lib_rawsostream.c
index 9af34ad..14940f2 100644
--- a/libs/libc/stdio/lib_rawsostream.c
+++ b/libs/libc/stdio/lib_rawsostream.c
@@ -46,9 +46,9 @@ static int rawoutstream_puts(FAR struct lib_outstream_s *this,
   FAR struct lib_rawoutstream_s *rthis =
 (FAR struct lib_rawoutstream_s *)this;
   int nwritten = 0;
-  int ret;
+  int ret = 0;
 
-  while (1)
+  while (nwritten != len)
 {
   ret = _NX_WRITE(rthis->fd, (FAR const char *)buf + nwritten,
   len - nwritten);
diff --git a/libs/libc/stdio/lib_stdoutstream.c 
b/libs/libc/stdio/lib_stdoutstream.c
index 903acb2..beb4157 100644
--- a/libs/libc/stdio/lib_stdoutstream.c
+++ b/libs/libc/stdio/lib_stdoutstream.c
@@ -33,48 +33,35 @@
  /
 
 /
- * Name: stdoutstream_puts
+ * Name: stdoutstream_putc
  /
 
-static int stdoutstream_puts(FAR struct lib_outstream_s *this,
- FAR const void *buf, int len)
+static void stdoutstream_putc(FAR struct lib_outstream_s *this, int ch)
 {
   FAR struct lib_stdoutstream_s *sthis =
(FAR struct lib_stdoutstream_s *)this;
-  int nwritten = 0;
-  int ret;
+  int result;
 
   DEBUGASSERT(this && sthis->stream);
 
-  while (1)
+  /* Loop until the character is successfully transferred or an irrecoverable
+   * error occurs.
+   */
+
+  do
 {
-  ret = fwrite((FAR char *)buf + nwritten,
-len - nwritten, 1, sthis->stream);
-  if (ret <= 0)
+  result = fputc(ch, sthis->stream);
+  if (result != EOF)
 {
-  if (_NX_GETERRNO(ret) == EINTR)
-{
-  continue;
-}
-
-  break;
+  this->nput++;
+  return;
 }
 
-  this->nput += ret;
-  nwritten   += ret;
+  /* EINTR (meaning that fputc was interrupted by a signal) is the only
+   * recoverable error.
+   */
 }
-
-  return nwritten > 0 ? nwritten : ret;
-}
-
-/
- * Name: stdoutstream_putc
- /
-
-static void stdoutstream_putc(FAR struct lib_outstream_s *this, int ch)
-{
-  char tmp = ch;
-  (void)stdoutstream_puts(this, &tmp, 1);
+  while (get_errno() == EINTR);
 }
 
 /
@@ -118,8 +105,7 @@ void lib_stdoutstream(FAR struct lib_stdoutstream_s 
*outstream,
 {
   /* Select the put operation */
 
-  outstream->public.put  = stdoutstream_putc;
-  outstream->public.puts = stdoutstream_puts;
+  outstream->public.put = stdoutstream_putc;
 
   /* Select the correct flush operation.  This flush is only called when
* a newline is encountered in the output stream.  However, we do not


[incubator-nuttx] branch master updated: arch: Remove FILE dump code from _up_dumponexit

2021-12-05 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 19e5ee6  arch: Remove FILE dump code from _up_dumponexit
19e5ee6 is described below

commit 19e5ee6ce0462d961f96e4291abeb4a20c414ef4
Author: Xiang Xiao 
AuthorDate: Sun Oct 31 18:38:16 2021 +0800

arch: Remove FILE dump code from _up_dumponexit

since the kernel build can't access the userspace memory
inside other process directly

Signed-off-by: Xiang Xiao 
---
 arch/arm/src/common/arm_exit.c| 25 -
 arch/avr/src/common/up_exit.c | 25 -
 arch/hc/src/common/up_exit.c  | 25 -
 arch/mips/src/common/mips_exit.c  | 25 -
 arch/misoc/src/lm32/lm32_exit.c   | 25 -
 arch/misoc/src/minerva/minerva_exit.c | 24 
 arch/or1k/src/common/up_exit.c| 25 -
 arch/renesas/src/common/up_exit.c | 25 -
 arch/risc-v/src/common/riscv_exit.c   | 25 -
 arch/x86/src/common/up_exit.c | 25 -
 arch/x86_64/src/common/up_exit.c  | 25 -
 arch/xtensa/src/common/xtensa_exit.c  | 25 -
 arch/z16/src/common/z16_exit.c| 25 -
 arch/z80/src/common/z80_exit.c| 25 -
 14 files changed, 349 deletions(-)

diff --git a/arch/arm/src/common/arm_exit.c b/arch/arm/src/common/arm_exit.c
index 6f4c84d..dfe2f3f 100644
--- a/arch/arm/src/common/arm_exit.c
+++ b/arch/arm/src/common/arm_exit.c
@@ -65,9 +65,6 @@
 static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
 {
   FAR struct filelist *filelist;
-#ifdef CONFIG_FILE_STREAM
-  FAR struct file_struct *filep;
-#endif
   int i;
   int j;
 
@@ -88,28 +85,6 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void 
*arg)
 }
 }
 }
-
-#ifdef CONFIG_FILE_STREAM
-  filep = tcb->group->tg_streamlist->sl_head;
-  for (; filep != NULL; filep = filep->fs_next)
-{
-  if (filep->fs_fd >= 0)
-{
-#ifndef CONFIG_STDIO_DISABLE_BUFFERING
-  if (filep->fs_bufstart != NULL)
-{
-  sinfo("  fd=%d nbytes=%d\n",
-filep->fs_fd,
-filep->fs_bufpos - filep->fs_bufstart);
-}
-  else
-#endif
-{
-  sinfo("  fd=%d\n", filep->fs_fd);
-}
-}
-}
-#endif
 }
 #endif
 
diff --git a/arch/avr/src/common/up_exit.c b/arch/avr/src/common/up_exit.c
index 201248d..7dd1e69 100644
--- a/arch/avr/src/common/up_exit.c
+++ b/arch/avr/src/common/up_exit.c
@@ -64,9 +64,6 @@
 static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
 {
   FAR struct filelist *filelist;
-#ifdef CONFIG_FILE_STREAM
-  FAR struct file_struct *filep;
-#endif
   int i;
   int j;
 
@@ -87,28 +84,6 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void 
*arg)
 }
 }
 }
-
-#ifdef CONFIG_FILE_STREAM
-  filep = tcb->group->tg_streamlist->sl_head;
-  for (; filep != NULL; filep = filep->fs_next)
-{
-  if (filep->fs_fd >= 0)
-{
-#ifndef CONFIG_STDIO_DISABLE_BUFFERING
-  if (filep->fs_bufstart != NULL)
-{
-  sinfo("  fd=%d nbytes=%d\n",
-filep->fs_fd,
-filep->fs_bufpos - filep->fs_bufstart);
-}
-  else
-#endif
-{
-  sinfo("  fd=%d\n", filep->fs_fd);
-}
-}
-}
-#endif
 }
 #endif
 
diff --git a/arch/hc/src/common/up_exit.c b/arch/hc/src/common/up_exit.c
index b9abf90..6027f4f 100644
--- a/arch/hc/src/common/up_exit.c
+++ b/arch/hc/src/common/up_exit.c
@@ -64,9 +64,6 @@
 static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
 {
   FAR struct filelist *filelist;
-#ifdef CONFIG_FILE_STREAM
-  FAR struct file_struct *filep;
-#endif
   int i;
   int j;
 
@@ -87,28 +84,6 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void 
*arg)
 }
 }
 }
-
-#ifdef CONFIG_FILE_STREAM
-  filep = tcb->group->tg_streamlist->sl_head;
-  for (; filep != NULL; filep = filep->fs_next)
-{
-  if (filep->fs_fd >= 0)
-{
-#ifndef CONFIG_STDIO_DISABLE_BUFFERING
-  if (filep->fs_bufstart != NULL)
-{
-  sinfo("  fd=%d nbytes=%d\n",
-filep->fs_fd,
-filep->fs_bufpos - filep->fs_bufstart);
-}
-  else
-#endif
-{
-  sinfo("  fd=

[incubator-nuttx] branch master updated: risc-v/esp32c3: Refactor SPI Flash to support umask interrupt when R/W/E SPI Flash

2021-12-05 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 698f1f7  risc-v/esp32c3: Refactor SPI Flash to support umask interrupt 
when R/W/E SPI Flash
698f1f7 is described below

commit 698f1f76ff204fbd4fcc8ef863156cf91cefe706
Author: Dong Heng 
AuthorDate: Thu Aug 5 16:09:54 2021 +0800

risc-v/esp32c3: Refactor SPI Flash to support umask interrupt when R/W/E 
SPI Flash

This can fix BLE assert when erase SPI Flash.
---
 arch/risc-v/src/esp32c3/Kconfig|  42 +-
 arch/risc-v/src/esp32c3/Make.defs  |   3 +
 arch/risc-v/src/esp32c3/esp32c3_ble.c  |   8 -
 arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c  | 166 +++--
 arch/risc-v/src/esp32c3/esp32c3_irq.c  |  22 +-
 arch/risc-v/src/esp32c3/esp32c3_partition.c|   2 +-
 arch/risc-v/src/esp32c3/esp32c3_spiflash.c | 782 +++--
 arch/risc-v/src/esp32c3/esp32c3_spiflash.h | 177 +
 .../{esp32c3_spiflash.c => esp32c3_spiflash_mtd.c} | 374 ++
 .../{esp32c3_wireless.h => esp32c3_spiflash_mtd.h} |  63 +-
 arch/risc-v/src/esp32c3/esp32c3_wireless.c | 224 ++
 arch/risc-v/src/esp32c3/esp32c3_wireless.h | 103 +++
 arch/risc-v/src/esp32c3/hardware/extmem_reg.h  |  12 +
 arch/risc-v/src/esp32c3/rom/esp32c3_spiflash.h | 213 ++
 .../esp32c3/esp32c3-devkit/scripts/esp32c3.ld  |   2 +
 .../esp32c3/esp32c3-devkit/src/esp32c3-devkit.h|   4 +-
 .../esp32c3/esp32c3-devkit/src/esp32c3_bringup.c   |   2 +-
 .../esp32c3/esp32c3-devkit/src/esp32c3_spiflash.c  |   7 +-
 18 files changed, 978 insertions(+), 1228 deletions(-)

diff --git a/arch/risc-v/src/esp32c3/Kconfig b/arch/risc-v/src/esp32c3/Kconfig
index a620ed3..e955ee6 100644
--- a/arch/risc-v/src/esp32c3/Kconfig
+++ b/arch/risc-v/src/esp32c3/Kconfig
@@ -169,6 +169,14 @@ config ESP32C3_WIRELESS
default n
select ESP32C3_RT_TIMER
 
+config ESP32C3_EXCEPTION_ENABLE_CACHE
+   bool
+   default y
+   depends on ESP32C3_SPIFLASH
+   ---help---
+   When exception triggers, panic function enables SPI Flash cache 
to
+   let functions be able to call functions which locate in SPI 
Flash.
+
 menu "ESP32-C3 Peripheral Support"
 
 config ESP32C3_ADC
@@ -264,9 +272,6 @@ config ESP32C3_TIMER1
 config ESP32C3_SPIFLASH
bool "SPI Flash"
default n
-   select MTD
-   select MTD_BYTE_WRITE
-   select MTD_PARTITION
 
 config ESP32C3_SPI2
bool "SPI 2"
@@ -856,10 +861,6 @@ endmenu # Wi-Fi configuration
 menu "BLE Configuration"
depends on ESP32C3_BLE
 
-config ESP32C3_BLE_PKTBUF_NUM
-   int "BLE netcard packet buffer number per netcard"
-   default 16
-
 config ESP32C3_BLE_TTY_NAME
string "BLE TTY device name"
default "/dev/ttyHCI0"
@@ -871,7 +872,7 @@ config ESP32C3_BLE_TASK_STACK_SIZE
 
 config ESP32C3_BLE_TASK_PRIORITY
int "Controller task priority"
-   default 110
+   default 253
 
 endmenu # BLE Configuration
 
@@ -918,25 +919,42 @@ endif
 
 comment "General storage MTD configuration"
 
+config ESP32C3_MTD
+   bool "MTD driver"
+   default y
+   select MTD
+   select MTD_BYTE_WRITE
+   select MTD_PARTITION
+   ---help---
+  Initialize an MTD driver for the ESP32-C3 SPI Flash, which will
+   add an entry at /dev for application access from userspace.
+
+config ESP32C3_STORAGE_MTD_BLKSIZE
+   int "Storage MTD block size"
+   default 64
+   depends on ESP32C3_MTD
+
 config ESP32C3_STORAGE_MTD_OFFSET
hex "Storage MTD base address in SPI Flash"
default 0x18 if !ESP32C3_HAVE_OTA_PARTITION
default 0x25 if ESP32C3_HAVE_OTA_PARTITION
+   depends on ESP32C3_MTD
---help---
MTD base address in SPI Flash.
 
 config ESP32C3_STORAGE_MTD_SIZE
hex "Storage MTD size in SPI Flash"
default 0x10
+   depends on ESP32C3_MTD
---help---
MTD size in SPI Flash.
 
-config ESP32C3_SPIFLASH_DEBUG
-   bool "Debug SPI Flash"
+config ESP32C3_STORAGE_MTD_DEBUG
+   bool "Storage MTD Debug"
default n
-   depends on DEBUG_FS_INFO
+   depends on ESP32C3_MTD && DEBUG_FS_INFO
---help---
-   If this option is enabled, SPI Flash driver read and write 
functions
+   If this option is enabled, Storage MTD driver read and write 
functions
will output input parameters and return values (if applicable).
 
 if ESP32C3_APP_FORMAT_LEGACY
diff --git a/arch/risc-v/src/esp32c3/Make.defs 
b/arch/risc-v

[incubator-nuttx] branch master updated: sched/signal: add spinlock to g_sigfreeaction

2021-12-08 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 2f55807  sched/signal: add spinlock to g_sigfreeaction
2f55807 is described below

commit 2f55807acb79490f615255e3c933ca0447f61a09
Author: ligd 
AuthorDate: Tue Jul 13 21:56:29 2021 +0800

sched/signal: add spinlock to g_sigfreeaction

To avoid nxsig_alloc_action() & nxsig_release_action() competition

Signed-off-by: ligd 
---
 sched/signal/sig_action.c | 40 
 sched/signal/sig_initialize.c | 35 ---
 sched/signal/signal.h |  1 -
 3 files changed, 40 insertions(+), 36 deletions(-)

diff --git a/sched/signal/sig_action.c b/sched/signal/sig_action.c
index 312d07e..dae2629 100644
--- a/sched/signal/sig_action.c
+++ b/sched/signal/sig_action.c
@@ -43,6 +43,37 @@
  /
 
 /
+ * Name: nxsig_alloc_actionblock
+ *
+ * Description:
+ *   Allocate a block of signal actions and place them
+ *   on the free list.
+ *
+ /
+
+static void nxsig_alloc_actionblock(void)
+{
+  FAR sigactq_t *sigact;
+  irqstate_t flags;
+  int i;
+
+  /* Allocate a block of signal actions */
+
+  sigact = kmm_malloc((sizeof(sigactq_t)) * NUM_SIGNAL_ACTIONS);
+  if (sigact != NULL)
+{
+  flags = spin_lock_irqsave(NULL);
+
+  for (i = 0; i < NUM_SIGNAL_ACTIONS; i++)
+{
+  sq_addlast((FAR sq_entry_t *)sigact++, &g_sigfreeaction);
+}
+
+  spin_unlock_irqrestore(NULL, flags);
+}
+}
+
+/
  * Name: nxsig_alloc_action
  *
  * Description:
@@ -53,10 +84,13 @@
 static FAR sigactq_t *nxsig_alloc_action(void)
 {
   FAR sigactq_t *sigact;
+  irqstate_t flags;
 
   /* Try to get the signal action structure from the free list */
 
+  flags = spin_lock_irqsave(NULL);
   sigact = (FAR sigactq_t *)sq_remfirst(&g_sigfreeaction);
+  spin_unlock_irqrestore(NULL, flags);
 
   /* Check if we got one. */
 
@@ -68,7 +102,9 @@ static FAR sigactq_t *nxsig_alloc_action(void)
 
   /* And try again */
 
+  flags = spin_lock_irqsave(NULL);
   sigact = (FAR sigactq_t *)sq_remfirst(&g_sigfreeaction);
+  spin_unlock_irqrestore(NULL, flags);
   DEBUGASSERT(sigact);
 }
 
@@ -363,7 +399,11 @@ int sigaction(int signo, FAR const struct sigaction *act,
 
 void nxsig_release_action(FAR sigactq_t *sigact)
 {
+  irqstate_t flags;
+
   /* Just put it back on the free list */
 
+  flags = spin_lock_irqsave(NULL);
   sq_addlast((FAR sq_entry_t *)sigact, &g_sigfreeaction);
+  spin_unlock_irqrestore(NULL, flags);
 }
diff --git a/sched/signal/sig_initialize.c b/sched/signal/sig_initialize.c
index 34e7b08..5b79388 100644
--- a/sched/signal/sig_initialize.c
+++ b/sched/signal/sig_initialize.c
@@ -71,12 +71,6 @@ sq_queue_t  g_sigpendingirqsignal;
  * Private Data
  /
 
-/* g_sigactionalloc is a pointer to the start of the allocated blocks of
- * signal actions.
- */
-
-static sigactq_t  *g_sigactionalloc;
-
 /* g_sigpendingactionalloc is a pointer to the start of the allocated
  * blocks of pending signal actions.
  */
@@ -230,32 +224,3 @@ void nxsig_initialize(void)
SIG_ALLOC_IRQ);
   DEBUGASSERT(g_sigpendingirqsignalalloc != NULL);
 }
-
-/
- * Name: nxsig_alloc_actionblock
- *
- * Description:
- *   Allocate a block of signal actions and place them
- *   on the free list.
- *
- /
-
-void nxsig_alloc_actionblock(void)
-{
-  FAR sigactq_t *sigact;
-  int i;
-
-  /* Allocate a block of signal actions */
-
-  g_sigactionalloc =
-(FAR sigactq_t *)kmm_malloc((sizeof(sigactq_t)) * NUM_SIGNAL_ACTIONS);
-
-  if (g_sigactionalloc != NULL)
-{
-  sigact = g_sigactionalloc;
-  for (i = 0; i < NUM_SIGNAL_ACTIONS; i++)
-{
-  sq_addlast((FAR sq_entry_t *)sigact++, &g_sigfreeaction);
-}
-}
-}
diff --git a/sched/signal/signal.h b/sched/signal/signal.h
index 8fe4b53..b8a3f5e 100644
--- a/sched/signal/signal.h
+++ b/sched/signal/signal.h
@@ -148,7 +148,6 @@ struct task_group_s;
 /* sig_initializee.c */
 
 void weak_function nxsig_initialize(void);
-void   nxsig_alloc_actionblock(void);
 
 /* sig_action.c */
 


[incubator-nuttx] 02/02: sched/semaphore: remove redundant goto case

2021-12-12 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 4703ef93cc4ef1cda52efb656a54c83fceba3e13
Author: chao.an 
AuthorDate: Mon Dec 13 11:15:40 2021 +0800

sched/semaphore: remove redundant goto case

Signed-off-by: chao.an 
---
 sched/semaphore/sem_clockwait.c | 11 +--
 sched/semaphore/sem_tickwait.c  | 19 ---
 2 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/sched/semaphore/sem_clockwait.c b/sched/semaphore/sem_clockwait.c
index 0b0db1c..5e8f40e 100644
--- a/sched/semaphore/sem_clockwait.c
+++ b/sched/semaphore/sem_clockwait.c
@@ -127,7 +127,7 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
 {
   /* We got it! */
 
-  goto success_with_irqdisabled;
+  goto out;
 }
 
   /* We will have to wait for the semaphore.  Make sure that we were provided
@@ -137,7 +137,7 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
   if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 10)
 {
   ret = -EINVAL;
-  goto errout_with_irqdisabled;
+  goto out;
 }
 
   /* Convert the timespec to clock ticks.  We must have interrupts
@@ -154,7 +154,7 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
   if (status == OK && ticks <= 0)
 {
   ret = -ETIMEDOUT;
-  goto errout_with_irqdisabled;
+  goto out;
 }
 
   /* Handle any time-related errors */
@@ -162,7 +162,7 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
   if (status != OK)
 {
   ret = -status;
-  goto errout_with_irqdisabled;
+  goto out;
 }
 
   /* Start the watchdog */
@@ -181,8 +181,7 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
 
   /* We can now restore interrupts and delete the watchdog */
 
-success_with_irqdisabled:
-errout_with_irqdisabled:
+out:
   leave_critical_section(flags);
   return ret;
 }
diff --git a/sched/semaphore/sem_tickwait.c b/sched/semaphore/sem_tickwait.c
index 9b0e1c1..fe30ba5 100644
--- a/sched/semaphore/sem_tickwait.c
+++ b/sched/semaphore/sem_tickwait.c
@@ -94,7 +94,7 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t 
delay)
 {
   /* We got it! */
 
-  goto success_with_irqdisabled;
+  goto out;
 }
 
   /* We will have to wait for the semaphore.  Make sure that we were provided
@@ -105,7 +105,7 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t 
delay)
 {
   /* Return the errno from nxsem_trywait() */
 
-  goto errout_with_irqdisabled;
+  goto out;
 }
 
   /* Adjust the delay for any time since the delay was calculated */
@@ -114,7 +114,7 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t 
delay)
   if (/* elapsed >= (UINT32_MAX / 2) || */ elapsed >= delay)
 {
   ret = -ETIMEDOUT;
-  goto errout_with_irqdisabled;
+  goto out;
 }
 
   delay -= elapsed;
@@ -131,20 +131,9 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t 
delay)
 
   wd_cancel(&rtcb->waitdog);
 
-  if (ret < 0)
-{
-  goto errout_with_irqdisabled;
-}
-
   /* We can now restore interrupts */
 
-  /* Success exits */
-
-success_with_irqdisabled:
-
-  /* Error exits */
-
-errout_with_irqdisabled:
+out:
   leave_critical_section(flags);
   return ret;
 }


[incubator-nuttx] 01/02: Revert "sched: Remove a redundant critical section"

2021-12-12 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 102a6357ca31898207767d917bff4b7346e570da
Author: chao.an 
AuthorDate: Thu Dec 9 15:08:01 2021 +0800

Revert "sched: Remove a redundant critical section"

There is a potential problem that can lead to deadlock at
condition wait, if the timeout of watchdog is a very small value
(1 tick ?), the timer interrupt will come before the nxsem_wait()

Revert "sched: pthread: Remove a redundant critical section in 
pthread_condclockwsait.c"
Revert "sched: semaphore: Remove a redundant critical section in 
nxsem_clockwait()"
Revert "sched: semaphore: Remove a redundant critical section in 
nxsem_tickwait()"

This reverts commit 7758f3dcb1dcf61e9280aaba6cc98668e6c3bc65.
This reverts commit 2976bb212e7e49d8c9c303f85fc3b83e07cd0010.
This reverts commit 65dec5d10ac57abc9a15aadf076d693ab5208f69.

Signed-off-by: chao.an 
---
 sched/pthread/pthread_condclockwait.c | 50 ---
 sched/semaphore/sem_clockwait.c   | 26 --
 sched/semaphore/sem_tickwait.c| 33 ++-
 3 files changed, 85 insertions(+), 24 deletions(-)

diff --git a/sched/pthread/pthread_condclockwait.c 
b/sched/pthread/pthread_condclockwait.c
index 865a40a..8bc046e 100644
--- a/sched/pthread/pthread_condclockwait.c
+++ b/sched/pthread/pthread_condclockwait.c
@@ -154,6 +154,7 @@ int pthread_cond_clockwait(FAR pthread_cond_t *cond,
FAR const struct timespec *abstime)
 {
   FAR struct tcb_s *rtcb = this_task();
+  irqstate_t flags;
   sclock_t ticks;
   int mypid = getpid();
   int ret = OK;
@@ -192,15 +193,14 @@ int pthread_cond_clockwait(FAR pthread_cond_t *cond,
 {
   sinfo("Give up mutex...\n");
 
-  /* NOTE: We do not need a critical section here,
-   * because nxsem_wait() uses a critical section and
-   * pthread_condtimedout() is called from wd_timer()
-   * which uses a critical section for SMP case
+  /* We must disable pre-emption and interrupts here so that
+   * the time stays valid until the wait begins.   This adds
+   * complexity because we assure that interrupts and
+   * pre-emption are re-enabled correctly.
*/
 
-  /* REVISIT: Do we need to disable pre-emption? */
-
   sched_lock();
+  flags = enter_critical_section();
 
   /* Convert the timespec to clock ticks.  We must disable pre-
* emption here so that this time stays valid until the wait
@@ -208,7 +208,15 @@ int pthread_cond_clockwait(FAR pthread_cond_t *cond,
*/
 
   ret = clock_abstime2ticks(clockid, abstime, &ticks);
-  if (ret == 0)
+  if (ret)
+{
+  /* Restore interrupts  (pre-emption will be enabled when
+   * we fall through the if/then/else)
+   */
+
+  leave_critical_section(flags);
+}
+  else
 {
   /* Check the absolute time to wait.  If it is now or in the
* past, then just return with the timedout condition.
@@ -216,6 +224,12 @@ int pthread_cond_clockwait(FAR pthread_cond_t *cond,
 
   if (ticks <= 0)
 {
+  /* Restore interrupts and indicate that we have already
+   * timed out. (pre-emption will be enabled when we fall
+   * through the if/then/else
+   */
+
+  leave_critical_section(flags);
   ret = ETIMEDOUT;
 }
   else
@@ -238,7 +252,15 @@ int pthread_cond_clockwait(FAR pthread_cond_t *cond,
   nlocks = mutex->nlocks;
 #endif
   ret= pthread_mutex_give(mutex);
-  if (ret == 0)
+  if (ret != 0)
+{
+  /* Restore interrupts  (pre-emption will be enabled
+   * when we fall through the if/then/else)
+   */
+
+  leave_critical_section(flags);
+}
+  else
 {
   /* Start the watchdog */
 
@@ -277,6 +299,14 @@ int pthread_cond_clockwait(FAR pthread_cond_t *cond,
   ret = status;
 }
 }
+
+  /* The interrupts stay disabled until after we sample
+   * the errno.  This is because when debug is enabled
+   * and the console is used for debug output, then the
+   * errno can be altered by interrupt handling! (bad)
+   */
+
+  leave_critical_section(flags);
 }
 
   /* Reacquire the mutex (retaining the ret). */
@@ -302,7 +332,9 @@ int pthread_cond_clockwait(FAR pthread_cond_t *cond,
 }
 }
 
-  /* Re-

[incubator-nuttx] branch master updated (0b7b8d2 -> 4703ef9)

2021-12-12 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 0b7b8d2  arm/cortex-m: enhance the crash dump
 new 102a635  Revert "sched: Remove a redundant critical section"
 new 4703ef9  sched/semaphore: remove redundant goto case

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:
 sched/pthread/pthread_condclockwait.c | 50 ---
 sched/semaphore/sem_clockwait.c   | 15 ---
 sched/semaphore/sem_tickwait.c| 16 ---
 3 files changed, 65 insertions(+), 16 deletions(-)


[incubator-nuttx] branch master updated (1f53a05 -> 33df35f)

2021-12-30 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 1f53a05  nuttx:Change fs strncpy to strlcpy to avoid losing'\0'
 add 33df35f  arch/risc-v: Correct epc adjustment with C ISA

No new revisions were added by this update.

Summary of changes:
 arch/risc-v/src/bl602/bl602_irq_dispatch.c   | 2 +-
 arch/risc-v/src/fe310/fe310_irq_dispatch.c   | 2 +-
 arch/risc-v/src/rv32m1/rv32m1_irq_dispatch.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)


[incubator-nuttx] branch master updated: net/tcp(unbuffered): advance sndseq by +1 because SYN and FIN occupy one sequence number (RFC 793)

2022-01-02 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new e9ab3ad  net/tcp(unbuffered): advance sndseq by +1 because SYN and FIN 
occupy one sequence number (RFC 793)
e9ab3ad is described below

commit e9ab3adf2382d2bdc632274e7b6fab1944eacb8c
Author: Alexander Lunev 
AuthorDate: Sun Jan 2 18:53:43 2022 +0300

net/tcp(unbuffered): advance sndseq by +1 because SYN and FIN occupy one 
sequence number (RFC 793)
---
 net/tcp/tcp_input.c |  5 +
 net/tcp/tcp_send.c  | 19 +++
 net/tcp/tcp_timer.c | 15 +++
 3 files changed, 39 insertions(+)

diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c
index 63b4d33..b5546dd 100644
--- a/net/tcp/tcp_input.c
+++ b/net/tcp/tcp_input.c
@@ -870,6 +870,11 @@ found:
 
 if ((tcp->flags & TCP_CTL) == TCP_SYN)
   {
+#if !defined(CONFIG_NET_TCP_WRITE_BUFFERS)
+tcp_setsequence(conn->sndseq, conn->rexmit_seq);
+#else
+/* REVISIT for the buffered mode */
+#endif
 tcp_synack(dev, conn, TCP_ACK | TCP_SYN);
 return;
   }
diff --git a/net/tcp/tcp_send.c b/net/tcp/tcp_send.c
index fd7eca1..13b89b7 100644
--- a/net/tcp/tcp_send.c
+++ b/net/tcp/tcp_send.c
@@ -382,6 +382,25 @@ static void tcp_sendcommon(FAR struct net_driver_s *dev,
   /* Finish the IP portion of the message and calculate checksums */
 
   tcp_sendcomplete(dev, tcp);
+
+#if !defined(CONFIG_NET_TCP_WRITE_BUFFERS)
+  if ((tcp->flags & (TCP_SYN | TCP_FIN)) != 0)
+{
+  /* Remember sndseq that will be used in case of a possible
+   * SYN or FIN retransmission
+   */
+
+  conn->rexmit_seq = tcp_getsequence(conn->sndseq);
+
+  /* Advance sndseq by +1 because SYN and FIN occupy
+   * one sequence number (RFC 793)
+   */
+
+  net_incr32(conn->sndseq, 1);
+}
+#else
+  /* REVISIT for the buffered mode */
+#endif
 }
 
 /
diff --git a/net/tcp/tcp_timer.c b/net/tcp/tcp_timer.c
index 7ecb987..a206a09 100644
--- a/net/tcp/tcp_timer.c
+++ b/net/tcp/tcp_timer.c
@@ -317,6 +317,11 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct 
tcp_conn_s *conn,
  * SYNACK.
  */
 
+#if !defined(CONFIG_NET_TCP_WRITE_BUFFERS)
+tcp_setsequence(conn->sndseq, conn->rexmit_seq);
+#else
+/* REVISIT for the buffered mode */
+#endif
 tcp_synack(dev, conn, TCP_ACK | TCP_SYN);
 goto done;
 
@@ -324,6 +329,11 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct 
tcp_conn_s *conn,
 
 /* In the SYN_SENT state, we retransmit out SYN. */
 
+#if !defined(CONFIG_NET_TCP_WRITE_BUFFERS)
+tcp_setsequence(conn->sndseq, conn->rexmit_seq);
+#else
+/* REVISIT for the buffered mode */
+#endif
 tcp_synack(dev, conn, TCP_SYN);
 goto done;
 
@@ -344,6 +354,11 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct 
tcp_conn_s *conn,
 
 /* In all these states we should retransmit a FINACK. */
 
+#if !defined(CONFIG_NET_TCP_WRITE_BUFFERS)
+tcp_setsequence(conn->sndseq, conn->rexmit_seq);
+#else
+/* REVISIT for the buffered mode */
+#endif
 tcp_send(dev, conn, TCP_FIN | TCP_ACK, hdrlen);
 goto done;
 }


[incubator-nuttx-apps] branch master updated (b9a6dc2 -> 64ffdb4)

2022-01-05 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from b9a6dc2  netutils/netcat: implemented NETUTILS_NETCAT_SENDFILE option. 
This option enables using sendfile() in netcat client mode if a normal file 
(not stdin) is sent. If the option is enabled but stdin is sent rather than a 
normal file, netcat falls back to the combination of read() and write(). Using 
sendfile() provides a higher performance compared to the combination of read() 
and write().
 add 64ffdb4  ntpc: optimize stack used

No new revisions were added by this update.

Summary of changes:
 netutils/ntpclient/ntpclient.c | 36 ++--
 1 file changed, 26 insertions(+), 10 deletions(-)


[incubator-nuttx-apps] branch master updated (64ffdb4 -> a1857b9)

2022-01-05 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 64ffdb4  ntpc: optimize stack used
 add a1857b9  wireless/gs2200m: replace the preamble scratch to union

No new revisions were added by this update.

Summary of changes:
 wireless/gs2200m/gs2200m_main.c | 27 ++-
 1 file changed, 22 insertions(+), 5 deletions(-)


[incubator-nuttx-apps] branch master updated: ostest: sighand.c: add sem_wait in signal handler

2022-01-05 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 614b73d  ostest: sighand.c: add sem_wait in signal handler
614b73d is described below

commit 614b73d3215b267f100d75463933a6dc41072225
Author: Zeng Zhaoxiu 
AuthorDate: Tue Jan 4 15:53:16 2022 +0800

ostest: sighand.c: add sem_wait in signal handler

task is blocked by semphore1, signal handler is blocked by semphore2,
after post semphore2, the task must get -EINTR.

Signed-off-by: Zeng Zhaoxiu 
---
 testing/ostest/sighand.c | 68 +++-
 1 file changed, 61 insertions(+), 7 deletions(-)

diff --git a/testing/ostest/sighand.c b/testing/ostest/sighand.c
index 134c9b5..890ba7d 100644
--- a/testing/ostest/sighand.c
+++ b/testing/ostest/sighand.c
@@ -43,9 +43,11 @@
  * Private Data
  /
 
-static sem_t sem;
+static sem_t sem1;
+static sem_t sem2;
 static bool sigreceived = false;
-static bool threadexited = false;
+static bool thread1exited = false;
+static bool thread2exited = false;
 
 /
  * Private Functions
@@ -134,6 +136,19 @@ static void wakeup_action(int signo, siginfo_t *info, void 
*ucontext)
   printf("wakeup_action: ERROR sigprocmask=%jx expected=%jx\n",
  (uintmax_t)oldset, (uintmax_t)allsigs);
 }
+
+  /* Checkout sem_wait */
+
+  status = sem_wait(&sem2);
+  if (status != 0)
+{
+  int error = errno;
+  printf("wakeup_action: ERROR sem_wait failed, errno=%d\n" , error);
+}
+  else
+{
+  printf("wakeup_action: sem_wait() successfully!\n");
+}
 }
 
 static int waiter_main(int argc, char *argv[])
@@ -179,7 +194,7 @@ static int waiter_main(int argc, char *argv[])
   printf("waiter_main: Waiting on semaphore\n");
   FFLUSH();
 
-  status = sem_wait(&sem);
+  status = sem_wait(&sem1);
   if (status != 0)
 {
   int error = errno;
@@ -206,7 +221,27 @@ static int waiter_main(int argc, char *argv[])
   printf("waiter_main: done\n");
   FFLUSH();
 
-  threadexited = true;
+  thread1exited = true;
+  return 0;
+}
+
+static int poster_main(int argc, char *argv[])
+{
+  int status;
+
+  printf("poster_main: Poster started\n");
+
+  status = sem_post(&sem2);
+  if (status != 0)
+{
+  int error = errno;
+  printf("poster_main: sem_post failed error=%d\n", error);
+}
+
+  printf("poster_main: done\n");
+  FFLUSH();
+
+  thread2exited = true;
   return 0;
 }
 
@@ -223,11 +258,12 @@ void sighand_test(void)
 #endif
   struct sched_param param;
   union sigval sigvalue;
-  pid_t waiterpid;
+  pid_t waiterpid, posterpid;
   int status;
 
   printf("sighand_test: Initializing semaphore to 0\n");
-  sem_init(&sem, 0, 0);
+  sem_init(&sem1, 0, 0);
+  sem_init(&sem2, 0, 0);
 
 #ifdef CONFIG_SCHED_HAVE_PARENT
   printf("sighand_test: Unmasking SIGCHLD\n");
@@ -294,6 +330,19 @@ void sighand_test(void)
   task_delete(waiterpid);
 }
 
+  /* Start poster thread  */
+
+  posterpid = task_create("poster", param.sched_priority,
+   STACKSIZE, poster_main, NULL);
+  if (posterpid == ERROR)
+{
+  printf("sighand_test: ERROR failed to start poster_main\n");
+}
+  else
+{
+  printf("sighand_test: Started poster_main pid=%d\n", posterpid);
+}
+
   /* Wait a bit */
 
   FFLUSH();
@@ -301,11 +350,16 @@ void sighand_test(void)
 
   /* Then check the result */
 
-  if (!threadexited)
+  if (!thread1exited)
 {
   printf("sighand_test: ERROR waiter task did not exit\n");
 }
 
+  if (!thread2exited)
+{
+  printf("sighand_test: ERROR poster task did not exit\n");
+}
+
   if (!sigreceived)
 {
   printf("sighand_test: ERROR signal handler did not run\n");


[incubator-nuttx] branch master updated: signal: signal handler may cause task's state error

2022-01-05 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new fb43fd7  signal: signal handler may cause task's state error
fb43fd7 is described below

commit fb43fd73ed9d2b60984c3e0c5dd71ea9e25d7fcd
Author: Zeng Zhaoxiu 
AuthorDate: Wed Dec 29 20:02:09 2021 +0800

signal: signal handler may cause task's state error

For example, task is blocked by nxsem_wait(sem1), use nxsem_wait(sem2)
in signal handler, and take sem2 successfully, after exit from signal
handler to task, nxsem_wait(sem1) returns OK, but the correct result
should be -EINTR.

Signed-off-by: Zeng Zhaoxiu 
---
 arch/arm/src/arm/arm_sigdeliver.c   |  8 
 arch/arm/src/armv6-m/arm_sigdeliver.c   | 11 ---
 arch/arm/src/armv7-a/arm_sigdeliver.c   | 11 ---
 arch/arm/src/armv7-m/arm_sigdeliver.c   | 11 ---
 arch/arm/src/armv7-r/arm_sigdeliver.c   |  8 
 arch/arm/src/armv8-m/arm_sigdeliver.c   | 11 ---
 arch/avr/src/avr/up_sigdeliver.c|  8 
 arch/avr/src/avr32/up_sigdeliver.c  |  8 
 arch/mips/src/mips32/mips_sigdeliver.c  |  8 
 arch/misoc/src/lm32/lm32_sigdeliver.c   |  8 
 arch/misoc/src/minerva/minerva_sigdeliver.c |  8 
 arch/renesas/src/m16c/m16c_sigdeliver.c |  8 
 arch/renesas/src/rx65n/rx65n_sigdeliver.c   |  8 
 arch/renesas/src/sh1/sh1_sigdeliver.c   |  8 
 arch/risc-v/src/rv32im/riscv_sigdeliver.c   |  8 
 arch/risc-v/src/rv64gc/riscv_sigdeliver.c   | 11 ---
 arch/sim/src/sim/up_sigdeliver.c| 11 ---
 arch/x86/src/i486/up_sigdeliver.c   |  8 
 arch/x86_64/src/intel64/up_sigdeliver.c |  8 
 arch/xtensa/src/common/xtensa_sigdeliver.c  | 11 ---
 arch/z16/src/common/z16_sigdeliver.c|  8 
 arch/z80/src/ez80/ez80_sigdeliver.c |  8 
 arch/z80/src/z180/z180_sigdeliver.c |  8 
 arch/z80/src/z8/z8_sigdeliver.c |  8 
 arch/z80/src/z80/z80_sigdeliver.c   |  8 
 sched/signal/sig_deliver.c  | 13 +
 26 files changed, 13 insertions(+), 221 deletions(-)

diff --git a/arch/arm/src/arm/arm_sigdeliver.c 
b/arch/arm/src/arm/arm_sigdeliver.c
index 983d1de6..7c51c14 100644
--- a/arch/arm/src/arm/arm_sigdeliver.c
+++ b/arch/arm/src/arm/arm_sigdeliver.c
@@ -57,13 +57,6 @@ void arm_sigdeliver(void)
   struct tcb_s  *rtcb = this_task();
   uint32_t regs[XCPTCONTEXT_REGS];
 
-  /* Save the errno.  This must be preserved throughout the signal handling
-   * so that the user code final gets the correct errno value (probably
-   * EINTR).
-   */
-
-  int saved_errno = get_errno();
-
   board_autoled_on(LED_SIGNAL);
 
   sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
@@ -93,7 +86,6 @@ void arm_sigdeliver(void)
 
   sinfo("Resuming\n");
   up_irq_save();
-  set_errno(saved_errno);
 
   /* Modify the saved return state with the actual saved values in the
* TCB.  This depends on the fact that nested signal handling is
diff --git a/arch/arm/src/armv6-m/arm_sigdeliver.c 
b/arch/arm/src/armv6-m/arm_sigdeliver.c
index 5317840..b5049c7 100644
--- a/arch/arm/src/armv6-m/arm_sigdeliver.c
+++ b/arch/arm/src/armv6-m/arm_sigdeliver.c
@@ -62,13 +62,6 @@ void arm_sigdeliver(void)
   struct tcb_s  *rtcb = this_task();
   uint32_t regs[XCPTCONTEXT_REGS + 4];
 
-  /* Save the errno.  This must be preserved throughout the signal handling
-   * so that the user code final gets the correct errno value (probably
-   * EINTR).
-   */
-
-  int saved_errno = get_errno();
-
 #ifdef CONFIG_SMP
   /* In the SMP case, we must terminate the critical section while the signal
* handler executes, but we also need to restore the irqcount when the
@@ -146,10 +139,6 @@ void arm_sigdeliver(void)
   up_irq_save();
 #endif
 
-  /* Restore the saved errno value */
-
-  set_errno(saved_errno);
-
   /* Modify the saved return state with the actual saved values in the
* TCB.  This depends on the fact that nested signal handling is
* not supported.  Therefore, these values will persist throughout the
diff --git a/arch/arm/src/armv7-a/arm_sigdeliver.c 
b/arch/arm/src/armv7-a/arm_sigdeliver.c
index 374170b..9f1684c 100644
--- a/arch/arm/src/armv7-a/arm_sigdeliver.c
+++ b/arch/arm/src/armv7-a/arm_sigdeliver.c
@@ -57,13 +57,6 @@ void arm_sigdeliver(void)
   struct tcb_s  *rtcb = this_task();
   uint32_t regs[XCPTCONTEXT_REGS];
 
-  /* Save the errno.  This must be preserved throughout the signal handling
-   * so that the user code final gets the correct errno value (probably
-   * EINTR).
-   */
-
-  int saved_errno = get_errno();
-
 #ifdef CONFIG_SMP
   /* In the SMP case, we must 

[incubator-nuttx] branch master updated: arch/Toolchain.defs: Don't expand EXTRA_LIBS immediately

2022-01-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new e0b62bf  arch/Toolchain.defs: Don't expand EXTRA_LIBS immediately
e0b62bf is described below

commit e0b62bf677340dbaa472ad8c535d0483cbf65cf7
Author: Xiang Xiao 
AuthorDate: Sat Jan 29 18:02:53 2022 +0800

arch/Toolchain.defs: Don't expand EXTRA_LIBS immediately

since board's Make.defs may overwrite ARCHCPUFLAGS

Signed-off-by: Xiang Xiao 
---
 arch/arm/src/arm/Toolchain.defs   | 2 +-
 arch/arm/src/armv6-m/Toolchain.defs   | 2 +-
 arch/arm/src/armv7-a/Toolchain.defs   | 2 +-
 arch/arm/src/armv7-m/Toolchain.defs   | 2 +-
 arch/arm/src/armv7-r/Toolchain.defs   | 2 +-
 arch/arm/src/armv8-m/Toolchain.defs   | 2 +-
 arch/avr/src/avr/Toolchain.defs   | 2 +-
 arch/avr/src/avr32/Toolchain.defs | 2 +-
 arch/hc/src/Makefile  | 2 +-
 arch/mips/src/mips32/Toolchain.defs   | 2 +-
 arch/misoc/src/lm32/Toolchain.defs| 2 +-
 arch/misoc/src/minerva/Toolchain.defs | 2 +-
 arch/or1k/src/mor1kx/Toolchain.defs   | 2 +-
 arch/risc-v/src/common/Toolchain.defs | 2 +-
 arch/x86/src/Makefile | 2 +-
 arch/x86_64/src/Makefile  | 2 +-
 arch/xtensa/src/lx6/Toolchain.defs| 2 +-
 arch/xtensa/src/lx7/Toolchain.defs| 2 +-
 18 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/arch/arm/src/arm/Toolchain.defs b/arch/arm/src/arm/Toolchain.defs
index 4a714f1..5e9eee9 100644
--- a/arch/arm/src/arm/Toolchain.defs
+++ b/arch/arm/src/arm/Toolchain.defs
@@ -103,7 +103,7 @@ OBJDUMP = $(CROSSDEV)objdump
 
 # Add the builtin library
 
-EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
+EXTRA_LIBS = ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
 
 ifneq ($(CONFIG_LIBM),y)
   EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) 
--print-file-name=libm.a}}
diff --git a/arch/arm/src/armv6-m/Toolchain.defs 
b/arch/arm/src/armv6-m/Toolchain.defs
index 876d7fd..682850c 100644
--- a/arch/arm/src/armv6-m/Toolchain.defs
+++ b/arch/arm/src/armv6-m/Toolchain.defs
@@ -95,7 +95,7 @@ OBJDUMP = $(CROSSDEV)objdump
 
 # Add the builtin library
 
-EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
+EXTRA_LIBS = ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
 
 ifneq ($(CONFIG_LIBM),y)
   EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) 
--print-file-name=libm.a}}
diff --git a/arch/arm/src/armv7-a/Toolchain.defs 
b/arch/arm/src/armv7-a/Toolchain.defs
index 09cebaf..702d439 100644
--- a/arch/arm/src/armv7-a/Toolchain.defs
+++ b/arch/arm/src/armv7-a/Toolchain.defs
@@ -121,7 +121,7 @@ OBJDUMP = $(CROSSDEV)objdump
 
 # Add the builtin library
 
-EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
+EXTRA_LIBS = ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
 
 ifneq ($(CONFIG_LIBM),y)
   EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) 
--print-file-name=libm.a}}
diff --git a/arch/arm/src/armv7-m/Toolchain.defs 
b/arch/arm/src/armv7-m/Toolchain.defs
index de00011..43c2205 100644
--- a/arch/arm/src/armv7-m/Toolchain.defs
+++ b/arch/arm/src/armv7-m/Toolchain.defs
@@ -154,7 +154,7 @@ OBJDUMP = $(CROSSDEV)objdump
 
 # Add the builtin library
 
-EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
+EXTRA_LIBS = ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
 
 ifneq ($(CONFIG_LIBM),y)
   EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) 
--print-file-name=libm.a}}
diff --git a/arch/arm/src/armv7-r/Toolchain.defs 
b/arch/arm/src/armv7-r/Toolchain.defs
index 0c4834f..2db3c8c 100644
--- a/arch/arm/src/armv7-r/Toolchain.defs
+++ b/arch/arm/src/armv7-r/Toolchain.defs
@@ -103,7 +103,7 @@ OBJDUMP = $(CROSSDEV)objdump
 
 # Add the builtin library
 
-EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
+EXTRA_LIBS = ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
 
 ifneq ($(CONFIG_LIBM),y)
   EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) 
--print-file-name=libm.a}}
diff --git a/arch/arm/src/armv8-m/Toolchain.defs 
b/arch/arm/src/armv8-m/Toolchain.defs
index 805a751..07c7f7b 100644
--- a/arch/arm/src/armv8-m/Toolchain.defs
+++ b/arch/arm/src/armv8-m/Toolchain.defs
@@ -153,7 +153,7 @@ OBJDUMP = $(CROSSDEV)objdump
 
 # Add the builtin library
 
-EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
+EXTRA_LIBS = ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}
 
 ifneq ($(CONFIG_LIBM),y)
   EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) 
--print-file-name=libm.a}}
diff --git a/arch/avr/src/avr/Toolchain.defs b/arch/avr/src/avr/Toolchain.defs
index 8e11c31..9816aac 100644
--- a/arch/avr/src/avr/Toolchain.defs
+++ b/arch/avr/src/avr/Toolchain.defs
@@ -126,7 +126,7 @@ OBJDUMP = $(CROSSDEV)objdump
 
 # 

[incubator-nuttx] branch master updated (601a0e8 -> 5c5f1de)

2022-01-31 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 601a0e8  arch/arm/samv7: fix leaving from critical section in HSMCI 
callback
 add d489460  Revert "sched: Don't duplicate caller file handler when 
creating kernel thread"
 add 5c5f1de  sched: Don't duplicate caller file handler when creating 
kernel thread

No new revisions were added by this update.

Summary of changes:
 fs/inode/fs_files.c| 26 +++---
 include/nuttx/fs/fs.h  |  3 ++-
 sched/group/group_setuptaskfiles.c | 16 ++--
 sched/task/task_init.c | 10 +-
 4 files changed, 28 insertions(+), 27 deletions(-)


[incubator-nuttx] branch master updated: armv7-r/a: fix a4 register use in xxx_invalidate/flush/clean_all.S

2022-02-08 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new cc8ab23  armv7-r/a: fix a4 register use in 
xxx_invalidate/flush/clean_all.S
cc8ab23 is described below

commit cc8ab23550b5b6b90a0035911675daa8c8d5fa7a
Author: zhuyanlin 
AuthorDate: Fri Jan 28 17:52:11 2022 +0800

armv7-r/a: fix a4 register use in xxx_invalidate/flush/clean_all.S

Use sub loop instead of add loop

Signed-off-by: zhuyanlin 
---
 arch/arm/src/armv7-a/cp15_clean_dcache_all.S  | 42 ++-
 arch/arm/src/armv7-a/cp15_flush_dcache_all.S  | 42 ++-
 arch/arm/src/armv7-a/cp15_invalidate_dcache_all.S | 21 +---
 arch/arm/src/armv7-r/cp15_clean_dcache_all.S  | 41 ++
 arch/arm/src/armv7-r/cp15_flush_dcache_all.S  | 41 ++
 arch/arm/src/armv7-r/cp15_invalidate_dcache_all.S | 21 +---
 6 files changed, 94 insertions(+), 114 deletions(-)

diff --git a/arch/arm/src/armv7-a/cp15_clean_dcache_all.S 
b/arch/arm/src/armv7-a/cp15_clean_dcache_all.S
index 5f8b42d..e2413a0 100644
--- a/arch/arm/src/armv7-a/cp15_clean_dcache_all.S
+++ b/arch/arm/src/armv7-a/cp15_clean_dcache_all.S
@@ -1,5 +1,5 @@
 /
- * arch/arm/src/armv7-a/cp15_flush_dcache_all.S
+ * arch/arm/src/armv7-a/cp15_clean_dcache_all.S
  *
  *   Copyright (C) 2013 Gregory Nutt. All rights reserved.
  *   Author: Gregory Nutt 
@@ -54,7 +54,7 @@
 
 #include "cp15.h"
 
-   .file   "cp15_flush_dcache_all.S"
+   .file   "cp15_clean_dcache_all.S"
 
 /
  * Pre-processor Definitions
@@ -64,7 +64,7 @@
  * Public Symbols
  /
 
-   .globl  cp15_flush_dcache_all
+   .globl  cp15_clean_dcache_all
 
 /
  * Public Functions
@@ -73,10 +73,10 @@
.text
 
 /
- * Name: cp15_flush_dcache_all
+ * Name: cp15_clean_dcache_all
  *
  * Description:
- *   Invalidate the entire contents of D cache.
+ *   Clean the entire contents of D cache.
  *
  * Input Parameters:
  *   None
@@ -86,36 +86,32 @@
  *
  /
 
-   .globl  cp15_flush_dcache_all
-   .type   cp15_flush_dcache_all, function
+   .globl  cp15_clean_dcache_all
+   .type   cp15_clean_dcache_all, function
 
-cp15_flush_dcache_all:
+cp15_clean_dcache_all:
+
+   mrc CP15_CCSIDR(r1) /* Read the Cache Size 
Identification Register */
 
-   mrc CP15_CCSIDR(r0) /* Read the Cache Size 
Identification Register */
ldr r3, =0x7fff /* Isolate the NumSets 
field (bits 13-27) */
-   and r0, r3, r0, lsr #13 /* r0=NumSets (number 
of sets - 1) */
+   and r0, r3, r1, lsr #13 /* r0=NumSets (number 
of sets - 1) */
 
ldr r3, =0x3ff  /* Isolate the way 
field (bits 3-12) */
-   add r4, r3, r0, lsr #3  /* r4=(number of ways - 
1) */
+   and r1, r3, r1, lsr #3  /* r1=(number of ways - 
1) */
 
-   mov r1, #0  /* r1 = way loop 
counter */
 way_loop:
-
-   mov r3, #0  /* r3 = set loop 
counter */
+   mov r3, r0  /* Init Sets */
 set_loop:
mov r2, r1, lsl #30 /* r2 = way loop 
counter << 30 */
orr r2, r3, lsl #5  /* r2 = set/way cache 
operation format */
-   mcr CP15_DCCISW(r2) /* Data Cache 
Invalidate by Set/Way */
-   add r3, r3, #1  /* Increment set 
counter */
-   cmp r0, r3  /* Last set? */
-   bne set_loop/* Keep looping if not 
*/
+   mcr CP15_DCCSW(r2)  /* Data Cache Clean by 
Set/Way */
+   subsr3, r3, #1  /* Subtraction set 
counter */
+   bcs set_loop/* Keep looping if not 
*/
 
-   add r1, r1, #1  /* Increment the way 
counter */
-   cmp r4, r1  /* Last way */
-   bne way_loop/* Keep looping if not 
*

[incubator-nuttx] branch master updated: net/tcp/monitor: do not migrate the state to close

2022-02-11 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new e749f6c  net/tcp/monitor: do not migrate the state to close
e749f6c is described below

commit e749f6ca7e6aea06463500ad9367f3e87fd61a44
Author: chao.an 
AuthorDate: Wed Oct 20 18:19:27 2021 +0800

net/tcp/monitor: do not migrate the state to close

1. remove the unnecessary interfaces tcp_close_monitor()

socket flags(s_flags) is a global state for net connection
remove the incorrect update for stop monitor

2. do not start the tcp monitor from duplicated psock

the tcp monitor has already registered in connect callback


This patch also fix the telnet issue reported by:
https://github.com/apache/incubator-nuttx/pull/5434#issuecomment-1035600651

the orignal session fd is closed after dup, the connect state
has incorrectly migrated to close:

drivers/net/telnet.c:
 977 static int telnet_session(FAR struct telnet_session_s *session)
 ...
 1031   ret = psock_dup2(psock, &priv->td_psock);
 ...
 1082   nx_close(session->ts_sd);

Signed-off-by: chao.an 
---
 net/inet/inet_sockif.c |  4 ---
 net/socket/net_dup2.c  | 51 ++
 net/tcp/tcp.h  | 23 
 net/tcp/tcp_monitor.c  | 75 --
 4 files changed, 2 insertions(+), 151 deletions(-)

diff --git a/net/inet/inet_sockif.c b/net/inet/inet_sockif.c
index d6384a1..8858c66 100644
--- a/net/inet/inet_sockif.c
+++ b/net/inet/inet_sockif.c
@@ -1696,10 +1696,6 @@ int inet_close(FAR struct socket *psock)
   /* No.. Just decrement the reference count */
 
   conn->crefs--;
-
-  /* Stop monitor for this socket only */
-
-  tcp_close_monitor(psock);
 }
 #else
 nwarn("WARNING: SOCK_STREAM support is not available in this "
diff --git a/net/socket/net_dup2.c b/net/socket/net_dup2.c
index 9080f28..53b5316 100644
--- a/net/socket/net_dup2.c
+++ b/net/socket/net_dup2.c
@@ -61,11 +61,6 @@
 
 int psock_dup2(FAR struct socket *psock1, FAR struct socket *psock2)
 {
-#ifdef NET_TCP_HAVE_STACK
-  FAR struct tcp_conn_s *conn;
-#endif
-  int ret = OK;
-
   /* Parts of this operation need to be atomic */
 
   net_lock();
@@ -87,49 +82,7 @@ int psock_dup2(FAR struct socket *psock1, FAR struct socket 
*psock2)
   psock2->s_sockif->si_addref != NULL);
   psock2->s_sockif->si_addref(psock2);
 
-#ifdef NET_TCP_HAVE_STACK
-  /* For connected socket types, it is necessary to also start the network
-   * monitor so that the newly cloned socket can receive a notification if
-   * the network connection is lost.
-   */
-
-  conn = (FAR struct tcp_conn_s *)psock2->s_conn;
-
-  if ((psock2->s_domain == PF_INET ||
-   psock2->s_domain == PF_INET6) &&
-  psock2->s_type == SOCK_STREAM && conn &&
-  (conn->tcpstateflags == TCP_ESTABLISHED ||
-   conn->tcpstateflags == TCP_SYN_RCVD))
-{
-  ret = tcp_start_monitor(psock2);
-
-  /* On failure, back out the reference count on the TCP connection
-   * structure.  tcp_start_monitor() will fail only in the race condition
-   * where the TCP connection has been lost.
-   */
-
-  if (ret < 0)
-{
-  /* There should be at least two reference counts on the connection
-   * structure:  At least one from the original socket and the one
-   * from above where we incremented the reference count.
-   * inet_close() will handle all cases.
-   *
-   * NOTE:  As a side-effect, inet_close()will also call
-   * tcp_stop_monitor() which could inform the loss of connection to
-   * all open sockets on the connection structure if the reference
-   * count decrements to zero.
-   */
-
-  inet_close(psock2);
-
-  /* The socket will not persist... reset it */
-
-  memset(psock2, 0, sizeof(*psock2));
-}
-}
-#endif
-
   net_unlock();
-  return ret;
+
+  return OK;
 }
diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h
index 7db3278..87dab15 100644
--- a/net/tcp/tcp.h
+++ b/net/tcp/tcp.h
@@ -653,29 +653,6 @@ int tcp_start_monitor(FAR struct socket *psock);
 void tcp_stop_monitor(FAR struct tcp_conn_s *conn, uint16_t flags);
 
 /
- * Name: tcp_close_monitor
- *
- * Description:
- *   One socket in a group of dup'ed sockets has been closed.  We need to
- *   selectively terminate just those things that are waiting of events
- *   from this specific socket.  And also recover any r

[incubator-nuttx] branch master updated (271518a -> 95b0c85)

2022-02-12 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 271518a  sim: detect clang native compiler on MacOS.
 add 95b0c85  arch: Add xxx_tcbinfo.c to SoC level Make.defs

No new revisions were added by this update.

Summary of changes:
 arch/arm/src/a1x/Make.defs  | 2 +-
 arch/arm/src/am335x/Make.defs   | 2 +-
 arch/arm/src/c5471/Make.defs| 2 +-
 arch/arm/src/cxd56xx/Make.defs  | 1 +
 arch/arm/src/dm320/Make.defs| 1 +
 arch/arm/src/efm32/Make.defs| 2 +-
 arch/arm/src/eoss3/Make.defs| 2 +-
 arch/arm/src/imx1/Make.defs | 1 +
 arch/arm/src/imx6/Make.defs | 2 +-
 arch/arm/src/imxrt/Make.defs| 2 +-
 arch/arm/src/kinetis/Make.defs  | 1 +
 arch/arm/src/kl/Make.defs   | 2 +-
 arch/arm/src/lc823450/Make.defs | 2 +-
 arch/arm/src/lpc17xx_40xx/Make.defs | 2 +-
 arch/arm/src/lpc214x/Make.defs  | 2 +-
 arch/arm/src/lpc2378/Make.defs  | 2 +-
 arch/arm/src/lpc31xx/Make.defs  | 1 +
 arch/arm/src/lpc43xx/Make.defs  | 1 +
 arch/arm/src/lpc54xx/Make.defs  | 1 +
 arch/arm/src/max326xx/Make.defs | 2 +-
 arch/arm/src/moxart/Make.defs   | 2 +-
 arch/arm/src/nrf52/Make.defs| 2 +-
 arch/arm/src/nuc1xx/Make.defs   | 2 +-
 arch/arm/src/phy62xx/Make.defs  | 2 +-
 arch/arm/src/rp2040/Make.defs   | 2 +-
 arch/arm/src/rtl8720c/Make.defs | 2 +-
 arch/arm/src/s32k1xx/Make.defs  | 1 +
 arch/arm/src/sam34/Make.defs| 1 +
 arch/arm/src/sama5/Make.defs| 2 +-
 arch/arm/src/samd2l2/Make.defs  | 2 +-
 arch/arm/src/samd5e5/Make.defs  | 1 +
 arch/arm/src/samv7/Make.defs| 1 +
 arch/arm/src/stm32/Make.defs| 1 +
 arch/arm/src/stm32f0l0g0/Make.defs  | 2 +-
 arch/arm/src/stm32f7/Make.defs  | 1 +
 arch/arm/src/stm32h7/Make.defs  | 1 +
 arch/arm/src/stm32l4/Make.defs  | 2 +-
 arch/arm/src/stm32l5/Make.defs  | 2 +-
 arch/arm/src/str71x/Make.defs   | 2 +-
 arch/arm/src/tiva/Make.defs | 1 +
 arch/arm/src/tms570/Make.defs   | 2 +-
 arch/arm/src/xmc4/Make.defs | 2 +-
 arch/risc-v/src/bl602/Make.defs | 2 +-
 arch/risc-v/src/c906/Make.defs  | 1 +
 arch/risc-v/src/esp32c3/Make.defs   | 1 +
 arch/risc-v/src/fe310/Make.defs | 2 +-
 arch/risc-v/src/k210/Make.defs  | 1 +
 arch/risc-v/src/litex/Make.defs | 2 +-
 arch/risc-v/src/mpfs/Make.defs  | 2 +-
 arch/risc-v/src/qemu-rv/Make.defs   | 2 +-
 arch/risc-v/src/rv32m1/Make.defs| 2 +-
 51 files changed, 51 insertions(+), 33 deletions(-)


[incubator-nuttx] branch master updated: libc: posix_openpty should use the absolute path("dev/ptmx")

2022-02-13 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 34baf47  libc: posix_openpty should use the absolute path("dev/ptmx")
34baf47 is described below

commit 34baf47307d97835f2c3416b6b8a2830bc210d03
Author: Xiang Xiao 
AuthorDate: Sun Feb 13 05:06:43 2022 +0800

libc: posix_openpty should use the absolute path("dev/ptmx")

Signed-off-by: Xiang Xiao 
---
 libs/libc/stdlib/lib_openpty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libs/libc/stdlib/lib_openpty.c b/libs/libc/stdlib/lib_openpty.c
index 9b8e9bf..747e010 100644
--- a/libs/libc/stdlib/lib_openpty.c
+++ b/libs/libc/stdlib/lib_openpty.c
@@ -68,7 +68,7 @@
 int posix_openpt(int oflag)
 {
 #ifdef CONFIG_PSEUDOTERM_SUSV1
-  return open("dev/ptmx", oflag);
+  return open("/dev/ptmx", oflag);
 #else
   int minor;
 


[incubator-nuttx] branch master updated (1ca9522 -> 4207882)

2022-02-14 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 1ca9522  stm32h7:flash can not use usleep
 add 4207882  arm/armv8-m: Handle the special irq correctly in up_secure_irq

No new revisions were added by this update.

Summary of changes:
 arch/arm/src/armv8-m/arm_secure_irq.c | 46 +--
 1 file changed, 38 insertions(+), 8 deletions(-)


[incubator-nuttx] branch master updated (0258968 -> 5cde8c6)

2022-02-14 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 0258968  drivers: wireless: Fix gs2200m_ioctl_accept()
 add 0d7f30c  risc-v/k210: Move wfi to entry of the slave cpu boot routine
 add 5cde8c6  risc-v: Let g_cpu_basestack determined at compile time

No new revisions were added by this update.

Summary of changes:
 arch/risc-v/src/common/riscv_cpuidlestack.c |  2 +-
 arch/risc-v/src/common/riscv_internal.h |  2 +-
 arch/risc-v/src/k210/k210_head.S| 12 +++-
 3 files changed, 9 insertions(+), 7 deletions(-)


[incubator-nuttx] branch master updated (85af0f3 -> 69a6072)

2022-02-16 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 85af0f3  arch/sim/src/Makefile: Fix build issues with clang on linux
 add 4bc5b24  arch/ceva: Remove B2C and C2B
 add f8df491  arch/ceva: Update tls handle to the latest mainline
 add 814cab1  arch/ceva: Mark the allocated stack with TCB_FLAG_FREE_STACK
 add 69a6072  arch/ceva: Replace adj_stack_ptr with stack_base_ptr

No new revisions were added by this update.

Summary of changes:
 arch/ceva/include/tls.h| 74 --
 arch/ceva/src/common/up_assert.c   |  2 +-
 arch/ceva/src/common/up_checkstack.c   | 40 +++---
 arch/ceva/src/common/up_createstack.c  | 44 
 arch/ceva/src/common/up_initialize.c   |  2 +-
 arch/ceva/src/common/up_internal.h |  2 +-
 arch/ceva/src/common/up_releasestack.c | 21 --
 arch/ceva/src/common/up_stackframe.c   |  8 ++--
 arch/ceva/src/common/up_start.c|  2 +-
 arch/ceva/src/common/up_usestack.c | 18 ++---
 arch/ceva/src/common/up_vfork.c| 22 +-
 arch/ceva/src/xc5/up_initialstate.c|  4 +-
 arch/ceva/src/xm6/up_initialstate.c|  4 +-
 13 files changed, 46 insertions(+), 197 deletions(-)
 delete mode 100644 arch/ceva/include/tls.h


[incubator-nuttx] branch master updated (19e5c8f -> e9a94a0)

2022-02-20 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 19e5c8f  armv7-a/r: fix SVC's sp restore in arm_vectors.S
 add e9a94a0  old arm: add BUILD_KERNEL code in arm/arm_vectors.S

No new revisions were added by this update.

Summary of changes:
 arch/arm/src/arm/arm_vectors.S | 305 +
 1 file changed, 305 insertions(+)


[incubator-nuttx] 01/02: Revert "os init_state: add new state OSINIT_IDLELOOP"

2022-02-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch revert-5577-mine
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 170381496cb17cc4be046da11847884ba8a7fa0d
Author: Masayuki Ishikawa 
AuthorDate: Tue Feb 22 17:33:14 2022 +0900

Revert "os init_state: add new state OSINIT_IDLELOOP"

This reverts commit 051bb32010608831f838158848c03f20c1458e93.
---
 include/nuttx/init.h  | 4 +---
 sched/init/nx_start.c | 4 
 sched/semaphore/sem_trywait.c | 4 +---
 sched/semaphore/sem_wait.c| 4 +---
 4 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/include/nuttx/init.h b/include/nuttx/init.h
index 3bdc67f..1d73ba7 100644
--- a/include/nuttx/init.h
+++ b/include/nuttx/init.h
@@ -41,7 +41,6 @@
 #define OSINIT_MM_READY()(g_nx_initstate >= OSINIT_MEMORY)
 #define OSINIT_HW_READY()(g_nx_initstate >= OSINIT_HARDWARE)
 #define OSINIT_OS_READY()(g_nx_initstate >= OSINIT_OSREADY)
-#define OSINIT_IDLELOOP()(g_nx_initstate >= OSINIT_IDLELOOP)
 #define OSINIT_OS_INITIALIZING() (g_nx_initstate  < OSINIT_OSREADY)
 
 /
@@ -66,9 +65,8 @@ enum nx_initstate_e
   * to support the hardware are also available but
   * the OS has not yet completed its full
   * initialization. */
-  OSINIT_OSREADY   = 5,  /* The OS is fully initialized and multi-tasking is
+  OSINIT_OSREADY   = 5   /* The OS is fully initialized and multi-tasking is
   * active. */
-  OSINIT_IDLELOOP  = 6   /* The OS enter idle loop */
 };
 
 /
diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c
index 74473e8..d789464 100644
--- a/sched/init/nx_start.c
+++ b/sched/init/nx_start.c
@@ -776,10 +776,6 @@ void nx_start(void)
 
   DEBUGVERIFY(nx_bringup());
 
-  /* Enter to idleloop */
-
-  g_nx_initstate = OSINIT_IDLELOOP;
-
   /* Let other threads have access to the memory manager */
 
   sched_unlock();
diff --git a/sched/semaphore/sem_trywait.c b/sched/semaphore/sem_trywait.c
index 1083dd9..2da2139 100644
--- a/sched/semaphore/sem_trywait.c
+++ b/sched/semaphore/sem_trywait.c
@@ -29,7 +29,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 
@@ -70,10 +69,9 @@ int nxsem_trywait(FAR sem_t *sem)
   irqstate_t flags;
   int ret;
 
-  /* This API should not be called from interrupt handlers & idleloop */
+  /* This API should not be called from interrupt handlers */
 
   DEBUGASSERT(sem != NULL && up_interrupt_context() == false);
-  DEBUGASSERT(OSINIT_IDLELOOP() && !sched_idletask());
 
   if (sem != NULL)
 {
diff --git a/sched/semaphore/sem_wait.c b/sched/semaphore/sem_wait.c
index 0e1acc4..eec6772 100644
--- a/sched/semaphore/sem_wait.c
+++ b/sched/semaphore/sem_wait.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -74,10 +73,9 @@ int nxsem_wait(FAR sem_t *sem)
   irqstate_t flags;
   int ret = -EINVAL;
 
-  /* This API should not be called from interrupt handlers & idleloop */
+  /* This API should not be called from interrupt handlers */
 
   DEBUGASSERT(sem != NULL && up_interrupt_context() == false);
-  DEBUGASSERT(OSINIT_IDLELOOP() && !sched_idletask());
 
   /* The following operations must be performed with interrupts
* disabled because nxsem_post() may be called from an interrupt


[incubator-nuttx] 02/02: Revert "pm: remove unnecessary depends on OSINIT_OS_READY"

2022-02-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch revert-5577-mine
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 8781ae546f4736a5648fc9f509670c93c859bf1d
Author: Masayuki Ishikawa 
AuthorDate: Tue Feb 22 17:33:14 2022 +0900

Revert "pm: remove unnecessary depends on OSINIT_OS_READY"

This reverts commit 8785673a7048d83d49327bbc1c9a6a17e6a8b27c.
---
 drivers/power/pm_register.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/power/pm_register.c b/drivers/power/pm_register.c
index fa95b8e..3c68f31 100644
--- a/drivers/power/pm_register.c
+++ b/drivers/power/pm_register.c
@@ -62,11 +62,19 @@ int pm_register(FAR struct pm_callback_s *callbacks)
 
   /* Add the new entry to the end of the list of registered callbacks */
 
-  ret = pm_lock();
-  if (ret == OK)
+  if (OSINIT_OS_READY())
+{
+  ret = pm_lock();
+  if (ret == OK)
+{
+  dq_addlast(&callbacks->entry, &g_pmglobals.registry);
+  pm_unlock();
+}
+}
+  else
 {
   dq_addlast(&callbacks->entry, &g_pmglobals.registry);
-  pm_unlock();
+  ret = OK;
 }
 
   return ret;


[incubator-nuttx] branch revert-5577-mine created (now 8781ae5)

2022-02-22 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a change to branch revert-5577-mine
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


  at 8781ae5  Revert "pm: remove unnecessary depends on OSINIT_OS_READY"

This branch includes the following new commits:

 new 1703814  Revert "os init_state: add new state OSINIT_IDLELOOP"
 new 8781ae5  Revert "pm: remove unnecessary depends on OSINIT_OS_READY"

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.



[incubator-nuttx] 02/02: boards/risc-v/k210/maix-bit: Add initial autoled support

2020-06-07 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 2b0324c3bfe7425a32e8cac846f1d463b46ec507
Author: Huang Qi 
AuthorDate: Sat Jun 6 13:18:14 2020 +0800

boards/risc-v/k210/maix-bit: Add initial autoled support

Signed-off-by: Huang Qi 
---
 arch/risc-v/src/k210/Make.defs  |  1 +
 arch/risc-v/src/k210/k210_fpioa.h   |  4 +-
 boards/Kconfig  |  1 +
 boards/risc-v/k210/maix-bit/include/board.h | 22 +++
 boards/risc-v/k210/maix-bit/src/Makefile|  4 ++
 boards/risc-v/k210/maix-bit/src/k210_boot.c |  2 +
 boards/risc-v/k210/maix-bit/src/k210_leds.c | 59 +
 7 files changed, 91 insertions(+), 2 deletions(-)

diff --git a/arch/risc-v/src/k210/Make.defs b/arch/risc-v/src/k210/Make.defs
index c8ad47e..718a785 100644
--- a/arch/risc-v/src/k210/Make.defs
+++ b/arch/risc-v/src/k210/Make.defs
@@ -47,6 +47,7 @@ CMN_CSRCS  += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c
 CMN_CSRCS  += riscv_releasepending.c riscv_reprioritizertr.c
 CMN_CSRCS  += riscv_releasestack.c riscv_stackframe.c k210_schedulesigaction.c
 CMN_CSRCS  += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
+CMN_CSRCS  += riscv_mdelay.c
 
 ifeq ($(CONFIG_STACK_COLORATION),y)
 CMN_CSRCS += riscv_checkstack.c
diff --git a/arch/risc-v/src/k210/k210_fpioa.h 
b/arch/risc-v/src/k210/k210_fpioa.h
index 5b13884..b3c7349 100644
--- a/arch/risc-v/src/k210/k210_fpioa.h
+++ b/arch/risc-v/src/k210/k210_fpioa.h
@@ -80,8 +80,8 @@
 #define K210_IO_SL (1 << 19)
 #define K210_IO_ST (1 << 23)
 
-#define K210_FLAG_GPIOHS  (K210_IO_DS(0xf) | K210_IO_OUTPUT_ENABLE | \
-   K210_IO_INPUT_ENABLE | K210_IO_ST)
+#define K210_IOFLAG_GPIOHS (K210_IO_DS(0xf) | K210_IO_OUTPUT_ENABLE | \
+K210_IO_INPUT_ENABLE | K210_IO_ST)
 
 /
  * Public Functions Prototypes
diff --git a/boards/Kconfig b/boards/Kconfig
index 860f3ec..917903f 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -549,6 +549,7 @@ config ARCH_BOARD_LX_CPU
 config ARCH_BOARD_MAIX_BIT
bool "Sipeed Maix Bit board"
depends on ARCH_CHIP_K210
+   select ARCH_HAVE_LEDS
---help---
This is the board configuration for the port of NuttX to the
Sipeed Maix Bit board. This board features the RISC-V K210
diff --git a/boards/risc-v/k210/maix-bit/include/board.h 
b/boards/risc-v/k210/maix-bit/include/board.h
index b0127c3..c3862bc 100644
--- a/boards/risc-v/k210/maix-bit/include/board.h
+++ b/boards/risc-v/k210/maix-bit/include/board.h
@@ -48,6 +48,28 @@
 
 #include "k210.h"
 
+#include "k210_fpioa.h"
+
+/
+ * Pre-processor Definitions
+ /
+
+#define BOARD_LED_PAD 14 /* Connected to red led */
+
+/* Map pad 14 to gpiohs io 0 */
+
+#define BOARD_LED_IO_FUNC K210_IO_FUNC_GPIOHS0
+#define BOARD_LED_IO  0
+
+#define LED_STARTED   0  /* N/C */
+#define LED_HEAPALLOCATE  1  /* N/C */
+#define LED_IRQSENABLED   2  /* N/C */
+#define LED_STACKCREATED  3  /* N/C */
+#define LED_INIRQ 4  /* N/C */
+#define LED_SIGNAL5  /* N/C */
+#define LED_ASSERTION 6  /* N/C */
+#define LED_PANIC 7  /* blink */
+
 /
  * Public Types
  /
diff --git a/boards/risc-v/k210/maix-bit/src/Makefile 
b/boards/risc-v/k210/maix-bit/src/Makefile
index dc91ae4..cbb092e 100644
--- a/boards/risc-v/k210/maix-bit/src/Makefile
+++ b/boards/risc-v/k210/maix-bit/src/Makefile
@@ -41,4 +41,8 @@ ifeq ($(CONFIG_LIB_BOARDCTL),y)
 CSRCS += k210_appinit.c
 endif
 
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += k210_leds.c
+endif
+
 include $(TOPDIR)/boards/Board.mk
diff --git a/boards/risc-v/k210/maix-bit/src/k210_boot.c 
b/boards/risc-v/k210/maix-bit/src/k210_boot.c
index fe08418..8c6f42c 100644
--- a/boards/risc-v/k210/maix-bit/src/k210_boot.c
+++ b/boards/risc-v/k210/maix-bit/src/k210_boot.c
@@ -41,6 +41,7 @@
 
 #include 
 
+#include 
 #include 
 
 /
@@ -68,4 +69,5 @@
 
 void k210_boardinitialize(void)
 {
+  board_autoled_initialize();
 }
diff --git a/boards/risc-v/k210/maix-bit/src/k210_leds.c 
b/boards/risc-v/k210/maix-bit/src/k210_leds.c
new file mode 100644
index 000..15442cb
--- /dev/null
+++ b/boards/risc-v/k210/maix-bit/src/k210_leds.c
@@ -0,0 +1,59 @@
+/
+ * boards/risc-v/k210/maix-bit/src/

[incubator-nuttx] branch master updated (24262a4 -> 2b0324c)

2020-06-07 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 24262a4  Fix nxstyle issue
 new bcd7ccc  arch/risc-v/src/k210: Add basic gpiohs support
 new 2b0324c  boards/risc-v/k210/maix-bit: Add initial autoled support

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/k210/Make.defs |  5 +-
 arch/risc-v/src/k210/hardware/k210_memorymap.h |  3 +-
 .../litex_allocateheap.c => k210/k210_fpioa.c} | 20 +++--
 arch/risc-v/src/k210/k210_fpioa.h  | 92 ++
 .../litex_clockconfig.c => k210/k210_gpiohs.c} | 64 +--
 .../risc-v/src/k210/k210_gpiohs.h  | 70 +++-
 boards/Kconfig |  1 +
 boards/risc-v/k210/maix-bit/include/board.h| 22 ++
 boards/risc-v/k210/maix-bit/src/Makefile   |  4 +
 boards/risc-v/k210/maix-bit/src/k210_boot.c|  2 +
 .../risc-v/k210/maix-bit/src/k210_leds.c   | 30 +--
 11 files changed, 232 insertions(+), 81 deletions(-)
 copy arch/risc-v/src/{litex/litex_allocateheap.c => k210/k210_fpioa.c} (79%)
 create mode 100644 arch/risc-v/src/k210/k210_fpioa.h
 copy arch/risc-v/src/{litex/litex_clockconfig.c => k210/k210_gpiohs.c} (55%)
 copy boards/renesas/rx65n/rx65n-rsk1mb/include/rx65n_gpio.h => 
arch/risc-v/src/k210/k210_gpiohs.h (67%)
 copy arch/risc-v/src/litex/litex_allocateheap.c => 
boards/risc-v/k210/maix-bit/src/k210_leds.c (70%)



[incubator-nuttx] 01/02: arch/risc-v/src/k210: Add basic gpiohs support

2020-06-07 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit bcd7ccc0b5392279a159de056779830b57092eb2
Author: Huang Qi 
AuthorDate: Sat Jun 6 10:42:33 2020 +0800

arch/risc-v/src/k210: Add basic gpiohs support

Signed-off-by: Huang Qi 
---
 arch/risc-v/src/k210/Make.defs |  4 +-
 arch/risc-v/src/k210/hardware/k210_memorymap.h |  3 +-
 .../{hardware/k210_memorymap.h => k210_fpioa.c}| 39 +
 arch/risc-v/src/k210/k210_fpioa.h  | 92 ++
 arch/risc-v/src/k210/k210_gpiohs.c | 83 +++
 arch/risc-v/src/k210/k210_gpiohs.h | 83 +++
 6 files changed, 281 insertions(+), 23 deletions(-)

diff --git a/arch/risc-v/src/k210/Make.defs b/arch/risc-v/src/k210/Make.defs
index f6b8f72..c8ad47e 100644
--- a/arch/risc-v/src/k210/Make.defs
+++ b/arch/risc-v/src/k210/Make.defs
@@ -59,8 +59,8 @@ endif
 # Specify our C code within this directory to be included
 CHIP_CSRCS  = k210_allocateheap.c k210_clockconfig.c
 CHIP_CSRCS += k210_idle.c k210_irq.c k210_irq_dispatch.c
-CHIP_CSRCS += k210_lowputc.c k210_serial.c
-CHIP_CSRCS += k210_start.c k210_timerisr.c
+CHIP_CSRCS += k210_lowputc.c k210_serial.c k210_fpioa.c
+CHIP_CSRCS += k210_start.c k210_timerisr.c k210_gpiohs.c
 
 ifeq ($(CONFIG_SMP), y)
 CHIP_CSRCS += k210_cpuidlestack.c k210_cpuindex.c
diff --git a/arch/risc-v/src/k210/hardware/k210_memorymap.h 
b/arch/risc-v/src/k210/hardware/k210_memorymap.h
index ac09406..60b6a2a 100644
--- a/arch/risc-v/src/k210/hardware/k210_memorymap.h
+++ b/arch/risc-v/src/k210/hardware/k210_memorymap.h
@@ -39,7 +39,8 @@
 #else
 #define K210_UART0_BASE   0x3800
 #endif
-#define K210_GPIO_BASE0x38001000
+#define K210_GPIOHS_BASE  0x38001000
+#define K210_FPIOA_BASE   0x502B
 
 #define K210_SYSCTL_BASE  0x5044
 
diff --git a/arch/risc-v/src/k210/hardware/k210_memorymap.h 
b/arch/risc-v/src/k210/k210_fpioa.c
similarity index 62%
copy from arch/risc-v/src/k210/hardware/k210_memorymap.h
copy to arch/risc-v/src/k210/k210_fpioa.c
index ac09406..bb71863 100644
--- a/arch/risc-v/src/k210/hardware/k210_memorymap.h
+++ b/arch/risc-v/src/k210/k210_fpioa.c
@@ -1,9 +1,5 @@
 /
- * arch/risc-v/src/k210/hardware/k210_memorymap.h
- *
- * Derives from software originally provided by Canaan Inc
- *
- *   Copyright 2018 Canaan Inc
+ * arch/risc-v/src/k210/k210_fpioa.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -22,25 +18,28 @@
  *
  /
 
-#ifndef __ARCH_RISCV_SRC_K210_HARDWARE_K210_MEMORYMAP_H
-#define __ARCH_RISCV_SRC_K210_HARDWARE_K210_MEMORYMAP_H
-
 /
- * Pre-processor Definitions
+ * Included Files
  /
 
-/* Register Base Address /
+#include 
 
-#define K210_CLINT_BASE   0x0200
-#define K210_PLIC_BASE0x0c00
+#include 
+#include 
 
-#ifdef CONFIG_K210_WITH_QEMU
-#define K210_UART0_BASE   0x1001
-#else
-#define K210_UART0_BASE   0x3800
-#endif
-#define K210_GPIO_BASE0x38001000
+#include "riscv_internal.h"
+#include "riscv_arch.h"
 
-#define K210_SYSCTL_BASE  0x5044
+#include "k210_memorymap.h"
+#include "k210_fpioa.h"
+
+/
+ * Public Functions
+ /
 
-#endif /* __ARCH_RISCV_SRC_K210_HARDWARE_K210_MEMORYMAP_H */
+void k210_fpioa_config(uint32_t io, uint32_t ioflags)
+{
+  uint32_t *fpioa = (uint32_t *)K210_FPIOA_BASE;
+  DEBUGASSERT(io < K210_IO_NUMBER);
+  putreg32(ioflags, &fpioa[io]);
+}
diff --git a/arch/risc-v/src/k210/k210_fpioa.h 
b/arch/risc-v/src/k210/k210_fpioa.h
new file mode 100644
index 000..5b13884
--- /dev/null
+++ b/arch/risc-v/src/k210/k210_fpioa.h
@@ -0,0 +1,92 @@
+/
+ * arch/risc-v/src/k210/k210_fpioa.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless 

[incubator-nuttx] branch master updated (6f3cef8 -> f4a9c45)

2020-06-08 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 6f3cef8  libc: Add the remaining wscanf series declaration
 add f4a9c45  Move Serial Console to USART1 to keep compatibility with 
BluePill

No new revisions were added by this update.

Summary of changes:
 boards/arm/stm32/stm32f411-minimum/configs/nsh/defconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



[incubator-nuttx] branch master updated (02ad0e9 -> c6c0214)

2020-06-14 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 02ad0e9  drivers/leds/ncp5623c&pca9635pw: Fix nxstyle issues.
 new 8fdfb74  drivers: video: fix uninitialized variables
 new c6c0214  boards: arm: cxd56: initilize the video stream driver from 
the board

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:
 boards/arm/cxd56xx/spresense/src/cxd56_bringup.c | 15 +--
 drivers/video/video.c| 15 +++
 include/nuttx/video/video.h  |  5 ++---
 3 files changed, 26 insertions(+), 9 deletions(-)



[incubator-nuttx] 01/02: drivers: video: fix uninitialized variables

2020-06-14 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 8fdfb745d62957a4f3f1a53a19cf299798f3201e
Author: Alin Jerpelea 
AuthorDate: Sun Jun 14 15:41:57 2020 +0200

drivers: video: fix uninitialized variables

Fix the build error by initializing the variables before we perform
th querry for the ext control.

Signed-off-by: Alin Jerpelea 
---
 drivers/video/video.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/video/video.c b/drivers/video/video.c
index 2be1530..922c64c 100644
--- a/drivers/video/video.c
+++ b/drivers/video/video.c
@@ -1035,8 +1035,14 @@ static int video_queryctrl(FAR struct v4l2_queryctrl 
*ctrl)
 
   /* Replace to VIDIOC_QUERY_EXT_CTRL format */
 
-  ext_ctrl.ctrl_class = ctrl->ctrl_class;
-  ext_ctrl.id = ctrl->id;
+  ext_ctrl.ctrl_class = ctrl->ctrl_class;
+  ext_ctrl.id = ctrl->id;
+  ext_ctrl.type   = ctrl->type;
+  ext_ctrl.minimum= ctrl->minimum;
+  ext_ctrl.maximum= ctrl->maximum;
+  ext_ctrl.step   = ctrl->step;
+  ext_ctrl.default_value  = ctrl->default_value;
+  ext_ctrl.flags  = ctrl->flags;
 
   ret = video_query_ext_ctrl(&ext_ctrl);
 



[incubator-nuttx] 02/02: boards: arm: cxd56: initilize the video stream driver from the board

2020-06-14 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit c6c0214f9a0e29fe563060069979d0cebf474d95
Author: Alin Jerpelea 
AuthorDate: Thu Jun 11 16:03:33 2020 +0200

boards: arm: cxd56: initilize the video stream driver from the board

The video stream driver must be intialized from the board to comply with 
NuttX

NOTE:
Please remove the initalization from any camera example

Signed-off-by: Alin Jerpelea 
---
 boards/arm/cxd56xx/spresense/src/cxd56_bringup.c | 15 +--
 drivers/video/video.c|  5 +++--
 include/nuttx/video/video.h  |  5 ++---
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_bringup.c 
b/boards/arm/cxd56xx/spresense/src/cxd56_bringup.c
index 019d2f6..2b87f38 100644
--- a/boards/arm/cxd56xx/spresense/src/cxd56_bringup.c
+++ b/boards/arm/cxd56xx/spresense/src/cxd56_bringup.c
@@ -203,6 +203,9 @@ int cxd56_bringup(void)
 {
   struct pm_cpu_wakelock_s wlock;
   int ret;
+#ifdef CONFIG_VIDEO_ISX012
+  FAR const struct video_devops_s *devops;
+#endif
 
   ret = nsh_cpucom_initialize();
   if (ret < 0)
@@ -359,14 +362,22 @@ int cxd56_bringup(void)
   _err("ERROR: Failed to initialize ISX012 board. %d\n", errno);
 }
 
-  g_video_devops = isx012_initialize();
-  if (g_video_devops == NULL)
+  devops  = isx012_initialize();
+  if (devops == NULL)
 {
   _err("ERROR: Failed to populate ISX012 devops. %d\n", errno);
   ret = ERROR;
 }
 #endif /* CONFIG_VIDEO_ISX012 */
 
+#ifdef CONFIG_VIDEO_STREAM
+  ret = video_initialize("/dev/video", devops);
+  if (ret < 0)
+{
+  _err("ERROR: Failed to initialize video stream driver. \n");
+}
+#endif
+
   /* In order to prevent Hi-Z from being input to the SD Card controller,
* Initialize SDIO pins to GPIO low output with internal pull-down.
*/
diff --git a/drivers/video/video.c b/drivers/video/video.c
index 922c64c..506d7ac 100644
--- a/drivers/video/video.c
+++ b/drivers/video/video.c
@@ -222,7 +222,7 @@ static int video_s_ext_ctrls(FAR struct video_mng_s *priv,
  * Public Data
  /
 
-FAR const struct video_devops_s *g_video_devops;
+static const struct video_devops_s *g_video_devops;
 
 /
  * Private Data
@@ -1495,7 +1495,8 @@ static int video_unregister(FAR video_mng_t *v_mgr)
  * Public Functions
  /
 
-int video_initialize(FAR const char *devpath)
+int video_initialize(FAR const char *devpath,
+ FAR const struct video_devops_s *devops)
 {
   if (is_initialized)
 {
diff --git a/include/nuttx/video/video.h b/include/nuttx/video/video.h
index f403281..b83c04f 100644
--- a/include/nuttx/video/video.h
+++ b/include/nuttx/video/video.h
@@ -625,8 +625,6 @@ struct v4l2_ext_controls
  * Public Data
  /
 
-extern FAR const struct video_devops_s *g_video_devops;
-
 /
  * Public Function Prototypes
  /
@@ -639,7 +637,8 @@ extern FAR const struct video_devops_s *g_video_devops;
  *  negative value is returned.
  */
 
-int video_initialize(FAR const char *devpath);
+int video_initialize(FAR const char *devpath,
+ FAR const struct video_devops_s *devops);
 
 /* Uninitialize video driver.
  *



[incubator-nuttx] branch feature/syscall-instrumentation created (now d24bd78)

2020-06-23 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a change to branch feature/syscall-instrumentation
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


  at d24bd78  libc: Implement pathconf and fpathconf

No new revisions were added by this update.



[incubator-nuttx-apps] branch master updated: Make programs under apps/bin executable to generate symtab file rightly

2020-06-25 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new dbfa8d5  Make programs under apps/bin executable to generate symtab 
file rightly
dbfa8d5 is described below

commit dbfa8d5f13580f4a12c38097cc4475c8ed81af28
Author: liuhaitao 
AuthorDate: Mon Jun 22 20:04:25 2020 +0800

Make programs under apps/bin executable to generate symtab file rightly

Make programs under apps/bin executable since tools/mksymtab.sh called with
'find $dir -type f -perm -a=x 2>/dev/null'. So generate symtab file rightly.

Signed-off-by: liuhaitao 
---
 Application.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Application.mk b/Application.mk
index 9f3d47d..49103c3 100644
--- a/Application.mk
+++ b/Application.mk
@@ -158,6 +158,7 @@ ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
 else
$(call ELFLD,$(firstword $(PROGOBJ)),$(firstword $(PROGLIST)))
 endif
+   $(Q) chmod +x $(firstword $(PROGLIST))
 ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
$(Q) $(STRIP) $(firstword $(PROGLIST))
 endif



[incubator-nuttx-apps] branch master updated (8750db6 -> f571af1)

2020-06-30 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 8750db6  examples: fix nxstyle warning
 add f571af1  Examples: camera: add a simple camera snapshot example

No new revisions were added by this update.

Summary of changes:
 examples/camera/Kconfig|  29 +
 examples/{audio_rttl => camera}/Make.defs  |   6 +-
 examples/{bmi160 => camera}/Makefile   |  21 +-
 examples/camera/README.txt |  39 ++
 .../camera/camera_fileutil.c   | 107 ++--
 examples/{igmp/igmp.h => camera/camera_fileutil.h} |  34 +-
 examples/camera/camera_main.c  | 607 +
 7 files changed, 774 insertions(+), 69 deletions(-)
 create mode 100644 examples/camera/Kconfig
 copy examples/{audio_rttl => camera}/Make.defs (94%)
 copy examples/{bmi160 => camera}/Makefile (82%)
 create mode 100644 examples/camera/README.txt
 copy netutils/ftpc/ftpc_filesize.c => examples/camera/camera_fileutil.c (61%)
 copy examples/{igmp/igmp.h => camera/camera_fileutil.h} (72%)
 create mode 100644 examples/camera/camera_main.c



[incubator-nuttx] branch master updated: spresense:example_camera: Remove CONFIG_SYSTEM_NSH_CXXINITIALIZE

2020-07-08 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new a62b453  spresense:example_camera: Remove 
CONFIG_SYSTEM_NSH_CXXINITIALIZE
a62b453 is described below

commit a62b45380b546664da44f335684b0e11205ae9cf
Author: Xiang Xiao 
AuthorDate: Thu Jul 9 10:28:02 2020 +0800

spresense:example_camera: Remove CONFIG_SYSTEM_NSH_CXXINITIALIZE

since it doesn't exist anymore

Signed-off-by: Xiang Xiao 
---
 boards/arm/cxd56xx/spresense/configs/example_camera/defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/boards/arm/cxd56xx/spresense/configs/example_camera/defconfig 
b/boards/arm/cxd56xx/spresense/configs/example_camera/defconfig
index d7ebdcc..78d2ebb 100644
--- a/boards/arm/cxd56xx/spresense/configs/example_camera/defconfig
+++ b/boards/arm/cxd56xx/spresense/configs/example_camera/defconfig
@@ -81,7 +81,6 @@ CONFIG_START_MONTH=12
 CONFIG_START_YEAR=2011
 CONFIG_SYSTEM_CLE=y
 CONFIG_SYSTEM_NSH=y
-CONFIG_SYSTEM_NSH_CXXINITIALIZE=y
 CONFIG_SYSTEM_USBMSC=y
 CONFIG_UART1_SERIAL_CONSOLE=y
 CONFIG_USBDEV=y



[incubator-nuttx] branch master updated: sim: add __cxa_atexit into the name list

2020-07-08 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 6b316ed  sim: add __cxa_atexit into the name list
6b316ed is described below

commit 6b316edcda6ee2eece92bb73cb4178e2a2b5bd3a
Author: Xiang Xiao 
AuthorDate: Thu Jul 9 01:52:08 2020 +0800

sim: add __cxa_atexit into the name list

Signed-off-by: Xiang Xiao 
Change-Id: I81e75532db1953584124142763f9d07ddb788898
---
 arch/sim/src/nuttx-names.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/sim/src/nuttx-names.in b/arch/sim/src/nuttx-names.in
index 3108c48..e23ef23 100644
--- a/arch/sim/src/nuttx-names.in
+++ b/arch/sim/src/nuttx-names.in
@@ -32,6 +32,7 @@
 #endif
 
 NXSYMBOLS(__errno)
+NXSYMBOLS(__cxa_atexit)
 NXSYMBOLS(_exit)
 NXSYMBOLS(accept)
 NXSYMBOLS(asprintf)



[incubator-nuttx] branch master updated (81d814b -> c3e256e)

2020-07-09 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 81d814b  include/nuttx/arch.h: Trivial typo fixes.
 add c3e256e  libxx: Make __dso_handle weak

No new revisions were added by this update.

Summary of changes:
 include/nuttx/compiler.h| 6 ++
 libs/libxx/libxx.hxx| 2 +-
 libs/libxx/libxx_cxa_atexit.cxx | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)



[incubator-nuttx] branch master updated (a58193a -> 78862c5)

2020-07-27 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from a58193a  arch: imxrt: Fix style violations in imxrt_enet.c
 new f2446ec  arch/sim: unify the prefix(g_cpu_) for SMP related variables
 new 71a9d24  arch/sim: Replace sigprocmask with pthread_sigmask in main 
thread
 new 53f33a7  arch/sim: Synchronize the creation of idle thread by semaphore
 new 78862c5  arch/sim: Fix the wrong sleep time calculation in 
sim_idle_trampoline

The 4 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/sim/src/sim/up_simsmp.c | 68 ++--
 1 file changed, 27 insertions(+), 41 deletions(-)



[incubator-nuttx] 02/04: arch/sim: Replace sigprocmask with pthread_sigmask in main thread

2020-07-27 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 71a9d2402de505ea7d1f8f556b1fdbf2f85f
Author: Xiang Xiao 
AuthorDate: Sat Jul 25 23:25:34 2020 +0800

arch/sim: Replace sigprocmask with pthread_sigmask in main thread

like other idle thread

Signed-off-by: Xiang Xiao 
---
 arch/sim/src/sim/up_simsmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sim/src/sim/up_simsmp.c b/arch/sim/src/sim/up_simsmp.c
index 22f68a5..68c8469 100644
--- a/arch/sim/src/sim/up_simsmp.c
+++ b/arch/sim/src/sim/up_simsmp.c
@@ -270,7 +270,7 @@ void sim_cpu0_start(void)
   sigemptyset(&set);
   sigaddset(&set, SIGUSR1);
 
-  ret = sigprocmask(SIG_UNBLOCK, &set, NULL);
+  ret = pthread_sigmask(SIG_UNBLOCK, &set, NULL);
   if (ret < 0)
 {
   return;



[incubator-nuttx] 03/04: arch/sim: Synchronize the creation of idle thread by semaphore

2020-07-27 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 53f33a7ea264f1c07bc2d4835614ab7114954ad7
Author: Xiang Xiao 
AuthorDate: Sat Jul 25 23:22:28 2020 +0800

arch/sim: Synchronize the creation of idle thread by semaphore

it's wrong to synchronize with mutex here

Signed-off-by: Xiang Xiao 
---
 arch/sim/src/sim/up_simsmp.c | 37 -
 1 file changed, 12 insertions(+), 25 deletions(-)

diff --git a/arch/sim/src/sim/up_simsmp.c b/arch/sim/src/sim/up_simsmp.c
index 68c8469..7c78005 100644
--- a/arch/sim/src/sim/up_simsmp.c
+++ b/arch/sim/src/sim/up_simsmp.c
@@ -39,6 +39,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -63,8 +64,8 @@ typedef unsigned char spinlock_t;
 
 struct sim_cpuinfo_s
 {
-  int cpu;/* CPU number */
-  pthread_mutex_t mutex;  /* For synchronization */
+  int cpu;/* CPU number */
+  sem_t done; /* For synchronization */
 };
 
 /
@@ -159,7 +160,7 @@ static void *sim_idle_trampoline(void *arg)
 
   /* Let up_cpu_start() continue */
 
-  pthread_mutex_unlock(&cpuinfo->mutex);
+  sem_post(&cpuinfo->done);
 
   /* up_cpu_started() is logically a part of this function but needs to be
* inserted in the path because in needs to access NuttX domain definition.
@@ -344,19 +345,10 @@ int up_cpu_start(int cpu)
   /* Initialize the CPU info */
 
   cpuinfo.cpu = cpu;
-  ret = pthread_mutex_init(&cpuinfo.mutex, NULL);
+  ret = sem_init(&cpuinfo.done, 0, 0);
   if (ret != 0)
 {
-  return -ret;  /* REVISIT:  That is a host errno value. */
-}
-
-  /* Lock the mutex */
-
-  ret = pthread_mutex_lock(&cpuinfo.mutex);
-  if (ret != 0)
-{
-  ret = -ret;  /* REVISIT: This is a host errno value. */
-  goto errout_with_mutex;
+  return -errno;  /* REVISIT:  That is a host errno value. */
 }
 
   /* Start the CPU emulation thread.  This is analogous to starting the CPU
@@ -368,24 +360,19 @@ int up_cpu_start(int cpu)
   if (ret != 0)
 {
   ret = -ret;  /* REVISIT:  That is a host errno value. */
-  goto errout_with_lock;
+  goto errout_with_sem;
 }
 
-  /* Try to lock the mutex again.  This will block until the pthread unlocks
-   * the mutex.
-   */
+  /* This will block until the pthread post the semaphore */
 
-  ret = pthread_mutex_lock(&cpuinfo.mutex);
+  ret = sem_wait(&cpuinfo.done);
   if (ret != 0)
 {
-  ret = -ret;  /* REVISIT:  That is a host errno value. */
+  ret = -errno;  /* REVISIT:  That is a host errno value. */
 }
 
-errout_with_lock:
-  pthread_mutex_unlock(&cpuinfo.mutex);
-
-errout_with_mutex:
-  pthread_mutex_destroy(&cpuinfo.mutex);
+errout_with_sem:
+  sem_destroy(&cpuinfo.done);
   return ret;
 }
 



[incubator-nuttx] 01/04: arch/sim: unify the prefix(g_cpu_) for SMP related variables

2020-07-27 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit f2446ecb901da1d0d509376cdb1ddeb7d972cc96
Author: Xiang Xiao 
AuthorDate: Sat Jul 25 23:10:21 2020 +0800

arch/sim: unify the prefix(g_cpu_) for SMP related variables

Signed-off-by: Xiang Xiao 
---
 arch/sim/src/sim/up_simsmp.c | 24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/arch/sim/src/sim/up_simsmp.c b/arch/sim/src/sim/up_simsmp.c
index 669562d..22f68a5 100644
--- a/arch/sim/src/sim/up_simsmp.c
+++ b/arch/sim/src/sim/up_simsmp.c
@@ -37,8 +37,6 @@
  * Included Files
  /
 
-#define _GNU_SOURCE 1
-
 #include 
 #include 
 #include 
@@ -73,8 +71,8 @@ struct sim_cpuinfo_s
  * Private Data
  /
 
-static pthread_key_t  g_cpukey;
-static pthread_t  g_sim_cputhread[CONFIG_SMP_NCPUS];
+static pthread_key_t g_cpu_key;
+static pthread_t g_cpu_thread[CONFIG_SMP_NCPUS];
 
 /* These spinlocks are used in the SMP configuration in order to implement
  * up_cpu_pause().  The protocol for CPUn to pause CPUm is as follows
@@ -139,9 +137,9 @@ static void *sim_idle_trampoline(void *arg)
   sigset_t set;
   int ret;
 
-  /* Set the CPU number zero for the CPU thread */
+  /* Set the CPU number for the CPU thread */
 
-  ret = pthread_setspecific(g_cpukey,
+  ret = pthread_setspecific(g_cpu_key,
(const void *)((uintptr_t)cpuinfo->cpu));
   if (ret != 0)
 {
@@ -207,7 +205,7 @@ static void *sim_idle_trampoline(void *arg)
 
 static void sim_handle_signal(int signo, siginfo_t *info, void *context)
 {
-  int cpu = (int)((uintptr_t)pthread_getspecific(g_cpukey));
+  int cpu = (int)((uintptr_t)pthread_getspecific(g_cpu_key));
 
   up_cpu_paused(cpu);
 }
@@ -237,11 +235,11 @@ void sim_cpu0_start(void)
   sigset_t set;
   int ret;
 
-  g_sim_cputhread[0] = pthread_self();
+  g_cpu_thread[0] = pthread_self();
 
   /* Create the pthread key */
 
-  ret = pthread_key_create(&g_cpukey, NULL);
+  ret = pthread_key_create(&g_cpu_key, NULL);
   if (ret != 0)
 {
   return;
@@ -249,7 +247,7 @@ void sim_cpu0_start(void)
 
   /* Set the CPU number zero for the CPU thread */
 
-  ret = pthread_setspecific(g_cpukey, (const void *)0);
+  ret = pthread_setspecific(g_cpu_key, (const void *)0);
   if (ret != 0)
 {
   return;
@@ -301,7 +299,7 @@ void sim_cpu0_start(void)
 
 int up_cpu_index(void)
 {
-  void *value = pthread_getspecific(g_cpukey);
+  void *value = pthread_getspecific(g_cpu_key);
   return (int)((uintptr_t)value);
 }
 
@@ -365,7 +363,7 @@ int up_cpu_start(int cpu)
* in a multi-CPU hardware model.
*/
 
-  ret = pthread_create(&g_sim_cputhread[cpu],
+  ret = pthread_create(&g_cpu_thread[cpu],
NULL, sim_idle_trampoline, &cpuinfo);
   if (ret != 0)
 {
@@ -426,7 +424,7 @@ int up_cpu_pause(int cpu)
 
   /* Signal the CPU thread */
 
-  pthread_kill(g_sim_cputhread[cpu], SIGUSR1);
+  pthread_kill(g_cpu_thread[cpu], SIGUSR1);
 
   /* Spin, waiting for the thread to pause */
 



[incubator-nuttx] 04/04: arch/sim: Fix the wrong sleep time calculation in sim_idle_trampoline

2020-07-27 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 78862c51dceda641edfdc00a57e66d2825f63e67
Author: Xiang Xiao 
AuthorDate: Sat Jul 25 23:31:54 2020 +0800

arch/sim: Fix the wrong sleep time calculation in sim_idle_trampoline

Signed-off-by: Xiang Xiao 
---
 arch/sim/src/sim/up_simsmp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/sim/src/sim/up_simsmp.c b/arch/sim/src/sim/up_simsmp.c
index 7c78005..2584347 100644
--- a/arch/sim/src/sim/up_simsmp.c
+++ b/arch/sim/src/sim/up_simsmp.c
@@ -135,6 +135,9 @@ void sched_note_cpu_resume(struct tcb_s *tcb, int cpu);
 static void *sim_idle_trampoline(void *arg)
 {
   struct sim_cpuinfo_s *cpuinfo = (struct sim_cpuinfo_s *)arg;
+#ifdef CONFIG_SIM_WALLTIME
+  uint64_t now = 0;
+#endif
   sigset_t set;
   int ret;
 
@@ -173,8 +176,6 @@ static void *sim_idle_trampoline(void *arg)
   for (; ; )
 {
 #ifdef CONFIG_SIM_WALLTIME
-  uint64_t now = 0;
-
   /* Wait a bit so that the timing is close to the correct rate. */
 
   now += 1000 * CONFIG_USEC_PER_TICK;



[incubator-nuttx] branch master updated (a32506b -> 28eed28)

2020-07-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from a32506b  boards: s32k1xx: Remove SPITOOL_PROGNAME
 add 28eed28  sched: The secondary idle threads should call 
nx_idle_trampoline

No new revisions were added by this update.

Summary of changes:
 arch/arm/src/cxd56xx/cxd56_cpustart.c |  2 +-
 arch/arm/src/lc823450/lc823450_cpustart.c |  2 +-
 arch/arm/src/sam34/sam4cm_cpustart.c  |  8 ++--
 arch/risc-v/src/k210/k210_cpustart.c  |  2 +-
 sched/init/init.h | 19 ---
 sched/init/nx_smpstart.c  | 26 --
 sched/init/nx_start.c |  4 ++--
 7 files changed, 11 insertions(+), 52 deletions(-)



[incubator-nuttx] 02/02: procfs: Get version info from uname instead

2020-07-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 338244dbac11a589c01949bb4ec77668e19142e6
Author: Xiang Xiao 
AuthorDate: Tue Jul 28 22:26:04 2020 +0800

procfs: Get version info from uname instead

unify the version into one place

Signed-off-by: Xiang Xiao 
Change-Id: I988fb40d3f460b0291114c60edb04db3aabb38f1
---
 fs/procfs/Make.defs  |  5 -
 fs/procfs/fs_procfsversion.c | 15 +--
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/fs/procfs/Make.defs b/fs/procfs/Make.defs
index 99ca2df..56607af 100644
--- a/fs/procfs/Make.defs
+++ b/fs/procfs/Make.defs
@@ -49,9 +49,4 @@ endif
 DEPPATH += --dep-path procfs
 VPATH += :procfs
 
-# To ensure version information is newest,
-# add fs_procfsversion to phony target for force rebuild
-
-.PHONY: fs_procfsversion$(OBJEXT)
-
 endif
diff --git a/fs/procfs/fs_procfsversion.c b/fs/procfs/fs_procfsversion.c
index fc2c55c..1a3e0c1 100644
--- a/fs/procfs/fs_procfsversion.c
+++ b/fs/procfs/fs_procfsversion.c
@@ -41,6 +41,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -206,6 +207,7 @@ static ssize_t version_read(FAR struct file *filep, FAR 
char *buffer,
 size_t buflen)
 {
   FAR struct version_file_s *attr;
+  struct utsname name;
   size_t linesize;
   off_t offset;
   ssize_t ret;
@@ -219,16 +221,9 @@ static ssize_t version_read(FAR struct file *filep, FAR 
char *buffer,
 
   if (filep->f_pos == 0)
 {
-#if defined(__DATE__) && defined(__TIME__)
-  linesize = snprintf(attr->line, VERSION_LINELEN,
-  "NuttX version %s %s %s %s\n",
-  CONFIG_VERSION_STRING, CONFIG_VERSION_BUILD,
-  __DATE__, __TIME__);
-#else
-  linesize = snprintf(attr->line, VERSION_LINELEN,
-  "NuttX version %s %s\n",
-  CONFIG_VERSION_STRING, CONFIG_VERSION_BUILD);
-#endif
+  uname(&name);
+  linesize = snprintf(attr->line, VERSION_LINELEN, "%s version %s %s\n",
+  name.sysname, name.release, name.version);
 
   /* Save the linesize in case we are re-entered with f_pos > 0 */
 



[incubator-nuttx] 01/02: libc: Make gethostname as syscall instead of uname

2020-07-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit 3cff139b855a0c1ccfc6253f7d255bc9c2ac636f
Author: Xiang Xiao 
AuthorDate: Tue Jul 28 17:52:17 2020 +0800

libc: Make gethostname as syscall instead of uname

simplify and symmetry the implementation in KERNEL/PROTECTED build

Signed-off-by: Xiang Xiao 
Change-Id: Iefdeea5f6ef6348c774b2ca9f7e45fe89c0c22dd
---
 include/sys/syscall_lookup.h   |  2 +-
 libs/libc/misc/lib_utsname.c   | 20 +-
 libs/libc/unistd/lib_gethostname.c | 42 +-
 syscall/syscall.csv|  2 +-
 4 files changed, 13 insertions(+), 53 deletions(-)

diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h
index a5f1d0e..f07906a 100644
--- a/include/sys/syscall_lookup.h
+++ b/include/sys/syscall_lookup.h
@@ -45,7 +45,7 @@ SYSCALL_LOOKUP(nxsched_get_stackinfo,  2)
   SYSCALL_LOOKUP(sched_setaffinity,3)
 #endif
 
-SYSCALL_LOOKUP(uname,  1)
+SYSCALL_LOOKUP(gethostname,2)
 SYSCALL_LOOKUP(sethostname,2)
 
 /* User identity */
diff --git a/libs/libc/misc/lib_utsname.c b/libs/libc/misc/lib_utsname.c
index 03c91b3..181af54 100644
--- a/libs/libc/misc/lib_utsname.c
+++ b/libs/libc/misc/lib_utsname.c
@@ -46,18 +46,6 @@
 #include 
 #include 
 
-/* In the protected and kernel build modes where kernel and application code
- * are separated, some of these common system property must reside only in
- * the kernel.  In that case, uname() can only be called from user space via
- * a kernel system call.
- */
-
-#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
-
-/
- * Pre-processor Definitions
- /
-
 /
  * Public Functions
  /
@@ -100,11 +88,7 @@ int uname(FAR struct utsname *name)
 
   /* Get the hostname */
 
-  if (-1 == gethostname(name->nodename, HOST_NAME_MAX))
-{
-  ret = -1;
-}
-
+  ret = gethostname(name->nodename, HOST_NAME_MAX);
   name->nodename[HOST_NAME_MAX - 1] = '\0';
 
   strncpy(name->release,  CONFIG_VERSION_STRING, SYS_NAMELEN);
@@ -123,5 +107,3 @@ int uname(FAR struct utsname *name)
 
   return ret;
 }
-
-#endif /* CONFIG_BUILD_FLAT || __KERNEL__ */
diff --git a/libs/libc/unistd/lib_gethostname.c 
b/libs/libc/unistd/lib_gethostname.c
index 9ed6f44..c02b2d9 100644
--- a/libs/libc/unistd/lib_gethostname.c
+++ b/libs/libc/unistd/lib_gethostname.c
@@ -41,12 +41,19 @@
 
 #include 
 
-#include 
 #include 
 #include 
 
 #include 
 
+/* Further, in the protected and kernel build modes where kernel and
+ * application code are separated, the hostname is a common system property
+ * and must reside only in the kernel.  In that case, this accessor
+ * function only be called from user space is only via a kernel system call.
+ */
+
+#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
+
 /
  * Pre-processor Definitions
  /
@@ -96,17 +103,6 @@ char g_hostname[HOST_NAME_MAX + 1] = CONFIG_LIB_HOSTNAME;
 
 int gethostname(FAR char *name, size_t namelen)
 {
-/* In the protected and kernel build modes where kernel and application code
- * are separated, the hostname is a common system property and must reside
- * only in the kernel.  In that case, we need to do things differently.
- *
- * uname() is implemented as a system call and can be called from user space.
- * So, in these configurations we will get the hostname via the uname
- * function.
- */
-
-#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
-
   irqstate_t flags;
 
   /* Return the host name, truncating to fit into the user provided buffer.
@@ -119,24 +115,6 @@ int gethostname(FAR char *name, size_t namelen)
   leave_critical_section(flags);
 
   return 0;
-
-#else
-
-  struct utsname info;
-  int ret;
-
-  /* Get uname data */
-
-  ret = uname(&info);
-  if (ret < 0)
-{
-  return ret;
-}
-
-  /* Return the nodename from the uname data */
-
-  strncpy(name, info.nodename, namelen);
-  return 0;
-
-#endif
 }
+
+#endif /* CONFIG_BUILD_FLAT || __KERNEL__ */
diff --git a/syscall/syscall.csv b/syscall/syscall.csv
index 475d287..3389ac8 100644
--- a/syscall/syscall.csv
+++ b/syscall/syscall.csv
@@ -30,6 +30,7 @@
 
"ftruncate","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","int","off_t"
 "getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)&

[incubator-nuttx] branch master updated (0a6c81b -> 338244d)

2020-07-29 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


from 0a6c81b  main README converted to Markdown format
 new 3cff139  libc: Make gethostname as syscall instead of uname
 new 338244d  procfs: Get version info from uname instead

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:
 fs/procfs/Make.defs|  5 -
 fs/procfs/fs_procfsversion.c   | 15 +-
 include/sys/syscall_lookup.h   |  2 +-
 libs/libc/misc/lib_utsname.c   | 20 +-
 libs/libc/unistd/lib_gethostname.c | 42 +-
 syscall/syscall.csv|  2 +-
 6 files changed, 18 insertions(+), 68 deletions(-)



[incubator-nuttx-apps] branch master updated: nsh/command: do not show the module application in built-in list

2020-04-03 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 9968461  nsh/command: do not show the module application in built-in 
list
9968461 is described below

commit 9968461c2be694e042035f774ab6e98e088cceab
Author: chao.an 
AuthorDate: Fri Feb 21 10:32:23 2020 +0800

nsh/command: do not show the module application in built-in list

Change-Id: Ia6dd5dcf7d7eb829fde67c522f7ee2155a4051ce
Signed-off-by: chao.an 
---
 nshlib/nsh_command.c | 37 +++--
 1 file changed, 27 insertions(+), 10 deletions(-)

diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index 819bfae..da749a8 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -766,12 +766,12 @@ static inline void help_allcmds(FAR struct nsh_vtbl_s 
*vtbl)
 static inline void help_builtins(FAR struct nsh_vtbl_s *vtbl)
 {
 #ifdef CONFIG_NSH_BUILTIN_APPS
-  FAR const char *name;
-  unsigned int num_builtins;
-  unsigned int column_width;
-  unsigned int builtin_width;
+  FAR const struct builtin_s *builtin;
   unsigned int builtins_per_line;
   unsigned int num_builtin_rows;
+  unsigned int builtin_width;
+  unsigned int num_builtins;
+  unsigned int column_width;
   unsigned int i;
   unsigned int j;
   unsigned int k;
@@ -781,17 +781,29 @@ static inline void help_builtins(FAR struct nsh_vtbl_s 
*vtbl)
   num_builtins = 0;
   column_width = 0;
 
-  for (i = 0; (name = builtin_getname(i)) != NULL; i++)
+  for (i = 0; (builtin = builtin_for_index(i)) != NULL; i++)
 {
+  if (builtin->main == NULL)
+{
+  continue;
+}
+
   num_builtins++;
 
-  builtin_width = strlen(name);
+  builtin_width = strlen(builtin->name);
   if (builtin_width > column_width)
 {
   column_width = builtin_width;
 }
 }
 
+  /* Skip the printing if no available built-in commands */
+
+  if (num_builtins == 0)
+{
+  return;
+}
+
   column_width += 2;
 
   /* Determine the number of commands to put on one line */
@@ -817,13 +829,18 @@ static inline void help_builtins(FAR struct nsh_vtbl_s 
*vtbl)
 {
   nsh_output(vtbl, "  ");
   for (j = 0, k = i;
-   j < builtins_per_line && k < num_builtins;
+   j < builtins_per_line &&
+   (builtin = builtin_for_index(k));
j++, k += num_builtin_rows)
 {
-  name = builtin_getname(k);
-  nsh_output(vtbl, "%s", name);
+  if (builtin->main == NULL)
+{
+  continue;
+}
+
+  nsh_output(vtbl, "%s", builtin->name);
 
-  for (builtin_width = strlen(name);
+  for (builtin_width = strlen(builtin->name);
builtin_width < column_width;
builtin_width++)
 {



[incubator-nuttx] branch master updated: Add defconfig for maix-bit:knsh

2020-05-12 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new f60b79f  Add defconfig for maix-bit:knsh
f60b79f is described below

commit f60b79f7729b4eeb6739c867901e721201337a75
Author: Nakamura, Yuuichi 
AuthorDate: Tue May 12 09:16:37 2020 +0900

Add defconfig for maix-bit:knsh
---
 boards/risc-v/k210/maix-bit/configs/knsh/defconfig | 58 ++
 1 file changed, 58 insertions(+)

diff --git a/boards/risc-v/k210/maix-bit/configs/knsh/defconfig 
b/boards/risc-v/k210/maix-bit/configs/knsh/defconfig
new file mode 100644
index 000..3f93f15
--- /dev/null
+++ b/boards/risc-v/k210/maix-bit/configs/knsh/defconfig
@@ -0,0 +1,58 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed 
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that 
includes your
+# modifications.
+#
+# CONFIG_STANDARD_SERIAL is not set
+CONFIG_ARCH="risc-v"
+CONFIG_ARCH_BOARD="maix-bit"
+CONFIG_ARCH_BOARD_MAIX_BIT=y
+CONFIG_ARCH_CHIP="k210"
+CONFIG_ARCH_CHIP_K210=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARCH_RISCV=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_USE_MPU=y
+CONFIG_BOARD_LOOPSPERMSEC=46000
+CONFIG_BUILD_PROTECTED=y
+CONFIG_BUILTIN=y
+CONFIG_DEBUG_ASSERTIONS=y
+CONFIG_DEBUG_ERROR=y
+CONFIG_DEBUG_FEATURES=y
+CONFIG_DEBUG_FULLOPT=y
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_DEV_ZERO=y
+CONFIG_FS_PROCFS=y
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_INTELHEX_BINARY=y
+CONFIG_LIBC_PERROR_STDOUT=y
+CONFIG_LIBC_STRERROR=y
+CONFIG_MAX_TASKS=64
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_MM_KERNEL_HEAPSIZE=524288
+CONFIG_NFILE_STREAMS=8
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NUTTX_USERSPACE=0x8010
+CONFIG_PASS1_BUILDIR="boards/risc-v/k210/maix-bit/kernel"
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_PREALLOC_WDOGS=16
+CONFIG_RAM_SIZE=2097152
+CONFIG_RAM_START=0x8040
+CONFIG_RAW_BINARY=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_WAITPID=y
+CONFIG_STACK_COLORATION=y
+CONFIG_START_DAY=14
+CONFIG_START_MONTH=2
+CONFIG_START_YEAR=2020
+CONFIG_SYSTEM_NSH=y
+CONFIG_SYS_RESERVED=8
+CONFIG_TASK_NAME_SIZE=20
+CONFIG_TESTING_GETPRIME=y
+CONFIG_TESTING_OSTEST=y
+CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_USERMAIN_STACKSIZE=3072
+CONFIG_USER_ENTRYPOINT="nsh_main"
+CONFIG_WDOG_INTRESERVE=0



[incubator-nuttx-apps] branch master updated: examples/posix_spawn: Fix parallel build errors at link time

2020-03-18 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 73319a6  examples/posix_spawn: Fix parallel build errors at link time
 new 0e13730  Merge pull request #120 from 
liuguo09/posix_spawn_nightly_build_fix
73319a6 is described below

commit 73319a6968ad39e65698dbf10b3b14bb9a247132
Author: liuhaitao 
AuthorDate: Fri Mar 13 11:33:42 2020 +0800

examples/posix_spawn: Fix parallel build errors at link time

During generating symtab.c, compile seqeuence would start with
incomplete symtab.c. This change will fix such a situation.

Signed-off-by: liuhaitao 
---
 examples/posix_spawn/filesystem/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/posix_spawn/filesystem/Makefile 
b/examples/posix_spawn/filesystem/Makefile
index c9541ef..aa6dece 100644
--- a/examples/posix_spawn/filesystem/Makefile
+++ b/examples/posix_spawn/filesystem/Makefile
@@ -78,7 +78,8 @@ $(ROMFS_HDR) : $(ROMFS_IMG)
 # Create the exported symbol table
 
 $(SYMTAB_SRC): $(ROMFS_IMG)
-   $(Q) $(FILESYSTEM_DIR)$(DELIM)mksymtab.sh $(ROMFS_DIR) >$@
+   $(Q) $(FILESYSTEM_DIR)$(DELIM)mksymtab.sh $(ROMFS_DIR) >$@_tmp
+   $(Q) mv $@_tmp $@
 
 # Clean each subdirectory
 



[incubator-nuttx-apps] 02/03: Revert "examples/posix_spawn: Fix parallel build errors at link time"

2020-03-19 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

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

commit d7886374bc10c488a281a065a1f4aa61456fcf76
Author: liuhaitao 
AuthorDate: Thu Mar 19 20:11:23 2020 +0800

Revert "examples/posix_spawn: Fix parallel build errors at link time"

This reverts commit 73319a6968ad39e65698dbf10b3b14bb9a247132.
---
 examples/posix_spawn/filesystem/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/examples/posix_spawn/filesystem/Makefile 
b/examples/posix_spawn/filesystem/Makefile
index aa6dece..c9541ef 100644
--- a/examples/posix_spawn/filesystem/Makefile
+++ b/examples/posix_spawn/filesystem/Makefile
@@ -78,8 +78,7 @@ $(ROMFS_HDR) : $(ROMFS_IMG)
 # Create the exported symbol table
 
 $(SYMTAB_SRC): $(ROMFS_IMG)
-   $(Q) $(FILESYSTEM_DIR)$(DELIM)mksymtab.sh $(ROMFS_DIR) >$@_tmp
-   $(Q) mv $@_tmp $@
+   $(Q) $(FILESYSTEM_DIR)$(DELIM)mksymtab.sh $(ROMFS_DIR) >$@
 
 # Clean each subdirectory
 



  1   2   3   4   5   6   7   >