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-mcumgr.git
commit 75463d7895127c544ee245901c24f9c10716c9b1 Author: Christopher Collins <ccoll...@apache.org> AuthorDate: Tue Feb 13 15:42:56 2018 -0800 Update readme files. * Indicate minimum required version of MCUboot. * Add details to smp_svr build instructions for Zephyr. --- README.md | 13 ++++--- samples/smp_svr/README.md | 86 +++++++++++++++++++++++++++++++++++------------ 2 files changed, 72 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index cad3514..1f202b3 100644 --- a/README.md +++ b/README.md @@ -21,15 +21,18 @@ the list below: ## Dependencies -To use mcumgr's image management support, your device must be running the -MCUboot boot loader (https://github.com/runtimeco/mcuboot). The other mcumgr -features do not require MCUboot. +To use mcumgr's image management support, your device must be running version +1.1.0 or later of the [MCUboot boot +loader](https://github.com/runtimeco/mcuboot). The other mcumgr features do +not require MCUboot. ## Command line tool The `mcumgr` command line tool is available at: -https://github.com/apache/mynewt-mcumgr-cli. The tool is written in Go, and it -is installed with the `go get` command: +https://github.com/apache/mynewt-mcumgr-cli. The command line tool requires [Go +1.7 or later](https://golang.org/dl/). Once Go is installed and set up on your +system, you can install the mcumgr CLI tool by issuing the following `go get` +command: ``` $ go get github.com/apache/mynewt-mcumgr-cli/mcumgr diff --git a/samples/smp_svr/README.md b/samples/smp_svr/README.md index 46e72a8..c311823 100644 --- a/samples/smp_svr/README.md +++ b/samples/smp_svr/README.md @@ -8,8 +8,9 @@ transports: `smp_svr` enables support for the following command groups: * fs_mgmt * img_mgmt - * log_mgmt + * log_mgmt (Mynewt only) * os_mgmt + * stat_mgmt ## Mynewt @@ -53,41 +54,82 @@ setting in `prj.conf` accordingly. In addition, the MCUboot boot loader (https://github.com/runtimeco/mcuboot) is required for img_mgmt to function properly. -The smp_svr app logs reboots to a flash circular buffer (FCB) backed log. The -flash map for the nRF52 only allocates flash for either the NFFS file system or -the FCB, but not both. By default, this application uses the FCB log, not the -file system. You can enable the NFFS file system and disable the FCB as follows- +### Building -1. In `zephyr/prj.conf`, uncomment the `FILE_SYSTEM` settings and comment out -the `FLASH` and `FCB` settings: +The below steps describe how to build and run the `smp_svr` sample app in +Zephyr. Where examples are given, they assume the following setup: -``` - # Enable the NFFS file system. - CONFIG_FILE_SYSTEM=y - CONFIG_FILE_SYSTEM_NFFS=y +* BSP: Nordic nRF52dk +* MCU: PCA10040 + +#### Step 1: Configure environment + +Define the `BOARD`, `ZEPHYR_GCC_VARIANT`, and any other environment variables +required by your setup. For our example, we use the following: - # Enable the flash circular buffer (FCB) for the reboot log. - #CONFIG_FLASH_PAGE_LAYOUT=y - #CONFIG_FLASH_MAP=y - #CONFIG_FCB=y ``` +export ZEPHYR_GCC_VARIANT=gccarmemb +export BOARD=nrf52_pca10040 +export GCCARMEMB_TOOLCHAIN_PATH=/usr/local/Caskroom/gcc-arm-embedded/6-2017-q2-update/gcc-arm-none-eabi-6-2017-q2-update +``` + +#### Step 2: Build MCUboot + +Build MCUboot by following the instructions in its `docs/readme-zephyr.md` +file. -2. Link in the NFFS library by uncommenting the `NFFS` line in -`zephyr/CMakeLists.txt`: +#### Step 3: Upload MCUboot + +Upload the resulting `zephyr.bin` file to address 0 of your board. This can be +done in gdb as follows: ``` - zephyr_link_libraries( - NFFS - ) +restore <path-to-mcuboot-zephyr.bin> binary 0 ``` -### Building +#### Step 4: Build smp_svr The Zephyr port of `smp_svr` can be built using the usual procedure: ``` $ cd samples/smp_svr/zephyr $ mkdir build && cd build -$ cmake -DBOARD=<board> .. +$ cmake .. $ make ``` + +#### Step 5: Create an MCUboot-compatible image + +Using MCUboot's `imgtool.py` script, convert the `zephyr.bin` file from step 4 +into an image file. In the below example, the MCUboot repo is located at `~/repos/mcuboot`. + +``` +~/repos/mcuboot/scripts/imgtool.py sign \ + --header-size 0x200 \ + --align 8 \ + --version 1.0 \ + --included-header \ + --key ~/repos/mcuboot/root-rsa-2048.pem \ + <path-to-smp_svr-zephyr.bin> signed-mcumgr.bin +``` + +The above command creates an image file called `signed-mcumgr.bin` in the +current directory. + +#### Step 6: Upload the smp_svr image + +Upload the `signed-mcumgr.bin` file from step 5 to image slot 0 of your board. The location of image slot 0 varies by BSP. For the nRF52dk, slot 0 is located at address 0xc000. + +The following gdb command uploads the image to 0xc000: +``` +restore <path-to-signed-mcumgr.bin> binary 0xc000 +``` + +#### Step 7: Run it! + +The `smp_svr` app is ready to run. Just reset your board and test the app with the mcumgr CLI tool: + +``` +$ mcumgr --conntype ble --connstring peer_name=Zephyr echo hello +hello +``` -- To stop receiving notification emails like this one, please contact ccoll...@apache.org.