Added JTAG support.
This commit is contained in:
parent
98cae4abc2
commit
18af13e017
8
fet.c
8
fet.c
|
@ -15,7 +15,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* Various constants and tables come from fet430uif, written by Robert
|
* Various constants and tables come from uif430, written by Robert
|
||||||
* Kavaler (kavaler@diva.com). This is available under the same license
|
* Kavaler (kavaler@diva.com). This is available under the same license
|
||||||
* as this program, from www.relavak.com.
|
* as this program, from www.relavak.com.
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +36,7 @@ static int fet_is_rf2500;
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* FET command codes.
|
* FET command codes.
|
||||||
*
|
*
|
||||||
* These come from fet430uif by Robert Kavaler (kavaler@diva.com).
|
* These come from uif430 by Robert Kavaler (kavaler@diva.com).
|
||||||
* www.relavak.com
|
* www.relavak.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ static struct {
|
||||||
#define PTYPE_NAK 5
|
#define PTYPE_NAK 5
|
||||||
#define PTYPE_FLASH_ACK 6
|
#define PTYPE_FLASH_ACK 6
|
||||||
|
|
||||||
/* This table is taken from fet430uif */
|
/* This table is taken from uif430 */
|
||||||
static const char *error_strings[] =
|
static const char *error_strings[] =
|
||||||
{
|
{
|
||||||
"No error", // 0
|
"No error", // 0
|
||||||
|
@ -489,7 +489,7 @@ static int xfer(int command_code, const char *data, int datalen,
|
||||||
|
|
||||||
static int fet_version;
|
static int fet_version;
|
||||||
|
|
||||||
/* Reply data taken from fet430uif */
|
/* Reply data taken from uif430 */
|
||||||
#define ID_REPLY_LEN 18
|
#define ID_REPLY_LEN 18
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
|
|
20
main.c
20
main.c
|
@ -597,11 +597,14 @@ static void reader_loop(void)
|
||||||
|
|
||||||
static void usage(const char *progname)
|
static void usage(const char *progname)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: %s [-u device] [command ...]\n"
|
fprintf(stderr, "Usage: %s [-u device] [-j] [command ...]\n"
|
||||||
"\n"
|
"\n"
|
||||||
"By default, the first RF2500 device on the USB bus is opened. If -u is\n"
|
" -u device\n"
|
||||||
"given, then a UIF device attached to the specified serial port is\n"
|
" Open the given tty device (MSP430 UIF compatible devices).\n"
|
||||||
"opened.\n"
|
" -j\n"
|
||||||
|
" Use JTAG, rather than spy-bi-wire (UIF devices only).\n"
|
||||||
|
"\n"
|
||||||
|
"By default, the first RF2500 device on the USB bus is opened.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"If commands are given, they will be executed. Otherwise, an interactive\n"
|
"If commands are given, they will be executed. Otherwise, an interactive\n"
|
||||||
"command reader is started.\n",
|
"command reader is started.\n",
|
||||||
|
@ -613,6 +616,7 @@ int main(int argc, char **argv)
|
||||||
const char *uif_device = NULL;
|
const char *uif_device = NULL;
|
||||||
int opt;
|
int opt;
|
||||||
int result;
|
int result;
|
||||||
|
int want_jtag = 0;
|
||||||
|
|
||||||
puts(
|
puts(
|
||||||
"MSPDebug version 0.2 - debugging tool for the eZ430\n"
|
"MSPDebug version 0.2 - debugging tool for the eZ430\n"
|
||||||
|
@ -620,12 +624,16 @@ int main(int argc, char **argv)
|
||||||
"This is free software; see the source for copying conditions. There is NO\n"
|
"This is free software; see the source for copying conditions. There is NO\n"
|
||||||
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
|
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "u:")) >= 0)
|
while ((opt = getopt(argc, argv, "u:j")) >= 0)
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'u':
|
case 'u':
|
||||||
uif_device = optarg;
|
uif_device = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'j':
|
||||||
|
want_jtag = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -633,7 +641,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
/* Open the appropriate device */
|
/* Open the appropriate device */
|
||||||
if (uif_device)
|
if (uif_device)
|
||||||
result = uif_open(uif_device);
|
result = uif_open(uif_device, want_jtag);
|
||||||
else
|
else
|
||||||
result = rf2500_open();
|
result = rf2500_open();
|
||||||
|
|
||||||
|
|
5
uif.c
5
uif.c
|
@ -94,7 +94,7 @@ static const struct fet_transport serial_transport = {
|
||||||
.close = serial_close
|
.close = serial_close
|
||||||
};
|
};
|
||||||
|
|
||||||
int uif_open(const char *device)
|
int uif_open(const char *device, int want_jtag)
|
||||||
{
|
{
|
||||||
struct termios attr;
|
struct termios attr;
|
||||||
|
|
||||||
|
@ -116,7 +116,8 @@ int uif_open(const char *device)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fet_open(&serial_transport, FET_PROTO_SPYBIWIRE, 3000) < 0) {
|
if (fet_open(&serial_transport, want_jtag ? 0 : FET_PROTO_SPYBIWIRE,
|
||||||
|
3000) < 0) {
|
||||||
close(serial_fd);
|
close(serial_fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
2
uif.h
2
uif.h
|
@ -23,6 +23,6 @@
|
||||||
* a kernel-supported serial interface. The argument given should be the
|
* a kernel-supported serial interface. The argument given should be the
|
||||||
* filename of the relevant tty device.
|
* filename of the relevant tty device.
|
||||||
*/
|
*/
|
||||||
int uif_open(const char *device);
|
int uif_open(const char *device, int want_jtag);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue