Introduction
SAM-BA® Applets are binary programs that are loaded and executed in the target device RAM by the SAM-BA Host program.
Applet programs are loaded and executed by the SAM-BA Host program by including the -a, --applet option on the command line:
$ sam-ba -p <port> -d <device> -a <applet>[:arg1>:<arg2>:<arg3>:…]
or
$ sam-ba -p <port> -b <board> -a <applet>[:arg1>:<arg2>:<arg3>:…]
DO NOT use the Monitor (-m, --monitor) or Scripting (-e, --execute) options on the same command line with the Applet (-a, --applet) option.
Applet programs support commands and arguments to customize their behavior. The command has the following structure:
$ sam-ba -p <port> -d <device> -a <applet> [-c <command1[:<arg1_1>:<arg1_2>:…]
More than one Applet command can be added to the command line:
$ sam-ba -p <port> -d <device> -a <applet> [-c <command1>[:<arg1_1>:<arg1_2>:…] -c <command2>[:<arg2_1>:<arg2_2>:…] -c <command3>[:<arg3_1>:<arg3_2>:…] …]
Applet Console
Applet programs provide tracing information to the Target Console (also referred to as the Applet Console). The Target Console is typically configured by the boot configuration in the target device. However, the Console can be explicitly configured by the console_instance and console_ioset arguments of the -d, --device option.
$ sam-ba -p <port> -d <device>:<console_instance>:<console_ioset>
$ sam-ba -p serial -d sama5d2:help
Syntax: sama5d2:[<instance>]:[<ioset>]
Parameters:
instance Serial console peripheral number
ioset Serial console I/O set
Examples:
sama5d2 use default device/board settings
sama5d2:1:2 use fully custom settings (peripheral number 1, I/O set 2)
sama5d2::2 use default device/board settings but force use of I/O set 2
Note:
Peripheral numbers and I/O sets are device specific. Please see device documentation in 'doc' directory.
Tracelevel Verbosity
The level of Applet Console verbosity can be controlled with the -t, --tracelevel option:
$ sam-ba -p <port> -d <device> -t n -a <applet> [-c <command1[:<arg1_1>:<arg1_2>:…]
where n specifies the level:
- 0: no trace
- 1: fatal error
- 2: error
- 3: warning
- 4: info
- 5: debug
Applets
A listing of supported Applets for a given target device can be found with the help argument:
$ sam-ba -p <port> -d <device> -a help
Applet programs can perform the following utility functions:
- Read and Write Boot Configuration (bootconfig)
- Initialize External RAM (extram)
- Enable Internal RC (internalrc)
- Initialize Device Clock Tree (lowlevel)
- Program External NAND Flash Memory (nandflash)
- Translate Bootstrap Master Image to Paired Target Device (pairingmode)
- Program External QSPI NOR Flash Memory (qspiflash)
- Read Target Device Unique ID (readuniqueid)
- Write to RESET Controller (RSTC) Control Register (CR) (reset)
- Program High Speed Multimedia Card Interface (HSMCIx) or Secure Digital Multi-Media Card (SDMMCx) (sdmcc)
- Program External SPI NOR Flash Memory (serialflash)