[GitHub] [incubator-nuttx-apps] masayuki2009 opened a new pull request #299: system: nxrecorder: Add O_TRUNC when creating a file

2020-06-16 Thread GitBox


masayuki2009 opened a new pull request #299:
URL: https://github.com/apache/incubator-nuttx-apps/pull/299


   ## Summary
   
   - This PR lets nxrecorder create a new file with O_TUNC option.
   
   ## Impact
   
   - This PR affects nxrecorder only.
   
   ## Testing
   
   - I tested this PR with spresense:wifi configuration.
   
   ```
   nsh> nxrecorder
   nxrecorder> device /dev/audio/pcm_in1
   nxrecorder> recordraw /mnt/sd0/rec0001.raw
   nxrecorder> stop
   ```
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] yamt opened a new pull request #1254: mkstemp: Only look at the trailing Xs

2020-06-16 Thread GitBox


yamt opened a new pull request #1254:
URL: https://github.com/apache/incubator-nuttx/pull/1254


   
   ## Summary
   mkstemp: Only look at the trailing Xs as it's stated in the standards.
   
   The original code look at the first Xs. It can end up with
   an unexpected behavior, if a template contains multiple series of Xs.
   E.g. /tmp/XX/XX
   
   ## Impact
   this might break some apps relying on the original non-standard behavior.
   
   ## Testing
   tested with my local app.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[incubator-nuttx-apps] branch master updated: system: nxrecorder: Add O_TRUNC when creating a file

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

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


The following commit(s) were added to refs/heads/master by this push:
 new 2282310  system: nxrecorder: Add O_TRUNC when creating a file
2282310 is described below

commit 2282310483f931844afd658ae76bb3918f64df62
Author: Masayuki Ishikawa 
AuthorDate: Tue Jun 16 16:11:23 2020 +0900

system: nxrecorder: Add O_TRUNC when creating a file

Signed-off-by: Masayuki Ishikawa 
---
 system/nxrecorder/nxrecorder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/system/nxrecorder/nxrecorder.c b/system/nxrecorder/nxrecorder.c
index 85297b1..1768c16 100644
--- a/system/nxrecorder/nxrecorder.c
+++ b/system/nxrecorder/nxrecorder.c
@@ -847,7 +847,7 @@ int nxrecorder_recordraw(FAR struct nxrecorder_s *precorder,
 
   /* Test that the specified file exists */
 
-  if ((precorder->fd = open(pfilename, O_WRONLY | O_CREAT)) == -1)
+  if ((precorder->fd = open(pfilename, O_WRONLY | O_CREAT | O_TRUNC)) == -1)
 {
   /* File not found.  Test if its in the mediadir */
 



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #299: system: nxrecorder: Add O_TRUNC when creating a file

2020-06-16 Thread GitBox


xiaoxiang781216 merged pull request #299:
URL: https://github.com/apache/incubator-nuttx-apps/pull/299


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[incubator-nuttx] branch master updated: mkstemp: Only look at the trailing Xs

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

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


The following commit(s) were added to refs/heads/master by this push:
 new 66052f7  mkstemp: Only look at the trailing Xs
66052f7 is described below

commit 66052f7c4c68ab5dab9292ad04f35b07352c9e74
Author: YAMAMOTO Takashi 
AuthorDate: Tue Jun 16 17:21:28 2020 +0900

mkstemp: Only look at the trailing Xs

As it's stated in the standards.

The original code look at the first Xs. It can end up with
an unexpected behavior, if a template contains multiple series of Xs.
E.g. /tmp/XX/XX
---
 libs/libc/stdlib/lib_mkstemp.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libs/libc/stdlib/lib_mkstemp.c b/libs/libc/stdlib/lib_mkstemp.c
index feb95d8..9fcc2df 100644
--- a/libs/libc/stdlib/lib_mkstemp.c
+++ b/libs/libc/stdlib/lib_mkstemp.c
@@ -198,29 +198,28 @@ int mkstemp(FAR char *path_template)
   uint8_t base62[MAX_XS];
   uint32_t retries;
   FAR char *xptr;
-  FAR char *ptr;
   int xlen;
   int fd;
   int i;
 
   /* Count the number of X's at the end of the template */
 
-  xptr = strchr(path_template, 'X');
-  if (!xptr)
+  xptr = &path_template[strlen(path_template)];
+  for (xlen = 0; xlen < MAX_XS && path_template < xptr && *(xptr - 1) == 'X';
+   xlen++, xptr--);
+
+  if (xlen == 0)
 {
   /* No Xs?  There should always really be 6 */
 
   return open(path_template, O_RDWR | O_CREAT | O_EXCL, 0666);
 }
 
-  /* There is at least one.. count all of them */
-
-  for (xlen = 0, ptr = xptr; xlen < MAX_XS && *ptr == 'X'; xlen++, ptr++);
-
   /* Ignore any X's after the sixth */
 
   if (xlen > MAX_XS)
 {
+  xptr += xlen - MAX_XS;
   xlen = MAX_XS;
 }
 



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #1254: mkstemp: Only look at the trailing Xs

2020-06-16 Thread GitBox


xiaoxiang781216 merged pull request #1254:
URL: https://github.com/apache/incubator-nuttx/pull/1254


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] sebastianene07 commented on a change in pull request #1009: Add support for preemptive scheduling in simulator build

2020-06-16 Thread GitBox


sebastianene07 commented on a change in pull request #1009:
URL: https://github.com/apache/incubator-nuttx/pull/1009#discussion_r440806239



##
File path: arch/sim/include/irq.h
##
@@ -44,6 +44,10 @@
  * Included Files
  /
 
+#ifdef CONFIG_SIM_PREEMPTIBLE
+#  include 

Review comment:
   As I'm working on my new patch (to switch from ucontext API  to 
sigsetjmp/siglongjmp pair) I need to keep the sigjmp_buf inside the xcpcontext. 
The problem is that you can't simply use a pointer and use dynamic memory 
allocation because the heap memory is not initialized when up_initial_state() 
is called for the Idle Task. We can have an array that can hold the sigjmp_buf 
data but the size of this is arch dependent. Do you have a better solution to 
this ?





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1009: Add support for preemptive scheduling in simulator build

2020-06-16 Thread GitBox


xiaoxiang781216 commented on a change in pull request #1009:
URL: https://github.com/apache/incubator-nuttx/pull/1009#discussion_r440822441



##
File path: arch/sim/include/irq.h
##
@@ -44,6 +44,10 @@
  * Included Files
  /
 
+#ifdef CONFIG_SIM_PREEMPTIBLE
+#  include 

Review comment:
   Two methods I can imagine:
   1.Call malloc/free function on host side just like you call host timer API
   2.Define an array of sigjmp_buf like this:
   ```
 sigjmp_buf g_jmpbuf[CONFIG_MAX_TASKS];
   ```
   and access it through pid:
   ```
   g_jmpbuf[PIDHASH(pid))]
   ```
   BTW, you don't need save pointer inside xcpcontext.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] sebastianene07 commented on a change in pull request #1009: Add support for preemptive scheduling in simulator build

2020-06-16 Thread GitBox


sebastianene07 commented on a change in pull request #1009:
URL: https://github.com/apache/incubator-nuttx/pull/1009#discussion_r440854838



##
File path: arch/sim/include/irq.h
##
@@ -44,6 +44,10 @@
  * Included Files
  /
 
+#ifdef CONFIG_SIM_PREEMPTIBLE
+#  include 

Review comment:
   That makes sense, thanks !





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1009: Add support for preemptive scheduling in simulator build

2020-06-16 Thread GitBox


xiaoxiang781216 commented on a change in pull request #1009:
URL: https://github.com/apache/incubator-nuttx/pull/1009#discussion_r440861878



##
File path: arch/sim/include/irq.h
##
@@ -44,6 +44,10 @@
  * Included Files
  /
 
+#ifdef CONFIG_SIM_PREEMPTIBLE
+#  include 

Review comment:
   BTW, you can't call NuttX malloc in up_initial_state because the 
critical section already enter.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #1255: sched: Avoid call up_initial_state for idle thread twice

2020-06-16 Thread GitBox


xiaoxiang781216 opened a new pull request #1255:
URL: https://github.com/apache/incubator-nuttx/pull/1255


   Signed-off-by: Xiang Xiao 
   Change-Id: Iaf5d4bcc915fbe842e9356ea6416f0af869ab116
   
   ## Summary
   
   ## Impact
   
   ## Testing
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] patacongo opened a new pull request #1256: sched/Kconfig: Add interrupt and system call instrumentation

2020-06-16 Thread GitBox


patacongo opened a new pull request #1256:
URL: https://github.com/apache/incubator-nuttx/pull/1256


   ## Summary
   
   This PR brings in the system call and interrupt instrumentation from 
https://github.com/YuuichiNakamura/incubator-nuttx (feature/task-tracer branch).
   
   ## Impact
   
   These are not currently used in the code base but are used by users of the 
OS.  There should be no impact if the features are not enabled.
   
   ## Testing
   
   N/A.  These are enabling hooks for features, but not testable features 
themselves.
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #1257: tools/nxstyle: Fix AddressSanitizer error

2020-06-16 Thread GitBox


xiaoxiang781216 opened a new pull request #1257:
URL: https://github.com/apache/incubator-nuttx/pull/1257


   =
   ==2474==ERROR: AddressSanitizer: stack-buffer-underflow on address 
0x7fffb7e59b5f at pc 0x561fffec79f6 bp 0x7fffb7e59ac0 sp 0x7fffb7e59ab0
   READ of size 1 at 0x7fffb7e59b5f thread T0
   #0 0x561fffec79f5 in block_comment_width 
/home/xiaoxiang/mirtos/nuttx/tools/nxstyle.c:355
   
   Address 0x7fffb7e59b5f is located in stack of thread T0 at offset 31 in frame
   #0 0x561fffec7b90 in get_line_width 
/home/xiaoxiang/mirtos/nuttx/tools/nxstyle.c:419
   
 This frame has 1 object(s):
   [32, 544) 'line' (line 420) <== Memory access at offset 31 underflows 
this variable
   HINT: this may be a false positive if your program uses some custom stack 
unwind mechanism, swapcontext or vfork
 (longjmp and C++ exceptions *are* supported)
   SUMMARY: AddressSanitizer: stack-buffer-underflow 
/home/xiaoxiang/mirtos/nuttx/tools/nxstyle.c:355 in block_comment_width
   Shadow bytes around the buggy address:
 0x100076fc3310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 0x100076fc3320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 0x100076fc3330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 0x100076fc3340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 0x100076fc3350: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   =>0x100076fc3360: 00 00 00 00 00 00 00 00 f1 f1 f1[f1]00 00 00 00
 0x100076fc3370: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 0x100076fc3380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 0x100076fc3390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 0x100076fc33a0: 00 00 00 00 00 00 00 00 00 00 00 00 f3 f3 f3 f3
 0x100076fc33b0: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
   Shadow byte legend (one shadow byte represents 8 application bytes):
 Addressable:   00
 Partially addressable: 01 02 03 04 05 06 07
 Heap left redzone:   fa
 Freed heap region:   fd
 Stack left redzone:  f1
 Stack mid redzone:   f2
 Stack right redzone: f3
 Stack after return:  f5
 Stack use after scope:   f8
 Global redzone:  f9
 Global init order:   f6
 Poisoned by user:f7
 Container overflow:  fc
 Array cookie:ac
 Intra object redzone:bb
 ASan internal:   fe
 Left alloca redzone: ca
 Right alloca redzone:cb
 Shadow gap:  cc
   ==2474==ABORTING
   
   Signed-off-by: Xiang Xiao 
   Change-Id: Ie7dee3cdfdbbd04ea9cdb58e227afef07073cecd
   
   ## Summary
   
   ## Impact
   
   ## Testing
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] PetervdPerk-NXP opened a new pull request #1258: S32K1XX: FlexCAN fixes & EEEPROM driver

