Difference between revisions of "Device Provisioner"

From SEGGER Wiki
Jump to: navigation, search
(Echo())
 
(7 intermediate revisions by 2 users not shown)
Line 26: Line 26:
 
|}
 
|}
   
{{Note|Usage of the particular operations are described in the corresponding Wiki-Page (listed in the section below) for that Device/Feature.
+
{{Note|Usage of the particular operations are described in the corresponding Wiki-Page (listed in the section [[#Supported Devices and Features | Supported Devices and Features]]) for that Device/Feature.
 
}}
 
}}
  +
  +
== Demo ==
  +
The following examples are simple demonstrations of custom script function declaration and passing of parameters to those functions.
  +
===HelloWorld()===
  +
Outputs "Hello World!" to the command line. It can be executed using the following command line parameters:<br>DevPro.exe -if swd -speed 1000 -operation HelloWorld -ScriptFile <PATH_TO_SCRIPT>\DeviceProvisioner_Demo_HelloWorld.JLinkScript
  +
  +
<div class="toccolours mw-collapsible mw-collapsed" style="overflow:auto;">
  +
<div style="font-weight:bold;line-height:1.6;">[[Media:DeviceProvisioner_Demo_HelloWorld.JLinkScript| Hello World demo code]]</div>
  +
<div class="mw-collapsible-content">
  +
<syntaxhighlight lang="c" class="collapsible">
  +
int HelloWorld(void) {
  +
JLINK_SYS_Report("Hello World!");
  +
return 0;
  +
}
  +
</syntaxhighlight>
  +
</div></div>
  +
  +
===Add()===
  +
Takes two parameters, adds them together and outputs the result. It can be executed using the following command line parameters:<br>DevPro.exe -if swd -speed 1000 -operation Add -SetConfigVal a=5 -SetConfigVal b=3 -ScriptFile <PATH_TO_SCRIPT>\DeviceProvisioner_Demo_Add.JLinkScript
  +
  +
<div class="toccolours mw-collapsible mw-collapsed" style="overflow:auto;">
  +
<div style="font-weight:bold;line-height:1.6;">[[Media:DeviceProvisioner_Demo_Add.JLinkScript| Add demo code]]</div>
  +
<div class="mw-collapsible-content">
  +
<syntaxhighlight lang="c" class="collapsible">
  +
int Add(void) {
  +
U32 a;
  +
U32 b;
  +
U32 c;
  +
int r;
  +
//
  +
// Get input parameters
  +
//
  +
r = JLINK_GetConfigValue("a", &a);
  +
if (r < 0) {
  +
JLINK_SYS_Report("Error! Parameter a not specified");
  +
return -1;
  +
}
  +
r = JLINK_GetConfigValue("b", &b);
  +
if (r < 0) {
  +
JLINK_SYS_Report("Error! Parameter b not specified");
  +
return -1;
  +
}
  +
//
  +
// Output input parameters
  +
//
  +
JLINK_SYS_Report1("Input parameter a=", a);
  +
JLINK_SYS_Report1("Input parameter b=", b);
  +
//
  +
// Add parameters
  +
//
  +
c = a + b;
  +
//
  +
// Output result
  +
//
  +
JLINK_SYS_Report1("a+b = ", c);
  +
return 0;
  +
}
  +
</syntaxhighlight>
  +
</div></div>
  +
  +
===Echo()===
  +
Takes one input string and outputs it. It can be executed using the following command line parameters:<br>DevPro.exe -if swd -speed 1000 -operation Echo -SetConfigVal "Input=This is an input string" -ScriptFile <PATH_TO_SCRIPT>\DeviceProvisioner_Demo_Echo.JLinkScript
  +
  +
<div class="toccolours mw-collapsible mw-collapsed" style="overflow:auto;">
  +
<div style="font-weight:bold;line-height:1.6;">[[Media:DeviceProvisioner_Demo_Echo.JLinkScript| Echo demo code]]</div>
  +
<div class="mw-collapsible-content">
  +
<syntaxhighlight lang="c" class="collapsible">
  +
int Echo(void) {
  +
U8 Input[256];
  +
int r;
  +
//
  +
// Get input string
  +
//
  +
r = JLINK_GetConfigData("Input", &Input[0], 256);
  +
if (r < 0) {
  +
JLINK_SYS_Report("Error! DataFile not specified");
  +
return -1;
  +
}
  +
//
  +
// Output string
  +
//
  +
JLINK_SYS_Report(&Input[0]);
  +
return 0;
  +
}
  +
</syntaxhighlight>
  +
</div></div>
  +
  +
== Additional features ==
  +
=== V7.96a ===
  +
==== Script file search sequence====
  +
If a script file is not specified with a absolute path, that file will be searched in the following order:<br>
  +
1) In the current working directory<br>
  +
2) In the "Script" folder relative to Device Provisioner executable path (Default script files)<br>
   
 
== Example Output ==
 
== Example Output ==
   
C:\> DevPro -operation DbgAuthDiscover -if SWD -speed 4000 -ScriptFile "C:\Program Files\SEGGER\JLink\Script\PCode_DevPro_ST_STM32H5.pex"
+
C:\> DevPro -operation DbgAuthDiscover -if SWD -speed 4000 -ScriptFile PCode_DevPro_ST_STM32H5.pex
 
SEGGER Device Provisioner V7.96
 
SEGGER Device Provisioner V7.96
 
Compiled Mar 7 2024 16:48:58
 
Compiled Mar 7 2024 16:48:58
Line 37: Line 130:
 
'q' to quit '?' for help
 
'q' to quit '?' for help
 
 
Command line: -operation DbgAuthDiscover -if SWD -speed 4000 -ScriptFile C:\Program Files\SEGGER\JLink\Script\PCode_DevPro_ST_STM32H5.pex
+
Command line: -operation DbgAuthDiscover -if SWD -speed 4000 -ScriptFile PCode_DevPro_ST_STM32H5.pex
 
J-Link log: Found device with ID: 0x00000474
 
J-Link log: Found device with ID: 0x00000474
 
J-Link log: Product state:
 
J-Link log: Product state:
Line 50: Line 143:
 
! colspan="3" | ST Microelectronics
 
! colspan="3" | ST Microelectronics
 
|-
 
|-
| [[#ST_STM32H5 | STM32H5]] || [[#STM32H5_Security_Product_Lifecycle | STM32H5 Security Product Lifecycle]] || STM32H5 Security Product Lifecycle management:<br>debug authentication, data provisioning, device regression, product state transitions.
+
| [[ST_STM32H5 | STM32H5]] || [[STM32H5_Security_Product_Lifecycle | STM32H5 Security Product Lifecycle]] || STM32H5 Security Product Lifecycle management:<br>debug authentication, data provisioning, device regression, product state transitions.
 
|-
 
|-
 
|}
 
|}

Latest revision as of 10:50, 24 April 2024

The Device Provisioner (DevPro) is a command line utility that supports provisioning of target devices (debug authentication, lifecycle management, ...).

Availability

DevPro is part of the J-Link software package and Flasher software package since V7.96.
It can be used with J-Link, J-Trace and Flasher probes/programmers.

Usage

DevPro [options] script-file
Option Default Description
-if SWD/JTAG Not set Select SWD or JTAG as target interface.
-speed n Not set Set interface speed to n kHz.
-operation Name Not set Perform an operation from a script file.
-SetConfigVal "Name=Value" Not set Set a parameter for an operation.
-ScriptFile Filename.pex Not set Set a script file to be executed.
Note:

Usage of the particular operations are described in the corresponding Wiki-Page (listed in the section Supported Devices and Features) for that Device/Feature.

Demo

The following examples are simple demonstrations of custom script function declaration and passing of parameters to those functions.

HelloWorld()

Outputs "Hello World!" to the command line. It can be executed using the following command line parameters:
DevPro.exe -if swd -speed 1000 -operation HelloWorld -ScriptFile <PATH_TO_SCRIPT>\DeviceProvisioner_Demo_HelloWorld.JLinkScript

int HelloWorld(void) {
  JLINK_SYS_Report("Hello World!");
  return 0;
}

Add()

Takes two parameters, adds them together and outputs the result. It can be executed using the following command line parameters:
DevPro.exe -if swd -speed 1000 -operation Add -SetConfigVal a=5 -SetConfigVal b=3 -ScriptFile <PATH_TO_SCRIPT>\DeviceProvisioner_Demo_Add.JLinkScript

int Add(void) {
  U32 a;
  U32 b;
  U32 c;
  int r;
  //
  // Get input parameters
  //
  r = JLINK_GetConfigValue("a", &a);
  if (r < 0) {
    JLINK_SYS_Report("Error! Parameter a not specified");
    return -1;
  }
  r = JLINK_GetConfigValue("b", &b);
  if (r < 0) {
    JLINK_SYS_Report("Error! Parameter b not specified");
    return -1;
  }
  //
  // Output input parameters
  //
  JLINK_SYS_Report1("Input parameter a=", a);
  JLINK_SYS_Report1("Input parameter b=", b);
  //
  // Add parameters
  //
  c = a + b;
  //
  // Output result
  //
  JLINK_SYS_Report1("a+b = ", c);  
  return 0;
}

Echo()

Takes one input string and outputs it. It can be executed using the following command line parameters:
DevPro.exe -if swd -speed 1000 -operation Echo -SetConfigVal "Input=This is an input string" -ScriptFile <PATH_TO_SCRIPT>\DeviceProvisioner_Demo_Echo.JLinkScript

int Echo(void) {
  U8  Input[256];
  int r;
  //
  // Get input string
  //
  r = JLINK_GetConfigData("Input", &Input[0], 256);
  if (r < 0) {
    JLINK_SYS_Report("Error! DataFile not specified");
    return -1;
  }
  //
  // Output string
  //
  JLINK_SYS_Report(&Input[0]);  
  return 0;
}

Additional features

V7.96a

Script file search sequence

If a script file is not specified with a absolute path, that file will be searched in the following order:
1) In the current working directory
2) In the "Script" folder relative to Device Provisioner executable path (Default script files)

Example Output

C:\> DevPro -operation DbgAuthDiscover -if SWD -speed 4000 -ScriptFile PCode_DevPro_ST_STM32H5.pex
SEGGER Device Provisioner V7.96
Compiled Mar  7 2024 16:48:58

'q' to quit '?' for help

Command line: -operation DbgAuthDiscover -if SWD -speed 4000 -ScriptFile PCode_DevPro_ST_STM32H5.pex
J-Link log: Found device with ID: 0x00000474
J-Link log: Product state:
J-Link log: OPEN

Supported Devices and Features

The following table lists supported devices and features.

Supported Devices Supported features Description
ST Microelectronics
STM32H5 STM32H5 Security Product Lifecycle STM32H5 Security Product Lifecycle management:
debug authentication, data provisioning, device regression, product state transitions.