[GitHub] jacobrosenthal commented on issue #281: imgmgr: add erase command, remove erase from upload command

2017-05-30 Thread git
jacobrosenthal commented on issue #281: imgmgr: add erase command, remove erase 
from upload command
URL: 
https://github.com/apache/incubator-mynewt-core/pull/281#issuecomment-305046664
 
 
   BTW hold on this until I get this last discussion finished on why nrf51 
radio doesnt appear to come back up cleanly and advertise after a flash_erase 
disconnect. 
   
   Its interesting though if I break and step a bit it does come back, so it 
seems like a timing issue?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jacobrosenthal commented on a change in pull request #281: imgmgr: add erase command, remove erase from upload command

2017-05-30 Thread git
jacobrosenthal commented on a change in pull request #281: imgmgr: add erase 
command, remove erase from upload command
URL: 
https://github.com/apache/incubator-mynewt-core/pull/281#discussion_r119246771
 
 

 ##
 File path: mgmt/imgmgr/src/imgmgr.c
 ##
 @@ -223,6 +228,70 @@ imgr_find_by_hash(uint8_t *find, struct image_version 
*ver)
 }
 
 static int
+imgr_erase(struct mgmt_cbuf *cb)
+{
+struct image_version ver;
+int area_id;
+int best = -1;
+int rc;
+int i;
+CborError g_err = CborNoError;
+
+for (i = 0; i < 2; i++) {
+rc = imgr_read_info(i, , NULL, NULL);
+if (rc < 0) {
+continue;
+}
+if (rc == 0) {
+/* Image in slot is ok. */
+if (imgmgr_state_slot_in_use(i)) {
+/* Slot is in use; can't erase to this. */
+continue;
+} else {
+/*
+ * Not active slot, but image is ok. Use it if there are
+ * no better candidates.
+ */
+best = i;
+}
+continue;
+}
+best = i;
+break;
+}
+if (best >= 0) {
+area_id = flash_area_id_from_image_slot(best);
+if (imgr_state.upload.fa) {
+flash_area_close(imgr_state.upload.fa);
+imgr_state.upload.fa = NULL;
+}
+rc = flash_area_open(area_id, _state.upload.fa);
+if (rc) {
+return MGMT_ERR_EINVAL;
+}
+rc = flash_area_erase(imgr_state.upload.fa, 0,
+  imgr_state.upload.fa->fa_size);
 
 Review comment:
   Done
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jacobrosenthal commented on a change in pull request #281: imgmgr: add erase command, remove erase from upload command

2017-05-30 Thread git
jacobrosenthal commented on a change in pull request #281: imgmgr: add erase 
command, remove erase from upload command
URL: 
https://github.com/apache/incubator-mynewt-core/pull/281#discussion_r119246721
 
 

 ##
 File path: sys/flash_map/include/flash_map/flash_map.h
 ##
 @@ -41,6 +41,7 @@ extern "C" {
  * match the linker scripts when platform executes from flash,
  * and match the target offset specified in download script.
  */
+#include 
 
 Review comment:
   Ah yes. Roger
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] ccollins476ad commented on a change in pull request #281: imgmgr: add erase command, remove erase from upload command

2017-05-30 Thread git
ccollins476ad commented on a change in pull request #281: imgmgr: add erase 
command, remove erase from upload command
URL: 
https://github.com/apache/incubator-mynewt-core/pull/281#discussion_r119246418
 
 

 ##
 File path: sys/flash_map/include/flash_map/flash_map.h
 ##
 @@ -41,6 +41,7 @@ extern "C" {
  * match the linker scripts when platform executes from flash,
  * and match the target offset specified in download script.
  */
+#include 
 
 Review comment:
   For bool, you should include 
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jacobrosenthal commented on a change in pull request #281: imgmgr: add erase command, remove erase from upload command

2017-05-30 Thread git
jacobrosenthal commented on a change in pull request #281: imgmgr: add erase 
command, remove erase from upload command
URL: 
https://github.com/apache/incubator-mynewt-core/pull/281#discussion_r119244439
 
 

 ##
 File path: sys/flash_map/include/flash_map/flash_map.h
 ##
 @@ -41,6 +41,7 @@ extern "C" {
  * match the linker scripts when platform executes from flash,
  * and match the target offset specified in download script.
  */
+#include 
 
 Review comment:
   Yes for bool
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] jacobrosenthal commented on a change in pull request #281: imgmgr: add erase command, remove erase from upload command

2017-05-30 Thread git
jacobrosenthal commented on a change in pull request #281: imgmgr: add erase 
command, remove erase from upload command
URL: 
https://github.com/apache/incubator-mynewt-core/pull/281#discussion_r119244347
 
 

 ##
 File path: sys/flash_map/src/flash_map.c
 ##
 @@ -21,6 +21,7 @@
 #include 
 #include 
 
+#include 
 
 Review comment:
   yes for min, though that could be duplicated so os isnt needed, or put 
somewhere else
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] PierreKircher opened a new pull request #194: slack logo in footer

2017-05-30 Thread git
PierreKircher opened a new pull request #194: slack logo in footer
URL: https://github.com/apache/incubator-mynewt-site/pull/194
 
 
   title says it all 
   
   why ? to get more people to engagne in the amazing community around mynewt
   
   icon/logo is debateable c on it 
   
   thanks
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] mkiiskila closed pull request #289: Shell fixes from review #256

2017-05-30 Thread git
mkiiskila closed pull request #289: Shell fixes from review #256
URL: https://github.com/apache/incubator-mynewt-core/pull/289
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] mkiiskila closed pull request #295: Wrap RTT console buffer if full

