mspdebug(1) | General Commands Manual | mspdebug(1) |
NAME¶
MSPDebug - debugging tool for MSP430 MCUsSYNOPSIS¶
mspdebug [options] driver [command ...]DESCRIPTION¶
MSPDebug is a command-line tool designed for debugging and programming the MSP430 family of MCUs. It supports the eZ430-F2013, eZ430-RF2500, Launchpad, Chronos, FET430UIF, Olimex MSP430-JTAG-TINY and MSP430-JTAG-ISO programming tools, as well as a simulation mode.COMMAND-LINE OPTIONS¶
Command-line options accepted by MSPDebug are described below. If commands are specified on the end of the command-line, then they are executed after connecting to the device, and the interactive prompt is not started. Please be aware that commands consisting of multiple words need to be enclosed in quotation marks, otherwise they are treated as single commands. Thus the common prog command would be used as "prog main.elf". See the section labelled COMMANDS for more information.- -q
- Start in quiet mode. See the "quiet" option described below.
- -v voltage
- Set the programming voltage. The voltage should be specified as an integer in millivolts. It defaults to 3000 (3.0 V).
- -j
- Use JTAG instead of Spy-Bi-Wire to communicate with the MSP430. This option doesn't work with eZ430 or eZ430-RF2500 devices, which support Spy-Bi-Wire only.
- -d device
- Specify that the driver should connect via a tty device rather than USB. The supported connection methods vary depending on the driver. See the section DRIVERS below for details.
- -U bus:device
- Specify a particular USB device to connect to. Without this option, the first device of the appropriate type is opened.
- -s serial
- Specify a particular USB device serial number to connect to. Use this option to distinguish between multiple devices of the same type.
- -n
- Do not process the startup file (~/.mspdebug).
- --long-password
- When using the flash-bsl driver, send a 32-byte BSL password instead of the standard 16-byte password.
- --help
- Display a brief help message and exit.
- --fet-list
- Display a list of chips supported by the FET driver (the driver used for UIF, RF2500 and Olimex devices)>
- --fet-force-id string
- When using a FET device, force the connected chip to be recognised by MSPDebug as one of the given type during initialization. This overrides the device ID returned by the FET. The given string should be a chip name in long form, for example "MSP430F2274".
- --usb-list
- List available USB devices and exit.
- --force-reset
- When using a FET device, always send a reset during initialization. By default, an initialization without reset will be tried first.
- --allow-fw-update
- When using a V3 FET device via the TI library, allow the library to perform a firmware update if the FET firmware is incompatible with the library.
- --require-fw-update image.txt
- When using a V3 FET device, force a firmware update using the given firmware image. The firmware file must be in TI Text format.
- --version
- Show program version and copyright information.
DRIVERS¶
A driver name must be specified on the command line for MSPDebug to connect to. Valid driver names are listed here.- rf2500
- Connect to an eZ430-RF2500, Launchpad or Chronos device. Only USB connection is supported.
- olimex
- Connect to an Olimex MSP-JTAG-TINY device. Both USB and tty access are supported.
- olimex-v1
- Connect to an Olimex MSP-JTAG-TINY (V1) device. Both USB and tty access are supported. This driver must be used instead of olimex if connecting to a V1 device via a tty interface.
- olimex-iso
- Connect to an Olimex MSP-JTAG-ISO device. Both USB and tty access are supported.
- sim
- Do not connect to any hardware device, but instead start in
simulation mode. A 64k buffer is allocated to simulate the device memory.
- uif
- Connect to an eZ430-F2013 or a FET430UIF device. The device
argument should be the filename of the appropriate tty device. The TI
serial converter chips on these devices are supported by newer versions of
the Linux kernel, and should appear as /dev/tty XX when attached.
- uif-bsl
- Connect to the bootloader on a FET430UIF device. These
devices contain MSP430F1612 chips. By sending a special command sequence,
you can obtain access to the bootloader and inspect memory on the
MSP430F1612 in the programming device itself.
- flash-bsl
- Connect to the built-in bootloader in MSP430 devices with
flash bootloader memory. Devices with ROM bootloaders require another
driver. Currently, this driver must mass-erase the device in order to gain
access. Read, write, and erase operations are supported.
- gdbc
- GDB client mode. Connect to a server which implements the GDB remote protocol and provide an interface to it. To use this driver, specify the remote address in hostname:port format using the -d option.
- tilib
- Use the Texas Instruments MSP430.DLL to access the device.
The library file (MSP430.DLL for Windows, libmsp430.so for Unix-like
systems) must be present in the dynamic loader search path.
COMMANDS¶
MSPDebug can accept commands either through an interactive prompt, or non-interactively when specified on the command line. The supported commands are listed below.- = expression
- Evaluate an address expression and show both its value, and
the result when the value is looked up in reverse in the current symbol
table. This result is of the form symbol+offset, where
symbol is the name of the nearest symbol not past the address in
question.
- alias
- Show a list of defined command aliases.
- alias name
- Remove a previously defined command alias.
- alias name command
- Define a command alias. The text command will be substituted for name when looking up commands. The given command text may contain a command plus arguments, if the entire text is wrapped in quotes when defining the alias. To avoid alias substitution when interpreting commands, prefix the command with \ (a backslash character).
- break
- Show a list of active breakpoints. Breakpoints can be added and removed with the setbreak and delbreak commands. Each breakpoint is numbered with an integer index starting at 0.
- cgraph address length [address]
- Construct the call graph of all functions contained or
referenced in the given range of memory. If a particular function is
specified, then details for that node of the graph are displayed.
Otherwise, a summary of all nodes is displayed.
- delbreak [index]
- Delete one or all breakpoints. If an index is given, the selected breakpoint is deleted. Otherwise, all breakpoints are cleared.
- dis address [length]
- Dissassemble a section of memory. Both arguments may be
address expressions. If no length is specified, a section of the default
length (64 bytes) is disassembled and shown.
- erase [all|segment] [address]
- Erase the device under test. With no arguments, all code
memory is erased (but not information or boot memory). With the argument
"all", a mass erase is performed (the results may depend on the
state of the LOCKA bit in the flash memory controller).
- exit
- Exit from MSPDebug.
- gdb [port]
- Start a GDB remote stub, optionally specifying a TCP port
to listen on. If no port is given, the default port is 2000.
- help [command]
- Show a brief listing of available commands. If an argument is specified, show the syntax for the given command. The help text shown when no argument is given is also shown when MSPDebug starts up.
- hexout address length filename
- Read the specified section of the device memory and save it
to an Intel HEX file. The address and length arguments may both be address
expressions.
- isearch address length [options ...]
- Search over the given range for an instruction which matches the specified search criteria. The search may be narrowed by specifying one or more of the following terms:
- opcode opcode
- Match the specified opcode. Byte/word specifiers are not recognised, as they are specified with other options.
- byte
- Match only byte operations.
- word
- Match only word operations.
- aword
- Match only address-word (20-bit) operations.
- jump
- Match only jump instructions (conditional and unconditional jumps, but not instructions such as BR which load the program counter explicitly).
- single
- Match only single-operand instructions.
- double
- Match only double-operand instructions.
- noarg
- Match only instructions with no arguments.
- src address
- Match instructions with the specified value in the source operand. The value may be given as an address expression. Specifying this option implies matching of only double-operand instructions.
- dst address
- Match instructions with the specified value in the destination operand. This option implies that no-argument instructions are not matched.
- srcreg register
- Match instructions using the specified register in the source operand. This option implies matching of only double-operand instructions.
- dstreg register
- Match instructions using the specified register in the destination operand. This option implies that no-argument instructions are not matched.
- srcmode mode
- Match instructions using the specified mode in the source operand. See below for a list of modes recognised. This option implies matching of only double-operand instructions.
- dstmode mode
- Match instructions using the specified mode in the destination operand. See below for a list of modes. This option implies that no-argument instructions are not matched.
- For single-operand instructions, the operand is considered
to be the destination operand.
- R
- Register mode.
- I
- Indexed mode.
- S
- Symbolic mode.
- &
- Absolute mode.
- @
- Register-indirect mode.
- +
- Register-indirect mode with auto-increment.
- #
- Immediate mode.
- load filename
- Program the device under test using the binary file
supplied. This command is like prog, but it does not load symbols
or erase the device before programming.
- locka [set|clear]
- Show or change the status of the LOCKA bit in the chip's
memory controller. The LOCKA bit is set on POR and acts as a write-protect
bit for info segment A. This segment contains factory-configured
calibration data, and under normal circumstances, should not be changed.
- md address [length]
- Read the specified section of device memory and display it
as a canonical-style hexdump. Both arguments may be address expressions.
If no length is specified, a section of the default length (64 bytes) is
shown.
- mw address bytes ...
- Write a sequence of bytes at the given memory address. The
address given may be an address expression. Bytes values are two-digit
hexadecimal numbers separated by spaces.
- opt [name] [value]
- Query, set or list option variables. MSPDebug's behaviour
can be configured using option variables, described below in the section
OPTIONS.
- prog filename
- Erase and reprogram the device under test using the binary
file supplied. The file format will be auto-detected and may be any of the
supported file formats.
- read filename
- Read commands from the given file, line by line and process each one. Any lines whose first non-space character is # are ignored. If an error occurs while processing a command, the rest of the file is not processed.
- regs
- Show the current value of all CPU registers in the device under test.
- reset
- Reset (and halt) the CPU of the device under test.
- run
- Start running the CPU. The interactive command prompt is
blocked when the CPU is started and the prompt will not appear again until
the CPU halts. The CPU will halt if it encounters a breakpoint, or if
Ctrl-C is pressed by the user.
- set register value
- Alter the value of a register. Registers are specified as numbers from 0 through 15. Any leading non-numeric characters are ignored (so a register may be specified as, for example, "R12"). The value argument is an address expression.
- setbreak address [index]
- Add a new breakpoint. The breakpoint location is an address expression. An optional index may be specified, indicating that this new breakpoint should overwrite an existing slot. If no index is specified, then the breakpoint will be stored in the next unused slot.
- simio add class name [args ...]
- Add a new peripheral to the IO simulator. The class
parameter may be any of the peripheral types named in the output of the
simio classes command. The name parameter is a unique name
assigned by the user to this peripheral instance, and is used with other
commands to refer to this instance of the peripheral.
- simio classes
- List the names of the different types of peripherals which may be added to the simulator. You can use the simio help command to obtain more information about each peripheral type.
- simio config name param [args ...]
- Configure or perform some action on a peripheral instance. The param argument is specific to the peripheral type. A list of valid configuration commands can be obtained by using the simio help command.
- simio del name
- Remove a previously added peripheral instance. The name argument should be the name of the peripheral that was assigned with the simio add command.
- simio devices
- List all peripheral instances currently attached to the simulator, along with their types and interrupt status. You can obtain more detailed information for each instance with the simio info command.
- simio help class
- Obtain more information about a peripheral class. The documentation given will list constructor arguments and configuration parameters for the device type.
- simio info name
- Display detailed status information for a particular peripheral. The type of information displayed is specific to each type of peripheral.
- step [count]
- Step the CPU through one or more instructions. After
stepping, the new register values are displayed, as well as a disassembly
of the instructions at the address selected by the program counter.
- sym clear
- Clear the symbol table, deleting all symbols.
- sym set name value
- Set or alter the value of a symbol. The value given may be an address expression.
- sym del name
- Delete the given symbol from the symbol table.
- sym import filename
- Load symbols from the specified file and add them to the
symbol table. The file format will be auto-detected and may be either
ELF32 or a BSD-style symbol listing (like the output from nm(1)).
- sym import+ filename
- This command is similar to sym import, except that the symbol table is not cleared first. By using this command, symbols from multiple sources can be combined.
- sym export filename
- Save all symbols currently defined to the given file. The symbols are saved as a BSD-style symbol table. Note that symbol types are not stored by MSPDebug, and all symbols are saved as type t.
- sym find [regex]
- Search for symbols. If a regular expression is given, then all symbols matching the expression are printed. If no expression is specified, then the entire symbol table is listed.
- sym rename regex string
- Rename symbols by searching for those matching the given regular expression and substituting the given string for the matched portion. The symbols renamed are displayed, as well as a total count of all symbols renamed.
SUPPORTED CHIPS¶
The following chips are supported when using FET-compatible drivers:CC430F5133 MSP430F169 MSP430F2370 MSP430F47197
MSP430F5528
CC430F5137 MSP430F2012 MSP430F247 MSP430F4784
MSP430F5529
CC430F6137 MSP430F2013 MSP430F249 MSP430F5418
MSP430FG4618
MSP430AFE253 MSP430F2121 MSP430F2616
MSP430F5437 MSP430FR5739
MSP430F1121 MSP430F2122 MSP430F2617
MSP430F5437A MSP430G2231
MSP430F1232 MSP430F2131 MSP430F2618
MSP430F5438 MSP430G2252
MSP430F147 MSP430F2132 MSP430F413 MSP430F5438A
MSP430G2452
MSP430F148 MSP430F2234 MSP430F427 MSP430F5510
MSP430G2553
MSP430F149 MSP430F2272 MSP430F4270 MSP430F5525
MSP430F1611 MSP430F2274 MSP430F449 MSP430F5526
MSP430F1612 MSP430F235 MSP430F47173
MSP430F5527
BINARY FORMATS¶
The following binary/symbol formats are supported by MSPDebug:ELF32
COFF
Intel HEX (program only)
BSD symbol table (symbols only)
TI Text (program only)
SREC (program only)
IO SIMULATOR¶
The IO simulator subsystem consists of a database of device classes, and a list of instances of those classes. Each device class has a different set of constructor arguments, configuration parameters and information which may be displayed. This section describes the operation of the available device classes in detail.- gpio
- Digital IO port simulator. This device simulates any of the digital ports with or without interrupt capability. It has the following configuration parameters:
- base address
- Set the base address for this port. Note that for ports without interrupt capability, the resistor enable port has a special address which is computable from the base address.
- irq vector
- Enable interrupt functionality for this port by specifying an interrupt vector number.
- noirq
- Disable interrupt functionality for this port.
- verbose
- Print a state change message every time the port output changes.
- quiet
- Don't print anything when the port state changes (the default).
- set pin value
- Set the input pin state for the given pin on this port. The pin parameter should be an index between 0 and 7. The value should be either zero (for a low state) or non-zero (for a high state).
- hwmult
- This peripheral simulates the hardware multiplier. It has no constructor or configuration parameters, and does not provide any extended information.
- timer [size]
- This peripheral simulators Timer_A modules, and can be used
to simulate Timer_B modules, provided that the extended features aren't
required.
- base address
- Alter the base IO address. By default, this is 0x0160. By setting this to 0x0180, a Timer_B module may be simulated.
- irq0 number
- Set the TACCR0 interrupt vector number. By default, this is interrupt vector 9. This interrupt is self-clearing, and higher priority than the TACCR1/TAIFG vector.
- irq1 number
- Set the TACCR1/TAIFG interrupt vector. By default, this is interrupt vector 8.
- iv address
- Alter the address of the interrupt vector register. By default, this is 0x012E. By setting this to 0x011E, a Timer_B module may be simulated.
- set channel value
- When Timer_A is used in capture mode, the CCI bit in each capture register reflects the state of the corresponding input pin, and can't be altered in software. This configuration command can be used to simulate changes in input pin state, and will trigger the corresponding interrupts if the peripheral is so configured.
- tracer [history-size]
- The tracer peripheral is a debugging device. It can be used
to investigate and record the IO activity of a running program, to
benchmark execution time, and to simulate interrupts.
- verbose
- Start displaying IO events as they occur, as well as recording them in the rotating buffer.
- quiet
- Stop displaying IO events as they occur, and just record them in the buffer.
- trigger irq
- Signal an interrupt request to the CPU. This request will remain raised until accepted by the CPU or cleared by the user.
- untrigger
- Clear a signalled interrupt request.
- clear
- Reset the clock cycle and instruction counts to 0, and clear the IO event history.
- wdt
- This peripheral simulates the Watchdog Timer+, which can be
used in software either as a watchdog or as an interval timer. It has no
constructor arguments.
- nmi state
- Set the NMI/RST# pin state. The argument should be zero to indicate a low state or non-zero for a high state.
- irq irq
- Select the interrupt vector for interval timer mode. The default is to use interrupt vector 10.
ADDRESS EXPRESSIONS¶
Any command which accepts a memory address, length or register value as an argument may be given an address expression. An address expression consists of an algebraic combination of values.OPTIONS¶
MSPDebug's behaviour can be configured via the following variables:- color (boolean)
- If true, MSPDebug will colorize debugging output.
- fet_block_size (numeric)
- Change the size of the buffer used to transfer memory to and from the FET. Increasing the value from the default of 64 will improve transfer speed, but may cause problems with some chips.
- gdb_loop (boolean)
- Automatically restart the GDB server after disconnection. If this option is set, then the GDB server keeps running until an error occurs, or the user interrupts with Ctrl+C.
- gdbc_xfer_size (numeric)
- Maximum size of memory transfers for the GDB client. Increasing this value will result in faster transfers, but may cause problems with some servers.
- iradix (numeric)
- Default input radix for address expressions. For address values with no radix specifier, this value gives the input radix, which is 10 (decimal) by default.
- quiet (boolean)
- If set, MSPDebug will supress most of its debug-related output. This option defaults to false, but can be set true on start-up using the -q command-line option.
ENVIRONMENT¶
- MSPDEBUG_TI3410_FW
- Specifies the location of TI3410 firmware, for raw USB access to FET430UIF or eZ430 devices. This variable should contain the path to an Intel HEX file containing suitable firmware for the TI3410.
FILES¶
- ~/.mspdebug
- File containing commands to be executed on startup.
- ti_3410.fw.ihex
- Firmware image for the TI3410 USB interface chip. This file is only required for raw USB access to FET430UIF or eZ430 devices.
SEE ALSO¶
nm(1), gdb(1), objcopy(1)BUGS¶
If you find any bugs, you should report them to the author at dlbeer@gmail.com. It would help if you could include a transcript of an MSPDebug session illustrating the program, as well as any relevant binaries or other files.COPYRIGHT¶
Copyright (C) 2009-2012 Daniel Beer <dlbeer@gmail.com>3 Mar 2012 | Version 0.19 |