[GitHub] [mynewt-nimble] prasad-alatkar commented on a change in pull request #765: nimble/host: Fix check for valid static random address

2020-03-05 Thread GitBox
prasad-alatkar commented on a change in pull request #765: nimble/host: Fix 
check for valid static random address
URL: https://github.com/apache/mynewt-nimble/pull/765#discussion_r388720848
 
 

 ##
 File path: nimble/host/src/ble_hs_id.c
 ##
 @@ -58,14 +58,20 @@ ble_hs_id_set_rnd(const uint8_t *rnd_addr)
 {
 uint8_t addr_type_byte;
 int rc;
-uint8_t all_zeros[BLE_DEV_ADDR_LEN] = {0}, all_ones[BLE_DEV_ADDR_LEN] = { 
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+int i, rnd_part_sum = 0;
 
 
 Review comment:
   Sure @sjanc and yes I agree that your suggested changes (almost all) are 
more readable. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-newt] ccollins476ad opened a new pull request #383: upgrade: Don't warn on fixup to an equivalent URL

2020-03-05 Thread GitBox
ccollins476ad opened a new pull request #383: upgrade: Don't warn on fixup to 
an equivalent URL
URL: https://github.com/apache/mynewt-newt/pull/383
 
 
   If `project.yml` specifies a repo with a different URL than the current 
`origin`, newt fixes the `origin` URL and produces a warning like this:
   
   ```
   WARNING: Repo's "origin" remote points to unexpected URL: 
g...@github.com:apache/mynewt-nimble.git; correcting it to 
https://github.com/apache/mynewt-nimble.git.  Repo contents may be incorrect.
   ```
   
   This commit suppresses the warning if the two URLs are "equivalent".  URLs 
are considered equivalent if:
   
   1. The strings are identical after the optional ".git" suffixes are stripped,
   
   OR
   
   2. One is a "git@" URL and the other is an "https://; URL for the same repo. 
 For example:
   * g...@github.com:apache/mynewt-core.git
   * https://github.com/apache/mynewt-core
   
   This is useful for people who have the following setting in their git 
configuration file:
   
   ```
   [url "g...@github.com:"]
   insteadOf = https://github.com/
   ```
   
   Go users who use private github repos are especially likely to use this 
configuration.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2230: da1469x/hal_flash: Add missing include

2020-03-05 Thread GitBox
apache-mynewt-bot removed a comment on issue #2230: da1469x/hal_flash: Add 
missing include
URL: https://github.com/apache/mynewt-core/pull/2230#issuecomment-595510326
 
 
   
   
   
   ## Style check summary
   
    No suggestions at this time!
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated: da1469x/hal_flash: Add missing include (#2230)

2020-03-05 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 47b257e  da1469x/hal_flash: Add missing include (#2230)
47b257e is described below

commit 47b257ec5eb60fbc187737c25b0e388ef5bd2076
Author: Vipul Rahane 
AuthorDate: Thu Mar 5 16:48:22 2020 -0800

da1469x/hal_flash: Add missing include (#2230)
---
 hw/mcu/dialog/da1469x/src/hal_flash.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/mcu/dialog/da1469x/src/hal_flash.c 
b/hw/mcu/dialog/da1469x/src/hal_flash.c
index a4cf444..5d19908 100644
--- a/hw/mcu/dialog/da1469x/src/hal_flash.c
+++ b/hw/mcu/dialog/da1469x/src/hal_flash.c
@@ -24,6 +24,7 @@
 #include "mcu/da1469x_hal.h"
 #include "hal/hal_flash_int.h"
 #include "mcu/mcu.h"
+#include 
 
 #define CODE_QSPI_INLINE__attribute__((always_inline)) inline
 
@@ -330,9 +331,9 @@ da1469x_hff_in_flash_addr_space(const void *src)
  * Due to the remap specified in the datasheet, 0->0x8 (8 MBytes) are
  * remapped, hence that needs to be considered as well.
  */
-if uint32_t)src < MCU_MEM_QSPIF_M_START_ADDRESS)   &&
+if uint32_t)src < MCU_MEM_QSPIF_M_START_ADDRESS) &&
  ((uint32_t)src >= MCU_MEM_QSPIF_M_END_REMAP_ADDRESS)) ||
- ((uint32_t)src >= MCU_MEM_QSPIF_M_END_ADDRESS)) {
+((uint32_t)src >= MCU_MEM_QSPIF_M_END_ADDRESS)) {
 return false;
 }
 



[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2230: da1469x/hal_flash: Add missing include

2020-03-05 Thread GitBox
apache-mynewt-bot commented on issue #2230: da1469x/hal_flash: Add missing 
include
URL: https://github.com/apache/mynewt-core/pull/2230#issuecomment-595519662
 
 
   
   
   
   ## Style check summary
   
    No suggestions at this time!
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] vrahane merged pull request #2230: da1469x/hal_flash: Add missing include

2020-03-05 Thread GitBox
vrahane merged pull request #2230: da1469x/hal_flash: Add missing include
URL: https://github.com/apache/mynewt-core/pull/2230
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] vrahane merged pull request #2227: fix incorrect check in lis2ds12_set_full_scale