2017-05-30 Thread git
mkiiskila closed pull request #295: Wrap RTT console buffer if full
URL: https://github.com/apache/incubator-mynewt-core/pull/295
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] PierreKircher closed pull request #193: Slack logo + link in footer

2017-05-30 Thread git
PierreKircher closed pull request #193: Slack logo + link in footer
URL: https://github.com/apache/incubator-mynewt-site/pull/193
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] PierreKircher opened a new pull request #193: Slack logo + link in footer

2017-05-30 Thread git
PierreKircher opened a new pull request #193: Slack logo + link in footer
URL: https://github.com/apache/incubator-mynewt-site/pull/193
 
 
   title says it all .. icon is debateable.
   
   why? to get more people to join the community and engage in a healthy 
conversation.
   
   like to hear comments/critics
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] mkiiskila commented on issue #288: MYNEWT-742 Initialize OIC automatically.

2017-05-30 Thread git
mkiiskila commented on issue #288: MYNEWT-742 Initialize OIC automatically.
URL: 
https://github.com/apache/incubator-mynewt-core/pull/288#issuecomment-305041180
 
 
   I would hold off from this change for now.
   
   The reason is that this would break the existing platforms where OIC runs 
over IP. When OIC initializes, it joins multicast groups on all existing 
interfaces. If interfaces come up later, they will not be enabled.
   What we should have before this commit is merged is a way for net/oic to 
notice that interface state has changed (or periodically poll for new 
interfaces). At the moment we don't have this facility.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] ccollins476ad commented on issue #55: MYNEWT-583; newt - allow use of specific tag/repository revision.

2017-05-30 Thread git
ccollins476ad commented on issue #55: MYNEWT-583; newt - allow use of specific 
tag/repository revision.
URL: 
https://github.com/apache/incubator-mynewt-newt/pull/55#issuecomment-305039698
 
 
   Just an FYI- here is a playground program which I think reproduces this 
case: https://play.golang.org/p/UP8i8vo1oZ
   
   ```
   package main
   
   import (
"fmt"
   )
   
   type S struct {
a int
   }
   
   func (s *S) String() string {
return fmt.Sprintf("%d", s.a)
   }
   
   func main() {
s := S{5}
fmt.Printf("s=%s\n", s)
   }
   ```
   
   Output:
   ```
   s={%!s(int=5)}
   
   Program exited.
   ```
   
   Maybe there is something different in this example?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] mkiiskila closed pull request #286: Wi-Fire: Add SPI support (master mode only)

2017-05-30 Thread git
mkiiskila closed pull request #286: Wi-Fire: Add SPI support (master mode only)
URL: https://github.com/apache/incubator-mynewt-core/pull/286
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] mkiiskila closed pull request #284: hw: mcu: pic32mz2048efg100: Rename ppc to pps

2017-05-30 Thread git
mkiiskila closed pull request #284: hw: mcu: pic32mz2048efg100: Rename ppc to 
pps
URL: https://github.com/apache/incubator-mynewt-core/pull/284
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] mkiiskila commented on a change in pull request #281: imgmgr: add erase command, remove erase from upload command

2017-05-30 Thread git
mkiiskila commented on a change in pull request #281: imgmgr: add erase 
command, remove erase from upload command
URL: 
https://github.com/apache/incubator-mynewt-core/pull/281#discussion_r119240061
 
 

 ##
 File path: sys/flash_map/src/flash_map.c
 ##
 @@ -131,6 +132,40 @@ flash_area_align(const struct flash_area *fa)
 return hal_flash_align(fa->fa_device_id);
 }
 
+int
+flash_area_is_empty(const struct flash_area *fa, bool *empty)
+{
+uint32_t data[64 >> 2];
+uint32_t data_off = 0;
+int8_t bytes_to_read;
+uint8_t i;
+int rc;
+
+while(data_off < fa->fa_size)
+{
 
 Review comment:
   Can you fix the coding style?
   See 
https://github.com/apache/incubator-mynewt-core/blob/master/CODING_STANDARDS.md
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] mkiiskila commented on a change in pull request #281: imgmgr: add erase command, remove erase from upload command

2017-05-30 Thread git
mkiiskila commented on a change in pull request #281: imgmgr: add erase 
command, remove erase from upload command
URL: 
https://github.com/apache/incubator-mynewt-core/pull/281#discussion_r119241026
 
 

 ##
 File path: sys/flash_map/src/flash_map.c
 ##
 @@ -131,6 +132,40 @@ flash_area_align(const struct flash_area *fa)
 return hal_flash_align(fa->fa_device_id);
 }
 
