Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ch32v003fun
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Horn
ch32v003fun
Commits
581f6db0
Commit
581f6db0
authored
1 year ago
by
cnlohr
Browse files
Options
Downloads
Patches
Plain Diff
* Switch to -a from -h because -h is help.
* In unbrick mode, revert previous change that left the processor hanging.
parent
fe86ce83
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
minichlink/README.md
+17
-13
17 additions, 13 deletions
minichlink/README.md
minichlink/minichlink.c
+8
-3
8 additions, 3 deletions
minichlink/minichlink.c
with
25 additions
and
16 deletions
minichlink/README.md
+
17
−
13
View file @
581f6db0
...
...
@@ -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.
```
This diff is collapsed.
Click to expand it.
minichlink/minichlink.c
+
8
−
3
View file @
581f6db0
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment