Difference between revisions of "J-Run"

From SEGGER Wiki
Jump to: navigation, search
(Usage)
(Usage)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  +
J-Run is a command line utility for automated tests.
J-Run is a test tool to automatically run an application on a target device and receive its terminal output.
 
  +
It loads an application (elf) file to the device under test, runs it, and captures the application's output.
   
https://blog.segger.com/j-run-automating-performance-tests
+
The origin on J-Run is described in this blog post: https://blog.segger.com/j-run-automating-performance-tests
   
  +
== Test Applications ==
  +
J-Run supports any ARM and RISC-V device which is supported by J-Link, and elf output from most toolchains.
   
  +
The test application can do standard printf-style debug output to the debugger.
  +
J-Run supports handling of [[RTT]] and [[Semihosting]].
  +
  +
When the test application is finished, it can call the semihosting exit operation or print the wildcard exit string (by default "STOP"),
  +
to exit the J-Run test.
  +
  +
The target output is printed to the terminal. It can be redirected to a file or application for further analysis.
   
 
== Usage ==
 
== Usage ==
Line 10: Line 20:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
  +
! Option !! Default !! Description
! Option
 
! Alias
 
! Default
 
! Description
 
 
|-
 
|-
| -d ''str''
 
| --device ''str''
 
| STM32F407IE
 
| Set device name to "str".
 
 
|-
 
|-
  +
| --usb ''SerialNo'' || Not set || Connect to J-Link with SN "SerialNo" via USB.
| --if ''SWD/JTAG''
 
|
 
| SWD
 
| Select SWD or JTAG as target interface.
 
 
|-
 
|-
  +
| --ip ''sIP'' || Not set || Connect to J-Link with IP "sIP" via IP.
| --speed ''n''
 
|
 
| 4000
 
| Set interface speed to n kHz.
 
 
|-
 
|-
  +
| --device ''str'' || STM32F407IE || Set device name to "str".
| --rtt
 
|
 
| Auto
 
| Force RTT enabled.
 
 
|-
 
|-
  +
| -if ''SWD/JTAG'' || SWD || Select SWD or JTAG as target interface.
| --nortt
 
|
 
| Auto
 
| Force RTT disabled.
 
 
|-
 
|-
  +
| -speed ''n'' || 4000 || Set interface speed to n kHz.
| --sh
 
|
 
| Auto
 
| Force semihosting enabled.
 
 
|-
 
|-
  +
| --rtt || Auto || Force RTT enabled.
| --nosh
 
|
 
| Auto
 
| Force semihosting disabled.
 
 
|-
 
|-
  +
| --nortt || Auto || Force RTT disabled.
| -x ''str''
 
| --exit ''str''
 
| *STOP*
 
| Set exit wildcard to "str".
 
 
|-
 
|-
  +
| --semihost || Auto || Force semihosting enabled.
| --quit
 
|
 
| On
 
| Automatically exit J-Run on application exit.
 
 
|-
 
|-
  +
| --nosemihost || Auto || Force semihosting disabled.
| --wait
 
|
 
| Off
 
| Wait for key press on application exit.
 
 
|-
 
|-
  +
| --exit ''str'' || *STOP* || Set exit wildcard to "str".
| -2
 
| --stderr
 
| Off
 
| Also send target output to stderr.
 
 
|-
 
|-
  +
| --quit || On || Automatically exit J-Run on application exit.
| -s
 
| --silent
 
| Off
 
| Work silently.
 
 
|-
 
|-
  +
| --wait || Off || Wait for key press on application exit.
| -v
 
  +
|-
| --verbose
 
  +
| --stderr || Off || Also send target output to stderr.
| Off
 
  +
|-
| Increase verbosity.
 
  +
| --jlinkscriptfile ''Path'' || Not set || Set path of J-Link script file to use to "Path". Further info: [[J-Link script files]]
  +
|-
  +
| --silent || Off || Work silently.
  +
|-
  +
| --verbose || Off || Increase verbosity.
  +
|-
  +
| --dryrun || Off || Dry run. Parse elf-file only.
 
|}
 
|}
   
 
== Example Output ==
 
== Example Output ==
   
