(mynewt-newtmgr) 01/01: Merge pull request #209 from m-gorecki/coap-fix

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git

commit b1abd41e853c404629c15afcd0f23d5cac0b1aa3
Merge: cf9985f 1e2b81b
Author: Vipul Rahane 
AuthorDate: Sat Jun 8 00:03:58 2024 -0700

Merge pull request #209 from m-gorecki/coap-fix

Fix CoAP over serial fragmentation problem

 newtmgr/bll/bll_sesn.go  | 10 --
 nmxact/mgmt/transceiver.go   | 10 --
 nmxact/mtech_lora/mtech_lora_sesn.go |  2 +-
 nmxact/nmble/naked_sesn.go   | 18 +-
 nmxact/nmserial/serial_sesn.go   |  2 +-
 nmxact/udp/udp_sesn.go   | 11 ---
 6 files changed, 35 insertions(+), 18 deletions(-)



(mynewt-newtmgr) branch master updated (cf9985f -> b1abd41)

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

vipulrahane pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git


from cf9985f  build(deps): bump golang.org/x/net from 0.17.0 to 0.23.0
 add 1e2b81b  Fix CoAP over serial fragmentation problem
 new b1abd41  Merge pull request #209 from m-gorecki/coap-fix

The 1 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:
 newtmgr/bll/bll_sesn.go  | 10 --
 nmxact/mgmt/transceiver.go   | 10 --
 nmxact/mtech_lora/mtech_lora_sesn.go |  2 +-
 nmxact/nmble/naked_sesn.go   | 18 +-
 nmxact/nmserial/serial_sesn.go   |  2 +-
 nmxact/udp/udp_sesn.go   | 11 ---
 6 files changed, 35 insertions(+), 18 deletions(-)



(mynewt-core) 01/01: Merge pull request #3230 from JuulLabs/config_fcb_wd_kick

2024-05-21 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 00452e6834ffce72a4a10f59de5248d177916434
Merge: 262a66bf6 482a5c10f
Author: Vipul Rahane 
AuthorDate: Tue May 21 17:00:25 2024 -0700

Merge pull request #3230 from JuulLabs/config_fcb_wd_kick

sys/config: Add watchdog tickle before each conf_fcb_var_read

 sys/config/src/config_fcb.c | 3 +++
 1 file changed, 3 insertions(+)



(mynewt-core) branch master updated (262a66bf6 -> 00452e683)

2024-05-21 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


from 262a66bf6 mcu/stm32l0: Fix voltage scaling configuration
 add 482a5c10f config_fcb: add watchdog tickle
 new 00452e683 Merge pull request #3230 from JuulLabs/config_fcb_wd_kick

The 1 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:
 sys/config/src/config_fcb.c | 3 +++
 1 file changed, 3 insertions(+)



(mynewt-newt) 01/01: Fix whole archive compiler flag handling

2024-05-17 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch 
vipul/fix_whole_archive_compiler_fag_handling
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git

commit 0307ed2efa518f866246696700f939a3f36c0d64
Author: Vipul Rahane 
AuthorDate: Fri May 17 14:14:28 2024 -0700

Fix whole archive compiler flag handling
---
 newt/toolchain/compiler.go | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/newt/toolchain/compiler.go b/newt/toolchain/compiler.go
