NRF52832 OTA无线升级


1  Installing nrfutil

You can install nrfutil from the Python Package Index (PyPI) or you can run or install it from the sources.

In both cases, the following prerequisites must be installed:


2.hex打包为zip

        进入工程的编译目录下使用以下命令把hex文件打包为zip, 其中app.hex为工程生成的文件

nrfutil pkg generate --hw-version 52 --sd-req0x8C --application-version 0xFF --application app.hex --key-file private.pem app_dfu_package.zip


3 Generating and displaying keys

The keys command can be used to generate and display cryptographic keys.

Cryptographic keys are required to sign and validate a Device Firmware Update package. See the Cryptography library in the SDK for more information about signing and cryptographic keys.
  • Run nrfutil keys generate to generate a private (signing) key and store it in a file in PEM format.
  • Run nrfutil keys display to display a private (signing) or public (verification) key from a PEM file.
    There are several options available, which you can view by entering the following command:
    nrfutil keys display --help
    
For example, enter the following command to generate a private key and store it in a file named private.pem:
nrfutil keys generate private.pem
Enter the following command to display a public key in code format from this key file:
nrfutil keys display --key pk --format code private.pem

通过pem生成public_key,替换原先的SDK\examples\dfu\bootloader_secure文件

nrfutil keys display --key pk --format code c:\vault\private.pem --out_file dfu_public_key.c


4.install micro-ecc

      Install version 4.9-2015-q3-update of the GCC compiler toolchain for ARM. You can use ARM's Launchpad to find the toolchain for your operating system.

      Make sure that make is installed (see, for example, MinGW, GNU Make, or Xcode).Click below URL and download it.

  1.  https://sourceforge.net/projects/mingw/files/latest/download?source=files

    I recommend you to install msys as well after installed MinGW in order to use Unix bash shell.

    after installed msys, open the bash shell script which it located in “C:\MinGW\msys\1.0\msys.bat”

    for uECC download and installation, you should unzip the uECC source code under micro-ecc folder as below.

    1. Unzip micro-ecc code at “nRF5_SDK_12.1.0_0d23e2a\external\micro-ecc\”
    2. Change folder name to “micro-ecc” ex) \external\micro-ecc\micro-ecc
    3. use the msys to make \external\micro-ecc\nrf52_keil\armgcc, and then generate micro_ecc_lib_nrf52.lib
    4. use this micro_ecc_lib_nrf52.lib and dfu_public_key.c, you can compile the project and examples\dfu\bootloader_secure, and use nrfgo-studio download SoftDevice and this bootloader.
    5. use android or IOS APP nrf-toolbox to upgrade applicationapp_dfu_package.zip

 


阅读更多

更多精彩内容