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
9cad6683
Commit
9cad6683
authored
2 years ago
by
cnlohr
Browse files
Options
Downloads
Patches
Plain Diff
Add configuration item for allowing re-use of PD7 as NRST or PP/IO
parent
0c594523
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
minichlink/minichlink.c
+17
-0
17 additions, 0 deletions
minichlink/minichlink.c
minichlink/test.bat
+4
-3
4 additions, 3 deletions
minichlink/test.bat
sandbox/sandbox.c
+2
-0
2 additions, 0 deletions
sandbox/sandbox.c
with
23 additions
and
3 deletions
minichlink/minichlink.c
+
17
−
0
View file @
9cad6683
...
@@ -41,6 +41,7 @@ int bootloader_len = 512;
...
@@ -41,6 +41,7 @@ int bootloader_len = 512;
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
int
status
;
int
status
;
int
must_be_end
=
0
;
uint8_t
rbuff
[
1024
];
uint8_t
rbuff
[
1024
];
libusb_device_handle
*
devh
=
wch_link_base_setup
();
libusb_device_handle
*
devh
=
wch_link_base_setup
();
...
@@ -50,6 +51,12 @@ int main( int argc, char ** argv )
...
@@ -50,6 +51,12 @@ int main( int argc, char ** argv )
{
{
char
*
argchar
=
argv
[
iarg
];
char
*
argchar
=
argv
[
iarg
];
if
(
argchar
[
0
]
!=
'-'
)
goto
help
;
if
(
argchar
[
0
]
!=
'-'
)
goto
help
;
if
(
must_be_end
)
{
fprintf
(
stderr
,
"Error: the command '%c' cannot be followed by other commands.
\n
"
,
must_be_end
);
return
-
1
;
}
keep_going:
keep_going:
switch
(
argchar
[
1
]
)
switch
(
argchar
[
1
]
)
{
{
...
@@ -65,8 +72,16 @@ keep_going:
...
@@ -65,8 +72,16 @@ keep_going:
case
'R'
:
case
'R'
:
// Part one "immediately" places the part into reset. Part 2 says when we're done, leave part in reset.
// Part one "immediately" places the part into reset. Part 2 says when we're done, leave part in reset.
wch_link_multicommands
(
devh
,
2
,
4
,
"
\x81\x0d\x01\x02
"
,
4
,
"
\x81\x0d\x01\x01
"
);
wch_link_multicommands
(
devh
,
2
,
4
,
"
\x81\x0d\x01\x02
"
,
4
,
"
\x81\x0d\x01\x01
"
);
must_be_end
=
'R'
;
break
;
break
;
// disable NRST pin (turn it into a GPIO)
case
'd'
:
wch_link_multicommands
(
devh
,
2
,
11
,
"
\x81\x06\x08\x02\xf7\xff\xff\xff\xff\xff\xff
"
,
4
,
"
\x81\x0b\x01\x01
"
);
break
;
case
'D'
:
wch_link_multicommands
(
devh
,
2
,
11
,
"
\x81\x06\x08\x02\xff\xff\xff\xff\xff\xff\xff
"
,
4
,
"
\x81\x0b\x01\x01
"
);
break
;
// PROTECTION UNTESTED!
// PROTECTION UNTESTED!
/*
/*
case 'p':
case 'p':
...
@@ -185,6 +200,8 @@ help:
...
@@ -185,6 +200,8 @@ help:
fprintf
(
stderr
,
" -f Disable 5V
\n
"
);
fprintf
(
stderr
,
" -f Disable 5V
\n
"
);
fprintf
(
stderr
,
" -r Release from reest
\n
"
);
fprintf
(
stderr
,
" -r Release from reest
\n
"
);
fprintf
(
stderr
,
" -R Place into Reset
\n
"
);
fprintf
(
stderr
,
" -R Place into Reset
\n
"
);
fprintf
(
stderr
,
" -D Configure NRST as GPIO
\n
"
);
fprintf
(
stderr
,
" -d Configure NRST as NRST
\n
"
);
// fprintf( stderr, " -P Enable Read Protection (UNTESTED)\n" );
// fprintf( stderr, " -P Enable Read Protection (UNTESTED)\n" );
// fprintf( stderr, " -p Disable Read Protection (UNTESTED)\n" );
// fprintf( stderr, " -p Disable Read Protection (UNTESTED)\n" );
fprintf
(
stderr
,
" -w [binary image to write]
\n
"
);
fprintf
(
stderr
,
" -w [binary image to write]
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
minichlink/test.bat
+
4
−
3
View file @
9cad6683
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
tcc
wch_erase
.c
libusb
-
1
.0.dll
tcc
wch_erase
.c
libusb
-
1
.0.dll
tcc
wch_reset
.c
libusb
-
1
.0.dll
tcc
wch_reset
.c
libusb
-
1
.0.dll
tcc
wch_write_simple
.c
libusb
-
1
.0.dll
tcc
wch_write_simple
.c
libusb
-
1
.0.dll
tcc
minichlink
.c
libusb
-
1
.0.dll
wch_erase
.exe
rem
wch_erase.exe
wch_write_simple
.exe
..\barebones\barebones.bin
rem
wch_write_simple.exe ..\barebones\barebones.bin
wch_reset
.exe
rem
wch_reset.exe
This diff is collapsed.
Click to expand it.
sandbox/sandbox.c
+
2
−
0
View file @
9cad6683
...
@@ -61,6 +61,8 @@ int main()
...
@@ -61,6 +61,8 @@ int main()
GPIOD
->
BSHR
=
1
;
GPIOD
->
BSHR
=
1
;
GPIOD
->
BSHR
=
1
<<
16
;
GPIOD
->
BSHR
=
1
<<
16
;
GPIOD
->
BSHR
=
1
;
GPIOD
->
BSHR
=
1
;
Delay_Ms
(
1
);
GPIOD
->
BSHR
=
(
128
+
64
+
1
)
<<
16
;
GPIOD
->
BSHR
=
(
128
+
64
+
1
)
<<
16
;
Delay_Ms
(
1
);
}
}
}
}
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