From 385cc20f4911b6260cdda8d550a034b2506d538b Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sun, 5 Jan 2014 17:29:28 +0100 Subject: commandline: reset vector patching in commandline tool --- commandline/micronucleus.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'commandline/micronucleus.c') diff --git a/commandline/micronucleus.c b/commandline/micronucleus.c index b7d49ab..4ef829a 100644 --- a/commandline/micronucleus.c +++ b/commandline/micronucleus.c @@ -54,6 +54,7 @@ static char* progress_friendly_name; // name of progress section static int dump_progress = 0; // output computer friendly progress info static int use_ansi = 0; // output ansi control character stuff static int erase_only = 0; // only erase, dont't write file +static int fast_mode = 0; // normal mode adds 2ms to page writing times and waits longer for connect. static int timeout = 0; /*****************************************************************************/ @@ -69,11 +70,12 @@ int main(int argc, char **argv) { int run = 0; int file_type = FILE_TYPE_INTEL_HEX; int arg_pointer = 1; - char* usage = "usage: micronucleus [--run] [--dump-progress] [--type intel-hex|raw] [--no-ansi] [--timeout integer] [--erase-only] filename"; + char* usage = "usage: micronucleus [--run] [--dump-progress] [--fast-mode] [--type intel-hex|raw] [--no-ansi] [--timeout integer] [--erase-only] filename"; progress_step = 0; progress_total_steps = 5; // steps: waiting, connecting, parsing, erasing, writing, (running)? dump_progress = 0; erase_only = 0; + fast_mode=0; timeout = 0; // no timeout by default //#if defined(WIN) // use_ansi = 0; @@ -104,6 +106,8 @@ int main(int argc, char **argv) { puts(" for driving GUIs"); puts(" --erase-only: Erase the device without programming. Fills the"); puts(" program memory with 0xFFFF. Any files are ignored."); + puts(" --fast-mode: Speed up the timing of micronucleus. Do not use if"); + puts(" you encounter USB errors. "); puts(" --run: Ask bootloader to run the program when finished"); puts(" uploading provided program"); //#ifndef WIN @@ -112,11 +116,15 @@ int main(int argc, char **argv) { puts(" --timeout [integer]: Timeout after waiting specified number of seconds"); puts(" filename: Path to intel hex or raw data file to upload,"); puts(" or \"-\" to read from stdin"); + puts(""); + puts(MICRONUCLEUS_COMMANDLINE_VERSION); return EXIT_SUCCESS; } else if (strcmp(argv[arg_pointer], "--dump-progress") == 0) { dump_progress = 1; } else if (strcmp(argv[arg_pointer], "--no-ansi") == 0) { use_ansi = 0; + } else if (strcmp(argv[arg_pointer], "--fast-mode") == 0) { + fast_mode = 1; } else if (strcmp(argv[arg_pointer], "--erase-only") == 0) { erase_only = 1; progress_total_steps -= 1; @@ -149,7 +157,7 @@ int main(int argc, char **argv) { while (my_device == NULL) { delay(100); - my_device = micronucleus_connect(); + my_device = micronucleus_connect(fast_mode); time(¤t_time); if (timeout && start_time + timeout < current_time) { @@ -164,17 +172,18 @@ int main(int argc, char **argv) { printf("> Device is found!\n"); - // wait for CONNECT_WAIT milliseconds with progress output - float wait = 0.0f; - setProgressData("connecting", 2); - while (wait < CONNECT_WAIT) { - printProgress((wait / ((float) CONNECT_WAIT)) * 0.9f); - wait += 50.0f; - delay(50); + if (!fast_mode) { + // wait for CONNECT_WAIT milliseconds with progress output + float wait = 0.0f; + setProgressData("connecting", 2); + while (wait < CONNECT_WAIT) { + printProgress((wait / ((float) CONNECT_WAIT)) * 0.9f); + wait += 50.0f; + delay(50); + } } - - //my_device = micronucleus_connect(); printProgress(1.0); + //my_device = micronucleus_connect(); // if (my_device->page_size == 64) { // printf("> Device looks like ATtiny85!\n"); @@ -239,7 +248,7 @@ int main(int argc, char **argv) { int deciseconds_till_reconnect_notice = 50; // notice after 5 seconds while (my_device == NULL) { delay(100); - my_device = micronucleus_connect(); + my_device = micronucleus_connect(fast_mode); deciseconds_till_reconnect_notice -= 1; if (deciseconds_till_reconnect_notice == 0) { -- cgit v1.2.3 From b4bb399c5ca2e2ddd82b77d541ededac80585461 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Tue, 18 Feb 2014 13:21:23 +0100 Subject: commandline: --no-ansi is default under windows. Ansi does not work --- commandline/micronucleus.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'commandline/micronucleus.c') diff --git a/commandline/micronucleus.c b/commandline/micronucleus.c index 4ef829a..63abbb1 100644 --- a/commandline/micronucleus.c +++ b/commandline/micronucleus.c @@ -77,11 +77,11 @@ int main(int argc, char **argv) { erase_only = 0; fast_mode=0; timeout = 0; // no timeout by default - //#if defined(WIN) - // use_ansi = 0; - //#else + #if defined(WIN) + use_ansi = 0; + #else use_ansi = 1; - //#endif + #endif while (arg_pointer < argc) { if (strcmp(argv[arg_pointer], "--run") == 0) { @@ -110,9 +110,9 @@ int main(int argc, char **argv) { puts(" you encounter USB errors. "); puts(" --run: Ask bootloader to run the program when finished"); puts(" uploading provided program"); - //#ifndef WIN + #ifndef WIN puts(" --no-ansi: Don't use ANSI in terminal output"); - //#endif + #endif puts(" --timeout [integer]: Timeout after waiting specified number of seconds"); puts(" filename: Path to intel hex or raw data file to upload,"); puts(" or \"-\" to read from stdin"); -- cgit v1.2.3 From b74ff002d11a29d77ac2be2493384da662512776 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Tue, 18 Feb 2014 13:23:42 +0100 Subject: commandline: update help --- commandline/micronucleus.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'commandline/micronucleus.c') diff --git a/commandline/micronucleus.c b/commandline/micronucleus.c index 63abbb1..5bef829 100644 --- a/commandline/micronucleus.c +++ b/commandline/micronucleus.c @@ -70,7 +70,11 @@ int main(int argc, char **argv) { int run = 0; int file_type = FILE_TYPE_INTEL_HEX; int arg_pointer = 1; - char* usage = "usage: micronucleus [--run] [--dump-progress] [--fast-mode] [--type intel-hex|raw] [--no-ansi] [--timeout integer] [--erase-only] filename"; + #if defined(WIN) + char* usage = "usage: micronucleus [--help] [--run] [--dump-progress] [--fast-mode] [--type intel-hex|raw] [--no-ansi] [--timeout integer] [--erase-only] filename"; + #else + char* usage = "usage: micronucleus [--help] [--run] [--dump-progress] [--fast-mode] [--type intel-hex|raw] [--timeout integer] [--erase-only] filename"; + #endif progress_step = 0; progress_total_steps = 5; // steps: waiting, connecting, parsing, erasing, writing, (running)? dump_progress = 0; -- cgit v1.2.3 From bdae3d430ffe822b97382ca2eb4c8a34bee75004 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sun, 16 Mar 2014 09:29:12 +0100 Subject: commandline: Update to 2.0a4 to accomodate for new device configuration reply for attiny841 --- commandline/micronucleus.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'commandline/micronucleus.c') diff --git a/commandline/micronucleus.c b/commandline/micronucleus.c index 5bef829..9e875db 100644 --- a/commandline/micronucleus.c +++ b/commandline/micronucleus.c @@ -1,7 +1,9 @@ /* - Created: September 2012 - by ihsan Kehribar - +Created: September 2012 + (c) 2012 by ihsan Kehribar + Changes for Micronucleus protocol version V2.x + (c) 2014 T. Bo"scke + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to -- cgit v1.2.3 From a6ddfb278eba3c2864530458e46716ebb6b18c7b Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sun, 16 Mar 2014 09:34:29 +0100 Subject: commandline: Display correct help for windows --- commandline/micronucleus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'commandline/micronucleus.c') diff --git a/commandline/micronucleus.c b/commandline/micronucleus.c index 9e875db..1b76e72 100644 --- a/commandline/micronucleus.c +++ b/commandline/micronucleus.c @@ -73,9 +73,9 @@ int main(int argc, char **argv) { int file_type = FILE_TYPE_INTEL_HEX; int arg_pointer = 1; #if defined(WIN) - char* usage = "usage: micronucleus [--help] [--run] [--dump-progress] [--fast-mode] [--type intel-hex|raw] [--no-ansi] [--timeout integer] [--erase-only] filename"; - #else char* usage = "usage: micronucleus [--help] [--run] [--dump-progress] [--fast-mode] [--type intel-hex|raw] [--timeout integer] [--erase-only] filename"; + #else + char* usage = "usage: micronucleus [--help] [--run] [--dump-progress] [--fast-mode] [--type intel-hex|raw] [--timeout integer] [--erase-only] filename [--no-ansi]"; #endif progress_step = 0; progress_total_steps = 5; // steps: waiting, connecting, parsing, erasing, writing, (running)? -- cgit v1.2.3 From 7e103740357273dcf1143bd04a1cb7fa957be89a Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Thu, 1 May 2014 19:15:05 +0200 Subject: commandline: Added signature to configurationreply --- commandline/micronucleus.c | 1 + 1 file changed, 1 insertion(+) (limited to 'commandline/micronucleus.c') diff --git a/commandline/micronucleus.c b/commandline/micronucleus.c index 1b76e72..0e76997 100644 --- a/commandline/micronucleus.c +++ b/commandline/micronucleus.c @@ -201,6 +201,7 @@ int main(int argc, char **argv) { // } printf("> Device has firmware version %d.%d\n",my_device->version.major,my_device->version.minor); + if (my_device->signature1) printf("> Device signature: 0x1e%02x%02x \n",(int)my_device->signature1,(int)my_device->signature2); printf("> Available space for user applications: %d bytes\n", my_device->flash_size); printf("> Suggested sleep time between sending pages: %ums\n", my_device->write_sleep); printf("> Whole page count: %d page size: %d\n", my_device->pages,my_device->page_size); -- cgit v1.2.3 From 80419704f68bf0783c5de63a6a4b9d89b45235c7 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sun, 27 Jul 2014 05:43:05 +0200 Subject: firmware: code clean up --- commandline/micronucleus.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'commandline/micronucleus.c') diff --git a/commandline/micronucleus.c b/commandline/micronucleus.c index 0e76997..14c1761 100644 --- a/commandline/micronucleus.c +++ b/commandline/micronucleus.c @@ -189,16 +189,6 @@ int main(int argc, char **argv) { } } printProgress(1.0); - //my_device = micronucleus_connect(); - - // if (my_device->page_size == 64) { - // printf("> Device looks like ATtiny85!\n"); - // } else if (my_device->page_size == 32) { - // printf("> Device looks like ATtiny45!\n"); - // } else { - // printf("> Unsupported device!\n"); - // return EXIT_FAILURE; - // } printf("> Device has firmware version %d.%d\n",my_device->version.major,my_device->version.minor); if (my_device->signature1) printf("> Device signature: 0x1e%02x%02x \n",(int)my_device->signature1,(int)my_device->signature2); -- cgit v1.2.3