2020-03-05 Thread GitBox
vrahane merged pull request #2227: fix incorrect check in 
lis2ds12_set_full_scale
URL: https://github.com/apache/mynewt-core/pull/2227
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated: fix incorrect check in lis2ds12_set_full_scale (#2227)

2020-03-05 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 9158ebb  fix incorrect check in lis2ds12_set_full_scale (#2227)
9158ebb is described below

commit 9158ebbaf8b1b2a05c0e90527d87a1b0a8b10b3b
Author: Vipul Rahane 
AuthorDate: Thu Mar 5 16:32:06 2020 -0800

fix incorrect check in lis2ds12_set_full_scale (#2227)

* fix invalid fs value check in lis2ds12_set_full_scale

* better condition to check the fs argument in lis2ds12_set_full_scale

* correct LIS2DS12_DATA_RATE_LP_10BIT_800HZ value
better condition to check the rate argument in lis2ds12_set_rate
---
 hw/drivers/sensors/lis2ds12/include/lis2ds12/lis2ds12.h | 2 +-
 hw/drivers/sensors/lis2ds12/src/lis2ds12.c  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/drivers/sensors/lis2ds12/include/lis2ds12/lis2ds12.h 
b/hw/drivers/sensors/lis2ds12/include/lis2ds12/lis2ds12.h
index f10ba94..7eef4fc 100644
--- a/hw/drivers/sensors/lis2ds12/include/lis2ds12/lis2ds12.h
+++ b/hw/drivers/sensors/lis2ds12/include/lis2ds12/lis2ds12.h
@@ -36,7 +36,7 @@ extern "C" {
 #define LIS2DS12_DATA_RATE_LP_10BIT_100HZ   0xC0
 #define LIS2DS12_DATA_RATE_LP_10BIT_200HZ   0xD0
 #define LIS2DS12_DATA_RATE_LP_10BIT_400HZ   0xE0
-#define LIS2DS12_DATA_RATE_LP_10BIT_800HZ   0x70
+#define LIS2DS12_DATA_RATE_LP_10BIT_800HZ   0xF0
 #define LIS2DS12_DATA_RATE_HR_14BIT_12_5HZ  0x10
 #define LIS2DS12_DATA_RATE_HR_14BIT_25HZ0x20
 #define LIS2DS12_DATA_RATE_HR_14BIT_50HZ0x30
diff --git a/hw/drivers/sensors/lis2ds12/src/lis2ds12.c 
b/hw/drivers/sensors/lis2ds12/src/lis2ds12.c
index af07684..c966105 100644
--- a/hw/drivers/sensors/lis2ds12/src/lis2ds12.c
+++ b/hw/drivers/sensors/lis2ds12/src/lis2ds12.c
@@ -520,7 +520,7 @@ lis2ds12_set_full_scale(struct sensor_itf *itf, uint8_t fs)
 int rc;
 uint8_t reg;
 
-if (fs > LIS2DS12_FS_16G) {
+if (0 != (fs & ~LIS2DS12_CTRL_REG1_FS)) {
 LIS2DS12_LOG_ERROR("Invalid full scale value\n");
 rc = SYS_EINVAL;
 goto err;
@@ -585,7 +585,7 @@ lis2ds12_set_rate(struct sensor_itf *itf, uint8_t rate)
 uint8_t reg;
 
 // TODO probably not the best check for me
-if (rate > LIS2DS12_DATA_RATE_LP_10BIT_400HZ) {
+if (0 != (rate & ~(LIS2DS12_CTRL_REG1_ODR | LIS2DS12_CTRL_REG1_HF_ODR))) {
 LIS2DS12_LOG_ERROR("Invalid rate value\n");
 rc = SYS_EINVAL;
 goto err;



[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2230: da1469x/hal_flash: Add missing include

2020-03-05 Thread GitBox
apache-mynewt-bot commented on issue #2230: da1469x/hal_flash: Add missing 
include
URL: https://github.com/apache/mynewt-core/pull/2230#issuecomment-595510326
 
 
   
   
   
   ## Style check summary
   
    No suggestions at this time!
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] vrahane opened a new pull request #2230: da1469x/hal_flash: Add missing include

2020-03-05 Thread GitBox
vrahane opened a new pull request #2230: da1469x/hal_flash: Add missing include
URL: https://github.com/apache/mynewt-core/pull/2230
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated: da1469x/hal_flash: Fix write boundaries (#2229)

2020-03-05 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 d879a6d  da1469x/hal_flash: Fix write boundaries (#2229)
d879a6d is described below

commit d879a6d7fbfe5ebb5a0eb12ca03bbc38d5c9d347
Author: Vipul Rahane 
AuthorDate: Thu Mar 5 15:57:55 2020 -0800

da1469x/hal_flash: Fix write boundaries (#2229)

- Write boundaries in the hal flash write callback were partially
  correct, 0->0x8 address remap also needs to be considered
---
 hw/mcu/dialog/da14699/include/mcu/mcu.h |  1 +
 hw/mcu/dialog/da1469x/src/hal_flash.c   | 22 ++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/hw/mcu/dialog/da14699/include/mcu/mcu.h 
b/hw/mcu/dialog/da14699/include/mcu/mcu.h
index a99eaa2..1e67367 100644
--- a/hw/mcu/dialog/da14699/include/mcu/mcu.h
+++ b/hw/mcu/dialog/da14699/include/mcu/mcu.h
@@ -145,6 +145,7 @@ void mcu_gpio_set_pin_function(int pin, int mode, 
mcu_gpio_func func);
 void mcu_gpio_enter_sleep(void);
 void mcu_gpio_exit_sleep(void);
 
+#define MCU_MEM_QSPIF_M_END_REMAP_ADDRESS (0x80)
 #define MCU_MEM_QSPIF_M_START_ADDRESS   (0x1600)
 #define MCU_MEM_QSPIF_M_END_ADDRESS (0x1800)
 #define MCU_MEM_SYSRAM_START_ADDRESS(0x2000)
diff --git a/hw/mcu/dialog/da1469x/src/hal_flash.c 
b/hw/mcu/dialog/da1469x/src/hal_flash.c
index 65df0c0..a4cf444 100644
--- a/hw/mcu/dialog/da1469x/src/hal_flash.c
+++ b/hw/mcu/dialog/da1469x/src/hal_flash.c
@@ -323,6 +323,22 @@ da1469x_hff_read(const struct hal_flash *dev, uint32_t 
address, void *dst,
 return 0;
 }
 
+static bool
+da1469x_hff_in_flash_addr_space(const void *src)
+{
+/*
+ * Due to the remap specified in the datasheet, 0->0x8 (8 MBytes) are
+ * remapped, hence that needs to be considered as well.
+ */
+if uint32_t)src < MCU_MEM_QSPIF_M_START_ADDRESS)   &&
+ ((uint32_t)src >= MCU_MEM_QSPIF_M_END_REMAP_ADDRESS)) ||
+ ((uint32_t)src >= MCU_MEM_QSPIF_M_END_ADDRESS)) {
+return false;
+}
+
+return true;
+}
+
 static int
 da1469x_hff_write(const struct hal_flash *dev, uint32_t address,
   const void *src, uint32_t num_bytes)
@@ -330,12 +346,10 @@ da1469x_hff_write(const struct hal_flash *dev, uint32_t 
address,
 uint8_t buf[ MYNEWT_VAL(QSPI_FLASH_READ_BUFFER_SIZE) ];
 uint32_t chunk_len;
 
-/*
- * We can write directly if 'src' is outside flash memory, otherwise we
+/* We can write directly if 'src' is outside flash memory, otherwise we
  * need to read data to RAM first and then write to flash.
  */
-if (((uint32_t)src < MCU_MEM_QSPIF_M_START_ADDRESS) ||
-((uint32_t)src >= MCU_MEM_QSPIF_M_END_ADDRESS)) {
+if (da1469x_hff_in_flash_addr_space(src) == false) {
 return da1469x_qspi_write(dev, address, src, num_bytes);
 }
 



[GitHub] [mynewt-core] vrahane merged pull request #2229: da1469x/hal_flash: Fix write boundaries

2020-03-05 Thread GitBox
vrahane merged pull request #2229: da1469x/hal_flash: Fix write boundaries
URL: https://github.com/apache/mynewt-core/pull/2229
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2229: da1469x/hal_flash: Fix write boundaries

2020-03-05 Thread GitBox
apache-mynewt-bot commented on issue #2229: da1469x/hal_flash: Fix write 
boundaries
URL: https://github.com/apache/mynewt-core/pull/2229#issuecomment-595502539
 
 
   
   
   
   ## Style check summary
   
   ### Our coding style is 
[here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
    hw/mcu/dialog/da1469x/src/hal_flash.c
   
   
   ```diff
   @@ -330,9 +330,9 @@
 * Due to the remap specified in the datasheet, 0->0x8 (8 MBytes) 
are
 * remapped, hence that needs to be considered as well.
 */
   -if uint32_t)src < MCU_MEM_QSPIF_M_START_ADDRESS)   &&
   +if uint32_t)src < MCU_MEM_QSPIF_M_START_ADDRESS) &&
 ((uint32_t)src >= MCU_MEM_QSPIF_M_END_REMAP_ADDRESS)) ||
   - ((uint32_t)src >= MCU_MEM_QSPIF_M_END_ADDRESS)) {
   +((uint32_t)src >= MCU_MEM_QSPIF_M_END_ADDRESS)) {
return false;
}

   ```
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch hal_flash_fix created (now 9058fde)

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

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


  at 9058fde  da1469x/hal_flash: Fix write boundaries

This branch includes the following new commits:

 new 9058fde  da1469x/hal_flash: Fix write boundaries

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: da1469x/hal_flash: Fix write boundaries

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

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

commit 9058fdeab7e4283bc586fa725bb0e825154b192d
Author: Vipul Rahane 
AuthorDate: Thu Mar 5 15:11:46 2020 -0800

da1469x/hal_flash: Fix write boundaries

- Write boundaries in the hal flash write callback were partially
  correct, 0->0x8 address remap also needs to be considered
---
 hw/mcu/dialog/da14699/include/mcu/mcu.h |  1 +
 hw/mcu/dialog/da1469x/src/hal_flash.c   | 22 ++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/hw/mcu/dialog/da14699/include/mcu/mcu.h 
b/hw/mcu/dialog/da14699/include/mcu/mcu.h
index a99eaa2..1e67367 100644
--- a/hw/mcu/dialog/da14699/include/mcu/mcu.h
+++ b/hw/mcu/dialog/da14699/include/mcu/mcu.h
@@ -145,6 +145,7 @@ void mcu_gpio_set_pin_function(int pin, int mode, 
mcu_gpio_func func);
 void mcu_gpio_enter_sleep(void);
 void mcu_gpio_exit_sleep(void);
 
+#define MCU_MEM_QSPIF_M_END_REMAP_ADDRESS (0x80)
 #define MCU_MEM_QSPIF_M_START_ADDRESS   (0x1600)
 #define MCU_MEM_QSPIF_M_END_ADDRESS (0x1800)
 #define MCU_MEM_SYSRAM_START_ADDRESS(0x2000)
diff --git a/hw/mcu/dialog/da1469x/src/hal_flash.c 
b/hw/mcu/dialog/da1469x/src/hal_flash.c
index 65df0c0..9b21dc6 100644
--- a/hw/mcu/dialog/da1469x/src/hal_flash.c
+++ b/hw/mcu/dialog/da1469x/src/hal_flash.c
@@ -323,6 +323,22 @@ da1469x_hff_read(const struct hal_flash *dev, uint32_t 
address, void *dst,
 return 0;
 }
 
+static bool
+da1469x_hff_in_flash_addr_space(const void *src)
+{
+/*
+ * Due to the remap specified in the datasheet, 0->0x8 (8 MBytes) are
+ * remapped, hence that needs to be considered as well.
+ */
+if uint32_t)src < MCU_MEM_QSPIF_M_START_ADDRESS) &&
+ ((uint32_t)src >= 0x80))||
+ ((uint32_t)src >= MCU_MEM_QSPIF_M_END_ADDRESS)) {
+return false;
+}
+
+return true;
+}
+
 static int
 da1469x_hff_write(const struct hal_flash *dev, uint32_t address,
   const void *src, uint32_t num_bytes)
@@ -330,12 +346,10 @@ da1469x_hff_write(const struct hal_flash *dev, uint32_t 
address,
 uint8_t buf[ MYNEWT_VAL(QSPI_FLASH_READ_BUFFER_SIZE) ];
 uint32_t chunk_len;
 
-/*
- * We can write directly if 'src' is outside flash memory, otherwise we
+/* We can write directly if 'src' is outside flash memory, otherwise we
  * need to read data to RAM first and then write to flash.
  */
-if (((uint32_t)src < MCU_MEM_QSPIF_M_START_ADDRESS) ||
-((uint32_t)src >= MCU_MEM_QSPIF_M_END_ADDRESS)) {
+if (da1469x_hff_in_flash_addr_space(src) == false) {
 return da1469x_qspi_write(dev, address, src, num_bytes);
 }
 



[GitHub] [mynewt-core] vrahane opened a new pull request #2229: da1469x/hal_flash: Fix write boundaries

2020-03-05 Thread GitBox
vrahane opened a new pull request #2229: da1469x/hal_flash: Fix write boundaries
URL: https://github.com/apache/mynewt-core/pull/2229
 
 
   - Write boundaries in the hal flash write callback were partially
 correct, 0->0x8 address remap also needs to be considered as per the 
datasheet.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-newt] 01/02: Remove mcuboot submodule hack

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

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

commit 403de363933b868c7d959567720cb0b0fd6441b2
Author: Fabio Utzig 
AuthorDate: Thu Mar 5 08:49:07 2020 -0300

Remove mcuboot submodule hack

After the conditional submodule feature added with
905c71ce407f94da1f6812dd6b24cda885336548, the mcuboot repo was updated
to inform that Mynewt does not required cloning of submodules; the hack
is not required anymore.

Signed-off-by: Fabio Utzig 
---
 newt/downloader/downloader.go | 68 ++-
 1 file changed, 2 insertions(+), 66 deletions(-)

diff --git a/newt/downloader/downloader.go b/newt/downloader/downloader.go
index 43f1f02..474309d 100644
--- a/newt/downloader/downloader.go
+++ b/newt/downloader/downloader.go
@@ -372,58 +372,6 @@ func untrackedFilesFromCheckoutErr(err error) []string {
return files
 }
 
-// applyMcubootPreHack attempts to clean up the mcuboot repo so that the
-// subsequent checkout operation will succeed.  This hack is required because a
-// directory in the mcuboot repo was replaced with a submodule.  Git is unable
-// to transition from a post-replace commit to a pre-replace commit because
-// some files in the submodule used to exist in the mcuboot repo itself.  If
-// this issue is detected, this function deletes the submodule directory so
-// that the checkout operation can be attempted again.
-func applyMcubootPreHack(repoDir string, err error) error {
-   if !strings.HasSuffix(repoDir, "repos/mcuboot") {
-   // Not the mcuboot repo.
-   return err
-   }
-
-   // Check for an "untracked files" error.
-   files := untrackedFilesFromCheckoutErr(err)
-   if len(files) == 0 {
-   // Not a hackable error.
-   return err
-   }
-
-   for _, file := range files {
-   if !strings.HasPrefix(file, "ext/mbedtls") {
-   return err
-   }
-   }
-
-   path := repoDir + "/ext/mbedtls"
-   log.Debugf("applying mcuboot hack: removing %s", path)
-   os.RemoveAll(path)
-   return nil
-}
-
-// applyMcubootPostHack attempts to clean up the mcuboot repo so that the
-// subsequent checkout operation will succeed.  This hack is required because a
-// directory in the mcuboot repo was replaced with a submodule.  This hack
-// should be applied after a successful checkout from a pre-replace commit to a
-// post-replace commit.  This function deletes an orphan directory left behind
-// by the checkout operation.
-func applyMcubootPostHack(repoDir string, output string) {
-   if !strings.HasSuffix(repoDir, "repos/mcuboot") {
-   // Not the mcuboot repo.
-   return
-   }
-
-   // Check for a "unable to rmdir" warning (pre- to post- submodule move).
-   if strings.Contains(output, "unable to rmdir 
'sim/mcuboot-sys/mbedtls'") {
-   path := repoDir + "/sim/mcuboot-sys/mbedtls"
-   log.Debugf("applying mcuboot hack: removing %s", path)
-   os.RemoveAll(path)
-   }
-}
-
 func (gd *GenericDownloader) Checkout(repoDir string, commit string) error {
// Get the hash corresponding to the commit in case the caller 
specified a
// branch or tag.  We always want to check out a hash and end up in a
@@ -439,20 +387,8 @@ func (gd *GenericDownloader) Checkout(repoDir string, 
commit string) error {
hash,
}
 
-   o, err := executeGitCommand(repoDir, cmd, true)
-   if err != nil {
-   if err := applyMcubootPreHack(repoDir, err); err != nil {
-   return err
-   }
-
-   if _, err := executeGitCommand(repoDir, cmd, true); err != nil {
-   return err
-   }
-   } else {
-   applyMcubootPostHack(repoDir, string(o))
-   }
-
-   return nil
+   _, err = executeGitCommand(repoDir, cmd, true)
+   return err
 }
 
 // Update one submodule tree in a repo (under path)



[mynewt-newt] 02/02: Fix skipping the copy of empty dirs on tree copies

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

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

commit 34d7d90344552a47d81d62cc2a354c3752263caa
Author: Fabio Utzig 
AuthorDate: Thu Mar 5 08:53:18 2020 -0300

Fix skipping the copy of empty dirs on tree copies

The CopyDir implementation did not copy empty directories which was
resulting in a dirty repo after the tree copy with non-cloned submodules
(empty dirs) was performed.

The issue resulted from calling `MkdirAll` with the parent directory of
the current directory under copy, followed by a `ReadDir` which would
result in an empty list of files/dirs, skipping the directory creation
(by skipping the recursive tree copy).

Signed-off-by: Fabio Utzig 
---
 util/util.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/util.go b/util/util.go
index ac92c28..91e8aed 100644
--- a/util/util.go
+++ b/util/util.go
@@ -525,7 +525,7 @@ func CopyDir(srcDirStr, dstDirStr string) error {
return ChildNewtError(err)
}
 
-   if err := os.MkdirAll(filepath.Dir(dstDirStr), info.Mode()); err != nil 
{
+   if err := os.MkdirAll(dstDirStr, info.Mode()); err != nil {
return ChildNewtError(err)
}
 



[mynewt-newt] branch master updated (db229b2 -> 34d7d90)

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

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


from db229b2  Remove "final-atom" target specifier type
 new 403de36  Remove mcuboot submodule hack
 new 34d7d90  Fix skipping the copy of empty dirs on tree copies

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


Summary of changes:
 newt/downloader/downloader.go | 68 ++-
 util/util.go  |  2 +-
 2 files changed, 3 insertions(+), 67 deletions(-)



[GitHub] [mynewt-newt] utzig merged pull request #382: Fix skipping the copy of empty dirs on tree copies

2020-03-05 Thread GitBox
utzig merged pull request #382: Fix skipping the copy of empty dirs on tree 
copies
URL: https://github.com/apache/mynewt-newt/pull/382
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated: add ifdefs to avoid calling watchdog if WATCHDOG_INTERVAL is 0

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

jerzy 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 6998514  add ifdefs to avoid calling watchdog if WATCHDOG_INTERVAL is 0
6998514 is described below

commit 69985141404347d8bce6f3cb47569823b574cd35
Author: Brian Wyld 
AuthorDate: Tue Mar 3 14:07:46 2020 +0100

add ifdefs to avoid calling watchdog if WATCHDOG_INTERVAL is 0
---
 kernel/os/src/os.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/os/src/os.c b/kernel/os/src/os.c
index 6e9e58e..bc88ef9 100644
--- a/kernel/os/src/os.c
+++ b/kernel/os/src/os.c
@@ -69,10 +69,11 @@ OS_TASK_STACK_DEFINE(g_os_main_stack, OS_MAIN_STACK_SIZE);
 static struct hal_timer os_wdog_monitor;
 #endif
 
+#if MYNEWT_VAL(WATCHDOG_INTERVAL) > 0
 #if MYNEWT_VAL(WATCHDOG_INTERVAL) - 200 < MYNEWT_VAL(SANITY_INTERVAL)
 #error "Watchdog interval - 200 < sanity interval"
 #endif
-
+#endif
 
 /* Default zero.  Set by the architecture specific code when os is started.
  */
@@ -270,8 +271,10 @@ os_start(void)
 #if MYNEWT_VAL(OS_SCHEDULING)
 os_error_t err;
 
+#if MYNEWT_VAL(WATCHDOG_INTERVAL) > 0
 /* Enable the watchdog prior to starting the OS */
 hal_watchdog_enable();
+#endif
 
 err = os_arch_os_start();
 assert(err == OS_OK);
@@ -289,11 +292,13 @@ os_reboot(int reason)
 void
 os_system_reset(void)
 {
+#if MYNEWT_VAL(WATCHDOG_INTERVAL) > 0
 /* Tickle watchdog just before re-entering bootloader.  Depending on what
  * the system has been doing lately, the watchdog timer might be close to
  * firing.
  */
 hal_watchdog_tickle();
+#endif
 hal_system_reset();
 }
 



[GitHub] [mynewt-core] kasjer merged pull request #2222: add ifdefs to avoid calling watchdog if WATCHDOG_INTERVAL is 0

2020-03-05 Thread GitBox
kasjer merged pull request #: add ifdefs to avoid calling watchdog if 
WATCHDOG_INTERVAL is 0
URL: https://github.com/apache/mynewt-core/pull/
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2227: fix incorrect check in lis2ds12_set_full_scale

2020-03-05 Thread GitBox
apache-mynewt-bot removed a comment on issue #2227: fix incorrect check in 
lis2ds12_set_full_scale
URL: https://github.com/apache/mynewt-core/pull/2227#issuecomment-595364965
 
 
   
   
   
   ## Style check summary
   
    No suggestions at this time!
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2227: fix incorrect check in lis2ds12_set_full_scale

2020-03-05 Thread GitBox
apache-mynewt-bot commented on issue #2227: fix incorrect check in 
lis2ds12_set_full_scale
URL: https://github.com/apache/mynewt-core/pull/2227#issuecomment-595390925
 
 
   
   
   
   ## Style check summary
   
   ### Our coding style is 
[here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
    hw/drivers/sensors/lis2ds12/src/lis2ds12.c
   
   
   ```diff
   @@ -584,7 +584,7 @@
int rc;
uint8_t reg;

   -// TODO probably not the best check for me
   +/* TODO probably not the best check for me */
if (0 != (rate & ~(LIS2DS12_CTRL_REG1_ODR | 
LIS2DS12_CTRL_REG1_HF_ODR))) {
LIS2DS12_LOG_ERROR("Invalid rate value\n");
rc = SYS_EINVAL;
   ```
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-imgmod] branch master updated: Don't print warning if `-q` specified

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

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


The following commit(s) were added to refs/heads/master by this push:
 new 973568a  Don't print warning if `-q` specified
973568a is described below

commit 973568a80eacc8e36220a22b892bedceea1317ed
Author: Christopher Collins 
AuthorDate: Thu Mar 5 09:26:48 2020 -0800

Don't print warning if `-q` specified
---
 cli/image_cmds.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/cli/image_cmds.go b/cli/image_cmds.go
index 13f2564..12262b0 100644
--- a/cli/image_cmds.go
+++ b/cli/image_cmds.go
@@ -313,8 +313,7 @@ func runHashableCmd(cmd *cobra.Command, args []string) {
}
 
if (img.Header.Flags & image.IMAGE_F_ENCRYPTED) != 0 {
-   fmt.Fprintf(os.Stderr,
-   "* Warning: extracting hashable content from an 
encrypted image\n")
+   iutil.Printf("warning: extracting hashable content from an 
encrypted image\n")
}
 
f, err := os.Create(outFilename)



[GitHub] [mynewt-imgmod] ccollins476ad merged pull request #12: Don't print warning if `-q` specified

2020-03-05 Thread GitBox
ccollins476ad merged pull request #12: Don't print warning if `-q` specified
URL: https://github.com/apache/mynewt-imgmod/pull/12
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2227: fix incorrect check in lis2ds12_set_full_scale

2020-03-05 Thread GitBox
apache-mynewt-bot commented on issue #2227: fix incorrect check in 
lis2ds12_set_full_scale
URL: https://github.com/apache/mynewt-core/pull/2227#issuecomment-595364965
 
 
   
   
   
   ## Style check summary
   
    No suggestions at this time!
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2227: fix incorrect check in lis2ds12_set_full_scale

2020-03-05 Thread GitBox
apache-mynewt-bot removed a comment on issue #2227: fix incorrect check in 
lis2ds12_set_full_scale
URL: https://github.com/apache/mynewt-core/pull/2227#issuecomment-594665191
 
 
   
   
   
   ## Style check summary
   
    No suggestions at this time!
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2224: add functionality to allow low power operation for STM32L1xx

2020-03-05 Thread GitBox
apache-mynewt-bot commented on issue #2224: add functionality to allow low 
power operation for STM32L1xx
URL: https://github.com/apache/mynewt-core/pull/2224#issuecomment-595362454
 
 
   
   
   
   ## Style check summary
   
   ### Our coding style is 
[here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
    hw/mcu/stm/stm32l1xx/src/hal_power_mgnt.c
   
   
   ```diff
   @@ -35,8 +35,8 @@
void stm32_tickless_start(uint32_t timeMS);

/* Put MCU  in lowest power stop state, exit only via POR or reset pin */
   -void 
   -hal_mcu_halt() 
   +void
   +hal_mcu_halt()
{

/* all interupts and exceptions off */
   @@ -49,7 +49,7 @@

while (1) {

   -/*Disables the Power Voltage Detector(PVD) */
   +/*Disables the Power Voltage Detector(PVD) */
HAL_PWR_DisablePVD( );
/* Enable Ultra low power mode */
HAL_PWREx_EnableUltraLowPower( );
   @@ -61,13 +61,13 @@
}
}

   -void 
   +void
stm32_tick_init(uint32_t os_ticks_per_sec, int prio)
{
/* Even for tickless we use SYSTICK for normal tick.*/
/* nb of ticks per seconds is hardcoded in HAL_InitTick(..) to have 
1ms/tick */
assert(os_ticks_per_sec == OS_TICKS_PER_SEC);
   -
   +
volatile uint32_t reload_val;

/*Reload Value = SysTick Counter Clock (Hz) x  Desired Time base (s) */
   @@ -77,8 +77,8 @@
SysTick->VAL = 0;

/* CLKSOURCE : 1 -> HCLK, 0-> AHB Clock (which is HCLK/8). Use HCLK, as 
this is the value of SystemCoreClock as used above */
   -SysTick->CTRL = (SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk 
| SysTick_CTRL_ENABLE_Msk);  
   -
   +SysTick->CTRL = (SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk 
| SysTick_CTRL_ENABLE_Msk);
   +
/* Set the system tick priority */
NVIC_SetPriority(SysTick_IRQn, prio);

   @@ -102,7 +102,7 @@

}

   -void 
   +void
stm32_tickless_start(uint32_t timeMS)
{

   @@ -116,10 +116,10 @@
CLEAR_BIT(SysTick->CTRL,SysTick_CTRL_TICKINT_Msk);
}

   -void 
   +void
stm32_tickless_stop(uint32_t timeMS)
{
   -
   +
/* add asleep duration to tick counter : how long we should have slept 
for minus any remaining time */
volatile uint32_t asleep_ms = hal_rtc_get_elapsed_wakeup_timer();
volatile int asleep_ticks = os_time_ms_to_ticks32(asleep_ms);
   @@ -133,10 +133,10 @@
NVIC_EnableIRQ(SysTick_IRQn);
/* reenable SysTick */
SET_BIT(SysTick->CTRL,SysTick_CTRL_TICKINT_Msk);
   -
   -}
   -
   -void 
   +
   +}
   +
   +void
stm32_power_enter(int power_mode, uint32_t durationMS)
{
/* if sleep time was less than MIN_TICKS, it is 0. Just do usual WFI 
and systick will wake us in 1ms */
   @@ -147,7 +147,7 @@

if (durationMS >= 32000) {
/* 32 sec is the largest value of wakeuptimer   leave 100ms slack */
   -durationMS = (32000 - 100); 
   +durationMS = (32000 - 100);
}

/* begin tickless */
   @@ -158,7 +158,7 @@
switch (power_mode) {
case HAL_BSP_POWER_OFF:
case HAL_BSP_POWER_DEEP_SLEEP: {
   -/*Disables the Power Voltage Detector(PVD) */
   +/*Disables the Power Voltage Detector(PVD) */
HAL_PWR_DisablePVD( );
/* Enable Ultra low power mode */
HAL_PWREx_EnableUltraLowPower( );
   @@ -172,7 +172,7 @@
}
case HAL_BSP_POWER_SLEEP: {

   -/*Disables the Power Voltage Detector(PVD) */
   +/*Disables the Power Voltage Detector(PVD) */
HAL_PWR_DisablePVD( );
/* Enable Ultra low power mode */
HAL_PWREx_EnableUltraLowPower( );
   @@ -187,16 +187,16 @@
case HAL_BSP_POWER_WFI: {
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);

   -//SystemClock_RestartPLL();
   +/*SystemClock_RestartPLL(); */
break;
}
case HAL_BSP_POWER_ON:
default: {
   -
   -break;
   -}
   -}
   -
   +
   +break;
   +}
   +}
   +
#if MYNEWT_VAL(OS_TICKLESS_RTC)
/* exit tickless low power mode */
stm32_tickless_stop(durationMS);
   ```
   
   
   
    hw/mcu/stm/stm32l1xx/src/rtc_utils.c
   
   
   ```diff
   @@ -1,13 +1,13 @@
/**
 * Copyright 2019 Wyres
   - * Licensed under the Apache License, Version 2.0 (the "License"); 
   - * you may not use this file except in compliance with the License. 
   + * 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 

[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2224: add functionality to allow low power operation for STM32L1xx

2020-03-05 Thread GitBox
apache-mynewt-bot removed a comment on issue #2224: add functionality to allow 
low power operation for STM32L1xx
URL: https://github.com/apache/mynewt-core/pull/2224#issuecomment-594624924
 
 
   
   
   
   ## Style check summary
   
   ### Our coding style is 
[here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
    hw/mcu/stm/stm32l1xx/src/hal_power_mgnt.c
   
   
   ```diff
   @@ -35,8 +35,8 @@
void stm32_tickless_start(uint32_t timeMS);

/* Put MCU  in lowest power stop state, exit only via POR or reset pin */
   -void 
   -hal_mcu_halt() 
   +void
   +hal_mcu_halt()
{

/* all interupts and exceptions off */
   @@ -49,7 +49,7 @@

while (1) {

   -/*Disables the Power Voltage Detector(PVD) */
   +/*Disables the Power Voltage Detector(PVD) */
HAL_PWR_DisablePVD( );
/* Enable Ultra low power mode */
HAL_PWREx_EnableUltraLowPower( );
   @@ -61,13 +61,13 @@
}
}

   -void 
   -stm32_tick_init(uint32_t os_ticks_per_sec, int prio) 
   +void
   +stm32_tick_init(uint32_t os_ticks_per_sec, int prio)
{
/* Even for tickless we use SYSTICK for normal tick.*/
/* nb of ticks per seconds is hardcoded in HAL_InitTick(..) to have 
1ms/tick */
assert(os_ticks_per_sec == OS_TICKS_PER_SEC);
   -
   +
volatile uint32_t reload_val;

/*Reload Value = SysTick Counter Clock (Hz) x  Desired Time base (s) */
   @@ -77,8 +77,8 @@
SysTick->VAL = 0;

/* CLKSOURCE : 1 -> HCLK, 0-> AHB Clock (which is HCLK/8). Use HCLK, as 
this is the value of SystemCoreClock as used above */
   -SysTick->CTRL = (SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk 
| SysTick_CTRL_ENABLE_Msk);  
   -
   +SysTick->CTRL = (SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk 
| SysTick_CTRL_ENABLE_Msk);
   +
/* Set the system tick priority */
NVIC_SetPriority(SysTick_IRQn, prio);

   @@ -102,12 +102,12 @@

}

   -void 
   -stm32_tickless_start(uint32_t timeMS) 
   +void
   +stm32_tickless_start(uint32_t timeMS)
{

/* Start RTC alarm for in this amount of time */
   -if(timeMS > 0) {
   +if (timeMS > 0) {
hal_rtc_enable_wakeup(timeMS);
}
/* Stop SYSTICK */
   @@ -116,10 +116,10 @@
CLEAR_BIT(SysTick->CTRL,SysTick_CTRL_TICKINT_Msk);
}

   -void 
   -stm32_tickless_stop(uint32_t timeMS) 
   -{
   -
   +void
   +stm32_tickless_stop(uint32_t timeMS)
   +{
   +
/* add asleep duration to tick counter : how long we should have slept 
for minus any remaining time */
volatile uint32_t asleep_ms = hal_rtc_get_elapsed_wakeup_timer();
volatile int asleep_ticks = os_time_ms_to_ticks32(asleep_ms);
   @@ -133,10 +133,10 @@
NVIC_EnableIRQ(SysTick_IRQn);
/* reenable SysTick */
SET_BIT(SysTick->CTRL,SysTick_CTRL_TICKINT_Msk);
   -
   -}
   -
   -void 
   +
   +}
   +
   +void
stm32_power_enter(int power_mode, uint32_t durationMS)
{
/* if sleep time was less than MIN_TICKS, it is 0. Just do usual WFI 
and systick will wake us in 1ms */
   @@ -147,7 +147,7 @@

if (durationMS >= 32000) {
/* 32 sec is the largest value of wakeuptimer   leave 100ms slack */
   -durationMS = (32000 - 100); 
   +durationMS = (32000 - 100);
}

/* begin tickless */
   @@ -158,7 +158,7 @@
switch (power_mode) {
case HAL_BSP_POWER_OFF:
case HAL_BSP_POWER_DEEP_SLEEP: {
   -/*Disables the Power Voltage Detector(PVD) */
   +/*Disables the Power Voltage Detector(PVD) */
HAL_PWR_DisablePVD( );
/* Enable Ultra low power mode */
HAL_PWREx_EnableUltraLowPower( );
   @@ -172,7 +172,7 @@
}
case HAL_BSP_POWER_SLEEP: {

   -/*Disables the Power Voltage Detector(PVD) */
   +/*Disables the Power Voltage Detector(PVD) */
HAL_PWR_DisablePVD( );
/* Enable Ultra low power mode */
HAL_PWREx_EnableUltraLowPower( );
   @@ -187,16 +187,16 @@
case HAL_BSP_POWER_WFI: {
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);

   -SystemClock_RestartPLL();
   +SystemClock_RestartPLL();
break;
}
case HAL_BSP_POWER_ON:
default: {
   -
   -break;
   -}
   -}
   -
   +
   +break;
   +}
   +}
   +
#if MYNEWT_VAL(OS_TICKLESS_RTC)
/* exit tickless low power mode */
stm32_tickless_stop(durationMS);
   ```
   
   
   
    hw/mcu/stm/stm32l1xx/src/rtc_utils.c
   
   
   ```diff
   @@ -1,13 +1,13 @@
/**
 * Copyright 2019 Wyres
   - * Licensed under the Apache License, Version 2.0 (the "License"); 
   - * you 

[GitHub] [mynewt-imgmod] ccollins476ad opened a new pull request #12: Don't print warning if `-q` specified

2020-03-05 Thread GitBox
ccollins476ad opened a new pull request #12: Don't print warning if `-q` 
specified
URL: https://github.com/apache/mynewt-imgmod/pull/12
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] gonccalo edited a comment on issue #2227: fix incorrect check in lis2ds12_set_full_scale

2020-03-05 Thread GitBox
gonccalo edited a comment on issue #2227: fix incorrect check in 
lis2ds12_set_full_scale
URL: https://github.com/apache/mynewt-core/pull/2227#issuecomment-595345794
 
 
   I also found some problems in the `lis2ds12_set_rate` function.
   The `LIS2DS12_DATA_RATE_LP_10BIT_800HZ` is defined as 0x70 when it should be 
0xF0 according to the documentation. The condition check for the rate argument 
is also not the best one (and is incorrect right now).
   ![Screenshot from 2020-03-05 
17-14-04](https://user-images.githubusercontent.com/5223817/76006785-e71a7480-5f04-11ea-90ae-c031f14f9ef0.png)
   
   Should I open a new pull request or can I make these changes here?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] gonccalo commented on issue #2227: fix incorrect check in lis2ds12_set_full_scale

2020-03-05 Thread GitBox
gonccalo commented on issue #2227: fix incorrect check in 
lis2ds12_set_full_scale
URL: https://github.com/apache/mynewt-core/pull/2227#issuecomment-595345794
 
 
   I also found some problems in the `lis2ds12_set_rate` function.
   The `LIS2DS12_DATA_RATE_LP_10BIT_800HZ` is defined as 0x70 when it should be 
0xF0 according to the documentation. The condition check for the rate argument 
is also not the best one (and is incorrect right now).
   ![Screenshot from 2020-03-05 
17-14-04](https://user-images.githubusercontent.com/5223817/76006785-e71a7480-5f04-11ea-90ae-c031f14f9ef0.png)


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-mcumgr] sjanc merged pull request #67: Add rat-excludes and missing licence headers

2020-03-05 Thread GitBox
sjanc merged pull request #67: Add rat-excludes and missing licence headers
URL: https://github.com/apache/mynewt-mcumgr/pull/67
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-mcumgr] branch master updated: Add rat-excludes and missing licence headers

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

janc 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 96d221f  Add rat-excludes and missing licence headers
96d221f is described below

commit 96d221f0b29a81a9762ef3b5ee07c6449a8df3d3
Author: Szymon Janc 
AuthorDate: Wed Mar 4 13:15:14 2020 +0100

Add rat-excludes and missing licence headers
---
 .rat-excludes | 14 ++
 CMakeLists.txt| 17 +
 cborattr/CMakeLists.txt   | 17 +
 cmd/CMakeLists.txt| 17 +
 cmd/fs_mgmt/CMakeLists.txt| 17 +
 cmd/img_mgmt/CMakeLists.txt   | 17 +
 cmd/log_mgmt/CMakeLists.txt   | 17 +
 cmd/os_mgmt/CMakeLists.txt| 17 +
 cmd/stat_mgmt/CMakeLists.txt  | 17 +
 mgmt/CMakeLists.txt   | 17 +
 samples/smp_svr/zephyr/CMakeLists.txt | 17 +
 samples/smp_svr/zephyr/src/main.c | 17 +++--
 smp/CMakeLists.txt| 17 +
 util/CMakeLists.txt   | 17 +
 util/src/mcumgr_util.c| 19 +++
 zephyr/module.yml | 18 ++
 16 files changed, 270 insertions(+), 2 deletions(-)

diff --git a/.rat-excludes b/.rat-excludes
new file mode 100644
index 000..21533c3
--- /dev/null
+++ b/.rat-excludes
@@ -0,0 +1,14 @@
+# Can't easily add license to rat-excludes file.
+.rat-excludes
+
+# Non-source files
+README-mynewt.md
+README-zephyr.md
+README.md
+README.rst
+protocol.md
+smp-bluetooth.md
+smp-console.md
+prj.conf
+prj_tiny.conf
+sample.yaml
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 76cc084..f22638e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,20 @@
+# 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.
+
 if(CONFIG_MCUMGR)
 zephyr_interface_library_named(MCUMGR)
 
diff --git a/cborattr/CMakeLists.txt b/cborattr/CMakeLists.txt
index bcaf40f..7d1a6b6 100644
--- a/cborattr/CMakeLists.txt
+++ b/cborattr/CMakeLists.txt
@@ -1,3 +1,20 @@
+# 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.
+
 target_include_directories(MCUMGR INTERFACE
 include
 )
diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt
index a9d5968..ef71865 100644
--- a/cmd/CMakeLists.txt
+++ b/cmd/CMakeLists.txt
@@ -1,3 +1,20 @@
+# 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.
+
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_FS_MGMT   fs_mgmt)
 

[GitHub] [mynewt-nimble] sjanc commented on a change in pull request #765: nimble/host: Fix check for valid static random address

2020-03-05 Thread GitBox
sjanc commented on a change in pull request #765: nimble/host: Fix check for 
valid static random address
URL: https://github.com/apache/mynewt-nimble/pull/765#discussion_r388152582
 
 

 ##
 File path: nimble/host/src/ble_hs_id.c
 ##
 @@ -58,14 +58,20 @@ ble_hs_id_set_rnd(const uint8_t *rnd_addr)
 {
 uint8_t addr_type_byte;
 int rc;
-uint8_t all_zeros[BLE_DEV_ADDR_LEN] = {0}, all_ones[BLE_DEV_ADDR_LEN] = { 
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+int i, rnd_part_sum = 0;
 
 
 Review comment:
   I'd make those checks explicit so that it obvious what is being check.
   Something like this maybe?
   
   ```
   int
   ble_hs_id_set_rnd(const uint8_t *rnd_addr)
   {
   uint8_t addr_type_byte;
   int ones;
   int rc;
   
   /* Make sure random part of rnd_addr is not all ones or zeros */
   addr_type_byte = rnd_addr[5] & 0xc0;
   
   /* count bits set to 1 in address */
   ones = __builtin_popcount(rnd_addr[0]);
   ones += __builtin_popcount(rnd_addr[1]);
   ones += __builtin_popcount(rnd_addr[2]);
   ones += __builtin_popcount(rnd_addr[3]);
   ones += __builtin_popcount(rnd_addr[4]);
   ones += __builtin_popcount(rnd_addr[5] & 0x3f);
   
   if ((addr_type_byte != 0x00 && addr_type_byte != 0xc0) ||
   (ones == 0 || ones == 46)) {
   return BLE_HS_EINVAL;
   }
   
   ble_hs_lock();
   rc = ble_hs_hci_util_set_random_addr(rnd_addr);
   if (rc == 0) {
   memcpy(ble_hs_id_rnd, rnd_addr, 6);
   }
   ble_hs_unlock();
   
   return rc;
   }
   ```
   
   
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-mcumgr] sjanc commented on a change in pull request #67: Add rat-excludes and missing licence headers

2020-03-05 Thread GitBox
sjanc commented on a change in pull request #67: Add rat-excludes and missing 
licence headers
URL: https://github.com/apache/mynewt-mcumgr/pull/67#discussion_r388280426
 
 

 ##
 File path: samples/smp_svr/zephyr/src/main.c
 ##
 @@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 
 Review comment:
   OK, I'll update PR 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-newt] utzig commented on a change in pull request #382: Fix skipping the copy of empty dirs on tree copies

2020-03-05 Thread GitBox
utzig commented on a change in pull request #382: Fix skipping the copy of 
empty dirs on tree copies
URL: https://github.com/apache/mynewt-newt/pull/382#discussion_r388278583
 
 

 ##
 File path: util/util.go
 ##
 @@ -525,7 +525,7 @@ func CopyDir(srcDirStr, dstDirStr string) error {
return ChildNewtError(err)
}
 
-   if err := os.MkdirAll(filepath.Dir(dstDirStr), info.Mode()); err != nil 
{
+   if err := os.MkdirAll(dstDirStr, info.Mode()); err != nil {
 
 Review comment:
   Or maybe this should be `filepath.Clean(dstDirStr)` ?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-mcumgr] carlescufi commented on a change in pull request #67: Add rat-excludes and missing licence headers

2020-03-05 Thread GitBox
carlescufi commented on a change in pull request #67: Add rat-excludes and 
missing licence headers
URL: https://github.com/apache/mynewt-mcumgr/pull/67#discussion_r388273165
 
 

 ##
 File path: samples/smp_svr/zephyr/src/main.c
 ##
 @@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 
 Review comment:
   The copyright is actually wrong anyway, Wind River did not contribute that 
`main.c`. So I would just get rid of everything below this line.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-newt] utzig commented on issue #382: Fix skipping the copy of empty dirs on tree copies

2020-03-05 Thread GitBox
utzig commented on issue #382: Fix skipping the copy of empty dirs on tree 
copies
URL: https://github.com/apache/mynewt-newt/pull/382#issuecomment-595198078
 
 
   @ccollins476ad This fixes the issue with dirty state in mcuboot directory 
because of submodules that were not copied. I am not so sure the `MkdirAll` 
change won't have side-effects, so another easy approach would be to just check 
that `ReadDir` returns an empty `info` and in this case create the directory. I 
will wait for your opinion!


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-newt] utzig opened a new pull request #382: Fix skipping the copy of empty dirs on tree copies

2020-03-05 Thread GitBox
utzig opened a new pull request #382: Fix skipping the copy of empty dirs on 
tree copies
URL: https://github.com/apache/mynewt-newt/pull/382
 
 
   The CopyDir implementation did not copy empty directories which was 
resulting in a dirty repo after the tree copy with non-cloned submodules (empty 
dirs) was performed.
   
   The issue resulted from calling `MkdirAll` with the parent directory of the 
current directory under copy, followed by a `ReadDir` which would result in an 
empty list of files/dirs, skipping the directory creation (by skipping the 
recursive tree copy).
   
   Also removes the mcuboot submodule hack.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-mcumgr] sjanc commented on a change in pull request #67: Add rat-excludes and missing licence headers

2020-03-05 Thread GitBox
sjanc commented on a change in pull request #67: Add rat-excludes and missing 
licence headers
URL: https://github.com/apache/mynewt-mcumgr/pull/67#discussion_r388214842
 
 

 ##
 File path: samples/smp_svr/zephyr/src/main.c
 ##
 @@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 
 Review comment:
   The licence is the same and I left original copyright. It is just that this 
was initially copied from zephyr which doesn't use explicit licence header but 
only SPDX identifier.
   
   I'm open for suggestion.  Removing SPDX and leaving only copyright notice is 
also an option. Or maybe put all under same comment /*  */ block..


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] kasjer commented on a change in pull request #2227: fix incorrect check in lis2ds12_set_full_scale

2020-03-05 Thread GitBox
kasjer commented on a change in pull request #2227: fix incorrect check in 
lis2ds12_set_full_scale
URL: https://github.com/apache/mynewt-core/pull/2227#discussion_r388205193
 
 

 ##
 File path: hw/drivers/sensors/lis2ds12/src/lis2ds12.c
 ##
 @@ -520,7 +520,7 @@ lis2ds12_set_full_scale(struct sensor_itf *itf, uint8_t fs)
 int rc;
 uint8_t reg;
 
-if (fs > LIS2DS12_FS_16G) {
+if (fs > LIS2DS12_FS_8G) {
 
 Review comment:
   Code was wrong, thanks @gonccalo, because it rejected correct value.
   This check implies that value could be wrong, but it could be wrong in more 
ways that this condition checks.
   So condition that validates correctness of full scale argument should rather 
be:
   if (0 != (fs & ~LIS2DS12_CTRL_REG1_FS))
   
   Condition fs > LIS2DS12_FS_8G on the first look suggest that 8G is limit for 
this sensor.
   So @gonccalo would you mind amending this.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-mcumgr] utzig commented on a change in pull request #67: Add rat-excludes and missing licence headers

2020-03-05 Thread GitBox
utzig commented on a change in pull request #67: Add rat-excludes and missing 
licence headers
URL: https://github.com/apache/mynewt-mcumgr/pull/67#discussion_r388198556
 
 

 ##
 File path: samples/smp_svr/zephyr/src/main.c
 ##
 @@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 
 Review comment:
   Is it OK to add a new license **over** an existing license?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-mcumgr] sjanc opened a new pull request #68: Remove version.yml

2020-03-05 Thread GitBox
sjanc opened a new pull request #68: Remove version.yml
URL: https://github.com/apache/mynewt-mcumgr/pull/68
 
 
   First version on mynewt-core using mcumgr will be 1.8 which will no
   longer require version.yml.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated: kernel/arch: Add option to use BASEPRI for critical section

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

andk 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 4e2b2ff  kernel/arch: Add option to use BASEPRI for critical section
4e2b2ff is described below

commit 4e2b2ffa26a48d5b9cb48406cd0660117dcb4e18
Author: Andrzej Kaczmarek 
AuthorDate: Tue Mar 3 20:27:24 2020 +0100

kernel/arch: Add option to use BASEPRI for critical section

This adds "hidden" option to use BASEPRI instead of PRIMASK for
critical sections on supported MCUs (i.e. Cortex M3/4/7/33).

New behavior can be enabled by #define in mcu/mcu.h as follows:
  MCU_CRITICAL_BASEPRI 
where  is highest priority interrupt that should be disabled by
critical section. Note that priority values here are the same as for
NVIC_SetPriority, i.e. they are *not* shifted by number of unused
priority bits.
---
 kernel/os/src/arch/cortex_m3/os_arch_arm.c  | 25 -
 kernel/os/src/arch/cortex_m33/os_arch_arm.c | 25 -
 kernel/os/src/arch/cortex_m4/os_arch_arm.c  | 25 -
 kernel/os/src/arch/cortex_m7/os_arch_arm.c  | 25 -
 4 files changed, 80 insertions(+), 20 deletions(-)

diff --git a/kernel/os/src/arch/cortex_m3/os_arch_arm.c 
b/kernel/os/src/arch/cortex_m3/os_arch_arm.c
index bc9f0e6..40be88b 100644
--- a/kernel/os/src/arch/cortex_m3/os_arch_arm.c
+++ b/kernel/os/src/arch/cortex_m3/os_arch_arm.c
@@ -127,26 +127,41 @@ os_arch_save_sr(void)
 {
 uint32_t isr_ctx;
 
-isr_ctx = __get_PRIMASK();
+#if MCU_CRITICAL_BASEPRI
+isr_ctx = __get_BASEPRI();
+__set_BASEPRI((MCU_CRITICAL_BASEPRI) << (8 - __NVIC_PRIO_BITS));
+#else
+isr_ctx = __get_PRIMASK() & 1;
 __disable_irq();
-return (isr_ctx & 1);
+#endif
+
+return isr_ctx;
 }
 
 void
 os_arch_restore_sr(os_sr_t isr_ctx)
 {
+#if MCU_CRITICAL_BASEPRI
+__set_BASEPRI(isr_ctx);
+#else
 if (!isr_ctx) {
 __enable_irq();
 }
+#endif
 }
 
 int
 os_arch_in_critical(void)
 {
-uint32_t isr_ctx;
+int ret;
+
+#if MCU_CRITICAL_BASEPRI
+ret = __get_BASEPRI() > 0;
+#else
+ret = __get_PRIMASK() & 1;
+#endif
 
-isr_ctx = __get_PRIMASK();
-return (isr_ctx & 1);
+return ret;
 }
 
 static void
diff --git a/kernel/os/src/arch/cortex_m33/os_arch_arm.c 
b/kernel/os/src/arch/cortex_m33/os_arch_arm.c
index e33d8dc..03677c7 100644
--- a/kernel/os/src/arch/cortex_m33/os_arch_arm.c
+++ b/kernel/os/src/arch/cortex_m33/os_arch_arm.c
@@ -128,26 +128,41 @@ os_arch_save_sr(void)
 {
 uint32_t isr_ctx;
 
-isr_ctx = __get_PRIMASK();
+#if MCU_CRITICAL_BASEPRI
+isr_ctx = __get_BASEPRI();
+__set_BASEPRI((MCU_CRITICAL_BASEPRI) << (8 - __NVIC_PRIO_BITS));
+#else
+isr_ctx = __get_PRIMASK() & 1;
 __disable_irq();
-return (isr_ctx & 1);
+#endif
+
+return isr_ctx;
 }
 
 void
 os_arch_restore_sr(os_sr_t isr_ctx)
 {
+#if MCU_CRITICAL_BASEPRI
+__set_BASEPRI(isr_ctx);
+#else
 if (!isr_ctx) {
 __enable_irq();
 }
+#endif
 }
 
 int
 os_arch_in_critical(void)
 {
-uint32_t isr_ctx;
+int ret;
+
+#if MCU_CRITICAL_BASEPRI
+ret = __get_BASEPRI() > 0;
+#else
+ret = __get_PRIMASK() & 1;
+#endif
 
-isr_ctx = __get_PRIMASK();
-return (isr_ctx & 1);
+return ret;
 }
 
 static void
diff --git a/kernel/os/src/arch/cortex_m4/os_arch_arm.c 
b/kernel/os/src/arch/cortex_m4/os_arch_arm.c
index 26de0f5..48111e5 100644
--- a/kernel/os/src/arch/cortex_m4/os_arch_arm.c
+++ b/kernel/os/src/arch/cortex_m4/os_arch_arm.c
@@ -128,26 +128,41 @@ os_arch_save_sr(void)
 {
 uint32_t isr_ctx;
 
-isr_ctx = __get_PRIMASK();
+#if MCU_CRITICAL_BASEPRI
+isr_ctx = __get_BASEPRI();
+__set_BASEPRI((MCU_CRITICAL_BASEPRI) << (8 - __NVIC_PRIO_BITS));
+#else
+isr_ctx = __get_PRIMASK() & 1;
 __disable_irq();
-return (isr_ctx & 1);
+#endif
+
+return isr_ctx;
 }
 
 void
 os_arch_restore_sr(os_sr_t isr_ctx)
 {
+#if MCU_CRITICAL_BASEPRI
+__set_BASEPRI(isr_ctx);
+#else
 if (!isr_ctx) {
 __enable_irq();
 }
+#endif
 }
 
 int
 os_arch_in_critical(void)
 {
-uint32_t isr_ctx;
+int ret;
+
+#if MCU_CRITICAL_BASEPRI
+ret = __get_BASEPRI() > 0;
+#else
+ret = __get_PRIMASK() & 1;
+#endif
 
-isr_ctx = __get_PRIMASK();
-return (isr_ctx & 1);
+return ret;
 }
 
 static void
diff --git a/kernel/os/src/arch/cortex_m7/os_arch_arm.c 
b/kernel/os/src/arch/cortex_m7/os_arch_arm.c
index 26de0f5..48111e5 100644
--- a/kernel/os/src/arch/cortex_m7/os_arch_arm.c
+++ b/kernel/os/src/arch/cortex_m7/os_arch_arm.c
@@ -128,26 +128,41 @@ os_arch_save_sr(void)
 {
 uint32_t isr_ctx;
 
-isr_ctx = __get_PRIMASK();
+#if MCU_CRITICAL_BASEPRI
+isr_ctx = __get_BASEPRI();
+__set_BASEPRI((MCU_CRITICAL_BASEPRI) << (8 - __NVIC_PRIO_BITS));
+#else
+isr_ctx = __get_PRIMASK() & 1;
 

[GitHub] [mynewt-core] andrzej-kaczmarek merged pull request #2225: kernel/arch: Add option to use BASEPRI for critical section

2020-03-05 Thread GitBox
andrzej-kaczmarek merged pull request #2225: kernel/arch: Add option to use 
BASEPRI for critical section
URL: https://github.com/apache/mynewt-core/pull/2225
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-nimble] sjanc commented on a change in pull request #765: nimble/host: Fix check for valid static random address

2020-03-05 Thread GitBox
sjanc commented on a change in pull request #765: nimble/host: Fix check for 
valid static random address
URL: https://github.com/apache/mynewt-nimble/pull/765#discussion_r388152582
 
 

 ##
 File path: nimble/host/src/ble_hs_id.c
 ##
 @@ -58,14 +58,20 @@ ble_hs_id_set_rnd(const uint8_t *rnd_addr)
 {
 uint8_t addr_type_byte;
 int rc;
-uint8_t all_zeros[BLE_DEV_ADDR_LEN] = {0}, all_ones[BLE_DEV_ADDR_LEN] = { 
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+int i, rnd_part_sum = 0;
 
 
 Review comment:
   I'd make those checks explicit so that it obvious what is being check.
   Something like this maybe?
   
   int
   ble_hs_id_set_rnd(const uint8_t *rnd_addr)
   {
   uint8_t addr_type_byte;
   int ones;
   int rc;
   
   /* Make sure random part of rnd_addr is not all ones or zeros */
   addr_type_byte = rnd_addr[5] & 0xc0;
   
   /* count bits set to 1 in address */
   ones = __builtin_popcount(rnd_addr[0]);
   ones += __builtin_popcount(rnd_addr[1]);
   ones += __builtin_popcount(rnd_addr[2]);
   ones += __builtin_popcount(rnd_addr[3]);
   ones += __builtin_popcount(rnd_addr[4]);
   ones += __builtin_popcount(rnd_addr[5] & 0x3f);
   
   if ((addr_type_byte != 0x00 && addr_type_byte != 0xc0) ||
   (ones == 0 || ones == 46)) {
   return BLE_HS_EINVAL;
   }
   
   ble_hs_lock();
   rc = ble_hs_hci_util_set_random_addr(rnd_addr);
   if (rc == 0) {
   memcpy(ble_hs_id_rnd, rnd_addr, 6);
   }
   ble_hs_unlock();
   
   return rc;
   }
   
   
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull request #744: Add support for Enhanced LE CoC as per BT 5.2

2020-03-05 Thread GitBox
andrzej-kaczmarek commented on a change in pull request #744: Add support for 
Enhanced LE CoC as per BT 5.2 
URL: https://github.com/apache/mynewt-nimble/pull/744#discussion_r388137622
 
 

 ##
 File path: apps/btshell/src/main.c
 ##
 @@ -2253,10 +2280,42 @@ btshell_l2cap_event(struct ble_l2cap_event *event, 
void *arg)
 
 case BLE_L2CAP_EVENT_COC_DATA_RECEIVED:
 btshell_l2cap_coc_recv(event->receive.chan, event->receive.sdu_rx);
+return 0;
+case BLE_L2CAP_EVENT_COC_RECONFIG_COMPLETED:
+
+if (ble_l2cap_get_chan_info(event->reconfigured.chan, _info)) 
{
+assert(0);
+}
+
+console_printf("LE CoC reconfigure completed status 0x%02x," \
+"chan: 0x%08lx\n",
 
 Review comment:
   use %p for pointers


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull request #744: Add support for Enhanced LE CoC as per BT 5.2

2020-03-05 Thread GitBox
andrzej-kaczmarek commented on a change in pull request #744: Add support for 
Enhanced LE CoC as per BT 5.2 
URL: https://github.com/apache/mynewt-nimble/pull/744#discussion_r388136398
 
 

 ##
 File path: apps/btshell/src/cmd.c
 ##
 @@ -3540,6 +3543,24 @@ static const struct shell_cmd_help 
l2cap_disconnect_help = {
 .params = l2cap_disconnect_params,
 };
 
+/*
+ * $l2cap-reconfig   *
+ */
+
+static const struct shell_param l2cap_reconfig_params[] = {
+{"conn", "connection handle, usage: ="},
+{"mtu", "new mtu, usage: =, default: 0 (no change)"},
+{"mps", "new mps, usage: =, default: 0 (no change)"},
+{"idxs", "list of channel indexes, usage: idxs=01:03"},
 
 Review comment:
   better use comma as separator - we use colon for byte streams already so it 
will be confusing


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services