14.4.2 Secure SAM-BA Monitor

Secure SAM-BA Monitor restricts the number of supported commands compared to the non-secure SAM-BA Monitor. Direct read and write access to the system memory is now discarded and new commands are introduced to help the user configure the Secure boot mode.

Note that the syntax of commands differs from that of the non-secure SAM-BA Monitor.

Commands are the only transfers using the raw text format. All other transfers, including replies and payloads, use the Xmodem protocol.

The syntax for Secure SAM-BA Monitor commands is:

command ::= op_code “,” address “,” length “,” id “,” rw “#”

op_code ::= “RVER” | “WCKY” | “SAPT” | “SMBX” | “RMBX” | “EAPP” | “SFIL” | “RFIL” | “SJTD” | “CRST” | “SSEC” | “SSNM”

address ::= hex_value

length ::= hex_value

id ::= hex_value

rw ::= hex_value

hex_value ::= [ hex_digit ] | hex_digit hex_value

hex_digit ::= “0” | “1” | “2” | “3” | “4” | “5” | “6” | “7” | “8” | “9” | “A” | “B” | “C” | “D” | “E” | “F” | “a” | “b” | “c” | “d” | “e” | “f”

The op_code parameter is always a string of four upper-case letters. The address and length parameters must not exceed eight hexadecimal digits.

The id and rw parameters are not used but kept for backward compatibility purpose. They should be left empty.

Depending on the command, a data payload can be added after the command. In this case, the payload must be sent after the Secure SAM-BA Monitor has acknowledged the command and communicated how the data payload must be split (size of the payload).

The following array lists all supported commands and their expected parameters:

op_codeaddresslengthDescriptionExamples
RVER__Read the ROM code version stringRVER,,,,#
WCKY_XWrite the payload of the length-byte Customer Key message into page 0 and page 1 of the User Signature Block 0.WCKY,,C0,,#
SAPT_XSend a length-byte Secure SAM-BA applet into the internal SRAM0.SAPT,,13D0,,#
SMBX_XSend the 128-byte applet mailbox into the internal SRAM0.SMBX,,80,,#
RMBX__Received the 128-byte applet mailbox from internal SRAM0RMBX,,,,#
EAPP__Execute the Secure SAM-BA applet previously loaded with the SAPT commandEAPP,,,,#
SFILXXSend a length-byte file to later program it at the address offset in some applet-dependent memorySFIL,2000,400,,#
RFILXXReceive a length-byte file from the address offset in some applet-dependent memoryRFIL,2000,400,,#
SJTD__Set the ‘SECURITY’ bit in GPNVM to persistently disable JTAG and Debug portsSJTD,,,,#
CRST__Chip ResetCRST,,,,#
SSEC__Set the boot mode to Secure Boot (with fallback to Secure SAM-BA Monitor) for further power-on/resetsSSEC,,,,#
SSNM__Set the boot mode to Secure Boot (Secure SAM-BA Monitor disabled) for further power-on/resetsSSNM,,,,#

There are three types of Secure SAM-BA command replies. The first type is used as a Command ACKnowledge for all but EAPP and SVER commands. In this case, the syntax of the reply is:

reply ::= “CACK,” errcode “,” length “#” [ payload ]

errcode ::= hex_value

length ::= hex_value

hex_value ::= [ hex_digit ] | hex_digit hex_value

hex_digit ::= “0” | “1” | “2” | “3” | “4” | “5” | “6” | “7” | “8” | “9” | “A” | “B” | “C” | “D” | “E” | “F” | “a” | “b” | “c” | “d” | “e” | “f”

payload ::= [ BYTE ]| BYTE payload

The second type replies to EAPP (Execute APPlet) commands. The syntax of this reply is the same as the first type except that “CACK” is replaced by “ASTA”, which stands for Applet STAtus.

Finally, the third type replies to RVER (Read VERsion) commands. . The syntax of this reply is the same as the first type except that “CACK” is replaced by “SVER”, which stands for Send VERsion.

Table 14-4. List of errcode
Hexadecimal ValueDescription
00000000No error
FFFFFFFDBad value for address argument
FFFFFFFCBad value for length argument
FFFFFFF9Bad op_code
FFFFFFF8Bad customer key length
FFFFFFF6The customer key has already been written
FFFFFFF5AES-256-CMAC error
FFFFFFF4AES-256-CBC error
FFFFFFF3Key expansion error
FFFFFFF0SEFC UID read error
FFFFFFEDSEFC write error
FFFFFFE7Data transfer error
FFFFFFE6Invalid argument (payload)