2020-06-16 Thread GitBox


PetervdPerk-NXP opened a new pull request #1258:
URL: https://github.com/apache/incubator-nuttx/pull/1258


   ## Summary
   Fixes compile error with older compiler for FlexCAN & SocketCAN
   FlexCAN don't disable interrupt but only remove masks TX MB interrupts
   S32K1XX: Emulated EEPROM block device driver
   
   ## Impact
   S32K1XX & Kinetis FlexCAN driver
   
   ## Testing
   Verified on S32K1XX
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] patacongo merged pull request #1257: tools/nxstyle: Fix AddressSanitizer error

2020-06-16 Thread GitBox


patacongo merged pull request #1257:
URL: https://github.com/apache/incubator-nuttx/pull/1257


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] patacongo commented on pull request #1255: sched: Avoid call up_initial_state for idle thread twice

2020-06-16 Thread GitBox


patacongo commented on pull request #1255:
URL: https://github.com/apache/incubator-nuttx/pull/1255#issuecomment-644854780


   Need to fill out these sections in the PR description:
   
   Summary
   Impact
   Testing
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] acassis commented on a change in pull request #1258: S32K1XX: FlexCAN fixes & EEEPROM driver

2020-06-16 Thread GitBox


acassis commented on a change in pull request #1258:
URL: https://github.com/apache/incubator-nuttx/pull/1258#discussion_r440985785



##
File path: arch/arm/src/s32k1xx/s32k1xx_flexcan.c
##
@@ -979,7 +982,7 @@ static void s32k1xx_txdone(FAR void *arg)
   /* Process TX completions */
 
   uint32_t mb_bit = 1 << RXMBCOUNT;

Review comment:
   I know you didn't touch this line in this commit, but please also move 
it to the top.

##
File path: arch/arm/src/kinetis/kinetis_flexcan.c
##
@@ -978,7 +981,7 @@ static void kinetis_txdone(FAR void *arg)
   /* Process TX completions */
 
   uint32_t mb_bit = 1 << RXMBCOUNT;

Review comment:
   same here

##
File path: arch/arm/src/kinetis/kinetis_flexcan.c
##
@@ -719,7 +719,8 @@ static int kinetis_transmit(FAR struct kinetis_driver_s 
*priv)
 
   uint32_t *frame_data_word = (uint32_t *)&frame->data[0];
 
-  for (int i = 0; i < (frame->len + 4 - 1) / 4; i++)
+  uint32_t i;

Review comment:
   Although code inside arch/ are not required to follow C89, please move 
the function declaration to the top of the function to spread good practice and 
avoid people follow it to core parts of the OS where it is forbidden.

##
File path: arch/arm/src/kinetis/kinetis_flexcan.c
##
@@ -863,7 +864,8 @@ static void kinetis_receive(FAR struct kinetis_driver_s 
*priv,
 
   uint32_t *frame_data_word = (uint32_t *)&frame->data[0];
 
-  for (int i = 0; i < (frame->len + 4 - 1) / 4; i++)
+  uint32_t i;

Review comment:
   ditto





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[incubator-nuttx] branch master updated (dde25b0 -> 4fd506e)

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

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


from dde25b0  tools/nxstyle: Fix AddressSanitizer error
 new df2bc1e  Add syscall and irqhandler hooks in sched_note.h
 new ed9532e  CONFIG_SCHED_INSTRUMENTATION_SYSCALL should not available if 
the architecture does not support the required system hook note hooks.
 new 4fd506e  include/nuttx/sched_note.h: nxstyle fixes.

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/Kconfig   |   8 +++
 include/nuttx/sched_note.h | 126 +++--
 sched/Kconfig  |  20 +++
 sched/irq/irq_dispatch.c   |  13 +
 4 files changed, 128 insertions(+), 39 deletions(-)



[incubator-nuttx] 03/03: include/nuttx/sched_note.h: nxstyle fixes.

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

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

commit 4fd506efaac9634cedb8838932261d3ebac9d551
Author: Gregory Nutt 
AuthorDate: Tue Jun 16 08:22:59 2020 -0600

include/nuttx/sched_note.h: nxstyle fixes.
---
 include/nuttx/sched_note.h | 108 +
 1 file changed, 69 insertions(+), 39 deletions(-)

diff --git a/include/nuttx/sched_note.h b/include/nuttx/sched_note.h
index bb7f032..721d234 100644
--- a/include/nuttx/sched_note.h
+++ b/include/nuttx/sched_note.h
@@ -1,35 +1,20 @@
 /
  * include/nuttx/sched_note.h
  *
- *   Copyright (C) 2016 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt 
+ * 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
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in
- *the documentation and/or other materials provided with the
- *distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * 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.
  *
  /
 
@@ -107,6 +92,15 @@ enum note_type_e
   NOTE_SPINLOCK_UNLOCK = 16,
   NOTE_SPINLOCK_ABORT  = 17
 #endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
+  ,
+  NOTE_SYSCALL_ENTER   = 18,
+  NOTE_SYSCALL_LEAVE   = 19
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
+  ,
+  NOTE_IRQHANDLER  = 20
+#endif
 };
 
 /* This structure provides the common header of each note */
@@ -226,7 +220,9 @@ struct note_csection_s
 #endif /* CONFIG_SCHED_INSTRUMENTATION_CSECTION */
 
 #ifdef CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS
-/* This is the specific form of the NOTE_SPINLOCK_LOCK/LOCKED/UNLOCK/ABORT 
note */
+/* This is the specific form of the NOTE_SPINLOCK_LOCK/LOCKED/UNLOCK/ABORT
+ * note.
+ */
 
 struct note_spinlock_s
 {
@@ -235,23 +231,53 @@ struct note_spinlock_s
   uint8_t nsp_value;/* Value of spinlock */
 };
 #endif /* CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS */
+
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
+/* This is the specific form of the NOTE_SYSCALL_ENTER/LEAVE notes */
+
+struct note_syscall_enter_s
+{
+  struct note_common_s nsc_cmn; /* Common note parameters */
+  int nsc_nr;   /* System call number */
+  bool nsc_enter;   /* true:  Entering system call */
+};
+
+struct note_syscall_leave_s
+{
+  struct note_common_s nsc_cmn; /* Common note parameters */
+  uintptr_t nsc_result; /* Result of the system call */
+  int nsc_nr;   /* System call number */
+  bool nsc_enter;   /* false:  Leaving system call */
+};
+#endif /* CONFIG_SCHED_INSTRUMENTATION_SYSCALL */
+
+#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
+/* This is the specific form of the NOTE_IRQHANDLER note */
+
+struct note_irqhandler_s
+{
+  st

[incubator-nuttx] 02/03: CONFIG_SCHED_INSTRUMENTATION_SYSCALL should not available if the architecture does not support the required system hook note hooks.

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

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

commit ed9532e31f8d2b41d66e865fe59d76ca9ea789c7
Author: Gregory Nutt 
AuthorDate: Tue Jun 16 08:02:03 2020 -0600

CONFIG_SCHED_INSTRUMENTATION_SYSCALL should not available if the 
architecture does not support the required system hook note hooks.
---
 arch/Kconfig  | 8 
 sched/Kconfig | 1 +
 2 files changed, 9 insertions(+)

diff --git a/arch/Kconfig b/arch/Kconfig
index eaebb89..21e3f5d 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -284,6 +284,14 @@ config ARCH_GLOBAL_IRQDISABLE
interrupts as well so that no context switches can occur on the 
CPU
that disabled "local" interrupts.
 
+config ARCH_HAVE_SYSCALL_HOOKS
+   bool
+   default n
+   ---help---
+   Indicates that the architecture supports the system call hooks 
as
+   required if CONFIG_SCHED_INSTRUMENTATION_SYSCALL is enabled.  
Refer
+   to sched/Kconfig for additional information.
+
 config ARCH_FPU
bool "FPU support"
default y
diff --git a/sched/Kconfig b/sched/Kconfig
index a1d66dd..a534969 100644
--- a/sched/Kconfig
+++ b/sched/Kconfig
@@ -975,6 +975,7 @@ config SCHED_INSTRUMENTATION_SPINLOCKS
 config SCHED_INSTRUMENTATION_SYSCALL
bool "System call monitor hooks"
default n
+   depends on LIB_SYSCALL && ARCH_HAVE_SYSCALL_HOOKS
---help---
Enables additional hooks for entry and exit from system call.
Board-specific logic must provide this additional logic.



[GitHub] [incubator-nuttx] acassis merged pull request #1256: sched/Kconfig: Add interrupt and system call instrumentation

2020-06-16 Thread GitBox


acassis merged pull request #1256:
URL: https://github.com/apache/incubator-nuttx/pull/1256


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[incubator-nuttx] 01/03: Add syscall and irqhandler hooks in sched_note.h

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

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

commit df2bc1e4c36b3f706cce83c075659339e27027db
Author: Yuuichi Nakamura 
AuthorDate: Tue Jun 16 07:57:49 2020 -0600

Add syscall and irqhandler hooks in sched_note.h
---
 include/nuttx/sched_note.h | 18 ++
 sched/Kconfig  | 19 +++
 sched/irq/irq_dispatch.c   | 13 +
 3 files changed, 50 insertions(+)

diff --git a/include/nuttx/sched_note.h b/include/nuttx/sched_note.h
index e04935a..bb7f032 100644
--- a/include/nuttx/sched_note.h
+++ b/include/nuttx/sched_note.h
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -305,6 +306,20 @@ void sched_note_spinabort(FAR struct tcb_s *tcb, FAR 
volatile void *spinlock);
 #  define sched_note_spinabort(t,s)
 #endif
 
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
+void sched_note_syscall_enter(int nr, int argc, ...);
+void sched_note_syscall_leave(int nr, uintptr_t result);
+#else
+#  define sched_note_syscall_enter(n,a...)
+#  define sched_note_syscall_leave(n,r)
+#endif
+
+#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
+void sched_note_irqhandler(int irq, FAR void *handler, bool enter);
+#else
+#  define sched_note_irqhandler(i,h,e)
+#endif
+
 /
  * Name: sched_note_get
  *
@@ -387,6 +402,9 @@ int note_register(void);
 #  define sched_note_spinlocked(t,s)
 #  define sched_note_spinunlock(t,s)
 #  define sched_note_spinabort(t,s)
+#  define sched_note_syscall_enter(n,a...)
+#  define sched_note_syscall_leave(n,r)
+#  define sched_note_irqhandler(i,h,e)
 
 #endif /* CONFIG_SCHED_INSTRUMENTATION */
 #endif /* __INCLUDE_NUTTX_SCHED_NOTE_H */
diff --git a/sched/Kconfig b/sched/Kconfig
index f7fe1ef..a1d66dd 100644
--- a/sched/Kconfig
+++ b/sched/Kconfig
@@ -972,6 +972,25 @@ config SCHED_INSTRUMENTATION_SPINLOCKS
void sched_note_spinunlock(FAR struct tcb_s *tcb, bool 
state);
void sched_note_spinabort(FAR struct tcb_s *tcb, bool 
state);
 
+config SCHED_INSTRUMENTATION_SYSCALL
+   bool "System call monitor hooks"
+   default n
+   ---help---
+   Enables additional hooks for entry and exit from system call.
+   Board-specific logic must provide this additional logic.
+
+   void sched_note_syscall_enter(int nr, int argc, ...);
+   void sched_note_syscall_leave(int nr, uintptr_t result);
+
+config SCHED_INSTRUMENTATION_IRQHANDLER
+   bool "Interrupt handler monitor hooks"
+   default n
+   ---help---
+   Enables additional hooks for interrupt handler. Board-specific 
logic
+   must provide this additional logic.
+
+   void sched_note_irqhandler(int irq, FAR void *handler, 
bool enter);
+
 config SCHED_INSTRUMENTATION_BUFFER
bool "Buffer instrumentation data in memory"
default n
diff --git a/sched/irq/irq_dispatch.c b/sched/irq/irq_dispatch.c
index f07cc13..49be385 100644
--- a/sched/irq/irq_dispatch.c
+++ b/sched/irq/irq_dispatch.c
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "irq/irq.h"
 #include "clock/clock.h"
@@ -171,11 +172,23 @@ void irq_dispatch(int irq, FAR void *context)
   add_irq_randomness(irq);
 #endif
 
+#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
+  /* Notify that we are entering into the interrupt handler */
+
+  sched_note_irqhandler(irq, vector, true);
+#endif
+
   /* Then dispatch to the interrupt handler */
 
   CALL_VECTOR(ndx, vector, irq, context, arg);
   UNUSED(ndx);
 
+#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
+  /* Notify that we are leaving from the interrupt handler */
+
+  sched_note_irqhandler(irq, vector, false);
+#endif
+
   /* Record the new "running" task.  g_running_tasks[] is only used by
* assertion logic for reporting crashes.
*/



[GitHub] [incubator-nuttx] PetervdPerk-NXP commented on pull request #1258: S32K1XX: FlexCAN fixes & EEEPROM driver

2020-06-16 Thread GitBox


PetervdPerk-NXP commented on pull request #1258:
URL: https://github.com/apache/incubator-nuttx/pull/1258#issuecomment-644896516


   @acassis, you're right C89 style initialization is better. I've pushed a new 
commit.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] acassis commented on pull request #1258: S32K1XX: FlexCAN fixes & EEEPROM driver