+int
+flash_area_is_empty(const struct flash_area *fa, bool *empty)
+{
+uint32_t data[64 >> 2];
+uint32_t data_off = 0;
+int8_t bytes_to_read;
+uint8_t i;
+int rc;
+
+while(data_off < fa->fa_size)
+{
+bytes_to_read = min(64, fa->fa_size - data_off);
+rc = flash_area_read(fa, data_off, data, bytes_to_read);
+if (rc) {
+return rc;
+}
+for (i = 0; i < bytes_to_read >> 2; i++){
+  if (data[i] != (uint32_t) -1) {
+goto not_empty;
+  }
+}
+for (i = i << 2; i < bytes_to_read; i++) {
+  if (*(((uint8_t *) data) + i) != (uint8_t) -1) {
+goto not_empty;
+  }
+}
 
 Review comment:
   I don't think this 2nd for loop is needed. I have not encountered a flash 
sector which would not be a multiple of minimally 4 bytes.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] mkiiskila commented on a change in pull request #281: imgmgr: add erase command, remove erase from upload command

2017-05-30 Thread git
mkiiskila commented on a change in pull request #281: imgmgr: add erase 
command, remove erase from upload command
URL: 
https://github.com/apache/incubator-mynewt-core/pull/281#discussion_r119239939
 
 

 ##
 File path: sys/flash_map/src/flash_map.c
 ##
 @@ -21,6 +21,7 @@
 #include 
 #include 
 
+#include 
 
 Review comment:
   Do we need this inclusion?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] mkiiskila commented on a change in pull request #281: imgmgr: add erase command, remove erase from upload command

2017-05-30 Thread git
mkiiskila commented on a change in pull request #281: imgmgr: add erase 
command, remove erase from upload command
URL: 
https://github.com/apache/incubator-mynewt-core/pull/281#discussion_r119239877
 
 

 ##
 File path: sys/flash_map/include/flash_map/flash_map.h
 ##
 @@ -41,6 +41,7 @@ extern "C" {
  * match the linker scripts when platform executes from flash,
  * and match the target offset specified in download script.
  */
+#include 
 
 Review comment:
   Do we need this inclusion?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] mkiiskila commented on a change in pull request #281: imgmgr: add erase command, remove erase from upload command

2017-05-30 Thread git
mkiiskila commented on a change in pull request #281: imgmgr: add erase 
command, remove erase from upload command
URL: 
https://github.com/apache/incubator-mynewt-core/pull/281#discussion_r119239770
 
 

 ##
 File path: mgmt/imgmgr/src/imgmgr.c
 ##
 @@ -223,6 +228,70 @@ imgr_find_by_hash(uint8_t *find, struct image_version 
*ver)
 }
 
 static int
+imgr_erase(struct mgmt_cbuf *cb)
+{
+struct image_version ver;
+int area_id;
+int best = -1;
+int rc;
+int i;
+CborError g_err = CborNoError;
+
+for (i = 0; i < 2; i++) {
+rc = imgr_read_info(i, , NULL, NULL);
+if (rc < 0) {
+continue;
+}
+if (rc == 0) {
+/* Image in slot is ok. */
+if (imgmgr_state_slot_in_use(i)) {
+/* Slot is in use; can't erase to this. */
+continue;
+} else {
+/*
+ * Not active slot, but image is ok. Use it if there are
+ * no better candidates.
+ */
+best = i;
+}
+continue;
+}
+best = i;
+break;
+}
+if (best >= 0) {
+area_id = flash_area_id_from_image_slot(best);
+if (imgr_state.upload.fa) {
+flash_area_close(imgr_state.upload.fa);
+imgr_state.upload.fa = NULL;
+}
+rc = flash_area_open(area_id, _state.upload.fa);
+if (rc) {
+return MGMT_ERR_EINVAL;
+}
+rc = flash_area_erase(imgr_state.upload.fa, 0,
+  imgr_state.upload.fa->fa_size);
 
 Review comment:
   Could call flash_area_close() for completeness.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] ccollins476ad closed pull request #55: MYNEWT-583; newt - allow use of specific tag/repository revision.

2017-05-30 Thread git
ccollins476ad closed pull request #55: MYNEWT-583; newt - allow use of specific 
tag/repository revision.
URL: https://github.com/apache/incubator-mynewt-newt/pull/55
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] ccollins476ad commented on issue #55: MYNEWT-583; newt - allow use of specific tag/repository revision.

2017-05-30 Thread git
ccollins476ad commented on issue #55: MYNEWT-583; newt - allow use of specific 
tag/repository revision.
URL: 
https://github.com/apache/incubator-mynewt-newt/pull/55#issuecomment-305037486
 
 
   Thanks, Marko.  I don't think String() gets called automatically.  At least, 
it didn't when I tried it in the Go playground.  I did that test a while ago 
and no longer have the exact code I tested, though.
   
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] aditihilbert closed pull request #188: newtmgr also moved to github

2017-05-30 Thread git
aditihilbert closed pull request #188: newtmgr also moved to github
URL: https://github.com/apache/incubator-mynewt-site/pull/188
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on 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