diff --git a/fet.c b/fet.c index 46aa6fa..b11db34 100644 --- a/fet.c +++ b/fet.c @@ -503,6 +503,18 @@ static const struct { 0x00, 0x00, 0x01, 0x61, 0x01, 0x00, 0xD1, 0x4D, 0x80, 0x00}, .idtext = "MSP430F1611" + }, + { + .reply = {0xf2, 0x27, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x01, 0x01, 0x04, 0xb1, 0x62, + 0x80, 0x00}, + .idtext = "MSP430F2274" + }, + { + .reply = {0xf2, 0x01, 0x10, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, + 0x00, 0x00}, + .idtext = "MSP430F2013" } }; @@ -630,9 +642,10 @@ int fet_open(const struct fet_transport *tr, int proto_flags, int vcc_mv) int fet_reset(int flags) { - int wh = flags & FET_RESET_HALT ? 1 : 0; + int wh = flags & FET_RESET_HALT ? 0 : 1; + int wr = flags & FET_RESET_RELEASE ? 1 : 0; - if (xfer(C_RESET, NULL, 3, flags & FET_RESET_ALL, wh, wh) < 0) { + if (xfer(C_RESET, NULL, 0, 3, flags & FET_RESET_ALL, wh, wr) < 0) { fprintf(stderr, "fet_reset: reset failed\n"); return -1; } @@ -789,7 +802,10 @@ int fet_poll(void) int fet_run(int type) { - if (xfer(C_RUN, NULL, 0, 2, type, 0) < 0) { + int wr = type & FET_RUN_RELEASE ? 1 : 0; + + type &= ~FET_RUN_RELEASE; + if (xfer(C_RUN, NULL, 0, 2, type, wr) < 0) { fprintf(stderr, "fet_run: run failed\n"); return -1; } diff --git a/fet.h b/fet.h index 6f5b0f4..e37c1ce 100644 --- a/fet.h +++ b/fet.h @@ -50,11 +50,12 @@ int fet_close(void); * of three methods, and you can choose whether or not to leave the CPU * halted after reset. */ -#define FET_RESET_PUC 0x01 -#define FET_RESET_RST 0x02 -#define FET_RESET_VCC 0x04 -#define FET_RESET_ALL 0x07 -#define FET_RESET_HALT 0x10 +#define FET_RESET_PUC 0x01 +#define FET_RESET_RST 0x02 +#define FET_RESET_VCC 0x04 +#define FET_RESET_ALL 0x07 +#define FET_RESET_HALT 0x10 +#define FET_RESET_RELEASE 0x20 int fet_reset(int flags); @@ -92,11 +93,12 @@ int fet_poll(void); /* CPU run/step/stop control. While the CPU is running, memory and * registers are inaccessible (only fet_poll() or fet_stop()) will - * work. fet_step() is used to single-step the CPU. + * work. */ #define FET_RUN_FREE 1 #define FET_RUN_STEP 2 #define FET_RUN_BREAKPOINT 3 +#define FET_RUN_RELEASE 0x10 int fet_run(int type); int fet_stop(void); diff --git a/main.c b/main.c index 819f6b8..510f7c8 100644 --- a/main.c +++ b/main.c @@ -445,7 +445,7 @@ static int cmd_prog(char **arg) } printf("Erasing...\n"); - if (fet_erase(FET_ERASE_ALL, 0, 0) < 0) { + if (fet_erase(FET_ERASE_ALL, 0x1000, 0x100) < 0) { fclose(in); return -1; } @@ -567,6 +567,7 @@ static void reader_loop(void) .sa_flags = 0 }; + printf("\n"); cmd_help(NULL); sigaction(SIGINT, &siga, NULL); @@ -646,7 +647,7 @@ int main(int argc, char **argv) reader_loop(); } - fet_run(FET_RUN_FREE); + fet_run(FET_RUN_FREE | FET_RUN_RELEASE); fet_close(); return 0;