2020-06-16 Thread GitBox


acassis commented on pull request #1258:
URL: https://github.com/apache/incubator-nuttx/pull/1258#issuecomment-644898376


   > @acassis, you're right C89 style initialization is better. I've pushed a 
new commit.
   
   Thank you for your modification Peter!



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] patacongo opened a new pull request #1259: sched/sched/sched_note.c: Implement interrupt/syscall support

2020-06-16 Thread GitBox


patacongo opened a new pull request #1259:
URL: https://github.com/apache/incubator-nuttx/pull/1259


   ## Summary
   
   A previous PR added interrupt and system call scheduler notes.  This PR 
addresses buffering support for those notes.
   
   ## Impact
   
   There should be none.  Not really usable without changes to apps/.
   
   ## Testing
   
   Tested with sim:nsh
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[incubator-nuttx] 02/05: S32K1XX Enhanced EEPROM block device driver

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

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

commit efbe4c89e2522fce7dbf1bf6d048da117676e743
Author: Peter van der Perk 
AuthorDate: Thu Jun 4 11:24:20 2020 +0200

S32K1XX Enhanced EEPROM block device driver
---
 arch/arm/src/s32k1xx/Kconfig |   7 +
 arch/arm/src/s32k1xx/Make.defs   |   4 +
 arch/arm/src/s32k1xx/hardware/s32k1xx_ftfc.h |   2 +
 arch/arm/src/s32k1xx/s32k1xx_eeeprom.c   | 486 +++
 arch/arm/src/s32k1xx/s32k1xx_eeeprom.h   |  89 +
 arch/arm/src/s32k1xx/s32k1xx_start.c |   4 +
 6 files changed, 592 insertions(+)

diff --git a/arch/arm/src/s32k1xx/Kconfig b/arch/arm/src/s32k1xx/Kconfig
index e3ef9bd..ca29c75 100644
--- a/arch/arm/src/s32k1xx/Kconfig
+++ b/arch/arm/src/s32k1xx/Kconfig
@@ -255,6 +255,13 @@ config S32K1XX_PROGMEM
 Use the FlexNVM 32/64 KB of d-flash memory as a
Memory-Technology-Device (MTD).
 
+config S32K1XX_EEEPROM
+   bool "Emulated EEPROM"
+   default n
+---help---
+   Enables Emulated EEPROM function which uses the FlexRAM and FlexNVM
+   memory to emulate non-volatile memory. The EEEPROM wil be registered 
+   as a ramdisk block device
 
 endmenu # S32K1XX Peripheral Selection
 
diff --git a/arch/arm/src/s32k1xx/Make.defs b/arch/arm/src/s32k1xx/Make.defs
index 05ac9dd..3928f30 100644
--- a/arch/arm/src/s32k1xx/Make.defs
+++ b/arch/arm/src/s32k1xx/Make.defs
@@ -99,6 +99,10 @@ ifeq ($(CONFIG_S32K1XX_PROGMEM),y)
 CHIP_CSRCS += s32k1xx_progmem.c
 endif
 
+ifeq ($(CONFIG_S32K1XX_EEEPROM),y)
+CHIP_CSRCS += s32k1xx_eeeprom.c
+endif 
+
 # Source files specific to the ARM CPU family and to the S32K1xx chip family
 
 ifeq ($(CONFIG_ARCH_CHIP_S32K11X),y)
diff --git a/arch/arm/src/s32k1xx/hardware/s32k1xx_ftfc.h 
b/arch/arm/src/s32k1xx/hardware/s32k1xx_ftfc.h
index 59f576a..891aefb 100644
--- a/arch/arm/src/s32k1xx/hardware/s32k1xx_ftfc.h
+++ b/arch/arm/src/s32k1xx/hardware/s32k1xx_ftfc.h
@@ -140,4 +140,6 @@
 #define S32K1XX_FTFC_PROGRAM_PARTITION   0x80 /* PGMPART */
 #define S32K1XX_FTFC_SET_FLEXRAM_FUNCTION0x81 /* SETRAM */
 
+#define S32K1XX_FTFC_EEEPROM_BASE0x1400
+
 #endif /* __ARCH_ARM_SRC_S32K1XX_HARDWARE_S32K1XX_FTFC_H */
diff --git a/arch/arm/src/s32k1xx/s32k1xx_eeeprom.c 
b/arch/arm/src/s32k1xx/s32k1xx_eeeprom.c
new file mode 100644
index 000..f5eb153
--- /dev/null
+++ b/arch/arm/src/s32k1xx/s32k1xx_eeeprom.c
@@ -0,0 +1,486 @@
+/**
+ * arch/arm/src/s32k1xx/s32k1xx_eeeprom.c
+ *
+ *   Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ *   Author:  Gregory Nutt 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in
+ *the documentation and/or other materials provided with the
+ *distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ *used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ 
**/
+
+/**
+ * Included Files
+ 
**/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "up_arch.h"
+
+#include "hardware/s32k1xx_ftfc.h"
+#include "hardware/s32k1xx_sim.h"
+
+#include "s32k1xx_config.h"
+#include "s32k1xx_eeeprom.h"
+
+#include "up_internal.h"
+
+#include  /* Include last:  has dependencies */
+
+#include 
+#include 
+
+
+/*

[incubator-nuttx] 05/05: FlexCAN C89 Style initialization

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

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

commit 6a19f037564966b6cbe4007083986500366a8c03
Author: Peter van der Perk 
AuthorDate: Tue Jun 16 19:05:46 2020 +0200

FlexCAN C89 Style initialization
---
 arch/arm/src/kinetis/kinetis_flexcan.c | 36 ++
 arch/arm/src/s32k1xx/s32k1xx_flexcan.c | 36 ++
 2 files changed, 48 insertions(+), 24 deletions(-)

diff --git a/arch/arm/src/kinetis/kinetis_flexcan.c 
b/arch/arm/src/kinetis/kinetis_flexcan.c
index 3d7d478..e50f13a 100644
--- a/arch/arm/src/kinetis/kinetis_flexcan.c
+++ b/arch/arm/src/kinetis/kinetis_flexcan.c
@@ -601,6 +601,16 @@ static int kinetis_transmit(FAR struct kinetis_driver_s 
*priv)
   /* Attempt to write frame */
 
   uint32_t mbi = 0;
+  uint32_t mb_bit;
+  uint32_t regval;
+#ifdef CONFIG_NET_CAN_CANFD
+  uint32_t *frame_data_word;
+  uint32_t i;
+#endif
+#ifdef CONFIG_NET_CAN_RAW_TX_DEADLINE
+  int32_t timeout;
+#endif
+
   if ((getreg32(priv->base + KINETIS_CAN_ESR2_OFFSET) &
   (CAN_ESR2_IMB | CAN_ESR2_VPS)) ==
   (CAN_ESR2_IMB | CAN_ESR2_VPS))
@@ -610,7 +620,7 @@ static int kinetis_transmit(FAR struct kinetis_driver_s 
*priv)
   mbi -= RXMBCOUNT;
 }
 
-  uint32_t mb_bit = 1 << (RXMBCOUNT + mbi);
+  mb_bit = 1 << (RXMBCOUNT + mbi);
 
   while (mbi < TXMBCOUNT)
 {
@@ -631,7 +641,6 @@ static int kinetis_transmit(FAR struct kinetis_driver_s 
*priv)
 }
 
 #ifdef CONFIG_NET_CAN_RAW_TX_DEADLINE
-  int32_t timeout = 0;
   struct timespec ts;
   clock_systimespec(&ts);
 
@@ -664,6 +673,7 @@ static int kinetis_transmit(FAR struct kinetis_driver_s 
*priv)
 {
   priv->txmb[mbi].deadline.tv_sec = 0;
   priv->txmb[mbi].deadline.tv_usec = 0;
+  timeout = -1;
 }
 }
 #endif
@@ -717,9 +727,8 @@ static int kinetis_transmit(FAR struct kinetis_driver_s 
*priv)
 
   cs.dlc = len_to_can_dlc[frame->len];
 
-  uint32_t *frame_data_word = (uint32_t *)&frame->data[0];
+  frame_data_word = (uint32_t *)&frame->data[0];
 
