Merge pull request #177 from andrzej-kaczmarek/log-offset-fix
log_mgmt: Zero-initialize log_offset struct
diff --git a/.asf.yaml b/.asf.yaml
new file mode 100644
index 0000000..c43fe91
--- /dev/null
+++ b/.asf.yaml
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+
+notifications:
+ commits: commits@mynewt.apache.org
+ issues: notifications@mynewt.apache.org
+ pullrequests: notifications@mynewt.apache.org
diff --git a/README.md b/README.md
index 94059c0..20ed145 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# mcumgr
-This is mcumgr, version 0.3.0
+This is mcumgr, version 0.5.0
mcumgr is a management library for 32-bit MCUs. The goal of mcumgr is to
define a common management infrastructure with pluggable transport and encoding
diff --git a/cborattr/test/src/testcases/cborattr_decode_int_array.c b/cborattr/test/src/testcases/cborattr_decode_int_array.c
index 96bc8cc..ae7fff8 100644
--- a/cborattr/test/src/testcases/cborattr_decode_int_array.c
+++ b/cborattr/test/src/testcases/cborattr_decode_int_array.c
@@ -83,7 +83,7 @@
.attribute = "a",
.type = CborAttrArrayType,
.addr.array.element_type = CborAttrIntegerType,
- .addr.array.arr.integers.store = arr_data,
+ .addr.array.arr.integers.store = (long long int *) arr_data,
.addr.array.count = &arr_cnt,
.addr.array.maxlen = sizeof(arr_data) / sizeof(arr_data[0]),
.nodefault = true
@@ -91,7 +91,7 @@
[1] = {
.attribute = "b",
.type = CborAttrIntegerType,
- .addr.integer = &b_int,
+ .addr.integer = (long long int *) &b_int,
.dflt.integer = 1
},
[2] = {
@@ -103,7 +103,7 @@
.attribute = "a",
.type = CborAttrArrayType,
.addr.array.element_type = CborAttrIntegerType,
- .addr.array.arr.integers.store = arr_data,
+ .addr.array.arr.integers.store = (long long int *) arr_data,
.addr.array.count = &arr_cnt,
.addr.array.maxlen = 1,
.nodefault = true
@@ -111,7 +111,7 @@
[1] = {
.attribute = "b",
.type = CborAttrIntegerType,
- .addr.integer = &b_int,
+ .addr.integer = (long long int *) &b_int,
.dflt.integer = 1
},
[2] = {
diff --git a/cborattr/test/src/testcases/cborattr_decode_object.c b/cborattr/test/src/testcases/cborattr_decode_object.c
index 25a32d2..358d379 100644
--- a/cborattr/test/src/testcases/cborattr_decode_object.c
+++ b/cborattr/test/src/testcases/cborattr_decode_object.c
@@ -115,7 +115,7 @@
[0] = {
.attribute = "bm",
.type = CborAttrIntegerType,
- .addr.integer = &bm_val,
+ .addr.integer = (long long int *) &bm_val,
.nodefault = true
},
[1] = {
@@ -139,7 +139,7 @@
[0] = {
.attribute = "i",
.type = CborAttrIntegerType,
- .addr.integer = &i_val,
+ .addr.integer = (long long int *) &i_val,
.nodefault = true
},
[1] = {
@@ -167,7 +167,7 @@
[1] = {
.attribute = "a",
.type = CborAttrIntegerType,
- .addr.integer = &a_val,
+ .addr.integer = (long long int *) &a_val,
.nodefault = true
},
[2] = {
diff --git a/cborattr/test/src/testcases/cborattr_decode_simple.c b/cborattr/test/src/testcases/cborattr_decode_simple.c
index 9e206e1..e899f1e 100644
--- a/cborattr/test/src/testcases/cborattr_decode_simple.c
+++ b/cborattr/test/src/testcases/cborattr_decode_simple.c
@@ -91,13 +91,13 @@
[0] = {
.attribute = "a",
.type = CborAttrIntegerType,
- .addr.uinteger = &a_val,
+ .addr.uinteger = (long long unsigned int *) &a_val,
.nodefault = true
},
[1] = {
.attribute = "b",
.type = CborAttrIntegerType,
- .addr.integer = &b_val,
+ .addr.integer = (long long int *) &b_val,
.nodefault = true
},
[2] = {
diff --git a/cborattr/test/src/testcases/cborattr_decode_unnamed_array.c b/cborattr/test/src/testcases/cborattr_decode_unnamed_array.c
index c4446b8..5edb537 100644
--- a/cborattr/test/src/testcases/cborattr_decode_unnamed_array.c
+++ b/cborattr/test/src/testcases/cborattr_decode_unnamed_array.c
@@ -78,7 +78,7 @@
.attribute = CBORATTR_ATTR_UNNAMED,
.type = CborAttrArrayType,
.addr.array.element_type = CborAttrIntegerType,
- .addr.array.arr.integers.store = arr_data,
+ .addr.array.arr.integers.store = (long long int *) arr_data,
.addr.array.count = &arr_cnt,
.addr.array.maxlen = sizeof(arr_data) / sizeof(arr_data[0]),
.nodefault = true
diff --git a/cmd/img_mgmt/port/mynewt/pkg.yml b/cmd/img_mgmt/port/mynewt/pkg.yml
index abe4c81..171743e 100644
--- a/cmd/img_mgmt/port/mynewt/pkg.yml
+++ b/cmd/img_mgmt/port/mynewt/pkg.yml
@@ -29,4 +29,4 @@
- '@apache-mynewt-core/sys/log/modlog'
pkg.init:
- img_mgmt_module_init: 501
+ img_mgmt_module_init: 'MYNEWT_VAL(IMG_MGMT_SYSINIT_STAGE)'
diff --git a/cmd/img_mgmt/port/mynewt/src/mynewt_img_mgmt.c b/cmd/img_mgmt/port/mynewt/src/mynewt_img_mgmt.c
index f75b00d..b56e3a6 100644
--- a/cmd/img_mgmt/port/mynewt/src/mynewt_img_mgmt.c
+++ b/cmd/img_mgmt/port/mynewt/src/mynewt_img_mgmt.c
@@ -254,6 +254,9 @@
int
img_mgmt_impl_erase_slot(void)
{
+#ifndef FLASH_AREA_IMAGE_1
+ return MGMT_ERR_ENOTSUP;
+#else
const struct flash_area *fa;
bool empty;
int rc;
@@ -276,6 +279,7 @@
}
return 0;
+#endif
}
int
@@ -392,6 +396,9 @@
img_mgmt_impl_write_image_data(unsigned int offset, const void *data,
unsigned int num_bytes, bool last)
{
+#ifndef FLASH_AREA_IMAGE_1
+ return MGMT_ERR_ENOTSUP;
+#else
const struct flash_area *fa;
struct flash_area sector;
int rc;
@@ -432,6 +439,7 @@
g_img_mgmt_state.sector_id = -1;
g_img_mgmt_state.sector_end = 0;
return MGMT_ERR_EUNKNOWN;
+#endif
}
#else
@@ -439,6 +447,9 @@
img_mgmt_impl_write_image_data(unsigned int offset, const void *data,
unsigned int num_bytes, bool last)
{
+#ifndef FLASH_AREA_IMAGE_1
+ return MGMT_ERR_ENOTSUP;
+#else
const struct flash_area *fa;
int rc;
@@ -454,12 +465,16 @@
}
return 0;
+#endif
}
#endif
int
img_mgmt_impl_erase_image_data(unsigned int off, unsigned int num_bytes)
{
+#ifndef FLASH_AREA_IMAGE_1
+ return MGMT_ERR_ENOTSUP;
+#else
const struct flash_area *fa;
int rc;
@@ -475,12 +490,16 @@
}
return 0;
+#endif
}
#if MYNEWT_VAL(IMG_MGMT_LAZY_ERASE)
int
img_mgmt_impl_erase_if_needed(uint32_t off, uint32_t len)
{
+#ifndef FLASH_AREA_IMAGE_1
+ return MGMT_ERR_ENOTSUP;
+#else
int rc = 0;
struct flash_area sector;
const struct flash_area *cfa;
@@ -506,6 +525,7 @@
done:
flash_area_close(cfa);
return rc;
+#endif
}
#endif
diff --git a/cmd/img_mgmt/port/mynewt/syscfg.yml b/cmd/img_mgmt/port/mynewt/syscfg.yml
index 4d09eba..35c68ce 100644
--- a/cmd/img_mgmt/port/mynewt/syscfg.yml
+++ b/cmd/img_mgmt/port/mynewt/syscfg.yml
@@ -23,6 +23,9 @@
IMG_MGMT_LOG_LVL:
description: 'Minimum level for the image management structured log.'
value: 15 # Log disabled by default.
+ IMG_MGMT_SYSINIT_STAGE:
+ description: System initalization stage for IMG_MGMT package
+ value: 501
syscfg.logs:
IMG_MGMT_LOG:
diff --git a/cmd/log_mgmt/port/mynewt/pkg.yml b/cmd/log_mgmt/port/mynewt/pkg.yml
index 6996e7d..0fded13 100644
--- a/cmd/log_mgmt/port/mynewt/pkg.yml
+++ b/cmd/log_mgmt/port/mynewt/pkg.yml
@@ -28,4 +28,4 @@
- '@apache-mynewt-mcumgr/mgmt'
pkg.init:
- log_mgmt_module_init: 501
+ log_mgmt_module_init: 'MYNEWT_VAL(LOG_MGMT_SYSINIT_STAGE)'
diff --git a/cmd/log_mgmt/port/mynewt/syscfg.yml b/cmd/log_mgmt/port/mynewt/syscfg.yml
index 7ab39d9..c155b2b 100644
--- a/cmd/log_mgmt/port/mynewt/syscfg.yml
+++ b/cmd/log_mgmt/port/mynewt/syscfg.yml
@@ -37,6 +37,11 @@
management commands.
value: 64
+ LOG_MGMT_SYSINIT_STAGE:
+ description: >
+ System Initalization stage for LOG MGMT package
+ value: 501
+
# For backwards compatibility with log nmgr
syscfg.vals.LOG_NMGR_MAX_RSP_LEN:
LOG_MGMT_MAX_RSP_SIZE: MYNEWT_VAL(LOG_NMGR_MAX_RSP_LEN)
diff --git a/cmd/os_mgmt/pkg.yml b/cmd/os_mgmt/pkg.yml
index 7e79da1..9c2d16a 100644
--- a/cmd/os_mgmt/pkg.yml
+++ b/cmd/os_mgmt/pkg.yml
@@ -33,4 +33,4 @@
- "stubs.c"
pkg.init:
- os_mgmt_module_init: 501
+ os_mgmt_module_init: 'MYNEWT_VAL(OS_MGMT_SYSINIT_STAGE)'
diff --git a/cmd/os_mgmt/syscfg.yml b/cmd/os_mgmt/syscfg.yml
index ef6bb0b..4707559 100644
--- a/cmd/os_mgmt/syscfg.yml
+++ b/cmd/os_mgmt/syscfg.yml
@@ -34,3 +34,8 @@
description: >
Enable support for echo command.
value: 1
+
+ OS_MGMT_SYSINIT_STAGE:
+ description: >
+ System Initialization stage for OS_MGMT package
+ value: 501
diff --git a/cmd/stat_mgmt/port/mynewt/pkg.yml b/cmd/stat_mgmt/port/mynewt/pkg.yml
index fc9e87d..23bbc5e 100644
--- a/cmd/stat_mgmt/port/mynewt/pkg.yml
+++ b/cmd/stat_mgmt/port/mynewt/pkg.yml
@@ -28,4 +28,4 @@
- '@apache-mynewt-mcumgr/mgmt'
pkg.init:
- stat_mgmt_module_init: 501
+ stat_mgmt_module_init: 'MYNEWT_VAL(STAT_MGMT_SYSINIT_STAGE)'
diff --git a/cmd/stat_mgmt/port/mynewt/syscfg.yml b/cmd/stat_mgmt/port/mynewt/syscfg.yml
new file mode 100644
index 0000000..7b704ed
--- /dev/null
+++ b/cmd/stat_mgmt/port/mynewt/syscfg.yml
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+syscfg.defs:
+ STAT_MGMT_SYSINIT_STAGE:
+ description: >
+ System Initialization stage for STAT_MGMT package
+ value: 501
diff --git a/repository.yml b/repository.yml
index e07d83c..4012a65 100644
--- a/repository.yml
+++ b/repository.yml
@@ -23,7 +23,9 @@
"0.1.0": "mcumgr_0_1_0_tag"
"0.2.0": "mcumgr_0_2_0_tag"
"0.3.0": "mcumgr_0_3_0_tag"
+ "0.4.0": "mcumgr_0_4_0_tag"
+ "0.5.0": "mcumgr_0_5_0_tag"
"0-dev": "0.0.0" # master
- "0-latest": "0.3.0" # latest release
+ "0-latest": "0.5.0" # latest release