index f84e16ed..13b3899d 100644
--- a/newt/toolchain/compiler.go
+++ b/newt/toolchain/compiler.go
@@ -1036,11 +1036,10 @@ func (c *Compiler) CompileBinaryCmd(dstFile string, 
options map[string]bool,
for _, lib := range libList {
if lib.WholeArch {
cmd = append(cmd, "-Wl,--whole-archive")
-   }
-   cmd = append(cmd, lib.File)
-   if lib.WholeArch {
+   } else {
cmd = append(cmd, "-Wl,--no-whole-archive")
}
+   cmd = append(cmd, lib.File)
}
if c.ldResolveCircularDeps {
cmd = append(cmd, "-Wl,--end-group")



(mynewt-newt) branch vipul/fix_whole_archive_compiler_fag_handling created (now 0307ed2e)

2024-05-17 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch 
vipul/fix_whole_archive_compiler_fag_handling
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git


  at 0307ed2e Fix whole archive compiler flag handling

This branch includes the following new commits:

 new 0307ed2e Fix whole archive compiler flag handling

The 1 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.




(mynewt-newt) branch vipul/fix_whole_archive_compiler_fag_handling deleted (was 1686c678)

2024-05-17 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch 
vipul/fix_whole_archive_compiler_fag_handling
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git


 was 1686c678 Don't panic in case of other error types in NewtUsage

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(mynewt-newt) branch vipul/fix_whole_archive_compiler_fag_handling created (now 1686c678)

2024-05-17 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch 
vipul/fix_whole_archive_compiler_fag_handling
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git


  at 1686c678 Don't panic in case of other error types in NewtUsage

No new revisions were added by this update.



(mynewt-core) branch vipul/logging_num_entries deleted (was 5851c5db7)

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

vipulrahane pushed a change to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


 was 5851c5db7 sys/log: Fix CI error

This change permanently discards the following revisions:

 discard 5851c5db7 sys/log: Fix CI error



(mynewt-core) branch vipul/logging_num_entries created (now 5851c5db7)

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

vipulrahane pushed a change to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


  at 5851c5db7 sys/log: Fix CI error

This branch includes the following new commits:

 new 5851c5db7 sys/log: Fix CI error

The 1 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.




(mynewt-core) 01/01: sys/log: Fix CI error

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

vipulrahane pushed a commit to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 5851c5db79678655b9d5af76051db027eab0f45f
Author: Vipul Rahane 
AuthorDate: Wed Apr 3 10:09:37 2024 -0700

sys/log: Fix CI error
---
 sys/log/full/src/log_shell.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/log/full/src/log_shell.c b/sys/log/full/src/log_shell.c
index e01350aab..d9042542c 100644
--- a/sys/log/full/src/log_shell.c
+++ b/sys/log/full/src/log_shell.c
@@ -190,7 +190,7 @@ shell_log_dump_cmd(int argc, char **argv)
 } else if (num_entries) {
 rc = log_get_entries(log, log_limit, );
 if (!rc) {
-console_printf("entries: %lu\n", entries);
+console_printf("entries: %u\n", entries);
 } else if (rc == SYS_ENOTSUP) {
 console_printf("Number of entries not supported!\n");
 } else {



(mynewt-core) branch vipul/logging_num_entries deleted (was 68bc308b4)

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

vipulrahane pushed a change to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


 was 68bc308b4 Use LOG_VERSION: 3 for number of log entries support

This change permanently discards the following revisions:

 discard 68bc308b4 Use LOG_VERSION: 3 for number of log entries support



(mynewt-core) branch vipul/logging_num_entries created (now 68bc308b4)

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

vipulrahane pushed a change to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


  at 68bc308b4 Use LOG_VERSION: 3 for number of log entries support

This branch includes the following new commits:

 new 68bc308b4 Use LOG_VERSION: 3 for number of log entries support

The 1 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.




(mynewt-core) 01/01: Use LOG_VERSION: 3 for number of log entries support

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

vipulrahane pushed a commit to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 68bc308b4083b3aa4e17f91ae9426c5921a67512
Author: Vipul Rahane 
AuthorDate: Tue Apr 2 14:30:51 2024 -0700

Use LOG_VERSION: 3 for number of log entries support
---
 sys/log/full/include/log/log.h | 20 ++--
 sys/log/full/src/log.c | 14 +++---
 2 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/sys/log/full/include/log/log.h b/sys/log/full/include/log/log.h
index 1b0309e79..dc0cef7a0 100644
--- a/sys/log/full/include/log/log.h
+++ b/sys/log/full/include/log/log.h
@@ -129,21 +129,11 @@ struct log_handler {
 /* Image hash length to be looged */
 #define LOG_IMG_HASHLEN 4
 
-/* Flags used to indicate type of data in reserved payload*/
-#define LOG_FLAGS_IMG_HASH (1 << 0)
+/* Flags used to indicate type of data in reserved payload */
+#define LOG_FLAGS_IMG_HASH(1 << 0)
 #define LOG_FLAGS_NUM_ENTRIES (1 << 1)
 
 #if MYNEWT_VAL(LOG_VERSION) == 3
-struct log_entry_hdr {
-int64_t ue_ts;
-uint32_t ue_index;
-uint8_t ue_module;
-uint8_t ue_level;
-uint8_t ue_etype : 4;
-uint8_t ue_flags : 4;
-uint8_t ue_imghash[4];
-} __attribute__((__packed__));
-#elif MYNEWT_VAL(LOG_VERSION) == 4
 struct log_entry_hdr {
 int64_t ue_ts;
 uint32_t ue_index;
@@ -160,9 +150,7 @@ struct log_entry_hdr {
 
 #define LOG_BASE_ENTRY_HDR_SIZE (15)
 
-#if MYNEWT_VAL(LOG_FLAGS_NUM_ENTRIES)
 #define LOG_NUM_ENTRIES_SIZE (sizeof(((struct log *)0)->l_num_entries))
-#endif
 
 #define LOG_MODULE_STR(module)  log_module_get_name(module)
 
@@ -229,9 +217,7 @@ struct log {
 #if !MYNEWT_VAL(LOG_GLOBAL_IDX)
 uint32_t l_idx;
 #endif
-#if MYNEWT_VAL(LOG_FLAGS_NUM_ENTRIES)
 uint32_t l_num_entries;
-#endif
 #if MYNEWT_VAL(LOG_STATS)
 STATS_SECT_DECL(logs) l_stats;
 #endif
@@ -786,8 +772,6 @@ log_read_hdr_by_idx(struct log *log, uint32_t idx, struct 
log_entry_hdr *out_hdr
  * @param log The log to get number of entries for
  * @param idx The log index to read number of entries from
  * @param num_entries Ptr to fill up number of entries in log
- *
- * @return 0 on success, non-zero on failure
  */
 int
 log_get_entries(struct log *log, uint32_t idx, uint32_t *entries);
diff --git a/sys/log/full/src/log.c b/sys/log/full/src/log.c
index 68481b2e8..9c19893a5 100644
--- a/sys/log/full/src/log.c
+++ b/sys/log/full/src/log.c
@@ -337,7 +337,6 @@ log_read_hdr_walk(struct log *log, struct log_offset 
*log_offset,
 }
 }
 
-#if MYNEWT_VAL(LOG_FLAGS_NUM_ENTRIES)
 if (arg->hdr->ue_flags & LOG_FLAGS_NUM_ENTRIES) {
 rc = log_fill_num_entries(log, dptr, arg->hdr, offset);
 if (!rc || rc == SYS_ENOTSUP) {
@@ -346,7 +345,6 @@ log_read_hdr_walk(struct log *log, struct log_offset 
*log_offset,
 arg->read_success = 0;
 }
 }
-#endif
 
 /* Abort the walk; only one header needed. */
 return 1;
@@ -511,8 +509,6 @@ log_register(const char *name, struct log *log, const 
struct log_handler *lh,
 log->l_idx = hdr.ue_index + 1;
 }
 #endif
-
-#if MYNEWT_VAL(LOG_FLAGS_NUM_ENTRIES)
 /* If this is a persisted log, read the num_entries from its most
  * recent entry. We need to ensure the number of entries are
  * monotonically increasing.
@@ -520,7 +516,6 @@ log_register(const char *name, struct log *log, const 
struct log_handler *lh,
 if (hdr.ue_num_entries >= log->l_num_entries) {
 log->l_num_entries = hdr.ue_num_entries + 1;
 }
-#endif
 OS_EXIT_CRITICAL(sr);
 }
 }
@@ -544,11 +539,9 @@ log_hdr_len(const struct log_entry_hdr *hdr)
 len += LOG_IMG_HASHLEN;
 }
 
-#if MYNEWT_VAL(LOG_FLAGS_NUM_ENTRIES)
 if (hdr->ue_flags & LOG_FLAGS_NUM_ENTRIES) {
 len += LOG_NUM_ENTRIES_SIZE;
 }
-#endif
 
 return len;
 }
@@ -1084,7 +1077,6 @@ log_read_hdr(struct log *log, const void *dptr, struct 
log_entry_hdr *hdr)
 }
 }
 
-#if MYNEWT_VAL(LOG_FLAGS_NUM_ENTRIES)
 if (hdr->ue_flags & LOG_FLAGS_NUM_ENTRIES) {
 bytes_read = log_read(log, dptr, >ue_num_entries,
   LOG_BASE_ENTRY_HDR_SIZE + bytes_read,
@@ -1093,7 +1085,6 @@ log_read_hdr(struct log *log, const void *dptr, struct 
log_entry_hdr *hdr)
 return SYS_EIO;
 }
 }
-#endif
 
 return 0;
 }
@@ -1148,9 +1139,8 @@ log_flush(struct log *log)
 {
 int rc;
 
-#if MYNEWT_VAL(LOG_FLAGS_NUM_ENTRIES)
 log->l_num_entries = 0;
-#endif
+
 rc = log->l_log->log_flush(log);
 if (rc != 0) {
 goto err;
@@ -1254,6 +1244,8 @@ log_fill_num_entries(struct log *log, const void *dptr,
 return rc;
 }
 #else
+hdr->ue_num_entries = 0;
+
 return SYS_ENOTSUP;
 #endif
 }



(mynewt-core) branch master updated (c9b0ded84 -> efa22cbe5)

2024-03-21 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


from c9b0ded84 mcu/pic32: Add minimal boot code
 add 9b43b9fe6 sys/log: Fix log index after reboot
 new efa22cbe5 Merge pull request #3169 from 
vrahane/vipul/fix_log_idx_after_reboot

The 1 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:
 sys/log/full/src/log.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)



(mynewt-core) 01/01: Merge pull request #3169 from vrahane/vipul/fix_log_idx_after_reboot

2024-03-21 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit efa22cbe57253eed1b83d78697453380365d395a
Merge: c9b0ded84 9b43b9fe6
Author: Vipul Rahane 
AuthorDate: Thu Mar 21 15:56:04 2024 -0700

Merge pull request #3169 from vrahane/vipul/fix_log_idx_after_reboot

sys/log: Fix log index after reboot

 sys/log/full/src/log.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)



(mynewt-newtmgr) branch vipul/log_num_entries_support created (now 7986b77)

2024-03-20 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch vipul/log_num_entries_support
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git


  at 7986b77  logs: Add support for reading number of entries since an 
index for a specific log

This branch includes the following new commits:

 new 7986b77  logs: Add support for reading number of entries since an 
index for a specific log

The 1 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.




(mynewt-newtmgr) branch vipul/log_num_entries_support deleted (was 7986b77)

2024-03-20 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch vipul/log_num_entries_support
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git


 was 7986b77  logs: Add support for reading number of entries since an 
index for a specific log

This change permanently discards the following revisions:

 discard 7986b77  logs: Add support for reading number of entries since an 
index for a specific log



(mynewt-newtmgr) 01/01: logs: Add support for reading number of entries since an index for a specific log

2024-03-20 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/log_num_entries_support
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git

commit 7986b77fb9001ce0784f382a66a378f7a24a5523
Author: Vipul Rahane 
AuthorDate: Wed Mar 20 21:01:14 2024 -0700

logs: Add support for reading number of entries since an index for a 
specific log
---
 newtmgr/cli/log.go   | 85 ++--
 nmxact/nmp/decode.go |  2 ++
 nmxact/nmp/defs.go   |  1 +
 nmxact/nmp/log.go| 46 +++-
 nmxact/xact/log.go   | 43 ++
 5 files changed, 167 insertions(+), 10 deletions(-)

diff --git a/newtmgr/cli/log.go b/newtmgr/cli/log.go
index 0774103..c77b743 100644
--- a/newtmgr/cli/log.go
+++ b/newtmgr/cli/log.go
@@ -60,6 +60,35 @@ type logShowCfg struct {
Timestamp int64
 }
 
+type logNumEntriesCfg struct {
+   Name  string
+   Index uint32
+}
+
+func logNumEntriesParseArgs(args []string) (*logNumEntriesCfg, error) {
+   cfg := {}
+
+   if len(args) < 1 {
+   return cfg, nil
+   }
+   cfg.Name = args[0]
+
+   if len(args) < 2 {
+   cfg.Index = 0
+  } else {
+   u64, err := strconv.ParseUint(args[1], 0, 64)
+   if err != nil {
+   return nil, util.ChildNewtError(err)
+   }
+   if u64 > 0x {
+   return nil, util.NewNewtError("index out of range")
+   }
+   cfg.Index = uint32(u64)
+   }
+
+   return cfg, nil
+}
+
 func logShowParseArgs(args []string) (*logShowCfg, error) {
cfg := {}
 
@@ -110,8 +139,8 @@ func printLogShowRsp(rsp *nmp.LogShowRsp, printHdr bool) {
fmt.Printf("Name: %s\n", log.Name)
fmt.Printf("Type: %s\n", nmp.LogTypeToString(log.Type))
 
-   fmt.Printf("%10s %22s | %16s %16s %6s %8s %s\n",
-   "[index]", "[timestamp]", "[module]", 
"[level]", "[type]",
+   fmt.Printf("%10s %10s %22s | %16s %16s %6s %8s %s\n",
+   "[num_entries]", "[index]", "[timestamp]", 
"[module]", "[level]", "[type]",
"[img]", "[message]")
}
 
@@ -145,7 +174,8 @@ func printLogShowRsp(rsp *nmp.LogShowRsp, printHdr bool) {
msgText = hex.EncodeToString(entry.Msg)
}
 
-   fmt.Printf("%10d %20dus | %16s %16s %6s %8s %s\n",
+   fmt.Printf("%10d %10d %20dus | %16s %16s %6s %8s %s\n",
+   entry.NumEntries,
entry.Index,
entry.Timestamp,
modText,
@@ -207,6 +237,20 @@ func logShowPartialCmd(s sesn.Sesn, cfg *logShowCfg) error 
{
return nil
 }
 
+func logNumEntriesCmd(cmd *cobra.Command, args []string) {
+   cfg, err := logNumEntriesParseArgs(args)
+   if err != nil {
+   nmUsage(cmd, err)
+   }
+
+   s, err := GetSesn()
+   if err != nil {
+   nmUsage(nil, err)
+   }
+
+  logNumEntriesProcCmd(s, cfg)
+}
+
 func logShowCmd(cmd *cobra.Command, args []string) {
cfg, err := logShowParseArgs(args)
if err != nil {
@@ -288,6 +332,33 @@ func logModuleListCmd(cmd *cobra.Command, args []string) {
}
 }
 
+func logNumEntriesProcCmd(s sesn.Sesn, cfg *logNumEntriesCfg) {
+   s, err := GetSesn()
+   if err != nil {
+   nmUsage(nil, err)
+   }
+
+   c := xact.NewLogNumEntriesCmd()
+   c.SetTxOptions(nmutil.TxOptions())
+   c.Name = cfg.Name
+   c.Index = cfg.Index
+
+   res, err := c.Run(s)
+   if err != nil {
+   nmUsage(nil, util.ChildNewtError(err))
+  }
+
+   sres := res.(*xact.LogNumEntriesResult)
+   if sres.Rsp.Rc != 0 {
+   fmt.Printf("error: %d\n", sres.Rsp.Rc)
+ return;
+  }
+
+   fmt.Printf("Number of entries: %d\n", sres.Rsp.NumEntries)
+
+  return
+}
+
 func logLevelListCmd(cmd *cobra.Command, args []string) {
s, err := GetSesn()
if err != nil {
@@ -407,5 +478,13 @@ func logCmd() *cobra.Command {
 
logCmd.AddCommand(ListCmd)
 
+   NumEntriesCmd := {
+   Use:   "num_entries [log-name [min-index]] -c ",
+   Short: "Show the number of entries from index for a particular 
log",
+   Run:   logNumEntriesCmd,
+   }
+
+   logCmd.AddCommand(NumEntriesCmd)
+
return logCmd
 }
diff --git a/nmxact/nmp/decode.go b/nmxact/nmp

(mynewt-core) branch vipul/logging_num_entries deleted (was a66e6efbe)

2024-03-20 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


 was a66e6efbe sys/log: fix coding style in header

This change permanently discards the following revisions:

 discard a66e6efbe sys/log: fix coding style in header



(mynewt-core) 01/01: sys/log: fix coding style in header

2024-03-20 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit a66e6efbe7844fffb55bc8936ccd6cedd888722d
Author: Vipul Rahane 
AuthorDate: Wed Mar 20 12:09:53 2024 -0700

sys/log: fix coding style in header
---
 sys/log/full/include/log/log.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/log/full/include/log/log.h b/sys/log/full/include/log/log.h
index 2bdf4fc67..1b0309e79 100644
--- a/sys/log/full/include/log/log.h
+++ b/sys/log/full/include/log/log.h
@@ -139,8 +139,8 @@ struct log_entry_hdr {
 uint32_t ue_index;
 uint8_t ue_module;
 uint8_t ue_level;
-uint8_t ue_etype:4;
-uint8_t ue_flags:4;
+uint8_t ue_etype : 4;
+uint8_t ue_flags : 4;
 uint8_t ue_imghash[4];
 } __attribute__((__packed__));
 #elif MYNEWT_VAL(LOG_VERSION) == 4
@@ -149,8 +149,8 @@ struct log_entry_hdr {
 uint32_t ue_index;
 uint8_t ue_module;
 uint8_t ue_level;
-uint8_t ue_etype:4;
-uint8_t ue_flags:4;
+uint8_t ue_etype : 4;
+uint8_t ue_flags : 4;
 uint8_t ue_imghash[4];
 uint32_t ue_num_entries;
 } __attribute__((__packed__));



(mynewt-core) branch vipul/logging_num_entries created (now a66e6efbe)

2024-03-20 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


  at a66e6efbe sys/log: fix coding style in header

This branch includes the following new commits:

 new a66e6efbe sys/log: fix coding style in header

The 1 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.




(mynewt-core) branch vipul/logging_num_entries deleted (was f2010e9b9)

2024-03-20 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


 was f2010e9b9 sys/log: Fix coding style of the log header

This change permanently discards the following revisions:

 discard f2010e9b9 sys/log: Fix coding style of the log header
 discard d85ecc063 sys/log/log_fcb: Fix buffer size for number of entries



(mynewt-core) branch vipul/logging_num_entries updated: sys/log: Fix coding style of the log header

2024-03-20 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/vipul/logging_num_entries by 
this push:
 new f2010e9b9 sys/log: Fix coding style of the log header
f2010e9b9 is described below

commit f2010e9b97256dc507e80a4597dbe8cc0001ee9f
Author: Vipul Rahane 
AuthorDate: Wed Mar 20 12:02:41 2024 -0700

sys/log: Fix coding style of the log header
---
 sys/log/full/include/log/log.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/log/full/include/log/log.h b/sys/log/full/include/log/log.h
index aedcb60f6..2bdf4fc67 100644
--- a/sys/log/full/include/log/log.h
+++ b/sys/log/full/include/log/log.h
@@ -142,7 +142,7 @@ struct log_entry_hdr {
 uint8_t ue_etype:4;
 uint8_t ue_flags:4;
 uint8_t ue_imghash[4];
-}__attribute__((__packed__));
+} __attribute__((__packed__));
 #elif MYNEWT_VAL(LOG_VERSION) == 4
 struct log_entry_hdr {
 int64_t ue_ts;
@@ -153,7 +153,7 @@ struct log_entry_hdr {
 uint8_t ue_flags:4;
 uint8_t ue_imghash[4];
 uint32_t ue_num_entries;
-}__attribute__((__packed__));
+} __attribute__((__packed__));
 #else
 #error "Unsupported log version"
 #endif



(mynewt-core) 01/01: sys/log/log_fcb: Fix buffer size for number of entries

2024-03-20 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit d85ecc06326219708a890e5bd027b07ba7f07add
Author: Vipul Rahane 
AuthorDate: Wed Mar 20 12:00:45 2024 -0700

sys/log/log_fcb: Fix buffer size for number of entries
---
 sys/log/full/src/log_fcb.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/sys/log/full/src/log_fcb.c b/sys/log/full/src/log_fcb.c
index b681665c0..e89e2d0de 100644
--- a/sys/log/full/src/log_fcb.c
+++ b/sys/log/full/src/log_fcb.c
@@ -862,8 +862,13 @@ log_fcb_copy_entry(struct log *log, struct fcb_entry 
*entry,
struct fcb *dst_fcb)
 {
 struct log_entry_hdr ueh;
+#if MYNEWT_VAL(LOG_FLAGS_NUM_ENTRIES)
+char data[MYNEWT_VAL(LOG_FCB_COPY_MAX_ENTRY_LEN) + LOG_BASE_ENTRY_HDR_SIZE 
+
+  LOG_IMG_HASHLEN + LOG_NUM_ENTRIES_SIZE];
+#else
 char data[MYNEWT_VAL(LOG_FCB_COPY_MAX_ENTRY_LEN) + LOG_BASE_ENTRY_HDR_SIZE 
+
   LOG_IMG_HASHLEN];
+#endif
 uint16_t hdr_len;
 int dlen;
 int rc;



(mynewt-core) branch vipul/logging_num_entries created (now d85ecc063)

2024-03-20 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch vipul/logging_num_entries
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


  at d85ecc063 sys/log/log_fcb: Fix buffer size for number of entries

This branch includes the following new commits:

 new d85ecc063 sys/log/log_fcb: Fix buffer size for number of entries

The 1 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.




[mynewt-core] branch master updated: hw/usb/tinyusb: Fix sysinit levels so that tinyusb gets initialized before console uses it

2023-10-09 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 1050faeac hw/usb/tinyusb: Fix sysinit levels so that tinyusb gets 
initialized before console uses it
 new f0152ae64 Merge pull request #3090 from 
vrahane/vipul/tinyusb_sysinit_fixes_
1050faeac is described below

commit 1050faeac70e58f26441247996d07e401e602092
Author: Vipul Rahane 
AuthorDate: Thu Oct 5 16:00:09 2023 -0700

hw/usb/tinyusb: Fix sysinit levels so that tinyusb gets initialized
before console uses it

- Changing cdc_console sysinit to 502 adding a new syscfg
  CONSOLE_USB_CDC_SYSINIT_STAGE for CDC USB console
  and use that instead
- Also add restrictions so that usbd is never inited after
  cdc_console
---
 hw/usb/tinyusb/cdc_console/pkg.yml| 2 +-
 hw/usb/tinyusb/cdc_console/syscfg.yml | 7 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/usb/tinyusb/cdc_console/pkg.yml 
b/hw/usb/tinyusb/cdc_console/pkg.yml
index c1a3374df..13ab96fac 100755
--- a/hw/usb/tinyusb/cdc_console/pkg.yml
+++ b/hw/usb/tinyusb/cdc_console/pkg.yml
@@ -32,4 +32,4 @@ pkg.deps:
 - "@apache-mynewt-core/hw/usb/tinyusb/cdc"
 
 pkg.init:
-usb_cdc_console_pkg_init: 'MYNEWT_VAL(CONSOLE_SYSINIT_STAGE)'
+usb_cdc_console_pkg_init: 'MYNEWT_VAL(CONSOLE_USB_CDC_SYSINIT_STAGE)'
diff --git a/hw/usb/tinyusb/cdc_console/syscfg.yml 
b/hw/usb/tinyusb/cdc_console/syscfg.yml
index 7c64373bd..b04d0a2ce 100755
--- a/hw/usb/tinyusb/cdc_console/syscfg.yml
+++ b/hw/usb/tinyusb/cdc_console/syscfg.yml
@@ -25,5 +25,12 @@ syscfg.defs:
 syscfg.vals:
 USBD_CDC_CONSOLE: 1
 
+syscfg.defs:
+CONSOLE_USB_CDC_SYSINIT_STAGE:
+description: >
+  Initialize USB CDC Console at the specified sysinit level
+value: 502
+
 syscfg.restrictions:
 - "USBD_CDC_CONSOLE"
+- CONSOLE_USB_CDC_SYSINIT_STAGE > USBD_SYSINIT_STAGE



[mynewt-core] branch master updated (fa625c181 -> 8bbd2354a)

2023-09-19 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


from fa625c181 tinyusb: Add TinyUSB sdk package with repository
 new e86a5d7f1 sys/log: Add option to make the global log index increment 
sequentially
 new 9ddf35318 sys/log: Optionally allow "log" command to display log index
 new 8bbd2354a Merge pull request #3068 from JuulLabs/global-idx-seq-incr

The 10738 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:
 sys/log/full/src/log.c   | 11 +++
 sys/log/full/src/log_shell.c |  3 +++
 sys/log/full/syscfg.yml  | 10 ++
 3 files changed, 24 insertions(+)



[mynewt-core] branch vipul/juul-master-steam-10-18-2023 deleted (was bfac05b46)

2023-09-19 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


 was bfac05b46 - Add mbedtls dependency & fix merge 10/18/2023 & fix commit

This change permanently discards the following revisions:

 discard bfac05b46 - Add mbedtls dependency & fix merge 10/18/2023 & fix commit
 discard 68203659f sys/log: Optionally allow "log" command to display log index
 discard 211219d7c sys/log: Don't increment global log index unless log is 
persisted.
 discard 9c9404c3a hw/mcu/cmac: Modify pad to wakeup time.
 discard e54e6ea5f Workaround: Add 500us delay to CMAC wakeup calculation
 discard 4a3b76734 Remove accidentally added mynewt-newt
 discard 66ffa232b Increase size of some `struct fcb` members
 discard 8053334c8 da1469x: Add option to not disable watchdog on init
 discard 9ae1dd991 da146x: hal_flash: Add export of RDID detection
 discard c24d3c45b da146x: hal_flash: Autodetect and configure flash
 discard 441931968 Fix bug in chip ID chip



[mynewt-core] 01/01: - Add mbedtls dependency & fix merge 10/18/2023 & fix commit

2023-09-19 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit bfac05b46f2d37b9a9c8a653e31d01998ad7e892
Author: Vipul Rahane 
AuthorDate: Mon Sep 18 22:57:39 2023 -0700

- Add mbedtls dependency & fix merge 10/18/2023 & fix commit
---
 crypto/mbedtls/pkg.yml  | 1 +
 hw/mcu/dialog/cmac/src/cmac_sleep.c | 2 +-
 hw/mcu/dialog/da1469x/syscfg.yml| 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/crypto/mbedtls/pkg.yml b/crypto/mbedtls/pkg.yml
index 4eb6fe3b8..5965fa553 100644
--- a/crypto/mbedtls/pkg.yml
+++ b/crypto/mbedtls/pkg.yml
@@ -35,6 +35,7 @@ pkg.include_dirs:
 - "include"
 - "@mbedtls/include"
 - "@mbedtls/library"
+- "include/mbedtls"
 
 pkg.src_dirs:
 - "@mbedtls/library"
diff --git a/hw/mcu/dialog/cmac/src/cmac_sleep.c 
b/hw/mcu/dialog/cmac/src/cmac_sleep.c
index 1ed611ce3..5691bb2be 100644
--- a/hw/mcu/dialog/cmac/src/cmac_sleep.c
+++ b/hw/mcu/dialog/cmac/src/cmac_sleep.c
@@ -196,7 +196,7 @@ cmac_sleep_calculate_wakeup_time(void)
  * worst case. Finally, LLP compensation takes around 50us.
  */
 T_LPTICK_U(2) + T_LPTICK_U(2) +
-max(T_LPTICK_U(3), T_USEC(g_cmac_shared_data.xtal32m_settle_us)) +
+max(T_LPTICK_U(3), T_USEC(g_cmac_shm_ctrl.xtal32m_settle_us)) +
 T_LPTICK(2) + T_USEC(50) +
 
 /*
diff --git a/hw/mcu/dialog/da1469x/syscfg.yml b/hw/mcu/dialog/da1469x/syscfg.yml
index 8e78f5d35..8105947a1 100644
--- a/hw/mcu/dialog/da1469x/syscfg.yml
+++ b/hw/mcu/dialog/da1469x/syscfg.yml
@@ -463,6 +463,7 @@ syscfg.defs:
 DA1469X_LPCLK_SYSINIT_STAGE:
 description: >
   'Initalization stage for DA1469X'
+value: 1
 
 WATCHDOG_DISABLE_ON_INIT:
 description: >



[mynewt-core] branch vipul/juul-master-steam-10-18-2023 updated (4e691dc1f -> bfac05b46)

2023-09-19 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


 discard 4e691dc1f - Add mbedtls dependency & fix merge 10/18/2023
 new bfac05b46 - Add mbedtls dependency & fix merge 10/18/2023 & fix commit

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (4e691dc1f)
\
 N -- N -- N   refs/heads/vipul/juul-master-steam-10-18-2023 
(bfac05b46)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 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:
 hw/mcu/dialog/cmac/src/cmac_sleep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[mynewt-core] 10/11: sys/log: Optionally allow "log" command to display log index

2023-09-18 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 68203659f5ffca45c0f539071bed0fb75bbb5928
Author: Ben McCrea 
AuthorDate: Wed Aug 30 12:19:29 2023 -0700

sys/log: Optionally allow "log" command to display log index
---
 sys/log/full/src/log_shell.c | 5 -
 sys/log/full/syscfg.yml  | 4 
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/sys/log/full/src/log_shell.c b/sys/log/full/src/log_shell.c
index cf3017a70..5c2a1c00b 100644
--- a/sys/log/full/src/log_shell.c
+++ b/sys/log/full/src/log_shell.c
@@ -69,7 +69,10 @@ shell_log_dump_entry(struct log *log, struct log_offset 
*log_offset,
 console_printf("[ih=0x%x%x%x%x]", ueh->ue_imghash[0], 
ueh->ue_imghash[1],
ueh->ue_imghash[2], ueh->ue_imghash[3]);
 }
-console_printf(" [%llu]  [ix=%lu]", ueh->ue_ts, ueh->ue_index);
+console_printf(" [%llu] ", ueh->ue_ts);
+#if MYNEWT_VAL(LOG_SHELL_SHOW_INDEX)
+console_printf(" [ix=%lu] ", ueh->ue_index);
+#endif
 
 switch (ueh->ue_etype) {
 case LOG_ETYPE_STRING:
diff --git a/sys/log/full/syscfg.yml b/sys/log/full/syscfg.yml
index 4d36b8bc6..a717233a0 100644
--- a/sys/log/full/syscfg.yml
+++ b/sys/log/full/syscfg.yml
@@ -69,6 +69,10 @@ syscfg.defs:
 restrictions:
 - SHELL_TASK
 
+LOG_SHELL_SHOW_INDEX:
+description: '"log" command shows log index when dumping entries'
+value: 0
+
 LOG_MGMT:
 description: 'Expose "log" command in mgmt.'
 value: 0



[mynewt-core] 05/11: Increase size of some `struct fcb` members

2023-09-18 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 66ffa232ba119e69ddd59d8409e4601a82495554
Author: Karthik Bharadwaj 
AuthorDate: Fri Jul 7 01:59:42 2023 +

Increase size of some `struct fcb` members

- Moving the sector_cnt and scratch_cnt members to a uint16_t allows for a 
counts > 255.
- Moving the version to a uint16_t allows for a more flexible scheme of 
versioning.

Component: Flash Circular Buffer
---
 fs/fcb/include/fcb/fcb.h | 2 +-
 mynewt-newt  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/fcb/include/fcb/fcb.h b/fs/fcb/include/fcb/fcb.h
index 4e43e7f0b..3d3c40c17 100644
--- a/fs/fcb/include/fcb/fcb.h
+++ b/fs/fcb/include/fcb/fcb.h
@@ -52,7 +52,7 @@ struct fcb_entry {
 struct fcb {
 /* Caller of fcb_init fills this in */
 uint32_t f_magic;  /* As placed on the disk */
-uint8_t f_version; /* Current version number of the data */
+uint16_t f_version;/* Current version number of the data */
 uint16_t f_sector_cnt; /* Number of elements in sector array */
 uint16_t f_scratch_cnt;/* How many sectors should be kept empty */
 struct flash_area *f_sectors; /* Array of sectors, must be contiguous */
diff --git a/mynewt-newt b/mynewt-newt
new file mode 16
index 0..9dbd3da3f
--- /dev/null
+++ b/mynewt-newt
@@ -0,0 +1 @@
+Subproject commit 9dbd3da3f3ab9e0db3540b9232ac9bd20b07b86d



[mynewt-core] 08/11: hw/mcu/cmac: Modify pad to wakeup time.

2023-09-18 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 9c9404c3a975d097acc225510a0f38e3f7bba130
Author: Will San Filippo 
AuthorDate: Fri Aug 4 14:24:29 2023 -0400

hw/mcu/cmac: Modify pad to wakeup time.

In order to avoid cmac crashes due to compensation of LL timer
causing an EQ_X interrupt to fire off and generating an assert
in cmac_timer_slp_disable, we are adding a 250 usec pad to the
wakeup time. This should be sufficient until the calculations
are fixed (under investigation).
---
 hw/mcu/dialog/cmac/src/cmac_sleep.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/hw/mcu/dialog/cmac/src/cmac_sleep.c 
b/hw/mcu/dialog/cmac/src/cmac_sleep.c
index fa00cba02..1ed611ce3 100644
--- a/hw/mcu/dialog/cmac/src/cmac_sleep.c
+++ b/hw/mcu/dialog/cmac/src/cmac_sleep.c
@@ -198,11 +198,14 @@ cmac_sleep_calculate_wakeup_time(void)
 T_LPTICK_U(2) + T_LPTICK_U(2) +
 max(T_LPTICK_U(3), T_USEC(g_cmac_shared_data.xtal32m_settle_us)) +
 T_LPTICK(2) + T_USEC(50) +
+
 /*
- * Add an extra 500us of settle time due to occasional crashes due to
- * unknown additional wakeup delay. 
+ * We are adding 250 usecs as a safeguard as we know the above
+ * calculations are not correct and need modification. This is
+ * to prevent EQ_X comparator from firing off and causing an
+ * assert when we compensate the LL timer
  */
-T_USEC(500); 
+T_USEC(250);
 }
 
 void



[mynewt-core] 11/11: - Add mbedtls dependency & fix merge 10/18/2023

2023-09-18 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 4e691dc1faa27adc52fee17dbf4b9a23d277a638
Author: Vipul Rahane 
AuthorDate: Mon Sep 18 22:57:39 2023 -0700

- Add mbedtls dependency & fix merge 10/18/2023
---
 crypto/mbedtls/pkg.yml   | 1 +
 hw/mcu/dialog/da1469x/syscfg.yml | 1 +
 2 files changed, 2 insertions(+)

diff --git a/crypto/mbedtls/pkg.yml b/crypto/mbedtls/pkg.yml
index 4eb6fe3b8..5965fa553 100644
--- a/crypto/mbedtls/pkg.yml
+++ b/crypto/mbedtls/pkg.yml
@@ -35,6 +35,7 @@ pkg.include_dirs:
 - "include"
 - "@mbedtls/include"
 - "@mbedtls/library"
+- "include/mbedtls"
 
 pkg.src_dirs:
 - "@mbedtls/library"
diff --git a/hw/mcu/dialog/da1469x/syscfg.yml b/hw/mcu/dialog/da1469x/syscfg.yml
index 8e78f5d35..8105947a1 100644
--- a/hw/mcu/dialog/da1469x/syscfg.yml
+++ b/hw/mcu/dialog/da1469x/syscfg.yml
@@ -463,6 +463,7 @@ syscfg.defs:
 DA1469X_LPCLK_SYSINIT_STAGE:
 description: >
   'Initalization stage for DA1469X'
+value: 1
 
 WATCHDOG_DISABLE_ON_INIT:
 description: >



[mynewt-core] 09/11: sys/log: Don't increment global log index unless log is persisted.

2023-09-18 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 211219d7ce98e6ef9bea14174043bffc60cf3114
Author: Ben McCrea 
AuthorDate: Thu Jun 29 14:20:08 2023 -0700

sys/log: Don't increment global log index unless log is persisted.

The global index is only useful for persisted logs, and if it is incremented
for non-persisted logs there will be jumps in the log indexes of the 
persisted
logs. This makes detection of missing logs a challenging task. By 
incrementing
the global index only for persisted logs, it becomes sequentially 
increasing,
which makes detection of missing/dropped logs trivial for upstream consumers
of the logs.
---
 sys/log/full/src/log.c   | 5 -
 sys/log/full/src/log_shell.c | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/log/full/src/log.c b/sys/log/full/src/log.c
index 4ef785ebf..5a2c823ea 100644
--- a/sys/log/full/src/log.c
+++ b/sys/log/full/src/log.c
@@ -540,7 +540,10 @@ log_append_prepare(struct log *log, uint8_t module, 
uint8_t level,
 
 OS_ENTER_CRITICAL(sr);
 #if MYNEWT_VAL(LOG_GLOBAL_IDX)
-idx = g_log_info.li_next_index++;
+if (log->l_log->log_type == LOG_TYPE_STORAGE) {
+g_log_info.li_next_index++;
+}
+idx = g_log_info.li_next_index;
 #else
 idx = log->l_idx++;
 #endif
diff --git a/sys/log/full/src/log_shell.c b/sys/log/full/src/log_shell.c
index 48db8a822..cf3017a70 100644
--- a/sys/log/full/src/log_shell.c
+++ b/sys/log/full/src/log_shell.c
@@ -69,7 +69,7 @@ shell_log_dump_entry(struct log *log, struct log_offset 
*log_offset,
 console_printf("[ih=0x%x%x%x%x]", ueh->ue_imghash[0], 
ueh->ue_imghash[1],
ueh->ue_imghash[2], ueh->ue_imghash[3]);
 }
-console_printf(" [%llu] ", ueh->ue_ts);
+console_printf(" [%llu]  [ix=%lu]", ueh->ue_ts, ueh->ue_index);
 
 switch (ueh->ue_etype) {
 case LOG_ETYPE_STRING:



[mynewt-core] 07/11: Workaround: Add 500us delay to CMAC wakeup calculation

2023-09-18 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit e54e6ea5ffb40427bb8bcd366488d86f8c6ddc5b
Author: Ben McCrea 
AuthorDate: Tue Jun 20 12:49:05 2023 -0700

Workaround: Add 500us delay to CMAC wakeup calculation

This is intended as a stability assurance workaround due to occasional
crashes in the CMAC due to a TIMER1 interrupt occurring while
cmac_timer_slp_disable() is still in progress. This changes causes the
CMAC to always wake up from deep sleep an extra 500us earlier, to
reduce the likelihood of a TIMER1 interrupt happening too early.
---
 hw/mcu/dialog/cmac/src/cmac_sleep.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/mcu/dialog/cmac/src/cmac_sleep.c 
b/hw/mcu/dialog/cmac/src/cmac_sleep.c
index cc78f7047..fa00cba02 100644
--- a/hw/mcu/dialog/cmac/src/cmac_sleep.c
+++ b/hw/mcu/dialog/cmac/src/cmac_sleep.c
@@ -196,8 +196,13 @@ cmac_sleep_calculate_wakeup_time(void)
  * worst case. Finally, LLP compensation takes around 50us.
  */
 T_LPTICK_U(2) + T_LPTICK_U(2) +
-max(T_LPTICK_U(3), T_USEC(g_cmac_shm_ctrl.xtal32m_settle_us)) +
-T_LPTICK(2) + T_USEC(50);
+max(T_LPTICK_U(3), T_USEC(g_cmac_shared_data.xtal32m_settle_us)) +
+T_LPTICK(2) + T_USEC(50) +
+/*
+ * Add an extra 500us of settle time due to occasional crashes due to
+ * unknown additional wakeup delay. 
+ */
+T_USEC(500); 
 }
 
 void



[mynewt-core] 06/11: Remove accidentally added mynewt-newt

2023-09-18 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 4a3b76734885de4a038c6918096e7cdf5b1867df
Author: Karthik Bharadwaj 
AuthorDate: Fri Jul 7 02:58:56 2023 +

Remove accidentally added mynewt-newt
---
 mynewt-newt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mynewt-newt b/mynewt-newt
deleted file mode 16
index 9dbd3da3f..0
--- a/mynewt-newt
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 9dbd3da3f3ab9e0db3540b9232ac9bd20b07b86d



[mynewt-core] 02/11: da146x: hal_flash: Autodetect and configure flash

2023-09-18 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit c24d3c45be25aafb950f1194f3b43e873517b953
Author: Andy Gross 
AuthorDate: Mon May 23 10:04:15 2022 -0500

da146x: hal_flash: Autodetect and configure flash

This patch adds in autodetection and configuration of Gigadevice and 
Macronix
flash devices based on the manufacturer and device ID.  The intent in this 
is to
allow for a single binary to work on devices with different flash.

Signed-off-by: Andy Gross 
---
 hw/mcu/dialog/da1469x/src/hal_flash.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/mcu/dialog/da1469x/src/hal_flash.c 
b/hw/mcu/dialog/da1469x/src/hal_flash.c
index 0ee84923b..2b84da115 100644
--- a/hw/mcu/dialog/da1469x/src/hal_flash.c
+++ b/hw/mcu/dialog/da1469x/src/hal_flash.c
@@ -461,6 +461,7 @@ qspi_read_rdid(const struct hal_flash *dev)
 static sec_text_ram_core void
 da1469x_hff_mcu_custom_init(const struct hal_flash *dev)
 {
+const struct qspi_flash_config *config = NULL;
 uint32_t primask;
 
 __HAL_DISABLE_INTERRUPTS(primask);



[mynewt-core] 04/11: da1469x: Add option to not disable watchdog on init

2023-09-18 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 8053334c8827b5f549216941d3ed973384c3869b
Author: Andy Gross 
AuthorDate: Fri Sep 23 13:32:10 2022 -0500

da1469x: Add option to not disable watchdog on init

This patch adds a facility to control whether or not the Dialog watchdog is
disabled when the hal_watchdog_init function is being called.

Signed-off-by: Andy Gross 
---
 hw/mcu/dialog/da1469x/src/hal_watchdog.c | 2 +-
 hw/mcu/dialog/da1469x/syscfg.yml | 9 -
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/hw/mcu/dialog/da1469x/src/hal_watchdog.c 
b/hw/mcu/dialog/da1469x/src/hal_watchdog.c
index d7e1df88a..22a24e7df 100644
--- a/hw/mcu/dialog/da1469x/src/hal_watchdog.c
+++ b/hw/mcu/dialog/da1469x/src/hal_watchdog.c
@@ -29,7 +29,7 @@ hal_watchdog_init(uint32_t expire_msecs)
 {
 SYS_WDOG->WATCHDOG_CTRL_REG = 
SYS_WDOG_WATCHDOG_CTRL_REG_WDOG_FREEZE_EN_Msk;
 
-#if MYNEWT_VAL(MCU_WATCHDOG_DISABLE_ON_INIT)
+#if MYNEWT_VAL(WATCHDOG_DISABLE_ON_INIT)
 GPREG->SET_FREEZE_REG |= GPREG_SET_FREEZE_REG_FRZ_SYS_WDOG_Msk;
 #endif
 
diff --git a/hw/mcu/dialog/da1469x/syscfg.yml b/hw/mcu/dialog/da1469x/syscfg.yml
index 5e808b69b..8e78f5d35 100644
--- a/hw/mcu/dialog/da1469x/syscfg.yml
+++ b/hw/mcu/dialog/da1469x/syscfg.yml
@@ -460,14 +460,13 @@ syscfg.defs:
 restrictions:
 - '!GPADC_BATTERY'
 
-MCU_WATCHDOG_DISABLE_ON_INIT:
-description: >
-  'Disable watchdog on init'
-value: 1
-
 DA1469X_LPCLK_SYSINIT_STAGE:
 description: >
   'Initalization stage for DA1469X'
+
+WATCHDOG_DISABLE_ON_INIT:
+description: >
+  'Enable watchdog on init'
 value: 1
 
 syscfg.vals:



[mynewt-core] 03/11: da146x: hal_flash: Add export of RDID detection

2023-09-18 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 9ae1dd991159289f41a522f00a7aed7db6dc6ebb
Author: Andy Gross 
AuthorDate: Tue Jul 26 11:59:32 2022 -0500

da146x: hal_flash: Add export of RDID detection

This patch adds a globally exported pointer to the RDID information detected
during flash init.  This can be used by other software to make decisions 
about
special actions taken with specific flash devices.

Signed-off-by: Andy Gross 
---
 hw/mcu/dialog/da1469x/include/mcu/da1469x_hal.h | 2 +-
 hw/mcu/dialog/da1469x/src/hal_flash.c   | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/mcu/dialog/da1469x/include/mcu/da1469x_hal.h 
b/hw/mcu/dialog/da1469x/include/mcu/da1469x_hal.h
index 78e167528..01014963e 100755
--- a/hw/mcu/dialog/da1469x/include/mcu/da1469x_hal.h
+++ b/hw/mcu/dialog/da1469x/include/mcu/da1469x_hal.h
@@ -85,7 +85,7 @@ struct qspi_flash_config {
 extern const struct qspi_flash_config rdids[];
 extern const int qspi_flash_config_array_size;
 
-const struct qspi_flash_config *da1469x_qspi_get_config(void);
+extern const struct qspi_flash_config *rdid_detected;
 
 #ifdef __cplusplus
 }
diff --git a/hw/mcu/dialog/da1469x/src/hal_flash.c 
b/hw/mcu/dialog/da1469x/src/hal_flash.c
index 2b84da115..18b37ea46 100644
--- a/hw/mcu/dialog/da1469x/src/hal_flash.c
+++ b/hw/mcu/dialog/da1469x/src/hal_flash.c
@@ -34,7 +34,7 @@ union da1469x_qspi_data_reg {
 uint8_t d8;
 };
 
-static const struct qspi_flash_config *rdid_detected = NULL;
+const struct qspi_flash_config *rdid_detected = NULL;
 
 static int da1469x_hff_read(const struct hal_flash *dev, uint32_t address,
 void *dst, uint32_t num_bytes);
@@ -461,7 +461,6 @@ qspi_read_rdid(const struct hal_flash *dev)
 static sec_text_ram_core void
 da1469x_hff_mcu_custom_init(const struct hal_flash *dev)
 {
-const struct qspi_flash_config *config = NULL;
 uint32_t primask;
 
 __HAL_DISABLE_INTERRUPTS(primask);



[mynewt-core] 01/11: Fix bug in chip ID chip

2023-09-18 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 441931968ab0d38347a4a01a71a325f27c726467
Author: Ben McCrea 
AuthorDate: Mon Jun 6 20:08:52 2022 -0700

Fix bug in chip ID chip
---
 .../da1469x/scripts/__pycache__/otp_tool.cpython-38.pyc | Bin 0 -> 15459 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/hw/mcu/dialog/da1469x/scripts/__pycache__/otp_tool.cpython-38.pyc 
b/hw/mcu/dialog/da1469x/scripts/__pycache__/otp_tool.cpython-38.pyc
new file mode 100644
index 0..b28462980
Binary files /dev/null and 
b/hw/mcu/dialog/da1469x/scripts/__pycache__/otp_tool.cpython-38.pyc differ



[mynewt-core] branch vipul/juul-master-steam-10-18-2023 created (now 4e691dc1f)

2023-09-18 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch vipul/juul-master-steam-10-18-2023
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


  at 4e691dc1f - Add mbedtls dependency & fix merge 10/18/2023

This branch includes the following new commits:

 new 441931968 Fix bug in chip ID chip
 new c24d3c45b da146x: hal_flash: Autodetect and configure flash
 new 9ae1dd991 da146x: hal_flash: Add export of RDID detection
 new 8053334c8 da1469x: Add option to not disable watchdog on init
 new 66ffa232b Increase size of some `struct fcb` members
 new 4a3b76734 Remove accidentally added mynewt-newt
 new e54e6ea5f Workaround: Add 500us delay to CMAC wakeup calculation
 new 9c9404c3a hw/mcu/cmac: Modify pad to wakeup time.
 new 211219d7c sys/log: Don't increment global log index unless log is 
persisted.
 new 68203659f sys/log: Optionally allow "log" command to display log index
 new 4e691dc1f - Add mbedtls dependency & fix merge 10/18/2023

The 11 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.




[mynewt-mcumgr] branch master updated (c76b7e3 -> a4dfaad)

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

vipulrahane pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git


from c76b7e3  Mcumgr 0.3.0 release
 new 4b0dc8b  zephyr: update include paths to use 
 new 3d128a6  zephyr: use 
 new a4dfaad  Merge pull request #159 from teslabs/zephyr-includes

The 310 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:
 cborattr/src/cborattr.c|  2 +-
 cmd/fs_mgmt/port/zephyr/src/zephyr_fs_mgmt.c   |  2 +-
 cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c | 14 +++---
 cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt_log.c |  2 +-
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c   |  6 +++---
 cmd/shell_mgmt/port/zephyr/src/zephyr_shell_mgmt.c |  6 +++---
 cmd/stat_mgmt/port/zephyr/src/zephyr_stat_mgmt.c   |  4 ++--
 samples/smp_svr/zephyr/src/main.c  | 16 
 8 files changed, 26 insertions(+), 26 deletions(-)



[mynewt-core] branch master updated: OSX support for detect_programmer

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new c0a8ca3  OSX support for detect_programmer
 new d1c2ff8  Merge pull request #2762 from cqexbesd/detect_programmer_osx
c0a8ca3 is described below

commit c0a8ca3978ac56b866e029c721abdca59f5d0d24
Author: Andrew Stevenson 
AuthorDate: Mon Jan 31 00:02:00 2022 +0100

OSX support for detect_programmer
---
 hw/scripts/common.sh | 21 +
 1 file changed, 21 insertions(+)

diff --git a/hw/scripts/common.sh b/hw/scripts/common.sh
index e987cfe..f0bc46c 100755
--- a/hw/scripts/common.sh
+++ b/hw/scripts/common.sh
@@ -88,6 +88,27 @@ detect_programmer() {
 # extract the VID:PID list for connected USB devices
 USB_DEV=$(lsusb | cut -f6 -d' ')
 
+elif [ $(which system_profiler) ] ; then
+
+# extract the VID:PID list for connected USB devices on OSX
+# and get them in the same format as lsusb from Linux
+USB_DEV=$(system_profiler SPUSBDataType 2>/dev/null | awk '
+/^[ \t]+Product ID:/ {
+# remove leading 0x from hex number
+sub(/^0x/, "", $3);
+PID=$3;
+}
+/^[ \t]+Vendor ID:/ {
+# remove leading 0x from hex number
+sub(/^0x/, "", $3);
+printf("%s:%s\n", PID, $3);
+}
+')
+
+fi
+
+if [ -n "$USB_DEV" ]; then
+
 echo "$USB_DEV" | grep -q -i 'c251:f001'
 [ $? -eq 0 ] && DETECTED_PROGRAMMER='cmsis-dap'
 


[mynewt-core] branch master updated: hw/drivers/adc_nrf52: Assign the device pointer before un-configuring ADC instance. This prevents accessing NULL pointer inside `channel_unconf()` via `init_instan

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new a9848fa  hw/drivers/adc_nrf52: Assign the device pointer before 
un-configuring ADC instance. This prevents accessing NULL pointer inside 
`channel_unconf()` via `init_instance_unconf()`
 new bf147b5  Merge pull request #2717 from vikrant-proxy/adc-nrf52
a9848fa is described below

commit a9848fa1b6c2edaad5cb3354a0766e7c1aae62d2
Author: Vikrant More 
AuthorDate: Fri Nov 12 10:13:58 2021 -0800

hw/drivers/adc_nrf52: Assign the device pointer before un-configuring ADC 
instance. This prevents accessing NULL pointer inside `channel_unconf()` via 
`init_instance_unconf()`
---
 hw/drivers/adc/adc_nrf52/src/adc_nrf52.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/drivers/adc/adc_nrf52/src/adc_nrf52.c 
b/hw/drivers/adc/adc_nrf52/src/adc_nrf52.c
index 8f45942..9dce3de 100644
--- a/hw/drivers/adc/adc_nrf52/src/adc_nrf52.c
+++ b/hw/drivers/adc/adc_nrf52/src/adc_nrf52.c
@@ -163,10 +163,10 @@ nrf52_adc_open(struct os_dev *odev, uint32_t wait, void 
*arg)
 }
 
 if (++(dev->ad_ref_cnt) == 1) {
+global_adc_dev = dev;
 init_instance_unconf();
 NVIC_SetPriority(SAADC_IRQn, 0);
 NVIC_EnableIRQ(SAADC_IRQn);
-global_adc_dev = dev;
 
 if (adc_config) {
 switch (adc_config->resolution) {


[mynewt-core] branch master updated (5af1e00 -> afce64e)

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

vipulrahane pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


from 5af1e00  mcu/nrf5340: Add GPIO pin core selection
 new 47aba2a  mcu/nrf5340: Add a check to confirm that the buffer points to 
a location in RAM. easyDMA can only access RAM locations
 new 6961e82  mcu/nrf5340: Change error code to EINVAL inline with rest of 
the file
 new afce64e  Merge pull request #2711 from vikrant-proxy/ram-check

The 10272 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:
 hw/bus/drivers/i2c_nrf5340/src/i2c_nrf5340.c | 8 
 hw/mcu/nordic/nrf5340/src/hal_spi.c  | 7 ++-
 hw/mcu/nordic/nrf5340_net/src/hal_spi.c  | 7 ++-
 3 files changed, 20 insertions(+), 2 deletions(-)


[mynewt-core] branch master updated: mcu/nrf5340_net: Add ipc_nrf5340 dependency for nrf5340_net_vflash_init

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 958f30a  mcu/nrf5340_net: Add ipc_nrf5340 dependency for 
nrf5340_net_vflash_init
 new feea64e  Merge pull request #2706 from t3zeng/master
958f30a is described below

commit 958f30a980518298aec0c3cb2c166cac2dae992b
Author: Tian Zeng 
AuthorDate: Mon Nov 1 17:16:41 2021 -0400

mcu/nrf5340_net: Add ipc_nrf5340 dependency for nrf5340_net_vflash_init
---
 hw/mcu/nordic/nrf5340_net/pkg.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/mcu/nordic/nrf5340_net/pkg.yml 
b/hw/mcu/nordic/nrf5340_net/pkg.yml
index 7fa8965..3216fdb 100644
--- a/hw/mcu/nordic/nrf5340_net/pkg.yml
+++ b/hw/mcu/nordic/nrf5340_net/pkg.yml
@@ -29,6 +29,7 @@ pkg.deps:
 - "@apache-mynewt-core/hw/mcu/nordic"
 - "@apache-mynewt-core/hw/cmsis-core"
 - "@apache-mynewt-core/hw/hal"
+- "@apache-mynewt-core/hw/drivers/ipc_nrf5340"
 
 pkg.cflags.NFC_PINS_AS_GPIO:
 - '-DCONFIG_NFCT_PINS_AS_GPIOS=1'


[mynewt-core] branch master updated: Define mtb_state on cortex m33 if OS_COREDUMP is enabled

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 244c50c  Define mtb_state on cortex m33 if OS_COREDUMP is enabled
 new 54c14f6  Merge pull request #2701 from t3zeng/master
244c50c is described below

commit 244c50c447e6fbc16a25010b53c5822c12da052c
Author: Tian Zeng 
AuthorDate: Wed Oct 27 14:41:50 2021 -0400

Define mtb_state on cortex m33 if OS_COREDUMP is enabled
---
 kernel/os/src/arch/cortex_m33/os_fault.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/os/src/arch/cortex_m33/os_fault.c 
b/kernel/os/src/arch/cortex_m33/os_fault.c
index 15b5f24..4aa0376 100644
--- a/kernel/os/src/arch/cortex_m33/os_fault.c
+++ b/kernel/os/src/arch/cortex_m33/os_fault.c
@@ -115,7 +115,9 @@ trap_to_coredump(struct trap_frame *tf, struct 
coredump_regs *regs)
 regs->pc = tf->ef->pc;
 regs->psr = tf->ef->psr;
 }
+#endif
 
+#if MYNEWT_VAL(OS_COREDUMP)
 struct mtb_state {
 uint32_t mtb_position_reg;
 uint32_t mtb_master_reg;


[mynewt-core] branch master updated: Implement OS Coredump CB feature

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new c415baa  Implement OS Coredump CB feature
 new 58d4be4  Merge pull request #2687 from t3zeng/master3
c415baa is described below

commit c415baa9be7b6f49e52e3a3ad4aaf0ddfab75713
Author: Tian Zeng 
AuthorDate: Mon Sep 13 15:37:03 2021 -0400

Implement OS Coredump CB feature
---
 kernel/os/include/os/arch/common.h   | 1 +
 kernel/os/include/os/os_fault.h  | 4 
 kernel/os/src/arch/arc/os_fault.c| 8 ++--
 kernel/os/src/arch/cortex_m0/os_fault.c  | 8 ++--
 kernel/os/src/arch/cortex_m3/os_fault.c  | 8 ++--
 kernel/os/src/arch/cortex_m33/os_fault.c | 8 ++--
 kernel/os/src/arch/cortex_m4/os_fault.c  | 8 ++--
 kernel/os/src/arch/cortex_m7/os_fault.c  | 8 ++--
 kernel/os/syscfg.yml | 5 +
 9 files changed, 46 insertions(+), 12 deletions(-)

diff --git a/kernel/os/include/os/arch/common.h 
b/kernel/os/include/os/arch/common.h
index ce80fbb..c5f09f3 100644
--- a/kernel/os/include/os/arch/common.h
+++ b/kernel/os/include/os/arch/common.h
@@ -71,6 +71,7 @@ void os_set_env(os_stack_t *);
 void os_arch_init_task_stack(os_stack_t *sf);
 void os_default_irq_asm(void);
 void os_assert_cb(void);
+void os_coredump_cb(void *tf);
 
 #ifdef __cplusplus
 }
diff --git a/kernel/os/include/os/os_fault.h b/kernel/os/include/os/os_fault.h
index e830e7a..098bf74 100644
--- a/kernel/os/include/os/os_fault.h
+++ b/kernel/os/include/os/os_fault.h
@@ -32,6 +32,10 @@ extern "C" {
 void __assert_func(const char *file, int line, const char *func, const char *e)
 __attribute((noreturn));
 
+#if MYNEWT_VAL(OS_COREDUMP_CB)
+typedef void (*coredump_cb_t)(void *tf);
+#endif
+
 #if MYNEWT_VAL(OS_CRASH_FILE_LINE)
 #define OS_CRASH() (HAL_DEBUG_BREAK(), __assert_func(__FILE__, __LINE__, NULL, 
NULL))
 #else
diff --git a/kernel/os/src/arch/arc/os_fault.c 
b/kernel/os/src/arch/arc/os_fault.c
index 8af16ca..7f18d80 100644
--- a/kernel/os/src/arch/arc/os_fault.c
+++ b/kernel/os/src/arch/arc/os_fault.c
@@ -73,7 +73,7 @@ struct coredump_regs {
 uint32_t psr;
 };
 
-#if MYNEWT_VAL(OS_COREDUMP)
+#if MYNEWT_VAL(OS_COREDUMP) && !MYNEWT_VAL(OS_COREDUMP_CB)
 static void
 trap_to_coredump(struct trap_frame *tf, struct coredump_regs *regs)
 {
@@ -154,7 +154,7 @@ __assert_func(const char *file, int line, const char *func, 
const char *e)
 void
 os_default_irq(struct trap_frame *tf)
 {
-#if MYNEWT_VAL(OS_COREDUMP)
+#if MYNEWT_VAL(OS_COREDUMP) && !MYNEWT_VAL(OS_COREDUMP_CB)
 struct coredump_regs regs;
 #endif
 
@@ -171,8 +171,12 @@ os_default_irq(struct trap_frame *tf)
   tf->ef->r12, tf->ef->lr, tf->ef->pc, tf->ef->psr);
 
 #if MYNEWT_VAL(OS_COREDUMP)
+#if MYNEWT_VAL(OS_COREDUMP_CB)
+os_coredump_cb(tf);
+#else
 trap_to_coredump(tf, );
 coredump_dump(, sizeof(regs));
 #endif
+#endif
 hal_system_reset();
 }
diff --git a/kernel/os/src/arch/cortex_m0/os_fault.c 
b/kernel/os/src/arch/cortex_m0/os_fault.c
index f6cd216..8365169 100644
--- a/kernel/os/src/arch/cortex_m0/os_fault.c
+++ b/kernel/os/src/arch/cortex_m0/os_fault.c
@@ -71,7 +71,7 @@ struct coredump_regs {
 uint32_t psr;
 };
 
-#if MYNEWT_VAL(OS_COREDUMP)
+#if MYNEWT_VAL(OS_COREDUMP) && !MYNEWT_VAL(OS_COREDUMP_CB)
 static void
 trap_to_coredump(struct trap_frame *tf, struct coredump_regs *regs)
 {
@@ -129,7 +129,7 @@ __assert_func(const char *file, int line, const char *func, 
const char *e)
 void
 os_default_irq(struct trap_frame *tf)
 {
-#if MYNEWT_VAL(OS_COREDUMP)
+#if MYNEWT_VAL(OS_COREDUMP) && !MYNEWT_VAL(OS_COREDUMP_CB)
 struct coredump_regs regs;
 #endif
 #if MYNEWT_VAL(OS_CRASH_RESTORE_REGS)
@@ -151,9 +151,13 @@ os_default_irq(struct trap_frame *tf)
 
 os_stacktrace((uintptr_t)(tf->ef + 1));
 #if MYNEWT_VAL(OS_COREDUMP)
+#if MYNEWT_VAL(OS_COREDUMP_CB)
+os_coredump_cb(tf);
+#else
 trap_to_coredump(tf, );
 coredump_dump(, sizeof(regs));
 #endif
+#endif
 
 #if MYNEWT_VAL(OS_CRASH_RESTORE_REGS)
 if ((SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) < 16) {
diff --git a/kernel/os/src/arch/cortex_m3/os_fault.c 
b/kernel/os/src/arch/cortex_m3/os_fault.c
index 4d7d7a0..6765c29 100644
--- a/kernel/os/src/arch/cortex_m3/os_fault.c
+++ b/kernel/os/src/arch/cortex_m3/os_fault.c
@@ -72,7 +72,7 @@ struct coredump_regs {
 uint32_t psr;
 };
 
-#if MYNEWT_VAL(OS_COREDUMP)
+#if MYNEWT_VAL(OS_COREDUMP) && !MYNEWT_VAL(OS_COREDUMP_CB)
 static void
 trap_to_coredump(struct trap_frame *tf, struct coredump_regs *regs)
 {
@@ -142,7 +142,7 @@ __assert_func(const char *file, int line, const char *func, 
const char *e)
 void
 os_default_irq(struct trap_frame *tf)
 {
-#if MYNEWT_VAL(OS_COREDUMP)
+#if MYNEWT_VAL(OS_COREDUMP) && !MYNEWT_VAL(OS_COREDUMP_CB)
 

[mynewt-core] branch master updated: sys/config: Make the maximum value length configurable

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 4aff454  sys/config: Make the maximum value length configurable
 new 8507a56  Merge pull request #2693 from vikrant-proxy/config-max-len
4aff454 is described below

commit 4aff4546646d118ff237f838c621867b24e919e5
Author: Vikrant More 
AuthorDate: Thu Oct 7 16:40:29 2021 -0700

sys/config: Make the maximum value length configurable
---
 sys/config/include/config/config.h | 3 ++-
 sys/config/syscfg.yml  | 4 
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/config/include/config/config.h 
b/sys/config/include/config/config.h
index 116f629..e492c5d 100644
--- a/sys/config/include/config/config.h
+++ b/sys/config/include/config/config.h
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef __cplusplus
 extern "C" {
@@ -36,7 +37,7 @@ extern "C" {
 
 #define CONF_MAX_DIR_DEPTH 8   /* max depth of config tree */
 #define CONF_MAX_NAME_LEN  (8 * CONF_MAX_DIR_DEPTH)
-#define CONF_MAX_VAL_LEN   256
+#define CONF_MAX_VAL_LEN   MYNEWT_VAL(CONFIG_MAX_VAL_LEN)
 #define CONF_NAME_SEPARATOR"/"
 
 #define CONF_NMGR_OP   0
diff --git a/sys/config/syscfg.yml b/sys/config/syscfg.yml
index 471dcb6..b9994c0 100644
--- a/sys/config/syscfg.yml
+++ b/sys/config/syscfg.yml
@@ -89,6 +89,10 @@ syscfg.defs:
 description: >
 Config CLI commands read 1, write 2, read/write 3
 value: 3
+CONFIG_MAX_VAL_LEN:
+description: >
+Max length of a value stored in the config FCB.
+value: 256
 
 syscfg.defs.(CONFIG_FCB || CONFIG_FCB2):
 CONFIG_FCB_FLASH_AREA:


[mynewt-nimble] branch master updated: controller/ble_ll_scan: For callouts number of ticks are used

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
 new a472cf5  controller/ble_ll_scan: For callouts number of ticks are used
 new e49a145  Merge pull request #1010 from vrahane/nimble_scanning_fix
a472cf5 is described below

commit a472cf519c1984700bb201539c8697b0e7aff0f3
Author: vrahane 
AuthorDate: Tue Aug 10 11:54:45 2021 -0700

controller/ble_ll_scan: For callouts number of ticks are used
---
 nimble/controller/src/ble_ll_scan.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/nimble/controller/src/ble_ll_scan.c 
b/nimble/controller/src/ble_ll_scan.c
index 44bb878..e67d806 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -3431,20 +3431,16 @@ ble_ll_set_ext_scan_params(const uint8_t *cmdbuf, 
uint8_t len)
 static void
 ble_ll_scan_duration_period_timers_restart(struct ble_ll_scan_sm *scansm)
 {
-ble_npl_time_t now;
-
-now = ble_npl_time_get();
-
 ble_npl_callout_stop(>duration_timer);
 ble_npl_callout_stop(>period_timer);
 
 if (scansm->duration_ticks) {
 ble_npl_callout_reset(>duration_timer,
-now + scansm->duration_ticks);
+  scansm->duration_ticks);
 
 if (scansm->period_ticks) {
 ble_npl_callout_reset(>period_timer,
-now + 
scansm->period_ticks);
+  scansm->period_ticks);
 }
 }
 }


[mynewt-core] branch master updated: sys/console/minimal: Revert changes in commit b22aea6433dd2663861ed8c2ea56cc229c6c64dd. Instead rename `console_out` to `console_out_nolock` in rtt_console.c

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new b14131a  sys/console/minimal: Revert changes in commit 
b22aea6433dd2663861ed8c2ea56cc229c6c64dd. Instead rename `console_out` to 
`console_out_nolock` in rtt_console.c
 new 4aa5ad3  Merge pull request #2656 from 
vikrant-proxy/console-rtt-minmal-fix
b14131a is described below

commit b14131aa11797fe76e5fab3900d2738ec569
Author: Vikrant More 
AuthorDate: Sat Aug 7 08:12:50 2021 -0700

sys/console/minimal: Revert changes in commit 
b22aea6433dd2663861ed8c2ea56cc229c6c64dd. Instead rename `console_out` to 
`console_out_nolock` in rtt_console.c
---
 sys/console/minimal/src/console.c | 2 --
 sys/console/minimal/src/rtt_console.c | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/sys/console/minimal/src/console.c 
b/sys/console/minimal/src/console.c
index bc920a4..3b7c28f 100644
--- a/sys/console/minimal/src/console.c
+++ b/sys/console/minimal/src/console.c
@@ -134,7 +134,6 @@ end:
 return rc;
 }
 
-#if MYNEWT_VAL(CONSOLE_UART)
 int
 console_out(int c)
 {
@@ -151,7 +150,6 @@ console_out(int c)
 
 return rc;
 }
-#endif
 
 void
 console_prompt_set(const char *prompt, const char *line)
diff --git a/sys/console/minimal/src/rtt_console.c 
b/sys/console/minimal/src/rtt_console.c
index af66f1f..711f0a3 100644
--- a/sys/console/minimal/src/rtt_console.c
+++ b/sys/console/minimal/src/rtt_console.c
@@ -33,7 +33,7 @@ static struct hal_timer rtt_timer;
 static const char CR = '\r';
 
 int
-console_out(int character)
+console_out_nolock(int character)
 {
 char c = (char)character;
 


[mynewt-core] branch master updated: hw/bus/spi_hal: Fix bus_spi_write_read

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 024ef38  hw/bus/spi_hal: Fix bus_spi_write_read
 new 5450a93  Merge pull request #2644 from 
kasjer/kasjer/fix-spi_hal-bus_write_read
024ef38 is described below

commit 024ef3818446701d3c8a7ccdc70ecb4f74efd03a
Author: Jerzy Kasenberg 
AuthorDate: Mon Jul 26 09:17:42 2021 +0200

hw/bus/spi_hal: Fix bus_spi_write_read

Function bus_spi_write_read() was calling hal_spi_txrx()
with NULL for txbuf for transactions involving more then 16 bytes.
NULL pointer is not valid for this function.
When code was build with SPI_HAL_USE_NOBLOCK enabled, zeroed receive buffer
was already used as argument for transmit buffer.
Same approach is now used when SPI_HAL_USE_NOBLOCK is not set.

For data reads 0xFF is used for MOSI line just to be consistent.
Some places used 0 some had 0xFF now 0xFF is used as it was
originally.
---
 hw/bus/drivers/spi_hal/src/spi_hal.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/bus/drivers/spi_hal/src/spi_hal.c 
b/hw/bus/drivers/spi_hal/src/spi_hal.c
index 1404456..5832fee 100644
--- a/hw/bus/drivers/spi_hal/src/spi_hal.c
+++ b/hw/bus/drivers/spi_hal/src/spi_hal.c
@@ -212,7 +212,7 @@ bus_spi_write_read(struct bus_dev *bdev, struct bus_node 
*bnode,
 #if MYNEWT_VAL(SPI_HAL_USE_NOBLOCK)
 if (wlength + rlength <= sizeof(buf)) {
 memcpy(buf, wbuf, wlength);
-memset(buf + wlength, 0, rlength);
+memset(buf + wlength, 0xFF, rlength);
 rc = hal_spi_txrx_noblock(dev->spi_dev.cfg.spi_num, buf, buf, wlength 
+ rlength);
 if (rc == 0) {
 os_sem_pend(>sem, OS_TIMEOUT_NEVER);
@@ -222,7 +222,7 @@ bus_spi_write_read(struct bus_dev *bdev, struct bus_node 
*bnode,
 rc = hal_spi_txrx_noblock(dev->spi_dev.cfg.spi_num, (uint8_t *)wbuf, 
NULL, wlength);
 if (rc == 0) {
 os_sem_pend(>sem, OS_TIMEOUT_NEVER);
-memset(rbuf, 0, rlength);
+memset(rbuf, 0xFF, rlength);
 rc = hal_spi_txrx_noblock(dev->spi_dev.cfg.spi_num, rbuf, rbuf, 
rlength);
 if (rc == 0) {
 os_sem_pend(>sem, OS_TIMEOUT_NEVER);
@@ -239,7 +239,8 @@ bus_spi_write_read(struct bus_dev *bdev, struct bus_node 
*bnode,
 } else {
 rc = hal_spi_txrx(dev->spi_dev.cfg.spi_num, (uint8_t *)wbuf, NULL, 
wlength);
 if (rc == 0) {
-rc = hal_spi_txrx(dev->spi_dev.cfg.spi_num, NULL, rbuf, rlength);
+memset(rbuf, 0xFF, rlength);
+rc = hal_spi_txrx(dev->spi_dev.cfg.spi_num, rbuf, rbuf, rlength);
 }
 }
 #endif


[mynewt-core] branch master updated: sys/console/minimal: Compile `console_out` for UART console only. RTT console has it's own implementation of `console_out` which conflicts if RTT_CONSOLE is used w

2021-07-28 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new b22aea6  sys/console/minimal: Compile `console_out` for UART console 
only. RTT console has it's own implementation of `console_out` which conflicts 
if RTT_CONSOLE is used with console/minimal
 new 15cc93e  Merge pull request #2649 from 
vikrant-proxy/console-rtt-minimal
b22aea6 is described below

commit b22aea6433dd2663861ed8c2ea56cc229c6c64dd
Author: Vikrant More 
AuthorDate: Wed Jul 28 22:06:46 2021 -0700

sys/console/minimal: Compile `console_out` for UART console only. RTT 
console has it's own implementation of `console_out` which conflicts if 
RTT_CONSOLE is used with console/minimal
---
 sys/console/minimal/src/console.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/console/minimal/src/console.c 
b/sys/console/minimal/src/console.c
index 3b7c28f..bc920a4 100644
--- a/sys/console/minimal/src/console.c
+++ b/sys/console/minimal/src/console.c
@@ -134,6 +134,7 @@ end:
 return rc;
 }
 
+#if MYNEWT_VAL(CONSOLE_UART)
 int
 console_out(int c)
 {
@@ -150,6 +151,7 @@ console_out(int c)
 
 return rc;
 }
+#endif
 
 void
 console_prompt_set(const char *prompt, const char *line)


[mynewt-core] branch master updated: sys/console/rtt_console: Move console_rx_restart within CONSOLE_INPUT guards to compile correctly with CONSOLE_INPUT turned off

2021-07-28 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 4eecfae  sys/console/rtt_console: Move console_rx_restart within 
CONSOLE_INPUT guards to compile correctly with CONSOLE_INPUT turned off
 new 1a60f1b  Merge pull request #2648 from vikrant-proxy/console-rtt
4eecfae is described below

commit 4eecfae4f78673a80db068f744a42e6f45ee7972
Author: Vikrant More 
AuthorDate: Wed Jul 28 21:54:52 2021 -0700

sys/console/rtt_console: Move console_rx_restart within CONSOLE_INPUT 
guards to compile correctly with CONSOLE_INPUT turned off
---
 sys/console/full/src/rtt_console.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys/console/full/src/rtt_console.c 
b/sys/console/full/src/rtt_console.c
index cfe8c82..1f75de2 100644
--- a/sys/console/full/src/rtt_console.c
+++ b/sys/console/full/src/rtt_console.c
@@ -115,12 +115,6 @@ console_out_nolock(int character)
 return character;
 }
 
-void
-console_rx_restart(void)
-{
-os_cputime_timer_relative(_timer, 0);
-}
-
 #if MYNEWT_VAL(CONSOLE_INPUT)
 
 #define RTT_INPUT_POLL_INTERVAL_MIN 10 /* ms */
@@ -154,6 +148,12 @@ rtt_console_poll_func(void *arg)
 
 os_cputime_timer_relative(_timer, itvl_ms * 1000);
 }
+
+void
+console_rx_restart(void)
+{
+os_cputime_timer_relative(_timer, 0);
+}
 #endif
 
 int


[mynewt-artifact] branch master updated: image: Function to convert image to a byte slice

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-artifact.git


The following commit(s) were added to refs/heads/master by this push:
 new 1794f79  image: Function to convert image to a byte slice
 new 4f94303  Merge pull request #24 from ccollins476ad/image-bin
1794f79 is described below

commit 1794f7972c3c6dba99dfe3bdc85354cfe0984e3d
Author: Christopher Collins 
AuthorDate: Thu Jun 4 14:15:14 2020 -0700

image: Function to convert image to a byte slice
---
 image/image.go | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/image/image.go b/image/image.go
index f7ef6e6..90191fc 100644
--- a/image/image.go
+++ b/image/image.go
@@ -20,6 +20,8 @@
 package image
 
 import (
+   "bufio"
+   "bytes"
"encoding/binary"
"fmt"
"io"
@@ -774,3 +776,20 @@ func DecryptHwFull(img Image, secret []byte) (Image, 
error) {
 func (img *Image) IsEncrypted() bool {
return img.Header.Flags_F_ENCRYPTED != 0
 }
+
+func (img *Image) Bin() ([]byte, error) {
+   b := {}
+   w := bufio.NewWriter(b)
+
+   _, err := img.Write(w)
+   if err != nil {
+   return nil, err
+   }
+
+   err = w.Flush()
+   if err != nil {
+   return nil, err
+   }
+
+   return b.Bytes(), nil
+}


[mynewt-core] branch master updated: hw/mcu/nordic/nrf5340: Update syscfg names to reflect nRF5340 netcore version and signing key

2021-07-26 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 1008815  hw/mcu/nordic/nrf5340: Update syscfg names to reflect nRF5340 
netcore version and signing key
 new d96ca03  Merge pull request #2647 from 
vikrant-proxy/build-net-core-names
1008815 is described below

commit 100881582fba9b04ea26631899ec279580b890c0
Author: Vikrant More 
AuthorDate: Mon Jul 26 12:40:28 2021 -0700

hw/mcu/nordic/nrf5340: Update syscfg names to reflect nRF5340 netcore 
version and signing key
---
 hw/mcu/nordic/nrf5340/net_core_image/scripts/build_net_core.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/mcu/nordic/nrf5340/net_core_image/scripts/build_net_core.sh 
b/hw/mcu/nordic/nrf5340/net_core_image/scripts/build_net_core.sh
index 32d6f60..958537b 100755
--- a/hw/mcu/nordic/nrf5340/net_core_image/scripts/build_net_core.sh
+++ b/hw/mcu/nordic/nrf5340/net_core_image/scripts/build_net_core.sh
@@ -25,10 +25,10 @@ NET_CORE_O=${MYNEWT_USER_SRC_DIR}/net_core_img.o
 # Default flags for create-image
 CREATE_IMAGE_FLAGS="timestamp"
 
-if [ -z "${MYNEWT_VAL_APPLICATION_VERSION}" ] && [ -z 
"${MYNEWT_VAL_APPLICATION_SIGNING_KEYS}" ]; then
+if [ -z "${MYNEWT_VAL_NRF5340_NET_APPLICATION_VERSION}" ] && [ -z 
"${MYNEWT_VAL_NRF5340_NET_APPLICATION_SIGNING_KEYS}" ]; then
   echo Using default create-image flags=$CREATE_IMAGE_FLAGS
 else
-  CREATE_IMAGE_FLAGS="${MYNEWT_VAL_APPLICATION_VERSION} 
${MYNEWT_VAL_APPLICATION_SIGNING_KEYS}"
+  CREATE_IMAGE_FLAGS="${MYNEWT_VAL_NRF5340_NET_APPLICATION_VERSION} 
${MYNEWT_VAL_NRF5340_NET_APPLICATION_SIGNING_KEYS}"
   echo Using user defined create-image flags=$CREATE_IMAGE_FLAGS
 fi
 


[mynewt-newt] branch master updated: mfg: account for updated bootloader path in mfg command

2021-07-20 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git


The following commit(s) were added to refs/heads/master by this push:
 new 67de80e  mfg: account for updated bootloader path in mfg command
 new 9009682  Merge pull request #440 from vikrant-proxy/mfg-create
67de80e is described below

commit 67de80e3a247f2ec9b678e6c3aeffb52e34a23ae
Author: Vikrant More 
AuthorDate: Sun Jul 11 14:16:59 2021 -0700

mfg: account for updated bootloader path in mfg command
---
 newt/builder/paths.go |  1 +
 newt/mfg/build.go |  7 ++-
 newt/mfg/emit.go  | 31 +++
 3 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/newt/builder/paths.go b/newt/builder/paths.go
index cc5c2d3..46b61c6 100644
--- a/newt/builder/paths.go
+++ b/newt/builder/paths.go
@@ -28,6 +28,7 @@ import (
"mynewt.apache.org/newt/util"
 )
 
+const BUILD_NAME_BOOT = "app/@mcuboot"
 const BUILD_NAME_APP = "app"
 const BUILD_NAME_LOADER = "loader"
 
diff --git a/newt/mfg/build.go b/newt/mfg/build.go
index e13b93c..ac04172 100644
--- a/newt/mfg/build.go
+++ b/newt/mfg/build.go
@@ -223,7 +223,12 @@ func newMfgBuildTarget(dt DecodedTarget,
t.App().Name())
man, err := manifest.ReadManifest(mpath)
if err != nil {
-   return MfgBuildTarget{}, util.FmtNewtError("%s", err.Error())
+   mpath = builder.ManifestPath(dt.Name, builder.BUILD_NAME_BOOT,
+   t.App().Name())
+   man, err = manifest.ReadManifest(mpath)
+   if err != nil {
+   return MfgBuildTarget{}, util.FmtNewtError("%s", 
err.Error())
+   }
}
 
isBoot := parse.ValueIsTrue(man.Syscfg["BOOT_LOADER"])
diff --git a/newt/mfg/emit.go b/newt/mfg/emit.go
index 7a8068f..e6632d7 100644
--- a/newt/mfg/emit.go
+++ b/newt/mfg/emit.go
@@ -99,7 +99,7 @@ type MfgEmitter struct {
 // `.bin` files; image targets use `.img`.
 func targetSrcBinPath(t *target.Target, isBoot bool) string {
if isBoot {
-   return builder.AppBinPath(t.Name(), builder.BUILD_NAME_APP,
+   return builder.AppBinPath(t.Name(), builder.BUILD_NAME_BOOT,
t.App().Name())
} else {
return builder.AppImgPath(t.Name(), builder.BUILD_NAME_APP,
@@ -108,26 +108,41 @@ func targetSrcBinPath(t *target.Target, isBoot bool) 
string {
 }
 
 // Calculates the source path of a target's `.elf` file.
-func targetSrcElfPath(t *target.Target) string {
-   return builder.AppElfPath(t.Name(), builder.BUILD_NAME_APP, 
t.App().Name())
+func targetSrcElfPath(t *target.Target, isBoot bool) string {
+   if isBoot {
+   return builder.AppElfPath(t.Name(), builder.BUILD_NAME_BOOT, 
t.App().Name())
+   } else {
+   return builder.AppElfPath(t.Name(), builder.BUILD_NAME_APP, 
t.App().Name())
+   }
 }
 
 // Calculates the source path of a target's manifest file.
-func targetSrcManifestPath(t *target.Target) string {
-   return builder.ManifestPath(t.Name(), builder.BUILD_NAME_APP,
-   t.App().Name())
+func targetSrcManifestPath(t *target.Target, isBoot bool) string {
+   if isBoot {
+   return builder.ManifestPath(t.Name(), builder.BUILD_NAME_BOOT,
+   t.App().Name())
+   } else {
+   return builder.ManifestPath(t.Name(), builder.BUILD_NAME_APP,
+   t.App().Name())
+   }
 }
 
 func newMfgEmitTarget(bt MfgBuildTarget) (MfgEmitTarget, error) {
+   var build_name string
+   if bt.IsBoot {
+   build_name = builder.BUILD_NAME_BOOT
+   } else {
+   build_name = builder.BUILD_NAME_APP
+   }
return MfgEmitTarget{
Name:bt.Target.FullName(),
Offset:  bt.Area.Offset + bt.Offset,
Size:bt.Size,
IsBoot:  bt.IsBoot,
BinPath: targetSrcBinPath(bt.Target, bt.IsBoot),
-   ElfPath: targetSrcElfPath(bt.Target),
+   ElfPath: targetSrcElfPath(bt.Target, bt.IsBoot),
ManifestPath: builder.ManifestPath(bt.Target.Name(),
-   builder.BUILD_NAME_APP, bt.Target.App().Name()),
+   build_name, bt.Target.App().Name()),
ExtraManifest: bt.ExtraManifest,
}, nil
 }


[mynewt-newt] branch master updated (4a5cd61 -> a71cc78)

2021-07-20 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git.


from 4a5cd61  cmake: escape also '<' and '>'
 add a71cc78  mfg: Add an optional base address flag to mfg commands that 
can specify a base address other than 0 (#441)

No new revisions were added by this update.

Summary of changes:
 newt/cli/mfg_cmds.go |  8 ++--
 newt/mfg/build.go| 21 +++--
 newt/mfg/misc.go |  3 ++-
 3 files changed, 19 insertions(+), 13 deletions(-)


[mynewt-core] branch master updated: spi_hal: Pull CS line back up if write / read_write operations fail

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new be3ce6f  spi_hal: Pull CS line back up if write / read_write 
operations fail
 new 22aa08e  Merge pull request #2641 from vikrant-proxy/spi-hal-rc
be3ce6f is described below

commit be3ce6f0e7220fbd2223246820504d0f1ab7a18f
Author: Vikrant More 
AuthorDate: Tue Jul 13 12:34:41 2021 -0700

spi_hal: Pull CS line back up if write / read_write operations fail
---
 hw/bus/drivers/spi_hal/src/spi_hal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/bus/drivers/spi_hal/src/spi_hal.c 
b/hw/bus/drivers/spi_hal/src/spi_hal.c
index 26e30a2..1404456 100644
--- a/hw/bus/drivers/spi_hal/src/spi_hal.c
+++ b/hw/bus/drivers/spi_hal/src/spi_hal.c
@@ -184,7 +184,7 @@ bus_spi_write(struct bus_dev *bdev, struct bus_node *bnode, 
const uint8_t *buf,
 rc = hal_spi_txrx(dev->spi_dev.cfg.spi_num, (uint8_t *)buf, NULL, length);
 #endif
 
-if (!(flags & BUS_F_NOSTOP)) {
+if (rc || !(flags & BUS_F_NOSTOP)) {
 hal_gpio_write(node->pin_cs, 1);
 }
 
@@ -244,7 +244,7 @@ bus_spi_write_read(struct bus_dev *bdev, struct bus_node 
*bnode,
 }
 #endif
 
-if (!(flags & BUS_F_NOSTOP)) {
+if (rc || !(flags & BUS_F_NOSTOP)) {
 hal_gpio_write(node->pin_cs, 1);
 }
 


[mynewt-core] branch master updated: nrf5340/i2c: Fix STOP event handling

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new f6c1534  nrf5340/i2c: Fix STOP event handling
 new d1404c1  Merge pull request #2632 from 
kasjer/kasjer/nrf5340-i2c-stop-fix
f6c1534 is described below

commit f6c15346ea9eafbb5e7d1dae2fdfa5db78f53bb4
Author: Jerzy Kasenberg 
AuthorDate: Fri Jun 25 16:36:53 2021 +0200

nrf5340/i2c: Fix STOP event handling

After read or write that ended with error (address nack)
interrupts are blocked and stop condition is generated
that will rise EVENTS_STOP later on.

Read or write finishes with this event active.

On next write or read interrupt were enabled before EVENTS_STOP
was cleared resulting in interrupt handling that would signal
semaphore.
In some cases that may lead to data corruption when code reuses buffer
while I2C transaction is ongoing.

This changes clears old events before enabling interrupts.
---
 hw/bus/drivers/i2c_nrf5340/src/i2c_nrf5340.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/hw/bus/drivers/i2c_nrf5340/src/i2c_nrf5340.c 
b/hw/bus/drivers/i2c_nrf5340/src/i2c_nrf5340.c
index 11e3c90..a3b9c45 100644
--- a/hw/bus/drivers/i2c_nrf5340/src/i2c_nrf5340.c
+++ b/hw/bus/drivers/i2c_nrf5340/src/i2c_nrf5340.c
@@ -270,15 +270,17 @@ bus_i2c_nrf5340_read(struct bus_dev *bdev, struct 
bus_node *bnode,
 nrf_twim->RXD.PTR = (uint32_t)buf;
 nrf_twim->RXD.MAXCNT = length;
 nrf_twim->RXD.LIST = 0;
-nrf_twim->INTEN = TWIM_INTEN_ERROR_Msk | TWIM_INTENCLR_STOPPED_Msk;
-nrf_twim->SHORTS = TWIM_SHORTS_LASTRX_STOP_Msk;
 
 nrf_twim->EVENTS_STOPPED = 0;
 nrf_twim->EVENTS_ERROR = 0;
 nrf_twim->EVENTS_SUSPENDED = 0;
 nrf_twim->EVENTS_RXSTARTED = 0;
-nrf_twim->TASKS_RESUME = 1;
 nrf_twim->EVENTS_LASTRX = 0;
+
+nrf_twim->INTEN = TWIM_INTEN_ERROR_Msk | TWIM_INTENCLR_STOPPED_Msk;
+nrf_twim->SHORTS = TWIM_SHORTS_LASTRX_STOP_Msk;
+
+nrf_twim->TASKS_RESUME = 1;
 nrf_twim->TASKS_STARTRX = 1;
 
 rc = os_sem_pend(>sem, timeout);
@@ -324,7 +326,14 @@ bus_i2c_nrf5340_write(struct bus_dev *bdev, struct 
bus_node *bnode,
 
 nrf_twim->TXD.PTR = (uint32_t)buf;
 nrf_twim->TXD.LIST = 0;
-nrf_twim->INTENSET = TWIM_INTEN_ERROR_Msk;
+
+nrf_twim->EVENTS_ERROR = 0;
+nrf_twim->EVENTS_STOPPED = 0;
+nrf_twim->EVENTS_SUSPENDED = 0;
+nrf_twim->EVENTS_TXSTARTED = 0;
+nrf_twim->EVENTS_LASTTX = 0;
+
+nrf_twim->INTEN = TWIM_INTEN_ERROR_Msk;
 if (last_op) {
 nrf_twim->INTENSET = TWIM_INTENSET_STOPPED_Msk;
 nrf_twim->SHORTS = TWIM_SHORTS_LASTTX_STOP_Msk;
@@ -332,13 +341,7 @@ bus_i2c_nrf5340_write(struct bus_dev *bdev, struct 
bus_node *bnode,
 nrf_twim->INTENSET = TWIM_INTENSET_SUSPENDED_Msk;
 nrf_twim->SHORTS = TWIM_SHORTS_LASTTX_SUSPEND_Msk;
 }
-
-nrf_twim->EVENTS_ERROR = 0;
-nrf_twim->EVENTS_STOPPED = 0;
-nrf_twim->EVENTS_SUSPENDED = 0;
-nrf_twim->EVENTS_TXSTARTED = 0;
 nrf_twim->TASKS_RESUME = 1;
-nrf_twim->EVENTS_LASTTX = 0;
 nrf_twim->TASKS_STARTTX = 1;
 
 rc = os_sem_pend(>sem, timeout);


[mynewt-core] branch master updated: net/osdp: Ignore reply packets from another PD

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 005eba2  net/osdp: Ignore reply packets from another PD
 new 4919feb  Merge pull request #2636 from vikrant-proxy/osdp-ignore-reply
005eba2 is described below

commit 005eba2c29e411473ba057f93c5531cb80d2205c
Author: Vikrant More 
AuthorDate: Sat Jun 26 13:24:59 2021 -0700

net/osdp: Ignore reply packets from another PD

If there is more data the 'skipped' packet than the entire packet itself, 
store this in rx_buf_len and adjust state based on it.
---
 net/osdp/src/osdp_pd.c | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/net/osdp/src/osdp_pd.c b/net/osdp/src/osdp_pd.c
index dac9775..0eab223 100644
--- a/net/osdp/src/osdp_pd.c
+++ b/net/osdp/src/osdp_pd.c
@@ -52,6 +52,7 @@
 #define OSDP_PD_ERR_GENERIC   -1
 #define OSDP_PD_ERR_REPLY -2
 #define OSDP_PD_ERR_EMPTY_Q   -3
+#define OSDP_PD_ERR_IGNORE-4
 
 /* Implicit cababilities */
 static struct osdp_pd_cap osdp_pd_cap[] = {
@@ -963,6 +964,9 @@ pd_receive_packet(struct osdp_pd *pd)
 if (err == OSDP_ERR_PKT_FMT) {
 return OSDP_PD_ERR_GENERIC;
 }
+if (err == OSDP_ERR_PKT_SKIP) {
+err = OSDP_PD_ERR_IGNORE;
+}
 if (err == OSDP_ERR_PKT_NONE) {
 pd->reply_id = 0; /* reset past reply ID so phy can send NAK */
 pd->ephemeral_data[0] = 0; /* reset past NAK reason */
@@ -980,8 +984,12 @@ pd_receive_packet(struct osdp_pd *pd)
 remaining = pd->rx_buf_len - len;
 if (remaining) {
 memmove(pd->rx_buf, pd->rx_buf + len, remaining);
-pd->rx_buf_len = remaining;
 }
+/**
+ * Store remaining length that needs to be processed.
+ * State machine will be updated accordingly.
+ */
+pd->rx_buf_len = remaining;
 
 return err;
 }
@@ -1019,6 +1027,15 @@ osdp_update(struct osdp_pd *pd)
 osdp_millis_since(pd->tstamp) < MYNEWT_VAL(OSDP_RESP_TOUT_MS)) {
 break;
 }
+if (ret == OSDP_PD_ERR_IGNORE) {
+/* Process command if non-empty */
+if (pd->rx_buf_len > 0) {
+pd->state = OSDP_PD_STATE_PROCESS_CMD;
+} else {
+pd->state = OSDP_PD_STATE_IDLE;
+}
+break;
+}
 if (ret != OSDP_PD_ERR_NONE && ret != OSDP_PD_ERR_REPLY) {
 OSDP_LOG_ERROR("osdp: pd: CMD receive error/timeout - err:%d\n", 
ret);
 pd->state = OSDP_PD_STATE_ERR;


[mynewt-core] branch master updated: net/osdp Support additional baud rates

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new dd8cd10  net/osdp Support additional baud rates
 new f4e27fd  Merge pull request #2635 from vikrant-proxy/osdp-baud
dd8cd10 is described below

commit dd8cd1028f12dadfdc8b71d9b2d3e049b7f847a6
Author: Vikrant More 
AuthorDate: Tue Jun 29 14:01:01 2021 -0700

net/osdp Support additional baud rates
---
 net/osdp/src/osdp_pd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/osdp/src/osdp_pd.c b/net/osdp/src/osdp_pd.c
index d24d51b..dac9775 100644
--- a/net/osdp/src/osdp_pd.c
+++ b/net/osdp/src/osdp_pd.c
@@ -506,7 +506,10 @@ pd_decode_command(struct osdp_pd *pd, uint8_t *buf, int 
len)
 cmd.comset.baud_rate |= buf[pos++] << 24;
 if (cmd.comset.address >= 0x7F ||
 (cmd.comset.baud_rate != 9600 &&
+ cmd.comset.baud_rate != 14400 &&
+ cmd.comset.baud_rate != 19200 &&
  cmd.comset.baud_rate != 38400 &&
+ cmd.comset.baud_rate != 57600 &&
  cmd.comset.baud_rate != 115200)) {
 OSDP_LOG_ERROR("osdp: pd: COMSET Failed! command discarded\n");
 cmd.comset.address = pd->address;


[mynewt-core] branch master updated: net/osdp Add logging prefixes

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new dc14e33  net/osdp Add logging prefixes
 new debc8b2  Merge pull request #2634 from vikrant-proxy/osdp-logs
dc14e33 is described below

commit dc14e33e23a9fa465a37ee3a6a88956a662da92f
Author: Vikrant More 
AuthorDate: Sat Jun 26 12:47:02 2021 -0700

net/osdp Add logging prefixes
---
 net/osdp/src/osdp.c|  2 +-
 net/osdp/src/osdp_common.c | 10 +++---
 net/osdp/src/osdp_cp.c | 84 +++---
 net/osdp/src/osdp_pd.c | 66 ++--
 net/osdp/src/osdp_sc.c |  2 +-
 5 files changed, 82 insertions(+), 82 deletions(-)

diff --git a/net/osdp/src/osdp.c b/net/osdp/src/osdp.c
index 05d799e..b6293fe 100644
--- a/net/osdp/src/osdp.c
+++ b/net/osdp/src/osdp.c
@@ -277,5 +277,5 @@ osdp_init(osdp_pd_info_t *info, uint8_t *scbk)
 
 os_callout_reset(_refresh_timer, OSDP_REFRESH_INTERVAL);
 
-OSDP_LOG_INFO("OSDP OK\n");
+OSDP_LOG_INFO("osdp: init OK\n");
 }
diff --git a/net/osdp/src/osdp_common.c b/net/osdp/src/osdp_common.c
index 3d749a4..b5d1b09 100644
--- a/net/osdp/src/osdp_common.c
+++ b/net/osdp/src/osdp_common.c
@@ -79,7 +79,7 @@ osdp_encrypt(uint8_t *key, uint8_t *iv, uint8_t *data, int 
len)
 len, /* inlen: input len */
 iv, /* iv: IV start */
 ) == TC_CRYPTO_FAIL) {
-OSDP_LOG_ERROR("CBC ENCRYPT - Failed");
+OSDP_LOG_ERROR("osdp: sc: CBC ENCRYPT - Failed");
 }
 
 /* copy ciphertext from offset */
@@ -87,7 +87,7 @@ osdp_encrypt(uint8_t *key, uint8_t *iv, uint8_t *data, int 
len)
 
 } else {
 if (tc_aes_encrypt(data, data, ) == TC_CRYPTO_FAIL) {
-OSDP_LOG_ERROR("ECB ENCRYPT - Failed\n");
+OSDP_LOG_ERROR("osdp: sc: ECB ENCRYPT - Failed\n");
 }
 }
 }
@@ -116,13 +116,13 @@ osdp_decrypt(uint8_t *key, uint8_t *iv, uint8_t *data, 
int len)
 len + TC_AES_BLOCK_SIZE, /* inlen: total length of input, iv + 
buffer length */
 scratch_buf1, /* iv: offset to IV in input buffer */
 ) == TC_CRYPTO_FAIL) {
-OSDP_LOG_ERROR("CBC DECRYPT - Failed\n");
+OSDP_LOG_ERROR("osdp: sc: CBC DECRYPT - Failed\n");
 }
 /* Copy decrypted data into output buffer */
 memcpy(data, scratch_buf1, len);
 } else {
 if (tc_aes_decrypt(data, data, ) == TC_CRYPTO_FAIL) {
-OSDP_LOG_ERROR("ECB DECRYPT - Failed\n");
+OSDP_LOG_ERROR("osdp: sc: ECB DECRYPT - Failed\n");
 }
 }
 }
@@ -137,7 +137,7 @@ osdp_get_rand(uint8_t *buf, int len)
 #elif MYNEWT_VAL(TRNG)
 trng = (struct trng_dev *) os_dev_open("trng", OS_WAIT_FOREVER, NULL);
 if (trng == NULL) {
-OSDP_LOG_ERROR("Could not open TRNG\n");
+OSDP_LOG_ERROR("osdp: sc: Could not open TRNG\n");
 buf = NULL;
 }
 
diff --git a/net/osdp/src/osdp_cp.c b/net/osdp/src/osdp_cp.c
index 0d48748..52b5e02 100644
--- a/net/osdp/src/osdp_cp.c
+++ b/net/osdp/src/osdp_cp.c
@@ -82,7 +82,7 @@ cp_cmd_queue_init(struct osdp_pd *pd, uint16_t num)
   pd->cmd.pool_buf, pool_names[num]);
 
 if (rc != OS_OK) {
-OSDP_LOG_ERROR("Failed to initialize command pool\n");
+OSDP_LOG_ERROR("osdp: cp: Failed to initialize command pool\n");
 return rc;
 }
 
@@ -101,7 +101,7 @@ cp_cmd_alloc(struct osdp_pd *pd)
 
 cmd = os_memblock_get(>cmd.pool);
 if (cmd == NULL) {
-OSDP_LOG_ERROR("Command pool allocation failed\n");
+OSDP_LOG_ERROR("osdp: cp: Command pool allocation failed\n");
 return NULL;
 }
 
@@ -244,7 +244,7 @@ cp_channel_release(struct osdp_pd *pd)
 struct osdp *ctx = TO_CTX(pd);
 
 if (ctx->cp->channel_lock[pd->offset] != pd->channel.id) {
-OSDP_LOG_ERROR("Attempt to release another PD's channel lock\n");
+OSDP_LOG_ERROR("osdp: cp: Attempt to release another PD's channel 
lock\n");
 return -1;
 }
 ctx->cp->channel_lock[pd->offset] = 0;
@@ -272,7 +272,7 @@ cp_build_command(struct osdp_pd *pd, uint8_t *buf, int 
max_len)
 
 #define ASSERT_BUF_LEN(need) \
 if (max_len < need) {\
-OSDP_LOG_ERROR("OOM at build CMD(%02x) - have:%d, need:%d\n", \
+OSDP_LOG_ERROR("osdp: cp: OOM at build CMD(%02x) - have:%d, 
need:%d\n", \
 pd->cmd_id, max_len, need);  \
 return OSDP_CP_ERR_GENERIC;  \
 

[mynewt-core] branch master updated: hw/mcu/nordic: use correct struct type for spi2 and spi3 bus. bus_spi_hal_dev_create needs struct `bus_spi_hal_dev` when using bus driver.

2021-06-21 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new e87646f  hw/mcu/nordic: use correct struct type for spi2 and spi3 bus. 
bus_spi_hal_dev_create needs struct `bus_spi_hal_dev` when using bus driver.
 new 057f6ff  Merge pull request #2622 from vikrant-proxy/nrf52-periph-fix
e87646f is described below

commit e87646f207960771de225ed96027408079e09b39
Author: Vikrant More 
AuthorDate: Mon Jun 21 09:32:55 2021 -0700

hw/mcu/nordic: use correct struct type for spi2 and spi3 bus. 
bus_spi_hal_dev_create needs struct `bus_spi_hal_dev` when using bus driver.
---
 hw/mcu/nordic/nrf52xxx/src/nrf52_periph.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/mcu/nordic/nrf52xxx/src/nrf52_periph.c 
b/hw/mcu/nordic/nrf52xxx/src/nrf52_periph.c
index a758916..f3413ca 100644
--- a/hw/mcu/nordic/nrf52xxx/src/nrf52_periph.c
+++ b/hw/mcu/nordic/nrf52xxx/src/nrf52_periph.c
@@ -203,7 +203,7 @@ static const struct bus_spi_dev_cfg spi2_cfg = {
 .pin_mosi = MYNEWT_VAL(SPI_2_MASTER_PIN_MOSI),
 .pin_miso = MYNEWT_VAL(SPI_2_MASTER_PIN_MISO),
 };
-static struct bus_spi_dev spi2_bus;
+static struct bus_spi_hal_dev spi2_bus;
 #else
 static const struct nrf52_hal_spi_cfg os_bsp_spi2m_cfg = {
 .sck_pin  = MYNEWT_VAL(SPI_2_MASTER_PIN_SCK),
@@ -229,7 +229,7 @@ static const struct bus_spi_dev_cfg spi3_cfg = {
 .pin_mosi = MYNEWT_VAL(SPI_3_MASTER_PIN_MOSI),
 .pin_miso = MYNEWT_VAL(SPI_3_MASTER_PIN_MISO),
 };
-static struct bus_spi_dev spi3_bus;
+static struct bus_spi_hal_dev spi3_bus;
 #else
 static const struct nrf52_hal_spi_cfg os_bsp_spi3m_cfg = {
 .sck_pin  = MYNEWT_VAL(SPI_3_MASTER_PIN_SCK),


[mynewt-core] branch master updated: hw/mcu/nrf5340: Add APPROTECT user handling syscfg

2021-06-15 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 5c84ed7  hw/mcu/nrf5340: Add APPROTECT user handling syscfg
 new ae153db  Merge pull request #2614 from vrahane/nrf5340_revA_errata26
5c84ed7 is described below

commit 5c84ed79bda2462be84f81bd4ad5eaebd23271b0
Author: vrahane 
AuthorDate: Tue Jun 8 21:56:35 2021 -0700

hw/mcu/nrf5340: Add APPROTECT user handling syscfg

- As per Errata 26, CTRL-AP: APPROTECT.DISABLE and
  SECUREAPPROTECT.DISABLE registers are not functional
- So we need to conditionally disable its usage
- The syscfg can also be used for user handling of APPROTECT,
  hence making it generic.
---
 hw/mcu/nordic/nrf5340/pkg.yml| 3 +++
 hw/mcu/nordic/nrf5340/syscfg.yml | 9 -
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/mcu/nordic/nrf5340/pkg.yml b/hw/mcu/nordic/nrf5340/pkg.yml
index 161e0bc..4ffbaec 100644
--- a/hw/mcu/nordic/nrf5340/pkg.yml
+++ b/hw/mcu/nordic/nrf5340/pkg.yml
@@ -104,3 +104,6 @@ pkg.deps.I2C_3':
 
 pkg.deps.NRF5340_EMBED_NET_CORE:
 - "@apache-mynewt-core/hw/mcu/nordic/nrf5340/net_core_image"
+
+pkg.cflags.MCU_NRF5340_EN_APPROTECT_USERHANDLING:
+- "-DENABLE_APPROTECT_USER_HANDLING"
diff --git a/hw/mcu/nordic/nrf5340/syscfg.yml b/hw/mcu/nordic/nrf5340/syscfg.yml
index 94a14af..9a07ebb 100644
--- a/hw/mcu/nordic/nrf5340/syscfg.yml
+++ b/hw/mcu/nordic/nrf5340/syscfg.yml
@@ -25,13 +25,14 @@ syscfg.defs:
 - $notnull
 choices:
 - nRF5340_APP
+
 MCU_APP_CORE:
 description: >
 Constant value always set to 1.  It allows to have common
 packages for network and application core that do have
 some differences depending on which core they are build for.
 value: 1
-restriction: MCU_NET_CORE==0
+
 MCU_FLASH_MIN_WRITE_SIZE:
 description: >
 Specifies the required alignment for internal flash writes.
@@ -89,6 +90,12 @@ syscfg.defs:
 Default value is 0, so disabled.
 value: 0
 
+MCU_NRF5340_EN_APPROTECT_USERHANDLING:
+description: >
+This needs to be set by the BSP/App/Target if the
+MCU/BSP wants to handle APPROTECT on its own.
+value: 0
+
 # MCU peripherals definitions
 ADC_0:
 description: 'Enable nRF5340 ADC 0'


[mynewt-core] 01/01: hw/mcu/nrf5340: Add APPROTECT user handling syscfg

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

vipulrahane pushed a commit to branch nrf5340_revA_errata26
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 9a048c079826f995662d8bc3076ab49c7d1896f6
Author: vrahane 
AuthorDate: Mon Jun 14 10:24:59 2021 -0700

hw/mcu/nrf5340: Add APPROTECT user handling syscfg

- Only added for app core
---
 hw/mcu/nordic/nrf5340/pkg.yml| 5 -
 hw/mcu/nordic/nrf5340/syscfg.yml | 3 +--
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/hw/mcu/nordic/nrf5340/pkg.yml b/hw/mcu/nordic/nrf5340/pkg.yml
index 8df1576..4ffbaec 100644
--- a/hw/mcu/nordic/nrf5340/pkg.yml
+++ b/hw/mcu/nordic/nrf5340/pkg.yml
@@ -105,10 +105,5 @@ pkg.deps.I2C_3':
 pkg.deps.NRF5340_EMBED_NET_CORE:
 - "@apache-mynewt-core/hw/mcu/nordic/nrf5340/net_core_image"
 
-# As per Errata 26 for Engineering RevA silicon we should not
-# depend on CTRL-AP: APPROTECT.DISABLE and SECUREAPPROTECT.DISABLE
-# registers since they are not functional. It causes quite a lot of
-# crashes and hardfaults, so enabling this will keep APPROTECT
-# control with UICR.
 pkg.cflags.MCU_NRF5340_EN_APPROTECT_USERHANDLING:
 - "-DENABLE_APPROTECT_USER_HANDLING"
diff --git a/hw/mcu/nordic/nrf5340/syscfg.yml b/hw/mcu/nordic/nrf5340/syscfg.yml
index c161d6b..9a07ebb 100644
--- a/hw/mcu/nordic/nrf5340/syscfg.yml
+++ b/hw/mcu/nordic/nrf5340/syscfg.yml
@@ -93,8 +93,7 @@ syscfg.defs:
 MCU_NRF5340_EN_APPROTECT_USERHANDLING:
 description: >
 This needs to be set by the BSP/App/Target if the
-MCU is a Rev A Silicon so that APPROTECT is enabled
-but handled by UICR instead.
+MCU/BSP wants to handle APPROTECT on its own.
 value: 0
 
 # MCU peripherals definitions


[mynewt-core] branch nrf5340_revA_errata26 created (now 9a048c0)

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

vipulrahane pushed a change to branch nrf5340_revA_errata26
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


  at 9a048c0  hw/mcu/nrf5340: Add APPROTECT user handling syscfg

This branch includes the following new commits:

 new 9a048c0  hw/mcu/nrf5340: Add APPROTECT user handling syscfg

The 1 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.



[mynewt-core] branch master updated (e7e7e06 -> 48f9d70)

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

vipulrahane pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


from e7e7e06  crypto: mbedtls: Fix xc32 build problem
 new 97a46bb  hw/drivers/uart: Add MAX3107 driver
 new 08135a6  hw/drivers/max3107: Add function to get real baudrate
 new 3e9bdee  hw/drivers/max3107: Add stats
 new 48f9d70  Merge pull request #2605 from kasjer/kasjer/max3107

The 10122 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:
 hw/drivers/uart/max3107/include/max3107/max3107.h |  201 
 hw/drivers/uart/{uart_da1469x => max3107}/pkg.yml |7 +-
 hw/drivers/uart/max3107/src/max3107.c | 1144 +
 hw/drivers/uart/max3107/src/max3107_priv.h|  291 ++
 hw/drivers/uart/max3107/syscfg.yml|  155 +++
 5 files changed, 1796 insertions(+), 2 deletions(-)
 create mode 100644 hw/drivers/uart/max3107/include/max3107/max3107.h
 copy hw/drivers/uart/{uart_da1469x => max3107}/pkg.yml (86%)
 create mode 100644 hw/drivers/uart/max3107/src/max3107.c
 create mode 100644 hw/drivers/uart/max3107/src/max3107_priv.h
 create mode 100644 hw/drivers/uart/max3107/syscfg.yml


[mynewt-mcumgr] branch master updated: cmd/img_mgmt: Call dfu stop cb on erase

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git


The following commit(s) were added to refs/heads/master by this push:
 new afa95ba  cmd/img_mgmt: Call dfu stop cb on erase
 new a5d3441  Merge pull request #125 from vrahane/img_mgmt_erase_stop_dfu
afa95ba is described below

commit afa95ba5dc1b12b0caa8d735b21c28dc892a7059
Author: vrahane 
AuthorDate: Thu Jun 10 12:32:23 2021 -0700

cmd/img_mgmt: Call dfu stop cb on erase

- If a DFU is in process, stop callback needs to be called when erase is
performed, since the DFU state of the image gets cleared
---
 cmd/img_mgmt/src/img_mgmt.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/cmd/img_mgmt/src/img_mgmt.c b/cmd/img_mgmt/src/img_mgmt.c
index 1a40ffc..f66dc62 100644
--- a/cmd/img_mgmt/src/img_mgmt.c
+++ b/cmd/img_mgmt/src/img_mgmt.c
@@ -314,6 +314,10 @@ img_mgmt_erase(struct mgmt_ctxt *ctxt)
 
 rc = img_mgmt_impl_erase_slot();
 
+if (!rc) {
+img_mgmt_dfu_stopped();
+}
+
 err = 0;
 err |= cbor_encode_text_stringz(>encoder, "rc");
 err |= cbor_encode_int(>encoder, rc);


[mynewt-core] branch nrf5340_revA_errata26 created (now 956255f)

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

vipulrahane pushed a change to branch nrf5340_revA_errata26
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


  at 956255f  nrf5340:Rev A errata 26 fix, needed only for appcore

This branch includes the following new commits:

 new 956255f  nrf5340:Rev A errata 26 fix, needed only for appcore

The 1 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.



[mynewt-core] 01/01: nrf5340:Rev A errata 26 fix, needed only for appcore

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

vipulrahane pushed a commit to branch nrf5340_revA_errata26
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 956255f54439dda85e9b4bcefec143632f5fa957
Author: vrahane 
AuthorDate: Tue Jun 8 21:56:35 2021 -0700

nrf5340:Rev A errata 26 fix, needed only for appcore

- As per Errata 26, CTRL-AP: APPROTECT.DISABLE and
  SECUREAPPROTECT.DISABLE registers are not functional
- So we need to conditionally disable its usage
---
 hw/mcu/nordic/nrf5340/pkg.yml| 7 +++
 hw/mcu/nordic/nrf5340/syscfg.yml | 7 +++
 2 files changed, 14 insertions(+)

diff --git a/hw/mcu/nordic/nrf5340/pkg.yml b/hw/mcu/nordic/nrf5340/pkg.yml
index 161e0bc..08d5c17 100644
--- a/hw/mcu/nordic/nrf5340/pkg.yml
+++ b/hw/mcu/nordic/nrf5340/pkg.yml
@@ -104,3 +104,10 @@ pkg.deps.I2C_3':
 
 pkg.deps.NRF5340_EMBED_NET_CORE:
 - "@apache-mynewt-core/hw/mcu/nordic/nrf5340/net_core_image"
+
+# As per Errata 26 for Engineering RevA silicon we should not
+# depend on CTRL-AP: APPROTECT.DISABLE and SECUREAPPROTECT.DISABLE
+# registers since they are not functional. It causes quite a lot of
+# crashes and hardfaults
+pkg.cflags.MCU_NRF5340_REVA_SILICON:
+- "-DENABLE_APPROTECT_USER_HANDLING"
diff --git a/hw/mcu/nordic/nrf5340/syscfg.yml b/hw/mcu/nordic/nrf5340/syscfg.yml
index 94a14af..c647033 100644
--- a/hw/mcu/nordic/nrf5340/syscfg.yml
+++ b/hw/mcu/nordic/nrf5340/syscfg.yml
@@ -89,6 +89,13 @@ syscfg.defs:
 Default value is 0, so disabled.
 value: 0
 
+MCU_NRF5340_REVA_SILICON:
+description: >
+This needs to be set by the BSP/App/Target if the
+MCU is a Rev A Silicon. There is some special
+handling we need to do for Rev As
+value: 0
+
 # MCU peripherals definitions
 ADC_0:
 description: 'Enable nRF5340 ADC 0'


[mynewt-core] branch master updated: net/osdp: add a polling timeout for non-secure session - Raise a timeout flag if the peripheral device does not hear from the control panel for said time interval

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 453459d  net/osdp: add a polling timeout for non-secure session - 
Raise a timeout flag if the peripheral device does not hear from the control 
panel for said time interval
 new 2bde4bd  Merge pull request #2600 from vikrant-proxy/osdp/nonsec
453459d is described below

commit 453459db981857914a09e5eda5617d2c43944dd3
Author: Vikrant More 
AuthorDate: Fri May 21 13:41:44 2021 -0700

net/osdp: add a polling timeout for non-secure session
- Raise a timeout flag if the peripheral device does not hear from the 
control panel for said time interval
---
 net/osdp/include/osdp/osdp.h|  5 +
 net/osdp/include/osdp/osdp_common.h |  1 +
 net/osdp/src/osdp_common.c  |  7 +--
 net/osdp/src/osdp_pd.c  | 31 +++
 net/osdp/syscfg.yml |  4 
 5 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/net/osdp/include/osdp/osdp.h b/net/osdp/include/osdp/osdp.h
index 491e1ce..d61e9fa 100644
--- a/net/osdp/include/osdp/osdp.h
+++ b/net/osdp/include/osdp/osdp.h
@@ -43,6 +43,11 @@ extern "C" {
 #define OSDP_FLAG_INSTALL_MODE 0x0002
 
 /**
+ * @brief When set, the PD will not set up secure mode capability.
+ */
+#define OSDP_FLAG_NON_SECURE_MODE  0x0004
+
+/**
  * @brief Various PD capability function codes.
  */
 enum osdp_pd_cap_function_code_e {
diff --git a/net/osdp/include/osdp/osdp_common.h 
b/net/osdp/include/osdp/osdp_common.h
index ab50375..f4a014a 100644
--- a/net/osdp/include/osdp/osdp_common.h
+++ b/net/osdp/include/osdp/osdp_common.h
@@ -144,6 +144,7 @@ union osdp_ephemeral_data {
 #define PD_FLAG_CHN_SHARED  0x0400 /* PD's channel is shared */
 #define PD_FLAG_PKT_SKIP_MARK   0x0800 /* CONFIG_OSDP_SKIP_MARK_BYTE */
 #define PD_FLAG_PKT_HAS_MARK0x1000 /* Packet has mark byte */
+#define PD_FLAG_CP_POLL_ACTIVE  0x2000 /* PD is getting polled by CP, for 
non-secure mode */
 
 #define osdp_dump(b, l, f, ...) hexdump(b, l, f, __VA_ARGS__)
 
diff --git a/net/osdp/src/osdp_common.c b/net/osdp/src/osdp_common.c
index 4c3b936..3d749a4 100644
--- a/net/osdp/src/osdp_common.c
+++ b/net/osdp/src/osdp_common.c
@@ -199,8 +199,11 @@ osdp_get_status_mask(osdp_t *ctx)
 }
 }
 } else {
-/* PD is stateless */
-mask = 1;
+/* PD state is either online or offline based on whether it got polled 
from CP */
+pd = TO_PD(ctx, 0);
+if (ISSET_FLAG(pd, PD_FLAG_CP_POLL_ACTIVE)) {
+mask = 1;
+}
 }
 
 return mask;
diff --git a/net/osdp/src/osdp_pd.c b/net/osdp/src/osdp_pd.c
index 6efe78d..3c9baf0 100644
--- a/net/osdp/src/osdp_pd.c
+++ b/net/osdp/src/osdp_pd.c
@@ -61,11 +61,6 @@ static struct osdp_pd_cap osdp_pd_cap[] = {
 1, /* The PD supports the 16-bit CRC-16 mode */
 0, /* N/A */
 },
-{
-OSDP_PD_CAP_COMMUNICATION_SECURITY,
-1, /* (Bit-0) AES128 support */
-0, /* N/A */
-},
 { -1, 0, 0 } /* Sentinel */
 };
 
@@ -356,6 +351,7 @@ pd_decode_command(struct osdp_pd *pd, uint8_t *buf, int len)
 pd->reply_id = REPLY_ACK;
 }
 ret = OSDP_PD_ERR_NONE;
+SET_FLAG(pd, PD_FLAG_CP_POLL_ACTIVE);
 break;
 case CMD_LSTAT:
 ASSERT_LENGTH(len, CMD_LSTAT_DATA_LEN);
@@ -999,6 +995,12 @@ osdp_update(struct osdp_pd *pd)
 OSDP_LOG_INFO("PD SC session timeout!\n");
 CLEAR_FLAG(pd, PD_FLAG_SC_ACTIVE);
 }
+/* When secure mode is inactive check if CP is polling */
+if (ISSET_FLAG(pd, PD_FLAG_CP_POLL_ACTIVE) &&
+osdp_millis_since(pd->tstamp) > 
MYNEWT_VAL(OSDP_PD_IDLE_TIMEOUT_MS)) {
+OSDP_LOG_INFO("PD CP-poll timeout!\n");
+CLEAR_FLAG(pd, PD_FLAG_CP_POLL_ACTIVE);
+}
 ret = pd->channel.recv(pd->channel.data, pd->rx_buf,
   sizeof(pd->rx_buf));
 if (ret <= 0) {
@@ -1110,16 +1112,29 @@ osdp_pd_setup(struct osdp_ctx *osdp_ctx, osdp_pd_info_t 
*info, uint8_t *scbk)
 OSDP_LOG_ERROR("SCBK must be provided in ENFORCE_SECURE\n");
 goto error;
 }
-OSDP_LOG_WARN("SCBK not provided. PD is in INSTALL_MODE\n");
-SET_FLAG(pd, OSDP_FLAG_INSTALL_MODE);
+if (!ISSET_FLAG(pd, OSDP_FLAG_NON_SECURE_MODE)) {
+OSDP_LOG_WARN("SCBK not provided. PD is in INSTALL_MODE\n");
+SET_FLAG(pd, OSDP_FLAG_INSTALL_MODE);
+} else {
+OSDP_LOG_WARN("Setting up in non-secure mode\n");
+/* Non secure mode */
+}
 } else {
 memcpy(pd->sc.scbk, scbk, 16

[mynewt-core] branch master updated: nrf53/hal: icache config enable is in netcore.

2021-04-19 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new cec8bf2  nrf53/hal: icache config enable is in netcore.
 new 186f947  Merge pull request #2571 from vikrant-proxy/mcu/nrf5340-icache
cec8bf2 is described below

commit cec8bf25e47290f2206b0442578fcfd7a609e4c5
Author: Vikrant More 
AuthorDate: Sun Apr 18 18:10:05 2021 -0700

nrf53/hal: icache config enable is in netcore.
---
 hw/mcu/nordic/nrf5340/src/hal_system.c |  4 
 hw/mcu/nordic/nrf5340/syscfg.yml   | 12 +++-
 hw/mcu/nordic/nrf5340_net/src/hal_system.c |  3 +++
 hw/mcu/nordic/nrf5340_net/syscfg.yml   |  6 ++
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/hw/mcu/nordic/nrf5340/src/hal_system.c 
b/hw/mcu/nordic/nrf5340/src/hal_system.c
index d314f51..4b9058b 100644
--- a/hw/mcu/nordic/nrf5340/src/hal_system.c
+++ b/hw/mcu/nordic/nrf5340/src/hal_system.c
@@ -36,10 +36,6 @@
 void
 hal_system_init(void)
 {
-#if MYNEWT_VAL(MCU_ICACHE_ENABLED)
-NRF_NVMC_S->ICACHECNF = 1;
-#endif
-
 #if MYNEWT_VAL(MCU_CACHE_ENABLED)
 NRF_CACHE_S->ENABLE = 1;
 #endif
diff --git a/hw/mcu/nordic/nrf5340/syscfg.yml b/hw/mcu/nordic/nrf5340/syscfg.yml
index 288d2cf..18be972 100644
--- a/hw/mcu/nordic/nrf5340/syscfg.yml
+++ b/hw/mcu/nordic/nrf5340/syscfg.yml
@@ -67,19 +67,13 @@ syscfg.defs:
 Default value 4, clock runs at 48MHz.
 range: 1,2,4
 value: 4
- 
+
 MCU_CACHE_ENABLED:
 description: >
 Enable instruction and data cache
 Default value is 0, so disabled.
 value: 0
 
-MCU_ICACHE_ENABLED:
-description: >
-Enable instruction code cache
-Default value is 0, so disabled.
-value: 0
-
 # MCU peripherals definitions
 ADC_0:
 description: 'Enable nRF5340 ADC 0'
@@ -181,7 +175,7 @@ syscfg.defs:
 UART_3_PIN_CTS:
 description: 'CTS pin for UART3'
 value: -1
-
+
 TIMER_0:
 description: 'Enable nRF5340 Timer 0'
 value:  1
@@ -316,7 +310,7 @@ syscfg.defs:
 SPI_0_SLAVE_PIN_SS:
 description: 'SS pin for SPI_0_SLAVE'
 value: ''
-
+
 SPI_1_MASTER:
 description: 'Enable nRF5340 SPI Master 1'
 value: 0
diff --git a/hw/mcu/nordic/nrf5340_net/src/hal_system.c 
b/hw/mcu/nordic/nrf5340_net/src/hal_system.c
index 571f7c0..df61efa 100644
--- a/hw/mcu/nordic/nrf5340_net/src/hal_system.c
+++ b/hw/mcu/nordic/nrf5340_net/src/hal_system.c
@@ -36,6 +36,9 @@
 void
 hal_system_init(void)
 {
+#if MYNEWT_VAL(MCU_ICACHE_ENABLED)
+NRF_NVMC_NS->ICACHECNF = 1;
+#endif
 }
 
 void
diff --git a/hw/mcu/nordic/nrf5340_net/syscfg.yml 
b/hw/mcu/nordic/nrf5340_net/syscfg.yml
index 57caca1..2e039a1 100644
--- a/hw/mcu/nordic/nrf5340_net/syscfg.yml
+++ b/hw/mcu/nordic/nrf5340_net/syscfg.yml
@@ -54,6 +54,12 @@ syscfg.defs:
 the breakpoint wherever it gets called, For example, reset and 
crash
value: 0
 
+MCU_ICACHE_ENABLED:
+description: >
+Enable instruction code cache
+Default value is 0, so disabled.
+value: 0
+
 # MCU peripherals definitions
 TRNG:
 description: 'Enable nRF5340 TRNG'


[mynewt-core] branch master updated (f360702 -> ae6358d)

2021-04-16 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


from f360702  hw/ipc_nrf5340: Improve reset behavior
 new 6a71b4b  nRF5340/nrf52xxx: Add instr/data cache support
 new 7487e8c  mcu/nrf5340: Add BUS Driver dependencies
 new ae6358d  Merge pull request #2564 from vrahane/nrf5340_misc_fixes

The 10061 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:
 hw/mcu/nordic/nrf52xxx/src/hal_system.c|  5 +
 hw/mcu/nordic/nrf52xxx/syscfg.yml  |  4 
 hw/mcu/nordic/nrf5340/pkg.yml  |  5 +
 hw/mcu/nordic/nrf5340/src/hal_system.c |  8 
 hw/mcu/nordic/nrf5340/src/nrf5340_periph.c |  4 
 hw/mcu/nordic/nrf5340/syscfg.yml   | 13 +
 6 files changed, 39 insertions(+)


[mynewt-core] branch nrf5340_misc_fixes created (now 1991c89)

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

vipulrahane pushed a change to branch nrf5340_misc_fixes
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


  at 1991c89  nrf5340: Add BUS Driver dependencies

This branch includes the following new commits:

 new b2a24be  nRF5340/nrf52xxx: Add instr/data cache support
 new 1991c89  nrf5340: Add BUS Driver dependencies

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



[mynewt-core] 01/02: nRF5340/nrf52xxx: Add instr/data cache support

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

vipulrahane pushed a commit to branch nrf5340_misc_fixes
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit b2a24be516fc37b3772ed9244d477e715e180ffa
Author: Vipul Rahane 
AuthorDate: Mon Apr 12 15:53:44 2021 -0700

nRF5340/nrf52xxx: Add instr/data cache support

- Add syscfg for controlling instruction/data cache
- Add syscfgs for enabling ICACHE and add corresponding code in 
hal_system_init()
---
 hw/mcu/nordic/nrf52xxx/src/hal_system.c |  5 +
 hw/mcu/nordic/nrf52xxx/syscfg.yml   |  4 
 hw/mcu/nordic/nrf5340/src/hal_system.c  | 10 ++
 hw/mcu/nordic/nrf5340/syscfg.yml| 13 +
 4 files changed, 32 insertions(+)

diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_system.c 
b/hw/mcu/nordic/nrf52xxx/src/hal_system.c
index ba98306..497c7b6 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_system.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_system.c
@@ -37,6 +37,11 @@
 void
 hal_system_init(void)
 {
+
+#if MYNEWT_VAL(MCU_ICACHE_ENABLED)
+NRF_NVMC->ICACHECNF = 1;
+#endif
+
 #if MYNEWT_VAL(MCU_DCDC_ENABLED)
 NRF_POWER->DCDCEN = 1;
 #endif
diff --git a/hw/mcu/nordic/nrf52xxx/syscfg.yml 
b/hw/mcu/nordic/nrf52xxx/syscfg.yml
index bb038ab..8452301 100644
--- a/hw/mcu/nordic/nrf52xxx/syscfg.yml
+++ b/hw/mcu/nordic/nrf52xxx/syscfg.yml
@@ -92,6 +92,10 @@ syscfg.defs:
 the breakpoint wherever it gets called, For example, reset and 
crash
value: 0
 
+MCU_ICACHE_ENABLED:
+   description: >
+Enabled Instruction code cache
+   value: 0
 
 # MCU peripherals definitions
 I2C_0:
diff --git a/hw/mcu/nordic/nrf5340/src/hal_system.c 
b/hw/mcu/nordic/nrf5340/src/hal_system.c
index 59ca458..512cd38 100644
--- a/hw/mcu/nordic/nrf5340/src/hal_system.c
+++ b/hw/mcu/nordic/nrf5340/src/hal_system.c
@@ -36,6 +36,15 @@
 void
 hal_system_init(void)
 {
+
+#if MYNEWT_VAL(MCU_ICACHE_ENABLED)
+NRF_NVMC_S->ICACHECNF = 1;
+#endif
+
+#if MYNEWT_VAL(MCU_CACHE_ENABLED)
+NRF_CACHE_S->ENABLE = 1;
+#endif
+
 #if MYNEWT_VAL(MCU_DCDC_ENABLED)
 NRF_REGULATORS_S->VREGMAIN.DCDCEN = 1;
 
@@ -72,6 +81,7 @@ hal_debugger_connected(void)
 void
 hal_system_clock_start(void)
 {
+
 #if MYNEWT_VAL(MCU_LFCLK_SOURCE)
 uint32_t regmsk;
 uint32_t regval;
diff --git a/hw/mcu/nordic/nrf5340/syscfg.yml b/hw/mcu/nordic/nrf5340/syscfg.yml
index d3a1e2e..8aaeca9 100644
--- a/hw/mcu/nordic/nrf5340/syscfg.yml
+++ b/hw/mcu/nordic/nrf5340/syscfg.yml
@@ -53,12 +53,25 @@ syscfg.defs:
 When enabled, asm(bkpt) will be ignored. If not set, it will hit
 the breakpoint wherever it gets called, For example, reset and 
crash
value: 0
+
 MCU_HFCLCK192_DIV:
 description: >
 Divider of 192MHz clock that is used for QSPI.
 Default value 4, clock runs at 48MHz.
 range: 1,2,4
 value: 4
+ 
+MCU_CACHE_ENABLED:
+description: >
+Enable instruction and data cache
+Default value is 0, so disabled.
+value: 0
+
+MCU_ICACHE_ENABLED:
+description: >
+Enable instruction code cache
+Default value is 0, so disabled.
+value: 0
 
 # MCU peripherals definitions
 ADC_0:


[mynewt-core] 02/02: nrf5340: Add BUS Driver dependencies

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

vipulrahane pushed a commit to branch nrf5340_misc_fixes
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 1991c891cd074fb06f2b77be9e81e45316c68427
Author: vrahane 
AuthorDate: Tue Apr 13 15:04:39 2021 -0700

nrf5340: Add BUS Driver dependencies
---
 hw/mcu/nordic/nrf5340/pkg.yml  | 5 +
 hw/mcu/nordic/nrf5340/src/nrf5340_periph.c | 4 
 2 files changed, 9 insertions(+)

diff --git a/hw/mcu/nordic/nrf5340/pkg.yml b/hw/mcu/nordic/nrf5340/pkg.yml
index deeb219..80860c6 100644
--- a/hw/mcu/nordic/nrf5340/pkg.yml
+++ b/hw/mcu/nordic/nrf5340/pkg.yml
@@ -30,6 +30,11 @@ pkg.deps:
 - "@apache-mynewt-core/hw/cmsis-core"
 - "@apache-mynewt-core/hw/hal"
 
+pkg.deps.BUS_DRIVER_PRESENT:
+- "@apache-mynewt-core/hw/bus/drivers/spi_hal"
+- "@apache-mynewt-core/hw/bus/drivers/i2c_common"
+- "@apache-mynewt-core/hw/bus/drivers/i2c_nrf5340"
+
 pkg.cflags.NFC_PINS_AS_GPIO: 
 - '-DCONFIG_NFCT_PINS_AS_GPIOS=1'
 
diff --git a/hw/mcu/nordic/nrf5340/src/nrf5340_periph.c 
b/hw/mcu/nordic/nrf5340/src/nrf5340_periph.c
index ac85a78..d663bf0 100644
--- a/hw/mcu/nordic/nrf5340/src/nrf5340_periph.c
+++ b/hw/mcu/nordic/nrf5340/src/nrf5340_periph.c
@@ -25,6 +25,10 @@
 #include 
 #include "hal/hal_spi.h"
 
+#if MYNEWT_VAL(BUS_DRIVER_PRESENT)
+#include "bus/bus.h"
+#endif
+
 #if MYNEWT_VAL(ADC_0)
 #include 
 #include 


[mynewt-core] branch master updated: mcu/nrf5340: Add trng to netcore. Use existing trng_nrf52 driver (#2563)

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new d288b3b  mcu/nrf5340: Add trng to netcore. Use existing trng_nrf52 
driver (#2563)
d288b3b is described below

commit d288b3ba4de2739fe0938b666b84f1fbd584d43a
Author: Vikrant <76705748+vikrant-pr...@users.noreply.github.com>
AuthorDate: Mon Apr 12 14:50:01 2021 -0700

mcu/nrf5340: Add trng to netcore. Use existing trng_nrf52 driver (#2563)

- Add nrfx header to trng_nrf52.c
---
 hw/drivers/trng/trng_nrf52/src/trng_nrf52.c|  1 +
 hw/mcu/nordic/nrf5340_net/pkg.yml  |  3 +++
 hw/mcu/nordic/nrf5340_net/src/nrf5340_net_periph.c | 25 ++
 3 files changed, 29 insertions(+)

diff --git a/hw/drivers/trng/trng_nrf52/src/trng_nrf52.c 
b/hw/drivers/trng/trng_nrf52/src/trng_nrf52.c
index ed9594e..0369128 100644
--- a/hw/drivers/trng/trng_nrf52/src/trng_nrf52.c
+++ b/hw/drivers/trng/trng_nrf52/src/trng_nrf52.c
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include "nrfx.h"
 #include "mcu/cmsis_nvic.h"
 #include "trng/trng.h"
 #include "trng_nrf52/trng_nrf52.h"
diff --git a/hw/mcu/nordic/nrf5340_net/pkg.yml 
b/hw/mcu/nordic/nrf5340_net/pkg.yml
index 0e62a03..f95e2e3 100644
--- a/hw/mcu/nordic/nrf5340_net/pkg.yml
+++ b/hw/mcu/nordic/nrf5340_net/pkg.yml
@@ -46,5 +46,8 @@ pkg.deps.SPI_0_MASTER:
 pkg.deps.I2C_0':
 - "@apache-mynewt-core/hw/bus/drivers/i2c_nrf5340"
 
+pkg.deps.TRNG:
+- "@apache-mynewt-core/hw/drivers/trng/trng_nrf52"
+
 pkg.deps.BLE_CONTROLLER:
 - "@apache-mynewt-nimble/nimble/drivers/nrf5340"
diff --git a/hw/mcu/nordic/nrf5340_net/src/nrf5340_net_periph.c 
b/hw/mcu/nordic/nrf5340_net/src/nrf5340_net_periph.c
index fa38f36..15822e3 100644
--- a/hw/mcu/nordic/nrf5340_net/src/nrf5340_net_periph.c
+++ b/hw/mcu/nordic/nrf5340_net/src/nrf5340_net_periph.c
@@ -39,6 +39,11 @@
 #include 
 #endif
 
+#if MYNEWT_VAL(TRNG)
+#include "trng/trng.h"
+#include "trng_nrf52/trng_nrf52.h"
+#endif
+
 #if MYNEWT_VAL(UART_0)
 static struct uart_dev os_bsp_uart0;
 static const struct nrf5340_net_uart_cfg os_bsp_uart0_cfg = {
@@ -76,6 +81,10 @@ static const struct bus_i2c_dev_cfg i2c0_cfg = {
 static struct bus_i2c_dev i2c0_bus;
 #endif
 
+#if MYNEWT_VAL(TRNG)
+static struct trng_dev os_bsp_trng;
+#endif
+
 static void
 nrf5340_net_periph_create_timers(void)
 {
@@ -153,6 +162,21 @@ nrf5340_net_periph_create_i2c(void)
 #endif
 }
 
+static void
+nrf5340_net_periph_create_trng(void)
+{
+int rc;
+
+(void)rc;
+
+#if MYNEWT_VAL(TRNG)
+rc = os_dev_create(_bsp_trng.dev, "trng",
+   OS_DEV_INIT_KERNEL, OS_DEV_INIT_PRIO_DEFAULT,
+   nrf52_trng_dev_init, NULL);
+assert(rc == 0);
+#endif
+}
+
 void
 nrf5340_net_periph_create(void)
 {
@@ -160,4 +184,5 @@ nrf5340_net_periph_create(void)
 nrf5340_net_periph_create_uart();
 nrf5340_net_periph_create_spi();
 nrf5340_net_periph_create_i2c();
+nrf5340_net_periph_create_trng();
 }


[mynewt-core] branch master updated: hw/util/buzzer: Tone generator with the PWM peripheral (#2538)

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 2673c6c  hw/util/buzzer: Tone generator with the PWM peripheral (#2538)
2673c6c is described below

commit 2673c6c414f05028abf12039033d3ec27f87d98b
Author: Rafa Couto 
AuthorDate: Mon Mar 22 12:07:03 2021 +0100

hw/util/buzzer: Tone generator with the PWM peripheral (#2538)

- hw/drivers/buzzer: Tone generator with the PWM peripheral
- Also adding apps/buzzer
---
 apps/buzzer/pkg.yml|  36 +++
 apps/buzzer/src/main.c |  60 ++
 apps/buzzer/syscfg.yml |  27 
 hw/util/buzzer/README.md   |  62 ++
 hw/util/buzzer/include/buzzer/buzzer.h |  37 +++
 hw/util/buzzer/pkg.yml |  31 +
 hw/util/buzzer/src/buzzer.c| 112 +
 hw/util/buzzer/syscfg.yml  |  36 +++
 8 files changed, 401 insertions(+)

diff --git a/apps/buzzer/pkg.yml b/apps/buzzer/pkg.yml
new file mode 100644
index 000..0d6c693
--- /dev/null
+++ b/apps/buzzer/pkg.yml
@@ -0,0 +1,36 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+pkg.name: apps/buzzer
+pkg.type: app
+pkg.description: Example app which generates beeps using a buzzer on PWM pin.
+pkg.author: "Apache Mynewt "
+pkg.homepage: "http://mynewt.apache.org/;
+pkg.keywords:
+- buzzer
+- pwm
+- tone
+
+pkg.deps:
+- "@apache-mynewt-core/kernel/os"
+- "@apache-mynewt-core/hw/hal"
+- "@apache-mynewt-core/sys/console/stub"
+- "@apache-mynewt-core/sys/log/stub"
+- "@apache-mynewt-core/hw/util/buzzer"
+
diff --git a/apps/buzzer/src/main.c b/apps/buzzer/src/main.c
new file mode 100755
index 000..a4a6a6c
--- /dev/null
+++ b/apps/buzzer/src/main.c
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include 
+
+#include "sysinit/sysinit.h"
+#include "os/os.h"
+
+#include "buzzer/buzzer.h"
+
+int count = 0;
+
+int
+main(int argc, char **argv)
+{
+sysinit();
+
+while (1) {
+
+/* quarter of second */
+os_time_delay(OS_TICKS_PER_SEC / 4);
+
+/* each quarter of second */
+switch (count++ % 4) {
+
+case 0:
+/* activate buzzer tone at 2 KHz frequency */
+buzzer_tone_on(2000);
+break;
+
+case 1:
+/* disable buzzer */
+buzzer_tone_off();
+break;
+
+default:
+/* empty */
+break;
+}
+}
+
+assert(0);
+}
+
diff --git a/apps/buzzer/syscfg.yml b/apps/buzzer/syscfg.yml
new file mode 100644
index 000..39728a7
--- /dev/null
+++ b/apps/buzzer/syscfg.yml
@@ -0,0 +1,27 @@
+#
+# 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

[mynewt-core] branch master updated: mcu/nrf5340: Fix spi device names

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 2f52b9f  mcu/nrf5340: Fix spi device names
 new 88323a5  Merge pull request #2540 from 
vikrant-proxy/nrf53/spi-periph-fix
2f52b9f is described below

commit 2f52b9fe4377c1bb0159b32bdfa384272d7db0d7
Author: Vikrant More 
AuthorDate: Thu Mar 18 23:36:28 2021 -0700

mcu/nrf5340: Fix spi device names
---
 hw/mcu/nordic/nrf5340/src/hal_spi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/mcu/nordic/nrf5340/src/hal_spi.c 
b/hw/mcu/nordic/nrf5340/src/hal_spi.c
index 81e5464..ded7bc6 100644
--- a/hw/mcu/nordic/nrf5340/src/hal_spi.c
+++ b/hw/mcu/nordic/nrf5340/src/hal_spi.c
@@ -294,7 +294,7 @@ nrf5340_spi3_irq_handler(void)
 {
 os_trace_isr_enter();
 if (nrf5340_hal_spi3.spi_type == HAL_SPI_TYPE_MASTER) {
-#if MYNEWT_VAL(SPI_2_MASTER)
+#if MYNEWT_VAL(SPI_3_MASTER)
 nrf5340_irqm_handler(_hal_spi3);
 #endif
 } else {
@@ -311,8 +311,8 @@ void
 nrf5340_spi4_irq_handler(void)
 {
 os_trace_isr_enter();
-if (nrf5340_hal_spi3.spi_type == HAL_SPI_TYPE_MASTER) {
-nrf5340_irqm_handler(_hal_spi3);
+if (nrf5340_hal_spi4.spi_type == HAL_SPI_TYPE_MASTER) {
+nrf5340_irqm_handler(_hal_spi4);
 }
 os_trace_isr_exit();
 }


[mynewt-core] branch master updated: mcu/nrf5340: Fix uart device names

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 5d86a17  mcu/nrf5340: Fix uart device names
 new deb21a4  Merge pull request #2537 from 
vikrant-proxy/nrf53/uart-periph-fix
5d86a17 is described below

commit 5d86a175377ab0227b6f989aec0f890950129d11
Author: Vikrant More 
AuthorDate: Wed Mar 17 11:34:25 2021 -0700

mcu/nrf5340: Fix uart device names
---
 hw/mcu/nordic/nrf5340/src/nrf5340_periph.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/mcu/nordic/nrf5340/src/nrf5340_periph.c 
b/hw/mcu/nordic/nrf5340/src/nrf5340_periph.c
index 30be48f..ac85a78 100644
--- a/hw/mcu/nordic/nrf5340/src/nrf5340_periph.c
+++ b/hw/mcu/nordic/nrf5340/src/nrf5340_periph.c
@@ -88,7 +88,7 @@ static const struct nrf5340_uart_cfg os_bsp_uart1_cfg = {
 };
 #endif
 #if MYNEWT_VAL(UART_2)
-static struct uart_dev os_bsp_uart0;
+static struct uart_dev os_bsp_uart2;
 static const struct nrf5340_uart_cfg os_bsp_uart2_cfg = {
 .suc_pin_tx = MYNEWT_VAL(UART_2_PIN_TX),
 .suc_pin_rx = MYNEWT_VAL(UART_2_PIN_RX),
@@ -97,7 +97,7 @@ static const struct nrf5340_uart_cfg os_bsp_uart2_cfg = {
 };
 #endif
 #if MYNEWT_VAL(UART_3)
-static struct uart_dev os_bsp_uart0;
+static struct uart_dev os_bsp_uart3;
 static const struct nrf5340_uart_cfg os_bsp_uart3_cfg = {
 .suc_pin_tx = MYNEWT_VAL(UART_3_PIN_TX),
 .suc_pin_rx = MYNEWT_VAL(UART_3_PIN_RX),



[mynewt-core] branch master updated: mcu/nrf5340: HAL gpio irq should use GPIOTE0

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new bb8dc18  mcu/nrf5340: HAL gpio irq should use GPIOTE0
 new 758fd76  Merge pull request #2533 from vrahane/fix_hal_gpio_irq_nrf5340
bb8dc18 is described below

commit bb8dc181d8fe5fc28e573497e0de72d50ddf1cb7
Author: Vipul Rahane 
AuthorDate: Mon Mar 15 17:48:29 2021 -0700

mcu/nrf5340: HAL gpio irq should use GPIOTE0

- hal gpio irq should use GPIOTE0 but GPIOTE1 was getting used
---
 hw/mcu/nordic/nrf5340/src/hal_gpio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/mcu/nordic/nrf5340/src/hal_gpio.c 
b/hw/mcu/nordic/nrf5340/src/hal_gpio.c
index c69afc7..8d3a4db 100644
--- a/hw/mcu/nordic/nrf5340/src/hal_gpio.c
+++ b/hw/mcu/nordic/nrf5340/src/hal_gpio.c
@@ -285,8 +285,8 @@ hal_gpio_irq_setup(void)
 static uint8_t irq_setup = 0;
 
 if (!irq_setup) {
-NVIC_SetVector(GPIOTE1_IRQn, (uint32_t)hal_gpio_irq_handler);
-NVIC_EnableIRQ(GPIOTE1_IRQn);
+NVIC_SetVector(GPIOTE0_IRQn, (uint32_t)hal_gpio_irq_handler);
+NVIC_EnableIRQ(GPIOTE0_IRQn);
 irq_setup = 1;
 
 #if MYNEWT_VAL(MCU_GPIO_USE_PORT_EVENT)



[mynewt-core] branch master updated: mcu/nrf5340: Pins should be checked for -1

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new db685bc  mcu/nrf5340: Pins should be checked for -1
 new 38a0a98  Merge pull request #2532 from 
vrahane/null_check_pins_mcu_nrf5340
db685bc is described below

commit db685bcd24c1b37adacc8cbbd180389044cb8b87
Author: Vipul Rahane 
AuthorDate: Mon Mar 15 16:37:29 2021 -0700

mcu/nrf5340: Pins should be checked for -1

- Pins hsould be checked for -1 for invalidity
---
 hw/mcu/nordic/nrf5340/syscfg.yml | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/mcu/nordic/nrf5340/syscfg.yml b/hw/mcu/nordic/nrf5340/syscfg.yml
index cf5803c..7d89455 100644
--- a/hw/mcu/nordic/nrf5340/syscfg.yml
+++ b/hw/mcu/nordic/nrf5340/syscfg.yml
@@ -413,7 +413,7 @@ syscfg.vals:
 OS_TICKS_PER_SEC: 128
 
 syscfg.restrictions:
-- "!UART_0 || (UART_0_PIN_TX && UART_0_PIN_RX)"
-- "!UART_1 || (UART_1_PIN_TX && UART_1_PIN_RX)"
-- "!UART_2 || (UART_2_PIN_TX && UART_2_PIN_RX)"
-- "!UART_3 || (UART_3_PIN_TX && UART_3_PIN_RX)"
+- "!UART_0 || (UART_0_PIN_TX != -1 && UART_0_PIN_RX != -1)"
+- "!UART_1 || (UART_1_PIN_TX != -1 && UART_1_PIN_RX != -1)"
+- "!UART_2 || (UART_2_PIN_TX != -1 && UART_2_PIN_RX != -1)"
+- "!UART_3 || (UART_3_PIN_TX != -1 && UART_3_PIN_RX != -1)"



[mynewt-core] branch master updated: net/osdp: update pkg.yml with a better description

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new a735bfe  net/osdp: update pkg.yml with a better description
 new c74b8fd  Merge pull request #2517 from vikrant-proxy/osdp-pkg-yml
a735bfe is described below

commit a735bfe08b4fe767ad09341b6680ea53086c8b29
Author: Vikrant More 
AuthorDate: Thu Mar 4 13:26:31 2021 -0800

net/osdp: update pkg.yml with a better description
---
 net/osdp/pkg.yml | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/osdp/pkg.yml b/net/osdp/pkg.yml
index 1872c5a..5a94108 100644
--- a/net/osdp/pkg.yml
+++ b/net/osdp/pkg.yml
@@ -17,9 +17,13 @@
 #
 
 pkg.name: net/osdp
-pkg.description: "OSDP implementation"
-pkg.author: ""
-pkg.homepage: ""
+pkg.description: >
+This package is a mynewt port of libOSDP library
+available at https://github.com/goToMain/libosdp
+It is currently at par with commit hash
+aaba129fe6ad71d61b8526bd8a9b3778b93c9b26
+pkg.author: "Apache Mynewt "
+pkg.homepage: "http://mynewt.apache.org/;
 pkg.keywords:
 - osdp
 



[mynewt-core] branch master updated: net/osdp: update osdp library to upstream master @ aaba129

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 980cf44  net/osdp: update osdp library to upstream master @ aaba129
 new 9332d6a  Merge pull request #2516 from vikrant-proxy/osdp-sync
980cf44 is described below

commit 980cf4486259c36853eabdec51b955f616cd16aa
Author: Vikrant More 
AuthorDate: Thu Mar 4 08:41:34 2021 -0800

net/osdp: update osdp library to upstream master @ aaba129
---
 net/osdp/include/osdp/osdp_common.h | 36 ++-
 net/osdp/src/osdp_cp.c  | 48 --
 net/osdp/src/osdp_pd.c  |  2 +-
 net/osdp/src/osdp_phy.c | 69 -
 net/osdp/src/osdp_sc.c  | 12 ---
 net/osdp/syscfg.yml |  4 +++
 6 files changed, 107 insertions(+), 64 deletions(-)

diff --git a/net/osdp/include/osdp/osdp_common.h 
b/net/osdp/include/osdp/osdp_common.h
index cd2ed13..ab50375 100644
--- a/net/osdp/include/osdp/osdp_common.h
+++ b/net/osdp/include/osdp/osdp_common.h
@@ -222,6 +222,13 @@ enum osdp_state_e {
 };
 
 enum osdp_pkt_errors_e {
+/* Define the busy error to a +ve value to indicate no error.  Also set it
+ * to 2 which is the value of OSDP_CP_ERR_RETRY_CMD which is the error
+ * code returned by cp_decode_response() after decoding the busy reply
+ * packet.  This thus allows a busy reply packet to be detected and
+ * handled without needing the usual additional decoding step. */
+OSDP_ERR_PKT_BUSY  = 2,
+
 OSDP_ERR_PKT_NONE  = 0,
 OSDP_ERR_PKT_FMT   = -1,
 OSDP_ERR_PKT_WAIT  = -2,
@@ -285,6 +292,7 @@ struct osdp_pd {
 /* PD state management */
 int state;
 int phy_state;
+uint32_t wait_ms;
 
 int64_t tstamp;
 int64_t sc_tstamp;
@@ -345,25 +353,9 @@ void osdp_phy_state_reset(struct osdp_pd *pd);
 int osdp_phy_packet_get_data_offset(struct osdp_pd *p, const uint8_t *buf);
 uint8_t *osdp_phy_packet_get_smb(struct osdp_pd *p, const uint8_t *buf);
 
-/* from osdp_common.c */
-int64_t osdp_millis_now(void);
-int64_t osdp_millis_since(int64_t last);
-/* void osdp_dump(const char *head, uint8_t *buf, int len); */
-uint16_t osdp_compute_crc16(const uint8_t *buf, size_t len);
-int osdp_device_lock(struct os_mutex *lock);
-void osdp_device_unlock(struct os_mutex *lock);
-
 /* from osdp.c */
 struct osdp *osdp_get_ctx();
 
-/* from osdp_cp.c */
-#if MYNEWT_VAL(OSDP_MODE_CP)
-int osdp_extract_address(int *address);
-#endif
-
-void osdp_encrypt(uint8_t *key, uint8_t *iv, uint8_t *data, int len);
-void osdp_decrypt(uint8_t *key, uint8_t *iv, uint8_t *data, int len);
-
 /* from osdp_sc.c */
 void osdp_compute_scbk(struct osdp_pd *pd, uint8_t *master_key, uint8_t *scbk);
 void osdp_compute_session_keys(struct osdp *ctx);
@@ -377,7 +369,17 @@ int osdp_encrypt_data(struct osdp_pd *pd, int is_cmd, 
uint8_t *data, int len);
 int osdp_compute_mac(struct osdp_pd *pd, int is_cmd,
  const uint8_t *data, int len);
 void osdp_sc_init(struct osdp_pd *pd);
-void osdp_get_rand(uint8_t *buf, int len);
+
+/* from osdp_common.c */
+__attribute__((weak)) int64_t osdp_millis_now(void);
+int64_t osdp_millis_since(int64_t last);
+/* void osdp_dump(const char *head, uint8_t *buf, int len); */
+uint16_t osdp_compute_crc16(const uint8_t *buf, size_t len);
+__attribute__((weak)) void osdp_encrypt(uint8_t *key, uint8_t *iv, uint8_t 
*data, int len);
+__attribute__((weak)) void osdp_decrypt(uint8_t *key, uint8_t *iv, uint8_t 
*data, int len);
+__attribute__((weak)) void osdp_get_rand(uint8_t *buf, int len);
+int osdp_device_lock(struct os_mutex *lock);
+void osdp_device_unlock(struct os_mutex *lock);
 
 /**
  * @brief This method is used to setup a device in PD mode. Application must
diff --git a/net/osdp/src/osdp_cp.c b/net/osdp/src/osdp_cp.c
index 4776960..0d48748 100644
--- a/net/osdp/src/osdp_cp.c
+++ b/net/osdp/src/osdp_cp.c
@@ -17,10 +17,8 @@
 
 #define OSDP_PD_POLL_TIMEOUT_MS(1000 / MYNEWT_VAL(OSDP_PD_POLL_RATE))
 #define OSDP_CMD_RETRY_WAIT_MS (MYNEWT_VAL(OSDP_CMD_RETRY_WAIT_SEC) * 
1000)
-
-#if MYNEWT_VAL(OSDP_SC_ENABLED)
 #define OSDP_PD_SC_RETRY_MS(MYNEWT_VAL(OSDP_SC_RETRY_WAIT_SEC) * 
1000)
-#endif
+#define OSDP_ONLINE_RETRY_WAIT_MAX_MS  
(MYNEWT_VAL(OSDP_ONLINE_RETRY_WAIT_MAX_SEC) * 1000)
 
 #define CMD_POLL_LEN   1
 #define CMD_LSTAT_LEN  1
@@ -424,7 +422,6 @@ cp_build_command(struct osdp_pd *pd, uint8_t *buf, int 
max_len)
 if (smb == NULL) {
 break;
 }
-osdp_get_rand(pd->sc.cp_random, 8);
 smb[0] = 3; /* length */
 smb[1] = SCS_11; /* type */
 smb[2] = ISSET_FLAG(pd, PD_FLAG_SC_USE_SCBKD) ? 0 : 1;
@@ -739,7 +736,7 @@ cp_send_command(struct osdp_pd *pd)
 
 if (MYNEWT_VAL(OSDP_PACKET_TR

[mynewt-core] branch master updated: net/osdp: Add a stop api

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new c523d33  net/osdp: Add a stop api
 new 4243264  Merge pull request #2515 from vikrant-proxy/osdp-stop
c523d33 is described below

commit c523d33c635bd61d4a8b54a9b0b1659c79ba6bb0
Author: Vikrant More 
AuthorDate: Wed Mar 3 15:52:04 2021 -0800

net/osdp: Add a stop api
---
 net/osdp/include/osdp/osdp.h |  5 +
 net/osdp/src/osdp.c  | 35 +++
 2 files changed, 40 insertions(+)

diff --git a/net/osdp/include/osdp/osdp.h b/net/osdp/include/osdp/osdp.h
index 4ca01c0..491e1ce 100644
--- a/net/osdp/include/osdp/osdp.h
+++ b/net/osdp/include/osdp/osdp.h
@@ -700,6 +700,11 @@ uint32_t osdp_get_sc_status_mask(osdp_t *ctx);
  */
 void osdp_init(osdp_pd_info_t *info, uint8_t *scbk);
 
+/**
+ * @brief Stop OSDP library.
+ */
+void osdp_stop(void);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/net/osdp/src/osdp.c b/net/osdp/src/osdp.c
index ebd7be8..05d799e 100644
--- a/net/osdp/src/osdp.c
+++ b/net/osdp/src/osdp.c
@@ -193,6 +193,41 @@ osdp_refresh_handler(struct os_event *ev)
 }
 
 /*
+ * Stop OSDP library. Called by application
+ */
+void
+osdp_stop(void)
+{
+int rc;
+struct osdp *ctx;
+struct osdp_device *od = _device;
+
+ctx = osdp_get_ctx();
+assert(ctx);
+
+/* Stop timer */
+os_callout_stop(_refresh_timer);
+
+/* Cleanup */
+#if MYNEWT_VAL(OSDP_MODE_PD)
+osdp_pd_teardown(ctx);
+#else
+osdp_cp_teardown(ctx);
+#endif
+
+/* Stop uart */
+assert(od->uart);
+rc = os_dev_close((struct os_dev *)od->uart);
+assert(rc == 0);
+
+/* Flush circular buffers */
+osdp_uart_flush((void *)od);
+
+/* Reset OSDP context */
+memset(_ctx, 0, sizeof(struct osdp_ctx));
+}
+
+/*
  * Start OSDP. Called by application
  */
 void



[mynewt-core] branch master updated: net/osdp: Changes to use internal data structures and remove dynamic memory allocations - Cleanup commented code - Make secure mode on by default

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 7018d4c  net/osdp: Changes to use internal data structures and remove 
dynamic memory allocations - Cleanup commented code - Make secure mode on by 
default
 new 8a7df98  Merge pull request #2508 from vikrant-proxy/osdp-ds
7018d4c is described below

commit 7018d4c671b4121e892169fa38a2179abf382c92
Author: Vikrant More 
AuthorDate: Wed Feb 10 11:54:20 2021 -0800

net/osdp: Changes to use internal data structures and remove dynamic memory 
allocations
- Cleanup commented code
- Make secure mode on by default
---
 net/osdp/include/osdp/circular_buffer.h | 209 
 net/osdp/include/osdp/list.h|  64 ---
 net/osdp/include/osdp/osdp.h|   1 -
 net/osdp/include/osdp/osdp_common.h |  41 ++--
 net/osdp/include/osdp/osdp_utils.h  |  36 ++--
 net/osdp/include/osdp/queue.h   |  25 ---
 net/osdp/include/osdp/slab.h|  79 
 net/osdp/src/circular_buffer.c  | 278 ---
 net/osdp/src/list.c | 328 
 net/osdp/src/osdp.c |  79 ++--
 net/osdp/src/osdp_common.c  |  41 +++-
 net/osdp/src/osdp_cp.c  | 216 +
 net/osdp/src/osdp_pd.c  | 145 +-
 net/osdp/src/osdp_sc.c  |   3 +-
 net/osdp/src/osdp_utils.c   | 125 +++-
 net/osdp/src/queue.c|  48 -
 net/osdp/src/slab.c |  69 ---
 net/osdp/syscfg.yml |  26 ++-
 18 files changed, 426 insertions(+), 1387 deletions(-)

diff --git a/net/osdp/include/osdp/circular_buffer.h 
b/net/osdp/include/osdp/circular_buffer.h
deleted file mode 100644
index fe5da5c..000
--- a/net/osdp/include/osdp/circular_buffer.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
-   CC0 1.0 Universal
-
-   Statement of Purpose
-
-   The laws of most jurisdictions throughout the world automatically confer
-   exclusive Copyright and Related Rights (defined below) upon the creator and
-   subsequent owner(s) (each and all, an "owner") of an original work of
-   authorship and/or a database (each, a "Work").
-
-   Certain owners wish to permanently relinquish those rights to a Work for the
-   purpose of contributing to a commons of creative, cultural and scientific
-   works ("Commons") that the public can reliably and without fear of later
-   claims of infringement build upon, modify, incorporate in other works, reuse
-   and redistribute as freely as possible in any form whatsoever and for any
-   purposes, including without limitation commercial purposes. These owners may
-   contribute to the Commons to promote the ideal of a free culture and the
-   further production of creative, cultural and scientific works, or to gain
-   reputation or greater distribution for their Work in part through the use 
and
-   efforts of others.
-
-   For these and/or other purposes and motivations, and without any expectation
-   of additional consideration or compensation, the person associating CC0 
with a
-   Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
-   and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
-   and publicly distribute the Work under its terms, with knowledge of his or 
her
-   Copyright and Related Rights in the Work and the meaning and intended legal
-   effect of CC0 on those rights.
-
-   1. Copyright and Related Rights. A Work made available under CC0 may be
-   protected by copyright and related or neighboring rights ("Copyright and
-   Related Rights"). Copyright and Related Rights include, but are not limited
-   to, the following:
-
-   i. the right to reproduce, adapt, distribute, perform, display, communicate,
-   and translate a Work;
-
-   ii. moral rights retained by the original author(s) and/or performer(s);
-
-   iii. publicity and privacy rights pertaining to a person's image or likeness
-   depicted in a Work;
-
-   iv. rights protecting against unfair competition in regards to a Work,
-   subject to the limitations in paragraph 4(a), below;
-
-   v. rights protecting the extraction, dissemination, use and reuse of data in
-   a Work;
-
-   vi. database rights (such as those arising under Directive 96/9/EC of the
-   European Parliament and of the Council of 11 March 1996 on the legal
-   protection of databases, and under any national implementation thereof,
-   including any amended or successor version of such directive); and
-
-   vii. other similar, equivalent or corresponding rights throughout the world
-   based on applicable law or treaty, and any national impleme

[mynewt-mcumgr] branch master updated: Fix unitialized variable warning

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git


The following commit(s) were added to refs/heads/master by this push:
 new 7be5e26  Fix unitialized variable warning
 new 130ae98  Merge pull request #111 from utzig/fix-linked-list
7be5e26 is described below

commit 7be5e2628331bdcc91b95e7ade1ee46d349e09bd
Author: Fabio Utzig 
AuthorDate: Thu Feb 11 11:12:24 2021 -0300

Fix unitialized variable warning

Fix usage of prev when curr==group, and add checking for invalid
parameter.

Signed-off-by: Fabio Utzig 
---
 mgmt/src/mgmt.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/mgmt/src/mgmt.c b/mgmt/src/mgmt.c
index 77aa631..361211a 100644
--- a/mgmt/src/mgmt.c
+++ b/mgmt/src/mgmt.c
@@ -74,9 +74,13 @@ mgmt_streamer_free_buf(struct mgmt_streamer *streamer, void 
*buf)
 void
 mgmt_unregister_group(struct mgmt_group *group)
 {
-struct mgmt_group *curr = mgmt_group_list, *prev;
+struct mgmt_group *curr = mgmt_group_list, *prev = NULL;
 
-if (curr && curr == group) {
+if (!group) {
+return;
+}
+
+if (curr == group) {
 mgmt_group_list = curr->mg_next;
 return;
 }
@@ -86,7 +90,7 @@ mgmt_unregister_group(struct mgmt_group *group)
 curr = curr->mg_next;
 }
 
-if (!curr) {
+if (!prev || !curr) {
 return;
 }
 



[mynewt-mcumgr] branch master updated: mgmt: Add support for un-registering a group along with the same support in img_mgmt (#108)

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git


The following commit(s) were added to refs/heads/master by this push:
 new fb489e1  mgmt: Add support for un-registering a group along with the 
same support in img_mgmt (#108)
fb489e1 is described below

commit fb489e1f9b3bcc536d467a9f04a59fc0fde8ea07
Author: Vipul Rahane 
AuthorDate: Wed Feb 10 12:02:30 2021 -0800

mgmt: Add support for un-registering a group along with the same support in 
img_mgmt (#108)

- Add support for unregistering command group at runtime
- Add support for unregistering img_mgmt_group at runtime
---
 cmd/img_mgmt/include/img_mgmt/img_mgmt.h |  5 +
 cmd/img_mgmt/src/img_mgmt.c  |  6 ++
 mgmt/include/mgmt/mgmt.h |  8 
 mgmt/src/mgmt.c  | 25 +
 4 files changed, 44 insertions(+)

diff --git a/cmd/img_mgmt/include/img_mgmt/img_mgmt.h 
b/cmd/img_mgmt/include/img_mgmt/img_mgmt.h
index 78e6ba5..69f6f1b 100644
--- a/cmd/img_mgmt/include/img_mgmt/img_mgmt.h
+++ b/cmd/img_mgmt/include/img_mgmt/img_mgmt.h
@@ -120,6 +120,11 @@ struct img_mgmt_upload_action {
 void img_mgmt_register_group(void);
 
 /**
+ * @brief Unregisters the image management command handler group.
+ */ 
+void img_mgmt_unregister_group(void);
+
+/*
  * @brief Read info of an image give the slot number
  *
  * @param image_slot Image slot to read info from
diff --git a/cmd/img_mgmt/src/img_mgmt.c b/cmd/img_mgmt/src/img_mgmt.c
index 1a40ffc..9cb7b7d 100644
--- a/cmd/img_mgmt/src/img_mgmt.c
+++ b/cmd/img_mgmt/src/img_mgmt.c
@@ -608,3 +608,9 @@ img_mgmt_register_group(void)
 {
 mgmt_register_group(_mgmt_group);
 }
+
+void
+img_mgmt_unregister_group(void)
+{
+mgmt_unregister_group(_mgmt_group);
+}
diff --git a/mgmt/include/mgmt/mgmt.h b/mgmt/include/mgmt/mgmt.h
index 7ad22df..cb7e896 100644
--- a/mgmt/include/mgmt/mgmt.h
+++ b/mgmt/include/mgmt/mgmt.h
@@ -367,6 +367,14 @@ void mgmt_streamer_free_buf(struct mgmt_streamer 
*streamer, void *buf);
 void mgmt_register_group(struct mgmt_group *group);
 
 /**
+ * @brief Unregisters a full command group.
+ *
+ * @param group The group to register.
+ */
+void
+mgmt_unregister_group(struct mgmt_group *group);
+
+/**
  * @brief Finds a registered command handler.
  *
  * @param group_id  The group of the command to find.
diff --git a/mgmt/src/mgmt.c b/mgmt/src/mgmt.c
index 08343bb..77aa631 100644
--- a/mgmt/src/mgmt.c
+++ b/mgmt/src/mgmt.c
@@ -71,6 +71,31 @@ mgmt_streamer_free_buf(struct mgmt_streamer *streamer, void 
*buf)
 streamer->cfg->free_buf(buf, streamer->cb_arg);
 }
 
+void
+mgmt_unregister_group(struct mgmt_group *group)
+{
+struct mgmt_group *curr = mgmt_group_list, *prev;
+
+if (curr && curr == group) {
+mgmt_group_list = curr->mg_next;
+return;
+}
+
+while (curr && curr != group) {
+prev = curr;
+curr = curr->mg_next;
+}
+
+if (!curr) {
+return;
+}
+
+prev->mg_next = curr->mg_next;
+if (curr->mg_next == NULL) {
+mgmt_group_list_end = curr;
+}
+}
+
 static struct mgmt_group *
 mgmt_find_group(uint16_t group_id, uint16_t command_id)
 {



[mynewt-core] branch master updated: Licence is missing to INA226 files

2021-02-07 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new cac8d8a  Licence is missing to INA226 files
 new feed6b8  Merge pull request #2474 from jipanienko/rama2474
cac8d8a is described below

commit cac8d8a6b38151f92319219d143ed7a882409a6a
Author: Jerzy Kasenberg 
AuthorDate: Sat Feb 6 13:58:10 2021 +0100

Licence is missing to INA226 files
---
 hw/drivers/sensors/ina226/include/ina226/ina226.h | 18 +-
 hw/drivers/sensors/ina226/pkg.yml | 16 
 hw/drivers/sensors/ina226/src/ina226.c| 16 
 hw/drivers/sensors/ina226/src/ina226_shell.c  | 16 
 hw/drivers/sensors/ina226/syscfg.yml  | 16 
 5 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/hw/drivers/sensors/ina226/include/ina226/ina226.h 
b/hw/drivers/sensors/ina226/include/ina226/ina226.h
index c9eb7b1..1cb8f7e 100644
--- a/hw/drivers/sensors/ina226/include/ina226/ina226.h
+++ b/hw/drivers/sensors/ina226/include/ina226/ina226.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2020 Jesus Ipanienko
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #ifndef __INA226_H__
 #define __INA226_H__
 
@@ -181,7 +197,7 @@ int ina226_read_bus_voltage(struct ina226_dev *ina226, 
uint32_t *voltage);
  * Reads shunt voltage and returns current.
  *
  * @param ina226Pointer to ina226 device.
- * @param voltage   Pointer to output current in uA.
+ * @param current   Pointer to output current in uA.
  *
  * @return 0 on success, non-zero on failure.
  */
diff --git a/hw/drivers/sensors/ina226/pkg.yml 
b/hw/drivers/sensors/ina226/pkg.yml
index 2bee384..595b16e 100644
--- a/hw/drivers/sensors/ina226/pkg.yml
+++ b/hw/drivers/sensors/ina226/pkg.yml
@@ -1,3 +1,19 @@
+#
+# Copyright 2020 Jesus Ipanienko
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
 pkg.name: hw/drivers/sensors/ina226
 pkg.description: Driver for the INA226 current sensor
 pkg.author:
diff --git a/hw/drivers/sensors/ina226/src/ina226.c 
b/hw/drivers/sensors/ina226/src/ina226.c
index 596f5b8..6777d1c 100644
--- a/hw/drivers/sensors/ina226/src/ina226.c
+++ b/hw/drivers/sensors/ina226/src/ina226.c
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2020 Jesus Ipanienko
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #include 
 #include 
 #include 
diff --git a/hw/drivers/sensors/ina226/src/ina226_shell.c 
b/hw/drivers/sensors/ina226/src/ina226_shell.c
index cf3723f..72ff909 100644
--- a/hw/drivers/sensors/ina226/src/ina226_shell.c
+++ b/hw/drivers/sensors/ina226/src/ina226_shell.c
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2020 Jesus Ipanienko
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations un

[mynewt-core] branch master updated (c446322 -> d453eac)

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

vipulrahane pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


from c446322  hw/mcu/stm: Add missing ld file for nucleo-l073rz BSP
 new da396c7  Update lwip_base to 2.1.2
 new 36922fb  Remove MEMP_NUM_SYS_TIMEOUT from lwipopts.h.
 new ccce89c  Remove makefsdata, update MYNEWT update instructions.
 new 0e3c6ff  Fix ppp debug macros, add to MYNEWT instructions.
 new ee168b7  Remove doxygen output.
 new d453eac  Merge pull request #2456 from 
jeremywood/jeremywood/update-lwip-to-212

The 9873 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:
 net/ip/lwip_base/CHANGELOG | 8843 ++--
 net/ip/lwip_base/CMakeLists.txt|   20 +
 net/ip/lwip_base/COPYING   |   66 +-
 net/ip/lwip_base/FEATURES  |   11 +
 net/ip/lwip_base/FILES |   10 +-
 net/ip/lwip_base/MYNEWT|   13 +-
 net/ip/lwip_base/README|  206 +-
 net/ip/lwip_base/UPGRADING |  517 +-
 net/ip/lwip_base/doc/FILES |   18 +-
 net/ip/lwip_base/doc/NO_SYS_SampleCode.c   |  244 +-
 net/ip/lwip_base/doc/ZeroCopyRx.c  |   45 +
 net/ip/lwip_base/doc/contrib.txt   |  116 +-
 net/ip/lwip_base/doc/doxygen/generate.bat  |2 +-
 net/ip/lwip_base/doc/doxygen/generate.sh   |6 +-
 net/ip/lwip_base/doc/doxygen/lwip.Doxyfile | 5036 +--
 .../{lwip.Doxyfile => lwip.Doxyfile.cmake.in}  | 5036 +--
 net/ip/lwip_base/doc/doxygen/main_page.h   |  535 +-
 net/ip/lwip_base/doc/doxygen/output/index.html |   20 +-
 net/ip/lwip_base/doc/mdns.txt  |  225 +-
 net/ip/lwip_base/doc/mqtt_client.txt   |  324 +-
 net/ip/lwip_base/doc/ppp.txt   | 1058 +--
 net/ip/lwip_base/doc/rawapi.txt|  499 --
 net/ip/lwip_base/doc/savannah.txt  |  240 +-
 net/ip/lwip_base/doc/sys_arch.txt  |  303 -
 .../sys/socket.h => compat/posix/arpa/inet.h}  |   66 +-
 .../{COPYING => include/compat/posix/net/if.h} |   69 +-
 .../lwip_base/include/{ => compat}/posix/netdb.h   |   66 +-
 .../include/{ => compat}/posix/sys/socket.h|   66 +-
 .../include/{posix => compat/stdc}/errno.h |   66 +-
 net/ip/lwip_base/include/lwip/altcp.h  |  201 +
 .../include/lwip/{ethip6.h => altcp_tcp.h} |  140 +-
 net/ip/lwip_base/include/lwip/altcp_tls.h  |  117 +
 net/ip/lwip_base/include/lwip/api.h|  831 +-
 net/ip/lwip_base/include/lwip/apps/FILES   |4 +-
 .../lwip/{ethip6.h => apps/altcp_proxyconnect.h}   |  147 +-
 .../lwip/{mem.h => apps/altcp_tls_mbedtls_opts.h}  |  149 +-
 net/ip/lwip_base/include/lwip/apps/fs.h|  229 +-
 net/ip/lwip_base/include/lwip/apps/http_client.h   |  160 +
 net/ip/lwip_base/include/lwip/apps/httpd.h |  491 +-
 net/ip/lwip_base/include/lwip/apps/httpd_opts.h|  719 +-
 net/ip/lwip_base/include/lwip/apps/lwiperf.h   |  184 +-
 net/ip/lwip_base/include/lwip/apps/mdns.h  |  174 +-
 net/ip/lwip_base/include/lwip/apps/mdns_opts.h |  155 +-
 net/ip/lwip_base/include/lwip/apps/mdns_priv.h |  140 +-
 net/ip/lwip_base/include/lwip/apps/mqtt.h  |  449 +-
 net/ip/lwip_base/include/lwip/apps/mqtt_opts.h |  206 +-
 net/ip/lwip_base/include/lwip/apps/mqtt_priv.h |  104 +
 net/ip/lwip_base/include/lwip/apps/netbiosns.h |   94 +-
 .../lwip_base/include/lwip/apps/netbiosns_opts.h   |  125 +-
 net/ip/lwip_base/include/lwip/apps/smtp.h  |  128 +
 net/ip/lwip_base/include/lwip/apps/smtp_opts.h |   81 +
 net/ip/lwip_base/include/lwip/apps/snmp.h  |  263 +-
 net/ip/lwip_base/include/lwip/apps/snmp_core.h |  741 +-
 net/ip/lwip_base/include/lwip/apps/snmp_mib2.h |  156 +-
 net/ip/lwip_base/include/lwip/apps/snmp_opts.h |  590 +-
 net/ip/lwip_base/include/lwip/apps/snmp_scalar.h   |  226 +-
 .../include/lwip/apps/snmp_snmpv2_framework.h  |   32 +
 .../lwip_base/include/lwip/apps/snmp_snmpv2_usm.h  |   24 +
 net/ip/lwip_base/include/lwip/apps/snmp_table.h|  268 +-
 .../lwip_base/include/lwip/apps/snmp_threadsync.h  |  228 +-
 net/ip/lwip_base/include/lwip/apps/snmpv3.h|  204 +-
 net/ip/lwip_base/include/lwip/apps/sntp.h  |  156 +-
 net/ip/lwip_base/include/lwip/apps/sntp_opts.h |  382 +-
 net/ip/lwip_base/include/lwip/apps/tftp_opts.h |  211 +-
 net/ip/lwip_base/include/lwip/apps/tftp_server.h   

[mynewt-core] branch master updated: crypto/tinycrypt: Update library to master 5969b0e - Explicitly set default_RNG_defined to 0

2021-01-22 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new dfd145c  crypto/tinycrypt: Update library to master 5969b0e - 
Explicitly set default_RNG_defined to 0
 new 69fcf3e  Merge pull request #2458 from vikrant-proxy/tinycrypt-update
dfd145c is described below

commit dfd145cf2d09484c564939305c444e50b82ca336
Author: Vikrant More 
AuthorDate: Wed Jan 20 10:59:59 2021 -0800

crypto/tinycrypt: Update library to master 5969b0e
- Explicitly set default_RNG_defined to 0
---
 crypto/tinycrypt/include/tinycrypt/utils.h | 26 ++
 crypto/tinycrypt/src/cbc_mode.c|  4 +--
 crypto/tinycrypt/src/cmac_mode.c   |  2 +-
 crypto/tinycrypt/src/ecc_dh.c  | 22 +---
 crypto/tinycrypt/src/ecc_dsa.c |  7 +
 crypto/tinycrypt/src/hmac.c|  7 +++--
 crypto/tinycrypt/src/hmac_prng.c   | 42 +-
 7 files changed, 70 insertions(+), 40 deletions(-)

diff --git a/crypto/tinycrypt/include/tinycrypt/utils.h 
b/crypto/tinycrypt/include/tinycrypt/utils.h
index bab5c32..6b7b0ab 100644
--- a/crypto/tinycrypt/include/tinycrypt/utils.h
+++ b/crypto/tinycrypt/include/tinycrypt/utils.h
@@ -41,6 +41,7 @@
 
 #include 
 #include 
+#include 
 
 #ifdef __cplusplus
 extern "C" {
@@ -69,6 +70,31 @@ unsigned int _copy(uint8_t *to, unsigned int to_len,
  */
 void _set(void *to, uint8_t val, unsigned int len);
 
+/**
+ * @brief Set the value 'val' into the buffer 'to', 'len' times, in a way
+ * which does not risk getting optimized out by the compiler
+ *In cases where the compiler does not set __GNUC__ and where the
+ * optimization level removes the memset, it may be necessary to
+ * implement a _set_secure function and define the
+ * TINYCRYPT_ARCH_HAS_SET_SECURE, which then can ensure that the
+ * memset does not get optimized out.
+ *
+ * @param to OUT -- destination buffer
+ * @param val IN -- value to be set in 'to'
+ * @param len IN -- number of times the value will be copied
+ */
+#ifdef TINYCRYPT_ARCH_HAS_SET_SECURE
+extern void _set_secure(void *to, uint8_t val, unsigned int len);
+#else /* ! TINYCRYPT_ARCH_HAS_SET_SECURE */
+static inline void _set_secure(void *to, uint8_t val, unsigned int len)
+{
+  (void) memset(to, val, len);
+#ifdef __GNUC__
+  __asm__ __volatile__("" :: "g"(to) : "memory");
+#endif /* __GNUC__ */
+}
+#endif /* TINYCRYPT_ARCH_HAS_SET_SECURE */
+
 /*
  * @brief AES specific doubling function, which utilizes
  * the finite field used by AES.
diff --git a/crypto/tinycrypt/src/cbc_mode.c b/crypto/tinycrypt/src/cbc_mode.c
index 62d7879..ae20af1 100644
--- a/crypto/tinycrypt/src/cbc_mode.c
+++ b/crypto/tinycrypt/src/cbc_mode.c
@@ -91,7 +91,7 @@ int tc_cbc_mode_decrypt(uint8_t *out, unsigned int outlen, 
const uint8_t *in,
outlen == 0 ||
(inlen % TC_AES_BLOCK_SIZE) != 0 ||
(outlen % TC_AES_BLOCK_SIZE) != 0 ||
-   outlen != inlen - TC_AES_BLOCK_SIZE) {
+   outlen != inlen) {
return TC_CRYPTO_FAIL;
}
 
@@ -101,7 +101,7 @@ int tc_cbc_mode_decrypt(uint8_t *out, unsigned int outlen, 
const uint8_t *in,
 * that would not otherwise be possible.
 */
p = iv;
-   for (n = m = 0; n < inlen; ++n) {
+   for (n = m = 0; n < outlen; ++n) {
if ((n % TC_AES_BLOCK_SIZE) == 0) {
(void)tc_aes_decrypt(buffer, in, sched);
in += TC_AES_BLOCK_SIZE;
diff --git a/crypto/tinycrypt/src/cmac_mode.c b/crypto/tinycrypt/src/cmac_mode.c
index 96d147e..22adf20 100644
--- a/crypto/tinycrypt/src/cmac_mode.c
+++ b/crypto/tinycrypt/src/cmac_mode.c
@@ -36,7 +36,7 @@
 #include 
 
 /* max number of calls until change the key (2^48).*/
-const static uint64_t MAX_CALLS = ((uint64_t)1 << 48);
+static const uint64_t MAX_CALLS = ((uint64_t)1 << 48);
 
 /*
  *  gf_wrap -- In our implementation, GF(2^128) is represented as a 16 byte
diff --git a/crypto/tinycrypt/src/ecc_dh.c b/crypto/tinycrypt/src/ecc_dh.c
index e5257d2..5624c96 100644
--- a/crypto/tinycrypt/src/ecc_dh.c
+++ b/crypto/tinycrypt/src/ecc_dh.c
@@ -57,14 +57,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
-#if default_RNG_defined
-static uECC_RNG_Function g_rng_function = _CSPRNG;
-#else
-static uECC_RNG_Function g_rng_function = 0;
-#endif
-
 int uECC_make_key_with_d(uint8_t *public_key, uint8_t *private_key,
 unsigned int *d, uECC_Curve curve)
 {
@@ -92,7 +87,7 @@ int uECC_make_key_with_d(uint8_t *public_key, uint8_t 
*private_key,
   _public + curve->num_words);
 
/* erasing temporary buffer used to store

[mynewt-newtmgr] branch master updated: taskstat: Add tab character after the task's name

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git


The following commit(s) were added to refs/heads/master by this push:
 new 59848a5  taskstat: Add tab character after the task's name
 new c56797e  Merge pull request #179 from 
vrahane/newtmgr_taskstat_format_fix
59848a5 is described below

commit 59848a51e84a12ca61aafa5222d974bdeb8db298
Author: Vipul Rahane 
AuthorDate: Fri Dec 11 00:49:36 2020 -0800

taskstat: Add tab character after the task's name

- There was a space earlier and if the task name was bigger,
  it owuld cause formatting issues
---
 newtmgr/cli/taskstat.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/newtmgr/cli/taskstat.go b/newtmgr/cli/taskstat.go
index 3e25913..06af0ad 100644
--- a/newtmgr/cli/taskstat.go
+++ b/newtmgr/cli/taskstat.go
@@ -56,12 +56,12 @@ func taskStatRunCmd(cmd *cobra.Command, args []string) {
}
sort.Strings(names)
 
-   fmt.Printf("  %8s %3s %3s %8s %8s %8s %8s %8s %8s\n",
+   fmt.Printf("  %8s\t%3s %3s %8s %8s %8s %8s %8s %8s\n",
"task", "pri", "tid", "runtime", "csw", "stksz",
"stkuse", "last_checkin", "next_checkin")
for _, n := range names {
t := sres.Rsp.Tasks[n]
-   fmt.Printf("  %8s %3d %3d %8d %8d %8d %8d %8d %8d\n",
+   fmt.Printf("  %8s\t%3d %3d %8d %8d %8d %8d %8d %8d\n",
n,
t["prio"],
t["tid"],



[mynewt-core] branch master updated: sensors/bmp388: Adding protection against rollover at high altitudes.

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new da1b9d3  sensors/bmp388: Adding protection against rollover at high 
altitudes.
 new a68da01  Merge pull request #2407 from 
supervillain101/bmp3_overflow_prevention
da1b9d3 is described below

commit da1b9d31e8671cc706ad9f5f85295d93b0ade59d
Author: Philip Burkhardt 
AuthorDate: Tue Nov 3 11:56:12 2020 -0800

sensors/bmp388: Adding protection against rollover at high altitudes.
---
 hw/drivers/sensors/bmp388/src/bmp388.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/drivers/sensors/bmp388/src/bmp388.c 
b/hw/drivers/sensors/bmp388/src/bmp388.c
index b3b9aa7..4e244d6 100644
--- a/hw/drivers/sensors/bmp388/src/bmp388.c
+++ b/hw/drivers/sensors/bmp388/src/bmp388.c
@@ -1343,7 +1343,8 @@ compensate_pressure(const struct bmp3_uncomp_data 
*uncomp_data,
 BMP388_LOG_ERROR("*partial_data4 high32bit = 0x%x low32bit = 0x%x\n", 
(uint32_t)((partial_data4)>>32),(uint32_t)(partial_data4&0x));
 #endif
 
-partial_data5 = (partial_data4 * uncomp_data->pressure) / 512;
+partial_data5 = (partial_data4 * (uncomp_data->pressure / 10)) / 512;
+partial_data5 = partial_data5 * 10;
 
 #if COMPENSTATE_DEBUG
 BMP388_LOG_ERROR("*partial_data5 high32bit = 0x%x low32bit = 0x%x\n", 
(uint32_t)((partial_data5)>>32),(uint32_t)(partial_data5&0x));



[mynewt-core] branch master updated: hw/bsp/pinetime: Setup I2C

2020-11-01 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new a25492a  hw/bsp/pinetime: Setup I2C
 new 2806850  Merge pull request #2406 from Treboada/bsp-pinetime-i2c
a25492a is described below

commit a25492ab5ad678a12982e53a4cb9defce722ec41
Author: Rafa Couto 
AuthorDate: Mon Nov 2 01:31:38 2020 +0100

hw/bsp/pinetime: Setup I2C

Enable the I2C port 1 for the Pinetime. Maximum speed of 400 KHz is set
since connected I2C slave devices are >= 400 KHz.
---
 hw/bsp/pinetime/syscfg.yml | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/bsp/pinetime/syscfg.yml b/hw/bsp/pinetime/syscfg.yml
index 7986de6..7f22f3c 100644
--- a/hw/bsp/pinetime/syscfg.yml
+++ b/hw/bsp/pinetime/syscfg.yml
@@ -47,7 +47,7 @@ syscfg.vals:
 MCU_TARGET: nRF52832
 
 # 32.768 kHz crystal oscillator
-MCU_LFCLK_SOURCE: LFXO  
+MCU_LFCLK_SOURCE: LFXO
 
 # Enable DC/DC regulator
 MCU_DCDC_ENABLED: 1
@@ -61,7 +61,9 @@ syscfg.vals:
 SPI_0_MASTER_PIN_MOSI: 3  # P0.03: SPI-MOSI, LCD_SDI
 SPI_0_MASTER_PIN_MISO: 4  # P0.04: SPI-MISO
 
-# I2C port 1 connected to CST816S touch controller, BMA421 accelerometer, 
HRS3300 heart rate sensor 
+# I2C port 1 connected to CST816S touch controller, BMA421 accelerometer, 
HRS3300 heart rate sensor
+I2C_1: 1
+I2C_1_FREQ_KHZ: 400 # BMA421=1000 HRS3300=800 CST816S=400
 I2C_1_PIN_SCL: 7  # P0.07: BMA421-SCL, HRS3300-SCL, TP-SCLOUT
 I2C_1_PIN_SDA: 6  # P0.06: BMA421-SDA, HRS3300-SDA, TP-SDAI/O
 



[mynewt-core] branch master updated: BMP388 Pressure/temperature sensor i2c communtication optimization (#2376)

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new a351a4d  BMP388 Pressure/temperature sensor i2c communtication 
optimization (#2376)
a351a4d is described below

commit a351a4dca423d6676e7b8c1e72db6fed87744bd9
Author: Philip Burkhardt <63323391+supervillain...@users.noreply.github.com>
AuthorDate: Sun Sep 20 12:24:52 2020 -0700

BMP388 Pressure/temperature sensor i2c communtication optimization (#2376)

* Add hybrid streaming mode that works without an interrupt pin
---
 hw/drivers/sensors/bmp388/include/bmp388/bmp388.h |   2 +
 hw/drivers/sensors/bmp388/src/bmp388.c| 249 +-
 hw/drivers/sensors/bmp388/syscfg.yml  |   5 +
 3 files changed, 253 insertions(+), 3 deletions(-)

diff --git a/hw/drivers/sensors/bmp388/include/bmp388/bmp388.h 
b/hw/drivers/sensors/bmp388/include/bmp388/bmp388.h
index 41b8f94..30d09dc 100644
--- a/hw/drivers/sensors/bmp388/include/bmp388/bmp388.h
+++ b/hw/drivers/sensors/bmp388/include/bmp388/bmp388.h
@@ -381,6 +381,7 @@ enum bmp388_int_type {
 enum bmp388_read_mode {
 BMP388_READ_M_POLL = 0,
 BMP388_READ_M_STREAM = 1,
+BMP388_READ_M_HYBRID = 2,
 };
 
 /* Read mode configuration */
@@ -719,6 +720,7 @@ struct bmp388 {
 #endif
 /* Variable used to hold stats data */
 STATS_SECT_DECL(bmp388_stat_section) stats;
+bool bmp388_cfg_complete;
 };
 
 /**
diff --git a/hw/drivers/sensors/bmp388/src/bmp388.c 
b/hw/drivers/sensors/bmp388/src/bmp388.c
index 412f6b9..b3b9aa7 100644
--- a/hw/drivers/sensors/bmp388/src/bmp388.c
+++ b/hw/drivers/sensors/bmp388/src/bmp388.c
@@ -3142,7 +3142,7 @@ bmp388_stream_read(struct sensor *sensor,
 /* FIFO object to be assigned to device structure */
 struct bmp3_fifo fifo;
 /* Pressure and temperature array of structures with maximum frame size */
-struct bmp3_data sensor_data[74];
+struct bmp3_data sensor_data[MYNEWT_VAL(BMP388_FIFO_CONVERTED_DATA_SIZE)];
 /* Loop Variable */
 uint8_t i;
 uint16_t frame_length;
@@ -3231,8 +3231,9 @@ bmp388_stream_read(struct sensor *sensor,
 #endif
 
 if (time_ms != 0) {
-if (time_ms > BMP388_MAX_STREAM_MS)
+if (time_ms > BMP388_MAX_STREAM_MS) {
 time_ms = BMP388_MAX_STREAM_MS;
+}
 rc = os_time_ms_to_ticks(time_ms, _ticks);
 if (rc) {
 goto err;
@@ -3366,6 +3367,246 @@ err:
 return rc;
 }
 
+int
+bmp388_hybrid_read(struct sensor *sensor,
+   sensor_type_t sensor_type,
+   sensor_data_func_t read_func,
+   void *read_arg,
+   uint32_t time_ms)
+{
+int rc;
+struct bmp388 *bmp388;
+struct bmp388_cfg *cfg;
+os_time_t time_ticks;
+os_time_t stop_ticks = 0;
+uint16_t try_count;
+
+#if MYNEWT_VAL(BMP388_FIFO_ENABLE)
+/* FIFO object to be assigned to device structure */
+struct bmp3_fifo fifo;
+/* Pressure and temperature array of structures with maximum frame size */
+struct bmp3_data sensor_data[MYNEWT_VAL(BMP388_FIFO_CONVERTED_DATA_SIZE)];
+/* Loop Variable */
+uint8_t i;
+uint16_t frame_length;
+/* Enable fifo */
+fifo.settings.mode = BMP3_ENABLE;
+/* Enable Pressure sensor for fifo */
+fifo.settings.press_en = BMP3_ENABLE;
+/* Enable temperature sensor for fifo */
+fifo.settings.temp_en = BMP3_ENABLE;
+/* Enable fifo time */
+fifo.settings.time_en = BMP3_ENABLE;
+/* No subsampling for FIFO */
+fifo.settings.down_sampling = BMP3_FIFO_NO_SUBSAMPLING;
+fifo.sensortime_updated = false;
+uint16_t current_fifo_len;
+#else
+struct bmp3_data sensor_data;
+#endif
+
+/* If the read isn't looking for pressure or temperature data, don't do 
anything. */
+if ((!(sensor_type & SENSOR_TYPE_PRESSURE)) &&
+(!(sensor_type & SENSOR_TYPE_TEMPERATURE))) {
+BMP388_LOG_ERROR("unsupported sensor type for bmp388\n");
+return SYS_EINVAL;
+}
+
+bmp388 = (struct bmp388 *)SENSOR_GET_DEVICE(sensor);
+
+cfg = >cfg;
+
+if (cfg->read_mode.mode != BMP388_READ_M_HYBRID) {
+BMP388_LOG_ERROR("*bmp388_hybrid_read mode is not hybrid\n");
+return SYS_EINVAL;
+}
+
+if (bmp388->bmp388_cfg_complete == false) {
+/* no interrupt feature */
+/* enable normal mode for fifo feature */
+rc = bmp388_set_normal_mode(bmp388);
+if (rc) {
+BMP388_LOG_ERROR("**bmp388_set_normal_mode failed %d\n", rc);
+goto error;
+}
+
+rc = bmp3_fifo_flush(>bmp3_dev); 
+if(rc) {
+BMP388_LOG_ERROR("fifo flush failed, error=0x%02x\n", rc);
+goto error;
+}
+  

[mynewt-core] branch master updated: BMP388 Pressure/temperature sensor i2c communtication optimization (#2376)

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new a351a4d  BMP388 Pressure/temperature sensor i2c communtication 
optimization (#2376)
a351a4d is described below

commit a351a4dca423d6676e7b8c1e72db6fed87744bd9
Author: Philip Burkhardt <63323391+supervillain...@users.noreply.github.com>
AuthorDate: Sun Sep 20 12:24:52 2020 -0700

BMP388 Pressure/temperature sensor i2c communtication optimization (#2376)

* Add hybrid streaming mode that works without an interrupt pin
---
 hw/drivers/sensors/bmp388/include/bmp388/bmp388.h |   2 +
 hw/drivers/sensors/bmp388/src/bmp388.c| 249 +-
 hw/drivers/sensors/bmp388/syscfg.yml  |   5 +
 3 files changed, 253 insertions(+), 3 deletions(-)

diff --git a/hw/drivers/sensors/bmp388/include/bmp388/bmp388.h 
b/hw/drivers/sensors/bmp388/include/bmp388/bmp388.h
index 41b8f94..30d09dc 100644
--- a/hw/drivers/sensors/bmp388/include/bmp388/bmp388.h
+++ b/hw/drivers/sensors/bmp388/include/bmp388/bmp388.h
@@ -381,6 +381,7 @@ enum bmp388_int_type {
 enum bmp388_read_mode {
 BMP388_READ_M_POLL = 0,
 BMP388_READ_M_STREAM = 1,
+BMP388_READ_M_HYBRID = 2,
 };
 
 /* Read mode configuration */
@@ -719,6 +720,7 @@ struct bmp388 {
 #endif
 /* Variable used to hold stats data */
 STATS_SECT_DECL(bmp388_stat_section) stats;
+bool bmp388_cfg_complete;
 };
 
 /**
diff --git a/hw/drivers/sensors/bmp388/src/bmp388.c 
b/hw/drivers/sensors/bmp388/src/bmp388.c
index 412f6b9..b3b9aa7 100644
--- a/hw/drivers/sensors/bmp388/src/bmp388.c
+++ b/hw/drivers/sensors/bmp388/src/bmp388.c
@@ -3142,7 +3142,7 @@ bmp388_stream_read(struct sensor *sensor,
 /* FIFO object to be assigned to device structure */
 struct bmp3_fifo fifo;
 /* Pressure and temperature array of structures with maximum frame size */
-struct bmp3_data sensor_data[74];
+struct bmp3_data sensor_data[MYNEWT_VAL(BMP388_FIFO_CONVERTED_DATA_SIZE)];
 /* Loop Variable */
 uint8_t i;
 uint16_t frame_length;
@@ -3231,8 +3231,9 @@ bmp388_stream_read(struct sensor *sensor,
 #endif
 
 if (time_ms != 0) {
-if (time_ms > BMP388_MAX_STREAM_MS)
+if (time_ms > BMP388_MAX_STREAM_MS) {
 time_ms = BMP388_MAX_STREAM_MS;
+}
 rc = os_time_ms_to_ticks(time_ms, _ticks);
 if (rc) {
 goto err;
@@ -3366,6 +3367,246 @@ err:
 return rc;
 }
 
+int
+bmp388_hybrid_read(struct sensor *sensor,
+   sensor_type_t sensor_type,
+   sensor_data_func_t read_func,
+   void *read_arg,
+   uint32_t time_ms)
+{
+int rc;
+struct bmp388 *bmp388;
+struct bmp388_cfg *cfg;
+os_time_t time_ticks;
+os_time_t stop_ticks = 0;
+uint16_t try_count;
+
+#if MYNEWT_VAL(BMP388_FIFO_ENABLE)
+/* FIFO object to be assigned to device structure */
+struct bmp3_fifo fifo;
+/* Pressure and temperature array of structures with maximum frame size */
+struct bmp3_data sensor_data[MYNEWT_VAL(BMP388_FIFO_CONVERTED_DATA_SIZE)];
+/* Loop Variable */
+uint8_t i;
+uint16_t frame_length;
+/* Enable fifo */
+fifo.settings.mode = BMP3_ENABLE;
+/* Enable Pressure sensor for fifo */
+fifo.settings.press_en = BMP3_ENABLE;
+/* Enable temperature sensor for fifo */
+fifo.settings.temp_en = BMP3_ENABLE;
+/* Enable fifo time */
+fifo.settings.time_en = BMP3_ENABLE;
+/* No subsampling for FIFO */
+fifo.settings.down_sampling = BMP3_FIFO_NO_SUBSAMPLING;
+fifo.sensortime_updated = false;
+uint16_t current_fifo_len;
+#else
+struct bmp3_data sensor_data;
+#endif
+
+/* If the read isn't looking for pressure or temperature data, don't do 
anything. */
+if ((!(sensor_type & SENSOR_TYPE_PRESSURE)) &&
+(!(sensor_type & SENSOR_TYPE_TEMPERATURE))) {
+BMP388_LOG_ERROR("unsupported sensor type for bmp388\n");
+return SYS_EINVAL;
+}
+
+bmp388 = (struct bmp388 *)SENSOR_GET_DEVICE(sensor);
+
+cfg = >cfg;
+
+if (cfg->read_mode.mode != BMP388_READ_M_HYBRID) {
+BMP388_LOG_ERROR("*bmp388_hybrid_read mode is not hybrid\n");
+return SYS_EINVAL;
+}
+
+if (bmp388->bmp388_cfg_complete == false) {
+/* no interrupt feature */
+/* enable normal mode for fifo feature */
+rc = bmp388_set_normal_mode(bmp388);
+if (rc) {
+BMP388_LOG_ERROR("**bmp388_set_normal_mode failed %d\n", rc);
+goto error;
+}
+
+rc = bmp3_fifo_flush(>bmp3_dev); 
+if(rc) {
+BMP388_LOG_ERROR("fifo flush failed, error=0x%02x\n", rc);
+goto error;
+}
+  

[mynewt-core] branch master updated: BMP388 Pressure/temperature sensor i2c communtication optimization (#2376)

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

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
 new a351a4d  BMP388 Pressure/temperature sensor i2c communtication 
optimization (#2376)
a351a4d is described below

commit a351a4dca423d6676e7b8c1e72db6fed87744bd9
Author: Philip Burkhardt <63323391+supervillain...@users.noreply.github.com>
AuthorDate: Sun Sep 20 12:24:52 2020 -0700

BMP388 Pressure/temperature sensor i2c communtication optimization (#2376)

* Add hybrid streaming mode that works without an interrupt pin
---
 hw/drivers/sensors/bmp388/include/bmp388/bmp388.h |   2 +
 hw/drivers/sensors/bmp388/src/bmp388.c| 249 +-
 hw/drivers/sensors/bmp388/syscfg.yml  |   5 +
 3 files changed, 253 insertions(+), 3 deletions(-)

diff --git a/hw/drivers/sensors/bmp388/include/bmp388/bmp388.h 
b/hw/drivers/sensors/bmp388/include/bmp388/bmp388.h
index 41b8f94..30d09dc 100644
--- a/hw/drivers/sensors/bmp388/include/bmp388/bmp388.h
+++ b/hw/drivers/sensors/bmp388/include/bmp388/bmp388.h
@@ -381,6 +381,7 @@ enum bmp388_int_type {
 enum bmp388_read_mode {
 BMP388_READ_M_POLL = 0,
 BMP388_READ_M_STREAM = 1,
+BMP388_READ_M_HYBRID = 2,
 };
 
 /* Read mode configuration */
@@ -719,6 +720,7 @@ struct bmp388 {
 #endif
 /* Variable used to hold stats data */
 STATS_SECT_DECL(bmp388_stat_section) stats;
+bool bmp388_cfg_complete;
 };
 
 /**
diff --git a/hw/drivers/sensors/bmp388/src/bmp388.c 
b/hw/drivers/sensors/bmp388/src/bmp388.c
index 412f6b9..b3b9aa7 100644
--- a/hw/drivers/sensors/bmp388/src/bmp388.c
+++ b/hw/drivers/sensors/bmp388/src/bmp388.c
@@ -3142,7 +3142,7 @@ bmp388_stream_read(struct sensor *sensor,
 /* FIFO object to be assigned to device structure */
 struct bmp3_fifo fifo;
 /* Pressure and temperature array of structures with maximum frame size */
-struct bmp3_data sensor_data[74];
+struct bmp3_data sensor_data[MYNEWT_VAL(BMP388_FIFO_CONVERTED_DATA_SIZE)];
 /* Loop Variable */
 uint8_t i;
 uint16_t frame_length;
@@ -3231,8 +3231,9 @@ bmp388_stream_read(struct sensor *sensor,
 #endif
 
 if (time_ms != 0) {
-if (time_ms > BMP388_MAX_STREAM_MS)
+if (time_ms > BMP388_MAX_STREAM_MS) {
 time_ms = BMP388_MAX_STREAM_MS;
+}
 rc = os_time_ms_to_ticks(time_ms, _ticks);
 if (rc) {
 goto err;
@@ -3366,6 +3367,246 @@ err:
 return rc;
 }
 
+int
+bmp388_hybrid_read(struct sensor *sensor,
+   sensor_type_t sensor_type,
+   sensor_data_func_t read_func,
+   void *read_arg,
+   uint32_t time_ms)
+{
+int rc;
+struct bmp388 *bmp388;
+struct bmp388_cfg *cfg;
+os_time_t time_ticks;
+os_time_t stop_ticks = 0;
+uint16_t try_count;
+
+#if MYNEWT_VAL(BMP388_FIFO_ENABLE)
+/* FIFO object to be assigned to device structure */
+struct bmp3_fifo fifo;
+/* Pressure and temperature array of structures with maximum frame size */
+struct bmp3_data sensor_data[MYNEWT_VAL(BMP388_FIFO_CONVERTED_DATA_SIZE)];
+/* Loop Variable */
+uint8_t i;
+uint16_t frame_length;
+/* Enable fifo */
+fifo.settings.mode = BMP3_ENABLE;
+/* Enable Pressure sensor for fifo */
+fifo.settings.press_en = BMP3_ENABLE;
+/* Enable temperature sensor for fifo */
+fifo.settings.temp_en = BMP3_ENABLE;
+/* Enable fifo time */
+fifo.settings.time_en = BMP3_ENABLE;
+/* No subsampling for FIFO */
+fifo.settings.down_sampling = BMP3_FIFO_NO_SUBSAMPLING;
+fifo.sensortime_updated = false;
+uint16_t current_fifo_len;
+#else
+struct bmp3_data sensor_data;
+#endif
+
+/* If the read isn't looking for pressure or temperature data, don't do 
anything. */
+if ((!(sensor_type & SENSOR_TYPE_PRESSURE)) &&
+(!(sensor_type & SENSOR_TYPE_TEMPERATURE))) {
+BMP388_LOG_ERROR("unsupported sensor type for bmp388\n");
+return SYS_EINVAL;
+}
+
+bmp388 = (struct bmp388 *)SENSOR_GET_DEVICE(sensor);
+
+cfg = >cfg;
+
+if (cfg->read_mode.mode != BMP388_READ_M_HYBRID) {
+BMP388_LOG_ERROR("*bmp388_hybrid_read mode is not hybrid\n");
+return SYS_EINVAL;
+}
+
+if (bmp388->bmp388_cfg_complete == false) {
+/* no interrupt feature */
+/* enable normal mode for fifo feature */
+rc = bmp388_set_normal_mode(bmp388);
+if (rc) {
+BMP388_LOG_ERROR("**bmp388_set_normal_mode failed %d\n", rc);
+goto error;
+}
+
+rc = bmp3_fifo_flush(>bmp3_dev); 
+if(rc) {
+BMP388_LOG_ERROR("fifo flush failed, error=0x%02x\n", rc);
+goto error;
+}
+  

  1   2   3   4   5   >