launch-master-page

Last modified by Microchip on 2025/07/17 12:47

In addition to the Qt5 QML language for scripting used for flashing the demos, most common SAM-BA action can be done using SAM-BA command line.

For browsing information on the SAM-BA command line usage, please see the Command Line Documentation that is available in the SAM-BA installation directory: doc/index.html or doc/cmdline.html .

SAM-BA includes command line interface that provides support for the most common actions:

  • reading / writing to arbitrary memory addresses and/or peripherals
  • uploading applets and using them to erase/read/write external memories

The command line interface is designed to be self-documenting.

The main commands can be listed using the "sam-ba --help" command:

SAM-BA Command Line Interface Tool v3.9.1 (linux - x86_64-little_endian-lp64)
Copyright 2025 Microchip Technology

Usage: sam-ba [options]

Options:
  -v, --version                             Displays version information.
  -h, --help                                Displays this help.
  -l, --loglevel <log_level[:options:...]>  Set verbose log level.
  -x, --execute <script.qml>                Execute script <script.qml>.
  -p, --port <port[:options:...]>           Communicate with device using
                                            <port>.
  -d, --device <device[:options:...]>       Connected device is <device>.
  -b, --board <board[:options:...]>         Connected board is <board>.
  -m, --monitor <command[:options:...]>     Run monitor command <command>.
  -a, --applet <applet[:options:...]>       Load and initialize applet
                                            <applet>.
  -c, --command <command[:args:...]>        Run command <command>.
  -t, --tracelevel <trace_level>            Set applet trace level to
                                            <trace_level>.
  -L, --applet-buffer-limit <SIZE>          Set applet buffer limit to <SIZE>
                                            bytes (default 131072).
  -w, --working-directory <DIR>             Set working directory to <DIR>.
  -u, --utils <tool[:args:...]>             Launch a tool <tool> .

If you get the following error, it indicates a symbol mismatch or unresolved symbol when the sam-ba executable is being loaded

$ sam-ba -v
sam-ba: symbol lookup error: sam-ba: undefined symbol: _ZdlPvm, version Qt_5

Check for Qt libraries inside the extracted SAM-BA directory.

$ cd path/to/sam-ba
$ export LD_LIBRARY_PATH=$(pwd)/lib:$LD_LIBRARY_PATH

Additional help can be obtained for most commands by supplying a "help" parameter that will display their usage.

For example "sam-ba --port help" will display:

Known ports: j-link, serial, secure

Command that take an argument with options (port, monitor, applet) will display even more documentation when called with "help" as option value.

For example "sam-ba --port serial:help" will display:

Syntax:
   serial:[<port>]:[<baudrate>]
Examples:
   serial                serial port (will use first AT91 USB if found otherwise first serial port)
   serial:COM80          serial port on COM80
   serial:ttyUSB0:57600  serial port on /dev/ttyUSB0, baudrate 57600