You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/12/20 14:02:22 UTC
[GitHub] [incubator-nuttx-apps] nandojve opened a new pull request #934: examples: Add mcuboot NSH example
nandojve opened a new pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934
## Summary
This example demonstrate swap between two valid images. Instructions are available at readme.md file inside project directory.
## Impact
None
## Testing
samv7-xult
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #934: examples: Add mcuboot Swap Test example
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] gustavonihei commented on a change in pull request #934: examples: Add mcuboot NSH example
Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#discussion_r772580011
##########
File path: examples/mcuboot/nsh/Kconfig
##########
@@ -0,0 +1,12 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+config EXAMPLES_MCUBOOT_NSH
+ tristate "MCUboot NSH example"
+ default n
+ select BOOT_MCUBOOT
+ ---help---
+ Example application to demonstrate a software firmware from
Review comment:
> [...] demonstrate a software firmware
This is confusing, maybe some words are missing or misplaced here.
Also, the help text should describe **WHAT** the example is or intends to do, and less of the **HOW** part. This will improve the comprehension for the unaware user.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] nandojve commented on pull request #934: examples: Add mcuboot Swap Test example
Posted by GitBox <gi...@apache.org>.
nandojve commented on pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#issuecomment-1025653412
> @nandojve please fix
>
> ```
> Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:53:2: error: Bad left brace alignment
> Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:58:2: error: Garbage follows right bracket
> Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:58:2: error: Bad right brace alignment
> ```
Done!
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on pull request #934: examples: Add mcuboot NSH example
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#issuecomment-1017154763
@nandojve do you have time to fix the comment and style issue?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] nandojve commented on pull request #934: examples: Add mcuboot NSH example
Posted by GitBox <gi...@apache.org>.
nandojve commented on pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#issuecomment-1017407087
> @nandojve do you have time to fix the comment and style issue?
Hi @xiaoxiang781216 ,
Yes, I have intention to move forward all open PR. I returned last week from long vacations period and I was unable to catch up all pending things. I hope soon I can give attention to it.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a change in pull request #934: examples: Add mcuboot Swap Test example
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#discussion_r795048628
##########
File path: examples/mcuboot/swap_test/version_main.c
##########
@@ -0,0 +1,125 @@
+/****************************************************************************
+ * apps/examples/mcuboot/swap_test/version_main.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <endian.h>
+
+#include <errno.h>
+#include <stdio.h>
+
+#include <bootutil/bootutil_public.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define BOOT_HEADER_MAGIC_V1 0x96f3b83d
+#define BOOT_HEADER_SIZE_V1 32
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct mcuboot_raw_header_v1
+{
+ uint32_t header_magic;
+ uint32_t image_load_address;
+ uint16_t header_size;
+ uint16_t pad;
+ uint32_t image_size;
+ uint32_t image_flags;
+ struct
+ {
+ uint8_t major;
+ uint8_t minor;
+ uint16_t revision;
+ uint32_t build_num;
+ } version;
+ uint32_t pad2;
+} __packed;
Review comment:
Please use definitions from `compiler.h`
##########
File path: examples/mcuboot/swap_test/set_img_main.c
##########
@@ -0,0 +1,55 @@
+/****************************************************************************
+ * apps/examples/mcuboot/swap_test/set_img_main.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/boardctl.h>
+
+#include <bootutil/bootutil_public.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * mcuboot_set_img_main
+ ****************************************************************************/
+
+int main(int argc, FAR char *argv[])
+{
+ boot_set_pending_multi(0, 0);
+
+ printf("Requested update for next boot. Restarting...\n");
+
+ fflush(stdout);
+ fflush(stderr);
+
+ usleep(1000);
+
+ boardctl(BOARDIOC_RESET, EXIT_SUCCESS);
Review comment:
```suggestion
boardctl(BOARDIOC_RESET, 0);
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] pkarashchenko commented on pull request #934: examples: Add mcuboot Swap Test example
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#issuecomment-1025287602
@gustavonihei could you please review?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on pull request #934: examples: Add mcuboot NSH example
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#issuecomment-1018192988
Ok, let's wait your update.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] gustavonihei commented on a change in pull request #934: examples: Add mcuboot NSH example
Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#discussion_r772584402
##########
File path: examples/mcuboot/nsh/Kconfig
##########
@@ -0,0 +1,12 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+config EXAMPLES_MCUBOOT_NSH
+ tristate "MCUboot NSH example"
+ default n
+ select BOOT_MCUBOOT
+ ---help---
+ Example application to demonstrate a software firmware from
Review comment:
```suggestion
Example application to demonstrate the firmware image update and the update rollback processes of MCUboot using the swap upgrade method.
```
Just a suggestion.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] gustavonihei commented on a change in pull request #934: examples: Add mcuboot NSH example
Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#discussion_r772577080
##########
File path: examples/mcuboot/nsh/Kconfig
##########
@@ -0,0 +1,12 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+config EXAMPLES_MCUBOOT_NSH
+ tristate "MCUboot NSH example"
Review comment:
The "MCUboot NSH" name is not intuitive as it does not summarizes or describe the purpose of the example.
The example intends to demonstrate the swap upgrade process, this could be a good starting point for a new name.
Just a suggestion: "Swap upgrade example".
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a change in pull request #934: examples: Add mcuboot Swap Test example
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#discussion_r795209896
##########
File path: examples/mcuboot/swap_test/version_main.c
##########
@@ -0,0 +1,125 @@
+/****************************************************************************
+ * apps/examples/mcuboot/swap_test/version_main.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <endian.h>
+
+#include <errno.h>
+#include <stdio.h>
+
+#include <bootutil/bootutil_public.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define BOOT_HEADER_MAGIC_V1 0x96f3b83d
+#define BOOT_HEADER_SIZE_V1 32
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+begin_packed_struct struct mcuboot_raw_header_v1_s
+{
+ uint32_t header_magic;
+ uint32_t image_load_address;
+ uint16_t header_size;
+ uint16_t pad;
+ uint32_t image_size;
+ uint32_t image_flags;
+ struct
+ {
+ uint8_t major;
+ uint8_t minor;
+ uint16_t revision;
+ uint32_t build_num;
+ } version;
Review comment:
```suggestion
begin_packed_struct struct
{
uint8_t major;
uint8_t minor;
uint16_t revision;
uint32_t build_num;
} end_packed_struct version;
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on pull request #934: examples: Add mcuboot Swap Test example
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#issuecomment-1021814035
@nandojve could you fix the follow warning:
```
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:41:1: error: Missing blank line after comment
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:42:29: error: Left bracket not on separate line
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:43:0: error: TABs found. First detected
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:49:8: error: Left bracket not on separate line
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:60:1: error: Missing blank line after comment
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:68:10: error: Left bracket not on separate line
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:69:4: error: Bad alignment
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:70:2: error: Bad right brace alignment
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:72:80: error: Long line found
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:74:10: error: Left bracket not on separate line
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:75:4: error: Bad alignment
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:76:2: error: Bad right brace alignment
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:87:57: error: Left bracket not on separate line
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:88:4: error: Bad alignment
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:89:2: error: Bad right brace alignment
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:104:10: error: Left bracket not on separate line
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:106:4: error: Bad alignment
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:107:2: error: Bad right brace alignment
```
you can check locally by:
../nuttx/tools/checkpatch.sh -g HEAD~...HEAD
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] nandojve commented on pull request #934: examples: Add mcuboot Swap Test example
Posted by GitBox <gi...@apache.org>.
nandojve commented on pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#issuecomment-1027408723
Is there anything missing?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] gustavonihei commented on a change in pull request #934: examples: Add mcuboot NSH example
Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#discussion_r772577080
##########
File path: examples/mcuboot/nsh/Kconfig
##########
@@ -0,0 +1,12 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+config EXAMPLES_MCUBOOT_NSH
+ tristate "MCUboot NSH example"
Review comment:
The "MCUboot NSH" name is not intuitive as it does not summarize or describe the purpose of the example.
The example intends to demonstrate the swap upgrade process, this could be a good starting point for a new name.
Just a suggestion: "Swap upgrade example".
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] pkarashchenko commented on pull request #934: examples: Add mcuboot Swap Test example
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#issuecomment-1025479306
@nandojve please fix
```
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:53:2: error: Bad left brace alignment
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:58:2: error: Garbage follows right bracket
Error: /home/runner/work/incubator-nuttx-apps/incubator-nuttx-apps/apps/examples/mcuboot/swap_test/version_main.c:58:2: error: Bad right brace alignment
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] nandojve commented on pull request #934: examples: Add mcuboot Swap Test example
Posted by GitBox <gi...@apache.org>.
nandojve commented on pull request #934:
URL: https://github.com/apache/incubator-nuttx-apps/pull/934#issuecomment-1027855278
Nice, thank you!
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org