-  uint32_t i;
   for (i = 0; i < (frame->len + 4 - 1) / 4; i++)
 {
   mb->data[i].w00 = __builtin_bswap32(frame_data_word[i]);
@@ -729,7 +738,6 @@ static int kinetis_transmit(FAR struct kinetis_driver_s 
*priv)
 
   mb->cs = cs; /* Go. */
 
-  uint32_t regval;
   regval = getreg32(priv->base + KINETIS_CAN_IMASK1_OFFSET);
   regval |= mb_bit;
   putreg32(regval, priv->base + KINETIS_CAN_IMASK1_OFFSET);
@@ -833,6 +841,10 @@ static void kinetis_receive(FAR struct kinetis_driver_s 
*priv,
 {
   uint32_t mb_index;
   struct mb_s *rf;
+#ifdef CONFIG_NET_CAN_CANFD
+  uint32_t *frame_data_word;
+  uint32_t i;
+#endif
 
   while ((mb_index = arm_lsb(flags)) != 32)
 {
@@ -862,9 +874,8 @@ static void kinetis_receive(FAR struct kinetis_driver_s 
*priv,
 
   frame->len = can_dlc_to_len[rf->cs.dlc];
 
-  uint32_t *frame_data_word = (uint32_t *)&frame->data[0];
+  frame_data_word = (uint32_t *)&frame->data[0];
 
-  uint32_t i;
   for (i = 0; i < (frame->len + 4 - 1) / 4; i++)
 {
   frame_data_word[i] = __builtin_bswap32(rf->data[i].w00);
@@ -970,17 +981,16 @@ static void kinetis_txdone(FAR void *arg)
   FAR struct kinetis_driver_s *priv = (FAR struct kinetis_driver_s *)arg;
   uint32_t flags;
   uint32_t mbi;
+  uint32_t mb_bit;
 
   flags  = getreg32(priv->base + KINETIS_CAN_IFLAG1_OFFSET);
   flags &= IFLAG1_TX;
 
-  #warning Missing logic
-
-  /* FIXME First Process Error aborts */
+  /* TODO First Process Error aborts */
 
   /* Process TX completions */
 
-  uint32_t mb_bit = 1 << RXMBCOUNT;
+  mb_bit = 1 << RXMBCOUNT;
   for (mbi = 0; flags && mbi < TXMBCOUNT; mbi++)
 {
   if (flags & mb_bit)
@@ -1708,6 +1718,9 @@ int kinetis_caninitialize(int intf)
   struct kinetis_driver_s *priv;
   int ret;
   uint32_t regval;
+#ifdef TX_TIMEOUT_WQ
+  uint32_t i;
+#endif
 
   switch (intf)
 {
@@ -1857,7 +1870,6 @@ int kinetis_caninitialize(int intf)
   priv->dev.d_private = (void *)priv;  /* Used to recover private state 
from dev */
 
 #ifdef TX_TIMEOUT_WQ
-  uint32_t i;
   for (i = 0; i < TXMBCOUNT; i++)
 {
   priv->txtimeout[i] = wd_create();/* Create TX timeout timer */
diff --git a/arch/arm/src/s32k1xx/s32k1xx_flexcan.c 
b/arch/arm/src/s32k1xx/s32k1xx_flexcan.c
index 55c01a5..75cc252 100644
--- a/arch/arm/src/s32k1xx/s32k1xx_flexcan.c
+++ b/arch/arm/src/s32k1xx/s32k1xx_flexcan.c
@@ -602,6 +602,16 @@ static int s32k1xx_transmit(FAR struct s32k1xx_driver_s 
*priv)
   /* Attempt to write frame */
 
   uint32_t mbi = 0;
+  uint32_t mb_bit;
+  uint32_t regval;
+#ifdef CONFIG_NET_CAN_CANFD
+  uint32_t *frame_data_word;
+  uint32_t i;
+#endif
+#ifdef CONFIG_NET_CAN_RAW_TX_DEADLINE
+  int32_t timeout;
+#endif
+
   if ((getreg32(priv->base + S32K1XX_CAN_ESR2_OFFSET) &
   (CAN_E

[incubator-nuttx] branch master updated (4fd506e -> 6a19f03)

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

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


from 4fd506e  include/nuttx/sched_note.h: nxstyle fixes.
 new 4eecf85  FlexCAN interrupt fixes, old compiler fixes SocketCAN old 
compiler fix
 new efbe4c8  S32K1XX Enhanced EEPROM block device driver
 new 662bd5e  Added S32K1XX EEEPROM init code
 new ede6225  NXStyle fixes
 new 6a19f03  FlexCAN C89 Style initialization

The 5 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/kinetis/kinetis_flexcan.c |  58 ++-
 arch/arm/src/s32k1xx/Kconfig   |   7 +
 arch/arm/src/s32k1xx/Make.defs |   4 +
 arch/arm/src/s32k1xx/hardware/s32k1xx_ftfc.h   |   2 +
 arch/arm/src/s32k1xx/s32k1xx_eeeprom.c | 479 +
 .../stm32_sai.h => s32k1xx/s32k1xx_eeeprom.h}  |  66 ++-
 arch/arm/src/s32k1xx/s32k1xx_flexcan.c |  58 ++-
 arch/arm/src/s32k1xx/s32k1xx_start.c   |   4 +
 .../rddrone-uavcan144/src/s32k1xx_bringup.c|  10 +
 .../rddrone-uavcan146/src/s32k1xx_bringup.c|  10 +
 .../arm/s32k1xx/s32k118evb/src/s32k1xx_bringup.c   |  10 +
 .../arm/s32k1xx/s32k144evb/src/s32k1xx_bringup.c   |  10 +
 .../arm/s32k1xx/s32k146evb/src/s32k1xx_bringup.c   |  10 +
 .../arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c   |  10 +
 net/can/can_recvfrom.c |   3 +-
 15 files changed, 666 insertions(+), 75 deletions(-)
 create mode 100644 arch/arm/src/s32k1xx/s32k1xx_eeeprom.c
 copy arch/arm/src/{stm32f7/stm32_sai.h => s32k1xx/s32k1xx_eeeprom.h} (70%)



[GitHub] [incubator-nuttx] acassis merged pull request #1258: S32K1XX: FlexCAN fixes & EEEPROM driver

2020-06-16 Thread GitBox


acassis merged pull request #1258:
URL: https://github.com/apache/incubator-nuttx/pull/1258


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[incubator-nuttx] 03/05: Added S32K1XX EEEPROM init code

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

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

commit 662bd5e49abd75070a90fb981697d1767b3a1155
Author: Peter van der Perk 
AuthorDate: Mon Jun 15 15:22:15 2020 +0200

Added S32K1XX EEEPROM init code
---
 boards/arm/s32k1xx/rddrone-uavcan144/src/s32k1xx_bringup.c | 9 +
 boards/arm/s32k1xx/rddrone-uavcan146/src/s32k1xx_bringup.c | 9 +
 boards/arm/s32k1xx/s32k118evb/src/s32k1xx_bringup.c| 9 +
 boards/arm/s32k1xx/s32k144evb/src/s32k1xx_bringup.c| 9 +
 boards/arm/s32k1xx/s32k146evb/src/s32k1xx_bringup.c| 9 +
 boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c| 9 +
 6 files changed, 54 insertions(+)

diff --git a/boards/arm/s32k1xx/rddrone-uavcan144/src/s32k1xx_bringup.c 
b/boards/arm/s32k1xx/rddrone-uavcan144/src/s32k1xx_bringup.c
index 0adea7e..5c47f2a 100644
--- a/boards/arm/s32k1xx/rddrone-uavcan144/src/s32k1xx_bringup.c
+++ b/boards/arm/s32k1xx/rddrone-uavcan144/src/s32k1xx_bringup.c
@@ -57,6 +57,10 @@
 #  include "s32k1xx_lpi2c.h"
 #endif
 
+#ifdef CONFIG_S32K1XX_EEEPROM
+#  include "s32k1xx_eeeprom.h"
+#endif
+
 #include "rddrone-uavcan144.h"
 
 /
@@ -154,5 +158,10 @@ int s32k1xx_bringup(void)
 }
 #endif
 
+#ifdef CONFIG_S32K1XX_EEEPROM
+  /* Register EEEPROM block device */
+  s32k1xx_eeeprom_register(0, 4096);
+#endif
+
   return ret;
 }
diff --git a/boards/arm/s32k1xx/rddrone-uavcan146/src/s32k1xx_bringup.c 
b/boards/arm/s32k1xx/rddrone-uavcan146/src/s32k1xx_bringup.c
index c792546..caf27a7 100644
--- a/boards/arm/s32k1xx/rddrone-uavcan146/src/s32k1xx_bringup.c
+++ b/boards/arm/s32k1xx/rddrone-uavcan146/src/s32k1xx_bringup.c
@@ -57,6 +57,10 @@
 #  include "s32k1xx_lpi2c.h"
 #endif
 
+#ifdef CONFIG_S32K1XX_EEEPROM
+#  include "s32k1xx_eeeprom.h"
+#endif
+
 #include "rddrone-uavcan146.h"
 
 /
@@ -151,5 +155,10 @@ int s32k1xx_bringup(void)
 }
 #endif
 
+#ifdef CONFIG_S32K1XX_EEEPROM
+  /* Register EEEPROM block device */
+  s32k1xx_eeeprom_register(0, 4096);
+#endif
+
   return ret;
 }
diff --git a/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_bringup.c 
b/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_bringup.c
index 81615fc..424bb8c 100644
--- a/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_bringup.c
+++ b/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_bringup.c
@@ -51,6 +51,10 @@
 #  include 
 #endif
 
+#ifdef CONFIG_S32K1XX_EEEPROM
+#  include "s32k1xx_eeeprom.h"
+#endif
+
 #include "s32k118evb.h"
 
 /
@@ -116,5 +120,10 @@ int s32k1xx_bringup(void)
 }
 #endif
 
+#ifdef CONFIG_S32K1XX_EEEPROM
+  /* Register EEEPROM block device */
+  s32k1xx_eeeprom_register(0, 4096);
+#endif
+
   return ret;
 }
diff --git a/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_bringup.c 
b/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_bringup.c
index ec88b7b..5796d68 100644
--- a/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_bringup.c
+++ b/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_bringup.c
@@ -56,6 +56,10 @@
 #  include "s32k1xx_lpi2c.h"
 #endif
 
+#ifdef CONFIG_S32K1XX_EEEPROM
+#  include "s32k1xx_eeeprom.h"
+#endif
+
 #include "s32k144evb.h"
 
 /
@@ -148,5 +152,10 @@ int s32k1xx_bringup(void)
 }
 #endif
 
+#ifdef CONFIG_S32K1XX_EEEPROM
+  /* Register EEEPROM block device */
+  s32k1xx_eeeprom_register(0, 4096);
+#endif
+
   return ret;
 }
diff --git a/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_bringup.c 
b/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_bringup.c
index c04617a..b762e42 100644
--- a/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_bringup.c
+++ b/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_bringup.c
@@ -56,6 +56,10 @@
 #  include "s32k1xx_lpi2c.h"
 #endif
 
+#ifdef CONFIG_S32K1XX_EEEPROM
+#  include "s32k1xx_eeeprom.h"
+#endif
+
 #include "s32k146evb.h"
 
 /
@@ -148,5 +152,10 @@ int s32k1xx_bringup(void)
 }
 #endif
 
+#ifdef CONFIG_S32K1XX_EEEPROM
+  /* Register EEEPROM block device */
+  s32k1xx_eeeprom_register(0, 4096);
+#endif
+
   return ret;
 }
diff --git a/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c 
b/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c
index 790f164..cc80633 100644
--- a/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c
+++ b/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c
@@ -51,6 +51,10 @@
 #  include 
 #endif
 
+#ifdef CONFIG_S32K1XX_EEEPROM
+#  include "s32k1xx_eeeprom.h"
+#endif
+
 #include "s32k148evb.h"
 
 /
@@ -105,5 +109,10 @@ int s32k1xx_bringup(void)
 }
 #endif
 
+#ifdef CONFIG

[incubator-nuttx] 04/05: NXStyle fixes

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

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

commit ede6225c72fc55d1dea3f10e7494627c86493e3a
Author: Peter van der Perk 
AuthorDate: Tue Jun 16 16:46:23 2020 +0200

