Node.js library that exposes the functionality of the nRF5x Command-Line-Tools, used for development, programming, and debugging of Nordic Semiconductor's nRF5x SoCs (System on Chip).
The library can be installed from npm, using:
npm install pc-nrfjprog-js
This will pull down precompiled binaries for your platform/runtime environment. If precompiled binaries do not exist, then npm will try to compile them, which requires:
- Node.js (>=4)
- npm (>=3.7.0)
- CMake (>=2.8.12)
- A C/C++ toolchain
As part of the installation procedure, pc-nrfjprog-js will check if it can access the nrfjprog libraries, and verify that they are up to date. If not, it will try to install/upgrade these libraries.
The library can be built from source, using:
npm run build
The library can be build from source while installing, using:
npm install --build-from-source
Building from source requires the tools from Installing to be installed.
Before using the library, some platform specific setup is required. If you are seeing errors like Errorcode: CouldNotFindJprogDLL (0x2)
or Errorcode: CouldNotLoadDLL (0x3)
then please check that the tools described below are properly installed.
Download nRF-Command-Line-Tools and run the installer (exe). This will install the required nrfjprog libraries and SEGGER J-Link.
Note that the nRF-Command-Line-Tools for Windows is only available in 32-bit at the moment. This means that 32-bit Node.js is required in order to use pc-nrfjprog-js on Windows.
SEGGER J-Link must be downloaded and installed. The required nRF-Command-Line-Tools libraries are bundled together with pc-nrfjprog-js on Linux/macOS, so they do not have to be installed.
http://nordicsemiconductor.github.io/pc-nrfjprog-js/
const nrfjprogjs = require('pc-nrfjprog-js');
nrfjprogjs.getConnectedDevices(function(err, devices) {
console.log('There are ' + devices.length + ' nRF devices connected.');
});
The project has integration tests that run against a devkit/dongle. Note that these tests will erase the contents on the connected devkit/dongle. To run the tests:
npm test