diff --git a/minichlink/README.md b/minichlink/README.md index a38f46d765e59a36b4eec4426d91dc71b567c55c..10ff8a51bcaf4354bc994948e6802b5adccc446f 100644 --- a/minichlink/README.md +++ b/minichlink/README.md @@ -14,18 +14,22 @@ The exe here is about 12kB and contains everything except for the libusb driver. Usage: minichlink [args] single-letter args may be combined, i.e. -3r multi-part args cannot. - -3 Enable 3.3V - -5 Enable 5V - -t Disable 3.3V - -f Disable 5V - -r Release from reest - -R Place into Reset - -D Configure NRST as GPIO **WARNING** If you do this and you reconfig - the SWIO pin (PD1) on boot, your part can never again be programmed! - -d Configure NRST as NRST - -w [binary image to write] - -s [debug register] [value] - -g [debug register] - -o [memory address, decimal or 0x, try 0x08000000] [size, decimal or 0x, try 16384] [output binary image] + -3 Enable 3.3V + -5 Enable 5V + -t Disable 3.3V + -f Disable 5V + -u Clear all code flash - by power off (also can unbrick) + -b Reboot out of Halt + -e Resume from halt + -a Place into Halt + -D Configure NRST as GPIO + -d Configure NRST as NRST + -s [debug register] [value] + -g [debug register] + -w [binary image to write] [address, decimal or 0x, try0x08000000] + -r [output binary image] [memory address, decimal or 0x, try 0x08000000] [size, decimal or 0x, try 16384] + Note: for memory addresses, you can use 'flash' 'launcher' 'bootloader' 'option' 'ram' and say "ram+0x10" for instance + For filename, you can use - for raw or + for hex. + -T is a terminal. This MUST be the last argument. ``` diff --git a/minichlink/minichlink.c b/minichlink/minichlink.c index 052c1ce510b0b1fcc23d3f46e21328b21290ae06..2081acb73545a391e79386ec8aa444e67eadc564 100644 --- a/minichlink/minichlink.c +++ b/minichlink/minichlink.c @@ -46,6 +46,9 @@ int main( int argc, char ** argv ) int skip_startup = (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'u' ) | + (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'h' ) | + (argc > 1 && argv[1][0] == '-' && argv[1][1] == 't' ) | + (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'f' ) | (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'X' ); if( !skip_startup && MCF.SetupInterface ) @@ -83,6 +86,7 @@ keep_going: { default: fprintf( stderr, "Error: Unknown command %c\n", argchar[1] ); + case 'h': goto help; case '3': if( MCF.Control3v3 ) @@ -136,7 +140,7 @@ keep_going: if( !MCF.Erase || MCF.Erase( dev, 0, 0, 1 ) ) goto unimplemented; break; - case 'h': + case 'a': if( !MCF.HaltMode || MCF.HaltMode( dev, 0 ) ) goto unimplemented; break; @@ -466,7 +470,7 @@ help: fprintf( stderr, " -u Clear all code flash - by power off (also can unbrick)\n" ); fprintf( stderr, " -b Reboot out of Halt\n" ); fprintf( stderr, " -e Resume from halt\n" ); - fprintf( stderr, " -h Place into Halt\n" ); + fprintf( stderr, " -a Place into Halt\n" ); fprintf( stderr, " -D Configure NRST as GPIO\n" ); fprintf( stderr, " -d Configure NRST as NRST\n" ); fprintf( stderr, " -s [debug register] [value]\n" ); @@ -1158,7 +1162,8 @@ int DefaultUnbrick( void * dev ) MCF.WriteReg32( dev, DMCONTROL, 0x80000001 ); // Many times we would clear the halt request, but in this case, we want to just leave it here, to prevent it from booting. -// MCF.WriteReg32( dev, DMCONTROL, 0x00000001 ); // Clear Halt Request. +// TODO: Experiment and see if this is needed/wanted in cases. NOTE: If you don't clear halt request, progarmmers can get stuck. + MCF.WriteReg32( dev, DMCONTROL, 0x00000001 ); // Clear Halt Request. MCF.FlushLLCommands( dev );