NXStyle fixes
---
 arch/arm/src/s32k1xx/s32k1xx_eeeprom.c | 111 ++---
 arch/arm/src/s32k1xx/s32k1xx_eeeprom.h |   9 +-
 .../rddrone-uavcan144/src/s32k1xx_bringup.c|   1 +
 .../rddrone-uavcan146/src/s32k1xx_bringup.c|   1 +
 .../arm/s32k1xx/s32k118evb/src/s32k1xx_bringup.c   |   1 +
 .../arm/s32k1xx/s32k144evb/src/s32k1xx_bringup.c   |   1 +
 .../arm/s32k1xx/s32k146evb/src/s32k1xx_bringup.c   |   1 +
 .../arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c   |   1 +
 8 files changed, 62 insertions(+), 64 deletions(-)

diff --git a/arch/arm/src/s32k1xx/s32k1xx_eeeprom.c 
b/arch/arm/src/s32k1xx/s32k1xx_eeeprom.c
index f5eb153..6eeb93d 100644
--- a/arch/arm/src/s32k1xx/s32k1xx_eeeprom.c
+++ b/arch/arm/src/s32k1xx/s32k1xx_eeeprom.c
@@ -61,16 +61,9 @@
 #include 
 #include 
 
-
 /**
- * Pre-processor Definitions
- 
**/
-
-
-
-/
  * Private Types
- /
+ 
**/
 
 struct eeed_struct_s
 {
@@ -82,9 +75,9 @@ struct eeed_struct_s
   FAR uint8_t *eeed_buffer;   /* FlexRAM memory */
 };
 
-/
+/**
  * Private Function Prototypes
- /
+ 
**/
 
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
 static int eeed_open(FAR struct inode *inode);
@@ -128,12 +121,10 @@ static const struct block_operations g_bops =
 #endif
 };
 
-
 /**
  * Private Functions
  
**/
 
-
 static inline void wait_ftfc_ready()
 {
   while ((getreg8(S32K1XX_FTFC_FSTAT) & FTTC_FSTAT_CCIF) == 0)
@@ -166,13 +157,12 @@ static uint32_t execute_ftfc_command()
   return retval;
 }
 
-
-/
+/**
  * Name: eeed_open
  *
  * Description: Open the block device
  *
- /
+ 
**/
 
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
 static int eeed_open(FAR struct inode *inode)
@@ -192,12 +182,12 @@ static int eeed_open(FAR struct inode *inode)
 }
 #endif
 
-/
+/**
  * Name: eeed_close
  *
  * Description: close the block device
  *
- /
+ 
**/
 
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
 static int eeed_close(FAR struct inode *inode)
@@ -217,12 +207,12 @@ static int eeed_close(FAR struct inode *inode)
 }
 #endif
 
-/
+/**
  * Name: eeed_read
  *
  * Description:  Read the specified number of sectors
  *
- /
+ 
**/
 
 static ssize_t eeed_read(FAR struct inode *inode, unsigned char *buffer,
size_t start_sector, unsigned int nsectors)
@@ -243,7 +233,7 @@ static ssize_t eeed_read(FAR struct inode *inode, unsigned 
char *buffer,
  &dev->eeed_buffer[start_sector * dev->eeed_sectsize]);
 
wait_ftfc_ready();
-   
+
memcpy(buffer,
  &dev->eeed_buffer[start_sector * dev->eeed_sectsize],
  nsectors * dev->eeed_sectsize);
@@ -253,12 +243,12 @@ static ssize_t eeed_read(FAR struct inode *inode, 
unsigned char *buffer,
   return -EINVAL;
 }
 
-/
+/**
  * Name: eeed_write
  *
  * Description: Write the spe

[incubator-nuttx] 01/05: FlexCAN interrupt fixes, old compiler fixes SocketCAN old compiler fix

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

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

commit 4eecf8561fc17eef67649029631108e261abbf73
Author: Peter van der Perk 
AuthorDate: Tue Jun 16 16:26:41 2020 +0200

FlexCAN interrupt fixes, old compiler fixes
SocketCAN old compiler fix
---
 arch/arm/src/kinetis/kinetis_flexcan.c | 28 ++--
 arch/arm/src/s32k1xx/s32k1xx_flexcan.c | 28 ++--
 net/can/can_recvfrom.c |  3 ++-
 3 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/arch/arm/src/kinetis/kinetis_flexcan.c 
b/arch/arm/src/kinetis/kinetis_flexcan.c
index 9e4eaa7..3d7d478 100644
--- a/arch/arm/src/kinetis/kinetis_flexcan.c
+++ b/arch/arm/src/kinetis/kinetis_flexcan.c
@@ -719,7 +719,8 @@ static int kinetis_transmit(FAR struct kinetis_driver_s 
*priv)
 
   uint32_t *frame_data_word = (uint32_t *)&frame->data[0];
 
-  for (int i = 0; i < (frame->len + 4 - 1) / 4; i++)
+  uint32_t i;
+  for (i = 0; i < (frame->len + 4 - 1) / 4; i++)
 {
   mb->data[i].w00 = __builtin_bswap32(frame_data_word[i]);
 }
@@ -863,7 +864,8 @@ static void kinetis_receive(FAR struct kinetis_driver_s 
*priv,
 
   uint32_t *frame_data_word = (uint32_t *)&frame->data[0];
 
-  for (int i = 0; i < (frame->len + 4 - 1) / 4; i++)
+  uint32_t i;
+  for (i = 0; i < (frame->len + 4 - 1) / 4; i++)
 {
   frame_data_word[i] = __builtin_bswap32(rf->data[i].w00);
 }
@@ -967,6 +969,7 @@ static void kinetis_txdone(FAR void *arg)
 {
   FAR struct kinetis_driver_s *priv = (FAR struct kinetis_driver_s *)arg;
   uint32_t flags;
+  uint32_t mbi;
 
   flags  = getreg32(priv->base + KINETIS_CAN_IFLAG1_OFFSET);
   flags &= IFLAG1_TX;
@@ -978,7 +981,7 @@ static void kinetis_txdone(FAR void *arg)
   /* Process TX completions */
 
   uint32_t mb_bit = 1 << RXMBCOUNT;
-  for (uint32_t mbi = 0; flags && mbi < TXMBCOUNT; mbi++)
+  for (mbi = 0; flags && mbi < TXMBCOUNT; mbi++)
 {
   if (flags & mb_bit)
 {
@@ -1004,7 +1007,6 @@ static void kinetis_txdone(FAR void *arg)
   net_lock();
   devif_poll(&priv->dev, kinetis_txpoll);
   net_unlock();
-  up_enable_irq(priv->config->mb_irq);
 }
 
 /
@@ -1052,11 +1054,13 @@ static int kinetis_flexcan_interrupt(int irq, FAR void 
*context,
 
   if (flags)
 {
-  /* Disable further CAN interrupts. here can be no race
+  /* Disable further TX MB CAN interrupts. here can be no race
* condition here.
*/
 
-  up_disable_irq(priv->config->mb_irq);
+  flags  = getreg32(priv->base + KINETIS_CAN_IMASK1_OFFSET);
+  flags &= ~(IFLAG1_TX);
+  putreg32(flags, priv->base + KINETIS_CAN_IMASK1_OFFSET);
   work_queue(CANWORK, &priv->irqwork, kinetis_txdone, priv, 0);
 }
 }
@@ -1084,6 +1088,7 @@ static int kinetis_flexcan_interrupt(int irq, FAR void 
*context,
 static void kinetis_txtimeout_work(FAR void *arg)
 {
   FAR struct kinetis_driver_s *priv = (FAR struct kinetis_driver_s *)arg;
+  uint32_t mbi;
 
   struct timespec ts;
   struct timeval *now = (struct timeval *)&ts;
@@ -1094,7 +1099,7 @@ static void kinetis_txtimeout_work(FAR void *arg)
* transmit function transmitted a new frame
*/
 
-  for (int mbi = 0; mbi < TXMBCOUNT; mbi++)
+  for (mbi = 0; mbi < TXMBCOUNT; mbi++)
 {
   if (priv->txmb[mbi].deadline.tv_sec != 0
   && (now->tv_sec > priv->txmb[mbi].deadline.tv_sec
@@ -1183,8 +1188,10 @@ static void kinetis_setfreeze(uint32_t base, uint32_t 
freeze)
 static uint32_t kinetis_waitmcr_change(uint32_t base, uint32_t mask,
uint32_t target_state)
 {
-  const unsigned timeout = 1000;
-  for (unsigned wait_ack = 0; wait_ack < timeout; wait_ack++)
+  const uint32_t timeout = 1000;
+  uint32_t wait_ack;
+
+  for (wait_ack = 0; wait_ack < timeout; wait_ack++)
 {
   const bool state = (getreg32(base + KINETIS_CAN_MCR_OFFSET) & mask)
   != 0;
@@ -1850,7 +1857,8 @@ int kinetis_caninitialize(int intf)
   priv->dev.d_private = (void *)priv;  /* Used to recover private state 
from dev */
 
 #ifdef TX_TIMEOUT_WQ
-  for (int i = 0; i < TXMBCOUNT; i++)
+  uint32_t i;
+  for (i = 0; i < TXMBCOUNT; i++)
 {
   priv->txtimeout[i] = wd_create();/* Create TX timeout timer */
 }
diff --git a/arch/arm/src/s32k1xx/s32k1xx_flexcan.c 
b/arch/arm/src/s32k1xx/s32k1xx_flexcan.c
index cec80ae..55c01a5 100644
--- a/arch/arm/src/s32k1xx/s32k1xx_flexcan.c
+++ b/arch/arm/src/s32k1xx/s32k1xx_flexcan.c
@@ -720,7 +720,8 @@ static int s32k1xx_transmit(FAR struct s32k1xx_driver_s 
*priv)
 
   uint32_t *frame_data_word = (uint32_t *)&frame->data[0];
 
-  for (int i = 0; i < (frame->len + 4 - 1) / 4; i++)
+

[GitHub] [incubator-nuttx-apps] patacongo opened a new pull request #300: system/sched_note/note_main.c: Add interrupt/syscall call decode.

2020-06-16 Thread GitBox


patacongo opened a new pull request #300:
URL: https://github.com/apache/incubator-nuttx-apps/pull/300


   ## Summary
   
   Add support for decoding interrupt and system call instrumentation
   
   ## Impact
   
   None other than to system/sched_note/note_main.c.
   
   ## Testing
   
   Tested with sim:nsh
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx-apps] patacongo commented on pull request #300: system/sched_note/note_main.c: Add interrupt/syscall call decode.

2020-06-16 Thread GitBox


patacongo commented on pull request #300:
URL: 
https://github.com/apache/incubator-nuttx-apps/pull/300#issuecomment-644945111


   Merge notes:
   
   1. There are three nxstyle complaints that need to be ignored:
   
   system/sched_note/note_main.c:609:64: error: Mixed case identifier found
   system/sched_note/note_main.c:653:0: error: No indentation line
   system/sched_note/note_main.c:705:0: error: No indentation line
   
   The first is the use of PRIdPTR from inttypes.h.  The second two make no 
sense are are, most likely, errors in nxstyle.
   
   2. The PR checks will fail until incubator-nuttx:#1259 is merged.  It 
depends on a definition added by that PR.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] acassis commented on pull request #1252: STM32L4: fix 48MHz MSI clock selection logic

2020-06-16 Thread GitBox


acassis commented on pull request #1252:
URL: https://github.com/apache/incubator-nuttx/pull/1252#issuecomment-644945027


   Hi Matias, do you have a defconfig that I could use to test it on 
nucleo-l476rg board?



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] v01d commented on pull request #1252: STM32L4: fix 48MHz MSI clock selection logic

2020-06-16 Thread GitBox


v01d commented on pull request #1252:
URL: https://github.com/apache/incubator-nuttx/pull/1252#issuecomment-644948366


   I usually use nsh config for testing. Anyway, clock selection requires 
editing the board header file. You should change the option at the top so that 
MSI is used. Then, inside the MSI section of that header, you can select MSI 
frequency by setting:
   
   #define STM32L4_BOARD_MSIRANGERCC_CR_MSIRANGE_48M
   
   and further below you should change:
   
   #define STM32L4_SYSCLK_FREQUENCY  4800ul
   
   I did my tests using MSI as the main clock so you should disable the PLL 
with:
   
   #define STM32L4_BOARD_NOPLL
   
   Then choose sysclk by changing this line to:
   
   #define STM32L4_CLK48_SEL RCC_CCIPR_CLK48SEL_MSI
   
   BTW, to my understanding all those "2*" on CLKIN definitions are not 
correct. I don't understand where that comes from, since the prescaler for 
peripheral clocks is clearly not divided by 2 as the comments a few lines above 
state. Anyway, it should not affect you.
   
   I think clock configuration should really be possible via menuconfig, I 
might work on that sometime.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] v01d commented on pull request #1252: STM32L4: fix 48MHz MSI clock selection logic

2020-06-16 Thread GitBox


v01d commented on pull request #1252:
URL: https://github.com/apache/incubator-nuttx/pull/1252#issuecomment-644949223


   You can also try other frequencies, but if you're using I2C, I think only 
other clock option is 16MHz since otherwise I2C timings are not yet defined. 
But UART should work.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] v01d commented on issue #1235: nxstyle should not complain on _Exit

2020-06-16 Thread GitBox


v01d commented on issue #1235:
URL: 
https://github.com/apache/incubator-nuttx/issues/1235#issuecomment-644950528


   Maybe nxstyle could be extended to recognize some special comment that 
instructs to ignore a line (or at least a given rule for that line)



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx-apps] patacongo edited a comment on pull request #300: system/sched_note/note_main.c: Add interrupt/syscall call decode.

2020-06-16 Thread GitBox


patacongo edited a comment on pull request #300:
URL: 
https://github.com/apache/incubator-nuttx-apps/pull/300#issuecomment-644945111


   Merge notes:
   
   1. There are three nxstyle complaints that need to be ignored:
   
   system/sched_note/note_main.c:609:64: error: Mixed case identifier found
   system/sched_note/note_main.c:653:0: error: No indentation line
   system/sched_note/note_main.c:705:0: error: No indentation line
   
   The first is the use of PRIdPTR from inttypes.h.  The second two make no 
sense are are, most likely, errors in nxstyle.
   
   2. The PR checks will fail until incubator-nuttx:#1259 is merged.  It 
depends on a definition added by that PR.  Hmm... actually it probably will not 
fail because there is no configuration that builds this file.  I have tested it 
with the PR 1259 and it does compile and work correctly if enabled.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx-apps] patacongo edited a comment on pull request #300: system/sched_note/note_main.c: Add interrupt/syscall call decode.

2020-06-16 Thread GitBox


patacongo edited a comment on pull request #300:
URL: 
https://github.com/apache/incubator-nuttx-apps/pull/300#issuecomment-644945111


   Merge notes:
   
   1. There are three nxstyle complaints that need to be ignored:
   
   system/sched_note/note_main.c:609:64: error: Mixed case identifier found
   system/sched_note/note_main.c:653:0: error: No indentation line
   system/sched_note/note_main.c:705:0: error: No indentation line
   
   The first is the use of PRIdPTR from inttypes.h.  The second two make no 
sense are are, most likely, errors in nxstyle.
   
   2. The PR checks could fail until incubator-nuttx:#1259 is merged.  The 
logic here depends on a definition added by that PR.  Hmm... actually it 
probably will not fail because there is no configuration that builds this file. 
 I have tested it with the PR 1259 and it does compile and work correctly if 
enabled.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx-apps] patacongo edited a comment on pull request #300: system/sched_note/note_main.c: Add interrupt/syscall call decode.