C:> jrun SEGGER_RTT_JRun_Demo.elf
+
C:> jrun --wait JRun_Demo.elf
  +
J-Run compiled Aug 15 2019 12:09:19
 
(c) 2018 SEGGER Microcontroller GmbH www.segger.com
+
(c) 2018-2019 SEGGER Microcontroller GmbH www.segger.com
  +
J-Run compiled Mar 19 2018 10:31:28
 
 
 
Open application...OK
 
Open application...OK
Set target device to MK66FN2M0xxx18...OK
+
Set target device to STM32F407IE...OK
 
Select SWD interface...OK
 
Select SWD interface...OK
 
Set interface speed to 4000 kHz...OK
 
Set interface speed to 4000 kHz...OK
 
Reset target...OK
 
Reset target...OK
Download 00000000-0000234F...OK
+
Download 08000000-08002E19...OK
  +
SEGGER_SEMIHOST_DebugHalt found at 0x08000734
Download 00002350-00002397...OK
 
Set RTT control block at 0x20002090...OK
 
 
Start target application...OK
 
Start target application...OK
  +
Reading output from target until exit command.
Start RTT...OK
 
  +
==============================================
Read terminal data...
 
  +
 
 
SEGGER J-Run demo.
 
SEGGER J-Run demo.
 
 
 
Took 2582433 cycles
 
Took 2582433 cycles
  +
 
  +
J-Run finished. Press any key to exit.
 
C:> _
 
C:> _
   
C:> jrun --silent SEGGER_RTT_JRun_Demo.elf
+
C:> jrun --silent JRun_Demo.elf
 
SEGGER J-Run demo.
 
SEGGER J-Run demo.
 
 
 
Took 2582433 cycles
 
Took 2582433 cycles
 
 
C:> _
 
C:> _

Latest revision as of 14:38, 29 June 2022

J-Run is a command line utility for automated tests. It loads an application (elf) file to the device under test, runs it, and captures the application's output.

The origin on J-Run is described in this blog post: https://blog.segger.com/j-run-automating-performance-tests

Test Applications

J-Run supports any ARM and RISC-V device which is supported by J-Link, and elf output from most toolchains.

The test application can do standard printf-style debug output to the debugger. J-Run supports handling of RTT and Semihosting.

When the test application is finished, it can call the semihosting exit operation or print the wildcard exit string (by default "STOP"), to exit the J-Run test.

The target output is printed to the terminal. It can be redirected to a file or application for further analysis.

Usage

JRun [options] elf-file
Option Default Description
--usb SerialNo Not set Connect to J-Link with SN "SerialNo" via USB.
--ip sIP Not set Connect to J-Link with IP "sIP" via IP.
--device str STM32F407IE Set device name to "str".
-if SWD/JTAG SWD Select SWD or JTAG as target interface.
-speed n 4000 Set interface speed to n kHz.
--rtt Auto Force RTT enabled.
--nortt Auto Force RTT disabled.
--semihost Auto Force semihosting enabled.
--nosemihost Auto Force semihosting disabled.
--exit str *STOP* Set exit wildcard to "str".
--quit On Automatically exit J-Run on application exit.
--wait Off Wait for key press on application exit.
--stderr Off Also send target output to stderr.
--jlinkscriptfile Path Not set Set path of J-Link script file to use to "Path". Further info: J-Link script files
--silent Off Work silently.
--verbose Off Increase verbosity.
--dryrun Off Dry run. Parse elf-file only.

Example Output

C:> jrun --wait JRun_Demo.elf
J-Run compiled Aug 15 2019 12:09:19
(c) 2018-2019 SEGGER Microcontroller GmbH    www.segger.com

Open application...OK
Set target device to STM32F407IE...OK
Select SWD interface...OK
Set interface speed to 4000 kHz...OK
Reset target...OK
Download 08000000-08002E19...OK
SEGGER_SEMIHOST_DebugHalt found at 0x08000734
Start target application...OK
Reading output from target until exit command.
==============================================

SEGGER J-Run demo.
 
Took 2582433 cycles

J-Run finished. Press any key to exit.
C:> _
C:> jrun --silent JRun_Demo.elf
SEGGER J-Run demo.
 
Took 2582433 cycles
C:> _