Introduction
The SAM-BA® Monitor program, controlled by the SAM-BA Host application program, performs basic internal memory read, write, and execute commands. It is embedded in the ROM Boot Code of the target device (Microchip Technology ARM®-based MPU or MCU). The SAM-BA Monitor communicates with the SAM-BA Host over a serial communications link.
The SAM-BA Host to Monitor serial communications link is a dedicated serial port separate from the Target Console serial communications.
Executing Monitor Commands
SAM-BA Monitor commands can be executed from the SAM-BA Host using the -m, --monitor option.
DO NOT use the Monitor (-m, --monitor) option on the same command line with the Applet (-a, --applet) or Execute (-e, --execute) options. However, many -m, --monitor options can be passed on the same command line.
Monitor (-m, --monitor) commands depend on the selected Port (-p, --port) option. The sam-ba -p <port> -m help command will display all supported monitor commands for a given <port> connection:
$ sam-ba -p serial -m help
* read8 - read a byte
Syntax:
read8:<addr>
Example:
read8:0x200000 read a byte at address 0x200000
* read16 - read a half-word (16-bit)
Syntax:
read16:<addr>
Example:
read16:0x200000 read a half-word at address 0x200000
* read32 - read a word (32-bit)
Syntax:
read32:<addr>
Example:
read32:0x200000 read a word at address 0x200000
* read - read data into a file
Syntax:
read:<filename>:<addr>:<length>
Example:
read:test.bin:0x200000:512 read 512 bytes from address 0x200000 into file test.bin
* write8 - write a byte
Syntax:
write8:<addr>:<value>
Example:
write8:0x200000:0x12 write byte 0x12 at address 0x200000
* write16 - write a half-word (16-bit)
Syntax:
write16:<addr>:<value>
Example:
write16:0x200000:0x1234 write half-word 0x1234 at address 0x200000
* write32 - write a word (32-bit)
Syntax:
write32:<addr>:<value>
Example:
write32:0x200000:0x12345678 write word 0x12345678 at address 0x200000
* write - write data from a file
Syntax:
write:<filename>:<addr>
Example:
write:test.bin:0x200000 write data from file test.bin to address 0x200000
* execute - execute code
Syntax:
execute:<addr>
Example:
execute:0x200000 execute code at 0x200000