2020-06-16 Thread GitBox


patacongo edited a comment on pull request #300:
URL: 
https://github.com/apache/incubator-nuttx-apps/pull/300#issuecomment-644945111


   Merge notes:
   
   1. There are three nxstyle complaints that need to be ignored:
   
   system/sched_note/note_main.c:609:64: error: Mixed case identifier found
   system/sched_note/note_main.c:653:0: error: No indentation line
   system/sched_note/note_main.c:705:0: error: No indentation line
   
   The first is the use of PRIdPTR from inttypes.h.  The second two make no 
sense and are, most likely, errors in nxstyle.
   
   2. The PR checks could fail until incubator-nuttx:#1259 is merged.  The 
logic here depends on a definition added by that PR.  Hmm... actually it 
probably will not fail because there is no configuration that builds this file. 
 I have tested it with the PR 1259 and it does compile and work correctly if 
enabled.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] patacongo commented on issue #1235: nxstyle should not complain on _Exit

2020-06-16 Thread GitBox


patacongo commented on issue #1235:
URL: 
https://github.com/apache/incubator-nuttx/issues/1235#issuecomment-644957144


   > 
   > 
   > Maybe nxstyle could be extended to recognize some special comment that 
instructs to ignore a line (or at least a given rule for that line)
   
   This has been discussed and I, for one, have been very opposed to corrupting 
good, clean C files with meta-data for nxstyle.  People have talked about a lot 
of things and we have done the best we can to squash that approach.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] patacongo edited a comment on issue #1235: nxstyle should not complain on _Exit

2020-06-16 Thread GitBox


patacongo edited a comment on issue #1235:
URL: 
https://github.com/apache/incubator-nuttx/issues/1235#issuecomment-644957144


   > 
   > 
   > Maybe nxstyle could be extended to recognize some special comment that 
instructs to ignore a line (or at least a given rule for that line)
   
   This has been discussed and I, for one, have been very opposed to corrupting 
good, clean C files with meta-data for nxstyle.  People have talked about a lot 
of things and we have done the best we can to squash that approach.  It is an 
unbounded, open-ended can or worms.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[incubator-nuttx] branch master updated: sched/sched/sched_note.c: Implement interrupt/syscall support

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

aguettouche 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 69e97c1  sched/sched/sched_note.c:  Implement interrupt/syscall support
69e97c1 is described below

commit 69e97c19ea65d1942f701db459a428e368fa0ed6
Author: Gregory Nutt 
AuthorDate: Tue Jun 16 11:30:58 2020 -0600

sched/sched/sched_note.c:  Implement interrupt/syscall support

A previous PR added interrupt and system call scheduler notes.  This addess 
buffering support for those notes.
---
 include/nuttx/sched_note.h |   8 ++--
 sched/Kconfig  |   2 +-
 sched/sched/sched_note.c   | 100 ++---
 3 files changed, 71 insertions(+), 39 deletions(-)

diff --git a/include/nuttx/sched_note.h b/include/nuttx/sched_note.h
index 721d234..e199197 100644
--- a/include/nuttx/sched_note.h
+++ b/include/nuttx/sched_note.h
@@ -99,7 +99,8 @@ enum note_type_e
 #endif
 #ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
   ,
-  NOTE_IRQHANDLER  = 20
+  NOTE_IRQ_ENTER   = 20,
+  NOTE_IRQ_LEAVE   = 21
 #endif
 };
 
@@ -239,7 +240,6 @@ struct note_syscall_enter_s
 {
   struct note_common_s nsc_cmn; /* Common note parameters */
   int nsc_nr;   /* System call number */
-  bool nsc_enter;   /* true:  Entering system call */
 };
 
 struct note_syscall_leave_s
@@ -247,18 +247,16 @@ struct note_syscall_leave_s
   struct note_common_s nsc_cmn; /* Common note parameters */
   uintptr_t nsc_result; /* Result of the system call */
   int nsc_nr;   /* System call number */
-  bool nsc_enter;   /* false:  Leaving system call */
 };
 #endif /* CONFIG_SCHED_INSTRUMENTATION_SYSCALL */
 
 #ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
-/* This is the specific form of the NOTE_IRQHANDLER note */
+/* This is the specific form of the NOTE_IRQ_ENTER/LEAVE notes */
 
 struct note_irqhandler_s
 {
   struct note_common_s nih_cmn; /* Common note parameters */
   int nih_irq;  /* IRQ number */
-  bool nih_enter;   /* true:  Entering handler */
 };
 #endif /* CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER */
 #endif /* CONFIG_SCHED_INSTRUMENTATION_BUFFER */
diff --git a/sched/Kconfig b/sched/Kconfig
index a534969..460b58a 100644
--- a/sched/Kconfig
+++ b/sched/Kconfig
@@ -1026,7 +1026,7 @@ config SCHED_NOTE_BUFSIZE
bytes).
 
 config SCHED_NOTE_GET
-   bool "Callable interface to get instrumentatin data"
+   bool "Callable interface to get instrumentation data"
default n
depends on !SCHED_INSTRUMENTATION_CSECTION && 
(!SCHED_INSTRUMENTATION_SPINLOCK || !SMP)
---help---
diff --git a/sched/sched/sched_note.c b/sched/sched/sched_note.c
index 6fcb2a5..c952ca8 100644
--- a/sched/sched/sched_note.c
+++ b/sched/sched/sched_note.c
@@ -1,35 +1,20 @@
 /
  * sched/sched/sched_note.c
  *
- *   Copyright (C) 2016 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt 
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in
- *the documentation and/or other materials provided with the
- *distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * 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

[GitHub] [incubator-nuttx] Ouss4 merged pull request #1259: sched/sched/sched_note.c: Implement interrupt/syscall support

2020-06-16 Thread GitBox


Ouss4 merged pull request #1259:
URL: https://github.com/apache/incubator-nuttx/pull/1259


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[incubator-nuttx-apps] branch master updated: system/sched_note/note_main.c: Add interrupt/syscall call decode.

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

aguettouche 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 4f044a4  system/sched_note/note_main.c:  Add interrupt/syscall call 
decode.
4f044a4 is described below

commit 4f044a434202eb79656f8905d6ba0e04ee652a6b
Author: Gregory Nutt 
AuthorDate: Tue Jun 16 12:30:41 2020 -0600

system/sched_note/note_main.c:  Add interrupt/syscall call decode.
---
 system/sched_note/note_main.c | 191 --
 1 file changed, 126 insertions(+), 65 deletions(-)

diff --git a/system/sched_note/note_main.c b/system/sched_note/note_main.c
index 4c251c1..d81708b 100644
--- a/system/sched_note/note_main.c
+++ b/system/sched_note/note_main.c
@@ -1,47 +1,33 @@
-/
+/
  * system/note/note_main.c
  *
- *   Copyright (C) 2016 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt 
+ * 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
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in
- *the documentation and/or other materials provided with the
- *distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *used to endorse or promote products derived from this software
- *without specific prior written permission.
+ * 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.
  *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- /
+ 
/
 
-/
+/
  * Included Files
- /
+ 
/
 
 #include 
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -49,9 +35,9 @@
 
 #include 
 
