@connectedyard/node-jlink
Advanced tools
Comparing version 1.1.5 to 1.1.6
#!/usr/bin/env node | ||
( function(){ | ||
( async function(){ | ||
'use strict'; | ||
const jlink = require('../lib/jlinkexe'); | ||
const jlink = require('../index'); | ||
const program = require('commander'); | ||
program | ||
.option('-v, --verbose', 'set verbose output') | ||
.arguments( "<commands>" ) | ||
.parse( process.argv ); | ||
.option('-v, --verbose', 'set verbose output') | ||
.option( '-t, --test', 'only check that jlink exe is found and exit') | ||
.arguments( "<commands>" ) | ||
.parse( process.argv ); | ||
if( !program.args || program.args.length === 0 ){ | ||
console.log( "<commands> required"); | ||
if( !program.test && (!program.args || program.args.length === 0 )){ | ||
program.help() | ||
return; | ||
} | ||
return jlink.executeJlinkCommands( program.args, { debug: program.verbose } ) | ||
const expectedJlinkExe = jlink.jlinkexe.JLinkExe | ||
if( !await jlink.isJLinkEXEInstalled() ){ | ||
console.error(`${expectedJlinkExe} not found in path`) | ||
console.log(`Try installing the nrf command line tools, or ensure that ${expectedJlinkExe} is on your path`) | ||
console.log(`See https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools`) | ||
process.exit(1) | ||
} | ||
console.log(`${expectedJlinkExe} found in path`) | ||
if( program.test ){ | ||
process.exit(0) | ||
} | ||
return jlink.executeCommands( program.args, { debug: program.verbose } ) | ||
.catch( function( error ){ | ||
@@ -22,0 +36,0 @@ console.error( error.message ); |
( function(){ | ||
var exec = require('./exec-wrapper'); | ||
var Promise = require("bluebird"); | ||
const exec = require('./exec-wrapper'); | ||
module.exports = function( filename ){ | ||
var command; | ||
let command; | ||
@@ -16,6 +15,6 @@ if( process.platform.indexOf("win") === 0 ){ | ||
return exec.runCommand( command, [ filename ] ) | ||
.then( function( result ){ | ||
.then( result => { | ||
return( result.code === 0 ); | ||
}); | ||
}) | ||
} | ||
})(); | ||
})(); |
{ | ||
"name": "@connectedyard/node-jlink", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "jLinkexe driver for nodejs", | ||
@@ -27,10 +27,10 @@ "main": "index.js", | ||
"dependencies": { | ||
"bluebird": "^3.4.6", | ||
"commander": "^2.9.0", | ||
"lodash": "^4.17.4" | ||
"bluebird": "^3.7.2", | ||
"commander": "^7.2.0", | ||
"lodash": "^4.17.21" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.2.0", | ||
"mocha": "^8.0.1" | ||
"chai": "^4.3.4", | ||
"mocha": "^8.3.2" | ||
} | ||
} |
# node-jlink | ||
NodeJS driver for the Segger JLink command line tool, jlinkexe, including conveniences found in nrfjprog (Nordic's commandline tool for the NRF series of micro-controllers). | ||
A NodeJS alternative to nrfjprog | ||
Calls the jlinkexe cli tool for maximum compatibility. Tested on Windows, MacOSX and Raspberry Pi. | ||
This is a NodeJS driver for the Segger JLink command line tool, `jlinkexe`, | ||
including conveniences found in nrfjprog | ||
(Nordic's commandline tool for the NRF series of micro-controllers). | ||
## Command Line Usage | ||
Calls the jlinkexe cli tool for maximum compatibility. | ||
Tested on Windows, MacOS and Raspberry Pi. | ||
`npm install -g @connectedyard/node-jlink` | ||
## Getting Started | ||
### Usage | ||
First, install the [nRF Command line Tools](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools), | ||
including the jlink cli, `Jlinkexe` | ||
Then install `node-jlink` | ||
```shell | ||
npm install -g @connectedyard/node-jlink | ||
``` | ||
Test you installation | ||
```shell | ||
node-jlink -t | ||
``` | ||
### Command line Usage | ||
`Usage: node-jlink [options] <commands>` | ||
All args after options will be sent to the jlink exe as commands, followed by `exit` | ||
## Module Usage | ||
@@ -72,4 +92,12 @@ | ||
By default, the JLinkEXE command is expected to be found on the path as `jlinkexe`. The default commandline options to jlinkexe are `"-device nrf51822 -if swd -speed 4000"`. | ||
By default, the JLinkEXE command is expected to be found on the path as `jlinkexe`. | ||
The default commandline options to jlinkexe are `"-device nrf51822 -if swd -speed 4000"`. | ||
These options will be sent with every command unless `options` are passed to `executeCommands` | ||
To change these values, set `jlink.JLinkExe` and `jlink.JLinkExeOptions`. | ||
To test your executable path, call `jlink.isJLinkEXEInstalled()` or run | ||
```shell | ||
node-jlink -t | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33796
26
531
103
+ Addedcommander@7.2.0(transitive)
- Removedcommander@2.20.3(transitive)
Updatedbluebird@^3.7.2
Updatedcommander@^7.2.0
Updatedlodash@^4.17.21