Easily Obtain And Use The Micro ECC Library For nRF52
Content
Introduction
The Micro ECC library is a lightweight cryptographic library specifically designed for Nordic Semiconductor's nRF52 series of chips, providing the ability to perform encryption and key exchange operations in resource-constrained embedded systems. In summary, nRF52's Micro ECC library provides developers with powerful tools to perform secure cryptographic operations on nRF52 series chips, allowing them to build highly secure and resource-efficient embedded systems.
Preparation
Install nRF5 SDK v17.1.0.
Clone Micro ECC GitHub Repository
Clone micro-ecc GitHub repository.
Add a new folder named micro-ecc in .../nRF5_SDK_17.1.0_ddde560/external/micro-ecc.
Copy the entire contents of micro-ecc downloaded from GitHub to .../nRF5_SDK_17.1.0_ddde560/external/micro-ecc/micro-ecc.
Download GNU ARM Embedded Toolchain
Download the GNU Arm Embedded Toolchain software appropriately according to your operating system. Take macos as an example to download gcc-arm-none-eabi-10.3-2021.10-mac.pkg and install it.
Setting Environment Variables
Set the environment variable for the installation path of GNU Arm Embedded Toolchain according to the operating system. Take macos as an example below and add the environment variable to the .zshrc file.
export PATH="/Applications/arm/bin:$PATH"
Open the terminal to verify whether the variables are set, as shown below...
➜ ~ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Modifying ” gcc ” path in nRF5 SDK v17.1.0
Find the gcc directory folder in the installation directory of nRF5 SDK v17.1.0 .../nRF5_SDK_17.1.0_ddde560/components/toolchain/gcc.
Modify the path of GNU_INSTALL_ROOT in the Makefile.posix or Makefile.windows file according to the operating system. Taking the macos system as an example, select Makefile.posix and modify /usr/local/gcc-arm-none-eabi-9-2020-q2-update/bin. / is as shown below...
GNU_INSTALL_ROOT ?= /Applications/arm/bin/
Compiling Micro ECC library
Go back to the directory in .../nRF5_SDK_17.1.0_ddde560/external/micro-ecc/ and select the appropriate directory according to the compilation tool and nRF chip used.
Taking macos as an example, you can choose .../nRF5_SDK_17.1.0_ddde560/external/micro-ecc/nrf52hf_armgcc/armgcc
Open the .../nRF5_SDK_17.1.0_ddde560/external/micro-ecc/nrf52hf_armgcc/armgcc directory with a terminal and execute the make command to get the micro_ecc_lib_nrf52.a library.
➜ armgcc make
mkdir _build
cd _build && mkdir micro_ecc_lib
Compiling file: uECC.c
Creating library: ../../nrf52hf_armgcc/armgcc/micro_ecc_lib_nrf52.a
/Applications/arm/bin/arm-none-eabi-ar: creating ../../nrf52hf_armgcc/armgcc/micro_ecc_lib_nrf52.a
Done
Further Learning
The Micro ECC library for the nRF5x family is a powerful tool for implementing safety-critical embedded applications on the nRF52 family of chips. Its lightweight design and strong security features make it ideal for execution in resource-constrained environments.