-/
+/
  * Private Data
- /
+ 
/
 
 static bool g_note_daemon_started;
 static uint8_t g_note_buffer[CONFIG_SYSTEM_NOTE_BUFFERSIZE];
@@ -75,13 +61,13 @@ static FAR const char *g_statenames[] =
 
 #define NSTATES (sizeof(g_statenames)/sizeof(FAR const char *))
 
-/
+/
  * Private Functions
- 

[GitHub] [incubator-nuttx-apps] Ouss4 merged pull request #300: system/sched_note/note_main.c: Add interrupt/syscall call decode.

2020-06-16 Thread GitBox


Ouss4 merged pull request #300:
URL: https://github.com/apache/incubator-nuttx-apps/pull/300


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] acassis commented on pull request #1252: STM32L4: fix 48MHz MSI clock selection logic

2020-06-16 Thread GitBox


acassis commented on pull request #1252:
URL: https://github.com/apache/incubator-nuttx/pull/1252#issuecomment-645018299


   Ok, it worked on 48MHz MSI.
   
   These are the modification I did:
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] acassis edited a comment on pull request #1252: STM32L4: fix 48MHz MSI clock selection logic

2020-06-16 Thread GitBox


acassis edited a comment on pull request #1252:
URL: https://github.com/apache/incubator-nuttx/pull/1252#issuecomment-645018299


   Ok, it worked on 48MHz MSI.
   
   These are the modification I did:
   
   diff --git a/boards/arm/stm32l4/nucleo-l476rg/include/nucleo-l476rg.h 
b/boards/arm/stm32l4/nucleo-l476rg/include/nucleo-l476rg.h
   index f6cfbd4d29..1bf31ad33d 100644
   --- a/boards/arm/stm32l4/nucleo-l476rg/include/nucleo-l476rg.h
   +++ b/boards/arm/stm32l4/nucleo-l476rg/include/nucleo-l476rg.h
   @@ -49,11 +49,10 @@
 * Pre-processor Definitions
 
/

   -#if 1
   +#if 0
#  define HSI_CLOCK_CONFIG  /* HSI-16 clock configuration */
#elif 0
/* Make sure you installed one! */
   -
#  define HSE_CLOCK_CONFIG  /* HSE with 8 MHz xtal */
#else
#  define MSI_CLOCK_CONFIG  /* MSI @ 4 MHz autotrimmed via LSE */
   @@ -97,7 +96,7 @@
#define STM32L4_LSI_FREQUENCY 32000
#define STM32L4_LSE_FREQUENCY 32768

   -#define STM32L4_BOARD_USEHSI  1
   +#define STM32L4_BOARD_USEMSI  1

/* XXX sysclk mux = pllclk */

   @@ -206,6 +205,8 @@
 * as per comment above HSI) .
 */

   +#define STM32L4_BOARD_NOPLL 1
   +
#define STM32L4_PLLCFG_PLLM RCC_PLLCFG_PLLM(1)

/* 'main' PLL config; we use this to generate our system clock via the R
   @@ -252,12 +253,12 @@
#define STM32L4_PLLSAI2CFG_PLLR 0
#undef  STM32L4_PLLSAI2CFG_PLLR_ENABLED

   -#define STM32L4_SYSCLK_FREQUENCY  8000ul
   +#define STM32L4_SYSCLK_FREQUENCY  4800ul

/* CLK48 will come from PLLSAI1 (implicitly Q) */

#define STM32L4_USE_CLK48
   -#define STM32L4_CLK48_SEL RCC_CCIPR_CLK48SEL_PLLSAI1
   +#define STM32L4_CLK48_SEL RCC_CCIPR_CLK48SEL_MSI

/* enable the LSE oscillator, used automatically trim the MSI, and for RTC 
*/

   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] acassis edited a comment on pull request #1252: STM32L4: fix 48MHz MSI clock selection logic

2020-06-16 Thread GitBox


acassis edited a comment on pull request #1252:
URL: https://github.com/apache/incubator-nuttx/pull/1252#issuecomment-645018299


   Ok, it worked on 48MHz MSI.
   
   These are the modification I did:
   
   `diff --git a/boards/arm/stm32l4/nucleo-l476rg/include/nucleo-l476rg.h 
b/boards/arm/stm32l4/nucleo-l476rg/include/nucleo-l476rg.h
   index f6cfbd4d29..1bf31ad33d 100644
   --- a/boards/arm/stm32l4/nucleo-l476rg/include/nucleo-l476rg.h
   +++ b/boards/arm/stm32l4/nucleo-l476rg/include/nucleo-l476rg.h
   @@ -49,11 +49,10 @@
 * Pre-processor Definitions
 
/

   -#if 1
   +#if 0
#  define HSI_CLOCK_CONFIG  /* HSI-16 clock configuration */
#elif 0
/* Make sure you installed one! */
   -
#  define HSE_CLOCK_CONFIG  /* HSE with 8 MHz xtal */
#else
#  define MSI_CLOCK_CONFIG  /* MSI @ 4 MHz autotrimmed via LSE */
   @@ -97,7 +96,7 @@
#define STM32L4_LSI_FREQUENCY 32000
#define STM32L4_LSE_FREQUENCY 32768

   -#define STM32L4_BOARD_USEHSI  1
   +#define STM32L4_BOARD_USEMSI  1

/* XXX sysclk mux = pllclk */

   @@ -206,6 +205,8 @@
 * as per comment above HSI) .
 */

   +#define STM32L4_BOARD_NOPLL 1
   +
#define STM32L4_PLLCFG_PLLM RCC_PLLCFG_PLLM(1)

/* 'main' PLL config; we use this to generate our system clock via the R
   @@ -252,12 +253,12 @@
#define STM32L4_PLLSAI2CFG_PLLR 0
#undef  STM32L4_PLLSAI2CFG_PLLR_ENABLED

   -#define STM32L4_SYSCLK_FREQUENCY  8000ul
   +#define STM32L4_SYSCLK_FREQUENCY  4800ul

/* CLK48 will come from PLLSAI1 (implicitly Q) */

#define STM32L4_USE_CLK48
   -#define STM32L4_CLK48_SEL RCC_CCIPR_CLK48SEL_PLLSAI1
   +#define STM32L4_CLK48_SEL RCC_CCIPR_CLK48SEL_MSI

/* enable the LSE oscillator, used automatically trim the MSI, and for RTC 
*/

   `
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] acassis edited a comment on pull request #1252: STM32L4: fix 48MHz MSI clock selection logic

2020-06-16 Thread GitBox


acassis edited a comment on pull request #1252:
URL: https://github.com/apache/incubator-nuttx/pull/1252#issuecomment-645018299


   Ok, it worked on 48MHz MSI.
   
   These are the modification I did:
   
   https://pastebin.com/00PW2cvL
   
   Pasting code here doesn't work, even using the "Insert code" button.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] patacongo merged pull request #1255: sched: Avoid call up_initial_state for idle thread twice

2020-06-16 Thread GitBox


patacongo merged pull request #1255:
URL: https://github.com/apache/incubator-nuttx/pull/1255


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[incubator-nuttx] branch master updated: sched: Avoid call up_initial_state for idle thread twice

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

gnutt 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 56fa98f  sched: Avoid call up_initial_state for idle thread twice
56fa98f is described below

commit 56fa98f3ea803f2a6144414683ca43d9901cad66
Author: Xiang Xiao 
AuthorDate: Tue Jun 16 21:08:16 2020 +0800

sched: Avoid call up_initial_state for idle thread twice

Signed-off-by: Xiang Xiao 
Change-Id: Iaf5d4bcc915fbe842e9356ea6416f0af869ab116
---
 sched/init/nx_smpstart.c | 6 +-
 sched/init/nx_start.c| 9 +++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/sched/init/nx_smpstart.c b/sched/init/nx_smpstart.c
index 831dd44..20abe2c 100644
--- a/sched/init/nx_smpstart.c
+++ b/sched/init/nx_smpstart.c
@@ -168,11 +168,7 @@ int nx_smp_start(void)
   return ret;
 }
 
-  /* Reinitialize the processor-specific portion of the TCB.  This is
-   * the second time this has been called for this CPU, but the stack
-   * was not yet initialized on the first call so we need to do it
-   * again.
-   */
+  /* Initialize the processor-specific portion of the TCB */
 
   up_initial_state(tcb);
 }
diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c
index b1c4d46..d4dff07 100644
--- a/sched/init/nx_start.c
+++ b/sched/init/nx_start.c
@@ -528,9 +528,14 @@ void nx_start(void)
 
   g_running_tasks[cpu] = &g_idletcb[cpu].cmn;
 
-  /* Initialize the processor-specific portion of the TCB */
+  /* Initialize the 1st processor-specific portion of the TCB
+   * Note: other idle thread get initialized in nx_smpstart
+   */
 
-  up_initial_state(&g_idletcb[cpu].cmn);
+  if (cpu == 0)
+{
+  up_initial_state(&g_idletcb[cpu].cmn);
+}
 }
 
   /* Task lists are initialized */



[GitHub] [incubator-nuttx] yamt commented on issue #1235: nxstyle should not complain on _Exit

2020-06-16 Thread GitBox


yamt commented on issue #1235:
URL: 
https://github.com/apache/incubator-nuttx/issues/1235#issuecomment-645082080


   for this specific case (_Exit), as it's a part of the standards, it's more 
appropriate to make nxstyle itself know, IMO.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx-apps] masayuki2009 opened a new pull request #301: system: nxrecorder: Refactor nxrecorder.c

2020-06-16 Thread GitBox


masayuki2009 opened a new pull request #301:
URL: https://github.com/apache/incubator-nuttx-apps/pull/301


   ## Summary
   
   - This PR removes redundant code regarding audio buffer configuration in 
nxrecorder.c
   - The approach is the same as 
https://github.com/apache/incubator-nuttx-apps/pull/285
   
   ## Impact
   
   - This PR affects nxrecorder.c only
   
   ## Testing
   
   - I tested this PR with spresense:wifi where 
CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS=y
   - To test CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS=n case, I had to modify the 
followings
   
   ```
   --- a/drivers/audio/Kconfig
   +++ b/drivers/audio/Kconfig
   @@ -31,7 +31,6 @@ config AUDIO_CXD56
   bool "CXD56 audio driver"
   default n
   depends on AUDIO
   - select AUDIO_DRIVER_SPECIFIC_BUFFERS
   ---help---
   Enable support for audio playback using the CXD5247 chip on the
   CXD56 Spresense board.
   
   
   --- a/boards/arm/cxd56xx/spresense/configs/wifi/defconfig
   +++ b/boards/arm/cxd56xx/spresense/configs/wifi/defconfig
   @@ -16,15 +16,15 @@ CONFIG_ARCH_CHIP_CXD56XX=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_USEBASEPRI=y
CONFIG_AUDIO=y
   +CONFIG_AUDIO_BUFFER_NUMBYTES=2048
CONFIG_AUDIO_CXD56=y
   +CONFIG_AUDIO_NUM_BUFFERS=32
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=5434
CONFIG_BOOT_RUNFROMISRAM=y
CONFIG_BUILTIN=y
CONFIG_CLOCK_MONOTONIC=y
CONFIG_CODECS_HASH_MD5=y
   -CONFIG_CXD56_AUDIO_BUFFER_SIZE=2048
   -CONFIG_CXD56_AUDIO_NUM_BUFFERS=32
CONFIG_CXD56_BINARY=y
CONFIG_CXD56_DMAC_SPI5_RX=y
   ```
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx-apps] masayuki2009 commented on pull request #301: system: nxrecorder: Refactor nxrecorder.c

