Runner
The runner is suitable for integration in a CI/CD environment like CTest.
./LinkServer run [OPTIONS] DEVICE FILE can be used to load, start execution, send input, and monitor output of applications for testing purposes without GDB.
FILE is a path to an ELF (.axf|.elf), HEX (.hex), SREC (.s19|.s28|.s37|.srec), or binary (any other extension, if not detected as one of the other types) file. In the case of a binary file, the --addr option must also be supplied.
The output of the test application (either via semihosting or UART port) is captured and printed on the console. Termination is determined based on a configurable exit marker printed by the application, or based on an exit system call (for semihosting only). Any (interactive) user input into the console is made available to the standard input of the application. It is also possible to specify as a command-line option some predetermined text input to be passed to the standard input of the application. The output can be checked against specified pass and/or fail markers and the return code is set accordingly. If the specified fail string is detected, the return code is set to nonzero. Similarly, if the specified pass string is not detected, the return code is set to nonzero. An optional timeout can be specified to limit the time the output is being monitored after loading the application. Use value 0 to exit immediately after loading and sending any predetermined input. The return code is not modified when the timeout expires.
The relevant options are:
--mode: I/O mode:semihostorserial:PORTNAME:BAUDRATE--send TEXT: Send (predetermined) input to application--args-mark TEXT: Marker to wait for before sending input to the application; if not specified the input is sent immediately after starting the application--exit-mark TEXT: Marker to detect application termination [default: *STOP*]--pass-mark TEXT: Pass string - if specified the output is checked against it; the return code is set to 0 if detected, nonzero otherwise--fail-mark TEXT: Fail string - if specified the output is checked against it; the return code is set to nonzero if detected, 0 otherwise--exit-timeout INTEGER: Timeout (seconds) to wait for application termination (return code is not changed based on expiration)--pause: Pause for key press on exit
The run command supports several common connection options (for example: DEVICE, --probe), with the same meaning
as for the gdbserver command.
Note: The connection options for the run command must be supplied before DEVICE.
The --log-level option controls the amount of information displayed on the console: at level 3 and below, only the application output is shown; level 5 includes extended information suitable for debugging purposes only. If not set, the logging level defaults to 4.
Use ./LinkServer help run for more information and options.
Examples:
Run an ELF application by using semihosting I/O, connect via probe #1 and pass “test=2” to the application.
./LinkServer run --probe #1 --mode semihost --send "test=2" --args-mark "*ARGS*" k64fn:frdm hello_world.axfRun a SREC application and capture its output using /dev/ttyACM0 serial port; use the ***DONE*** marker to indicate termination. Since no probe is specified, it assumes that there is only one probe connected.
./LinkServer run LPC55S36 --mode serial:/dev/ttyACM0:115200 --exit-mark "***DONE***" test_app.s19Run a binary application at 0x0 address using semihosting I/O; check output for *** FAILED *** marker and set the return code accordingly.
./LinkServer run LPC55S16 --fail-mark "*** FAILED ***" test_app.bin --addr 0x0Run an application and exit immediately (don’t wait for markers).
./LinkServer run MCXN947 test.elf --exit-timeout 0