2020-06-16 Thread GitBox


masayuki2009 commented on pull request #301:
URL: 
https://github.com/apache/incubator-nuttx-apps/pull/301#issuecomment-645116787


   Hi @xiaoxiang781216,
   
   I refactored nxrecorder.c
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] yamt commented on issue #1137: Correct behavior of sched_lock() in SMP mode

2020-06-16 Thread GitBox


yamt commented on issue #1137:
URL: 
https://github.com/apache/incubator-nuttx/issues/1137#issuecomment-645138739


   i have two comments
   
   * to me, enter_critical_section() is another primitive with unclear 
semantics. are you interested in more fine grained locking? or, do you think 
the "global irq lock" approach is good enough for what nuttx is for?
   
   * how about introducing a set of new api with clear semantics and name, say, 
preempt_disable().
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[incubator-nuttx-apps] branch master updated: system: nxrecorder: Refactor nxrecorder.c

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

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


The following commit(s) were added to refs/heads/master by this push:
 new fed7a53  system: nxrecorder: Refactor nxrecorder.c
fed7a53 is described below

commit fed7a53ef54980ddcb9263bd9cf2a43e5b8b8d9e
Author: Masayuki Ishikawa 
AuthorDate: Wed Jun 17 10:22:37 2020 +0900

system: nxrecorder: Refactor nxrecorder.c

NOTE: Remove redundant code regarding audio buffer configuration

Signed-off-by: Masayuki Ishikawa 
---
 system/nxrecorder/nxrecorder.c | 50 +-
 1 file changed, 1 insertion(+), 49 deletions(-)

diff --git a/system/nxrecorder/nxrecorder.c b/system/nxrecorder/nxrecorder.c
index 1768c16..170e9e0 100644
--- a/system/nxrecorder/nxrecorder.c
+++ b/system/nxrecorder/nxrecorder.c
@@ -64,14 +64,6 @@
 #define NXRECORDER_STATE_RECORDING 1
 #define NXRECORDER_STATE_PAUSED2
 
-#ifndef CONFIG_AUDIO_NUM_BUFFERS
-#  define CONFIG_AUDIO_NUM_BUFFERS  2
-#endif
-
-#ifndef CONFIG_AUDIO_BUFFER_NUMBYTES
-#  define CONFIG_AUDIO_BUFFER_NUMBYTES  8192
-#endif
-
 #ifndef CONFIG_NXRECORDER_MSG_PRIO
 #  define CONFIG_NXRECORDER_MSG_PRIO  1
 #endif
@@ -253,12 +245,8 @@ static void *nxrecorder_recordthread(pthread_addr_t pvarg)
   boolrunning = true;
   boolstreaming = true;
   boolfailed = false;
-#ifdef CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS
   struct ap_buffer_info_s buf_info;
   FAR struct ap_buffer_s  **pbuffers;
-#else
-  FAR struct ap_buffer_s  *pbuffers[CONFIG_AUDIO_NUM_BUFFERS];
-#endif
   unsigned intprio;
 #ifdef CONFIG_DEBUG_FEATURES
   int outstanding = 0;
@@ -270,7 +258,6 @@ static void *nxrecorder_recordthread(pthread_addr_t pvarg)
 
   /* Query the audio device for it's preferred buffer size / qty */
 
-#ifdef CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS
   if ((ret = ioctl(precorder->dev_fd, AUDIOIOC_GETBUFFERINFO,
   (unsigned long) &buf_info)) != OK)
 {
@@ -301,26 +288,14 @@ static void *nxrecorder_recordthread(pthread_addr_t pvarg)
 }
 
   for (x = 0; x < buf_info.nbuffers; x++)
-#else /* CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFER */
-
-  for (x = 0; x < CONFIG_AUDIO_NUM_BUFFERS; x++)
-{
-  pbuffers[x] = NULL;
-}
-
-  for (x = 0; x < CONFIG_AUDIO_NUM_BUFFERS; x++)
-#endif /* CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFER */
 {
   /* Fill in the buffer descriptor struct to issue an alloc request */
 
 #ifdef CONFIG_AUDIO_MULTI_SESSION
   buf_desc.session = precorder->session;
 #endif
-#ifdef CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS
+
   buf_desc.numbytes = buf_info.buffer_size;
-#else
-  buf_desc.numbytes = CONFIG_AUDIO_BUFFER_NUMBYTES;
-#endif
   buf_desc.u.pbuffer = &pbuffers[x];
 
   ret = ioctl(precorder->dev_fd, AUDIOIOC_ALLOCBUFFER,
@@ -337,11 +312,7 @@ static void *nxrecorder_recordthread(pthread_addr_t pvarg)
 
   /* Fill up the pipeline with enqueued buffers */
 
-#ifdef CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS
   for (x = 0; x < buf_info.nbuffers; x++)
-#else
-  for (x = 0; x < CONFIG_AUDIO_NUM_BUFFERS; x++)
-#endif
 {
   /* Write the next buffer of data */
 
@@ -563,7 +534,6 @@ static void *nxrecorder_recordthread(pthread_addr_t pvarg)
 err_out:
   audinfo("Clean-up and exit\n");
 
-#ifdef CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS
   if (pbuffers != NULL)
 {
   audinfo("Freeing buffers\n");
@@ -587,24 +557,6 @@ err_out:
 
   free(pbuffers);
 }
-#else
-audinfo("Freeing buffers\n");
-for (x = 0; x < CONFIG_AUDIO_NUM_BUFFERS; x++)
-  {
-/* Fill in the buffer descriptor struct to issue a free request */
-
-if (pbuffers[x] != NULL)
-  {
-#ifdef CONFIG_AUDIO_MULTI_SESSION
-buf_desc.session = pplayer->session;
-#endif
-buf_desc.u.pbuffer = pbuffers[x];
-ioctl(precorder->dev_fd,
-  AUDIOIOC_FREEBUFFER,
-  (unsigned long) &buf_desc);
-  }
-  }
-#endif
 
   /* Unregister the message queue and release the session */
 



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #301: system: nxrecorder: Refactor nxrecorder.c

2020-06-16 Thread GitBox


xiaoxiang781216 merged pull request #301:
URL: https://github.com/apache/incubator-nuttx-apps/pull/301


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on pull request #301: system: nxrecorder: Refactor nxrecorder.c

2020-06-16 Thread GitBox


xiaoxiang781216 commented on pull request #301:
URL: 
https://github.com/apache/incubator-nuttx-apps/pull/301#issuecomment-645152490


   LGTM.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on issue #1137: Correct behavior of sched_lock() in SMP mode

2020-06-16 Thread GitBox


xiaoxiang781216 edited a comment on issue #1137:
URL: 
https://github.com/apache/incubator-nuttx/issues/1137#issuecomment-645153945


   > i have two comments
   > 
   > * to me, enter_critical_section() is another primitive with unclear 
semantics. are you interested in more fine grained locking? or, do you think 
the "global irq lock" approach is good enough for what nuttx is for?
   
   Here is the similar question: 
https://github.com/apache/incubator-nuttx/issues/1144
   
   > * how about introducing a set of new api with clear semantics and name, 
say, preempt_disable().
   
   Does sched_lock equivalent to preempt_disable?



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] xiaoxiang781216 commented on issue #1137: Correct behavior of sched_lock() in SMP mode

2020-06-16 Thread GitBox


xiaoxiang781216 commented on issue #1137:
URL: 
https://github.com/apache/incubator-nuttx/issues/1137#issuecomment-645153945


   > i have two comments
   > 
   > * to me, enter_critical_section() is another primitive with unclear 
semantics. are you interested in more fine grained locking? or, do you think 
the "global irq lock" approach is good enough for what nuttx is for?
   
   Here is the similar question:
   https://github.com/apache/incubator-nuttx/issues/1144
   
   > * how about introducing a set of new api with clear semantics and name, 
say, preempt_disable().
   
   Does sched_lock equivalent to preempt_disable?



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] yamt commented on issue #1137: Correct behavior of sched_lock() in SMP mode

2020-06-16 Thread GitBox


yamt commented on issue #1137:
URL: 
https://github.com/apache/incubator-nuttx/issues/1137#issuecomment-645166781


   > Does sched_lock equivalent to preempt_disable?
   
   ideally it should be, if i read @patacongo's comment correctly.
   it would allow us to replace sched_lock gradually.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] sebastianene07 commented on a change in pull request #1009: Add support for preemptive scheduling in simulator build

2020-06-16 Thread GitBox


sebastianene07 commented on a change in pull request #1009:
URL: https://github.com/apache/incubator-nuttx/pull/1009#discussion_r441303412



##
File path: arch/sim/src/sim/up_releasepending.c
##
@@ -114,7 +118,11 @@ void up_release_pending(void)
 
   /* Then switch contexts */
 
+#ifdef CONFIG_SIM_PREEMPTIBLE
+  swapcontext(&prev_rtcb->xcp.context, &rtcb->xcp.context);

Review comment:
   By looking more at this API `sigsetjmp/siglongjmp` doesn't have a direct 
way for setting the initial task context. The ucontext API has the advantage of 
having the makecontext function. We need to manually change the PC and the SP 
in the `sigjmp_buf` from the `up_initial_state` call and this should be done 
for every arch that is building the `sim` config.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] sebastianene07 commented on a change in pull request #1009: Add support for preemptive scheduling in simulator build

2020-06-16 Thread GitBox


sebastianene07 commented on a change in pull request #1009:
URL: https://github.com/apache/incubator-nuttx/pull/1009#discussion_r441303412



##
File path: arch/sim/src/sim/up_releasepending.c
##
@@ -114,7 +118,11 @@ void up_release_pending(void)
 
   /* Then switch contexts */
 
+#ifdef CONFIG_SIM_PREEMPTIBLE
+  swapcontext(&prev_rtcb->xcp.context, &rtcb->xcp.context);

Review comment:
   By looking more at this API `sigsetjmp/siglongjmp` doesn't have a direct 
way for setting the initial task context. The ucontext API has the advantage of 
having the makecontext function. We need to manually change the PC and the SP 
in the `sigjmp_buf` from the `up_initial_state` call and this should be done 
for every arch.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] raiden00pl commented on pull request #1248: Do not set oneshot zero timer period

2020-06-16 Thread GitBox


raiden00pl commented on pull request #1248:
URL: https://github.com/apache/incubator-nuttx/pull/1248#issuecomment-645180373


   I'm not sure if this is the correct behavior. Shouldn't we return an error 
when a given period is not achievable? 
   This is the case where the function argument is out of the supported range, 
and in this case we should return an error (probably -EINVAL).



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] YuuichiNakamura opened a new pull request #1260: drivers/syslog/note_driver.c: nxstyle fix

2020-06-16 Thread GitBox


YuuichiNakamura opened a new pull request #1260:
URL: https://github.com/apache/incubator-nuttx/pull/1260


   ## Summary
   Only fixing styles.
   
   ## Impact
   None.
   
   ## Testing
   
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [incubator-nuttx] jerpelea commented on pull request #1252: STM32L4: fix 48MHz MSI clock selection logic

2020-06-16 Thread GitBox


jerpelea commented on pull request #1252:
URL: https://github.com/apache/incubator-nuttx/pull/1252#issuecomment-645190392


   @v01d Please add commit messages for all commits 



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org