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
ae0c7203
Commit
ae0c7203
authored
1 year ago
by
CNLohr
Browse files
Options
Downloads
Patches
Plain Diff
Closes #160 - Add `monitor reset` command.
parent
b2e8695a
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/microgdbstub.h
+22
-16
22 additions, 16 deletions
minichlink/microgdbstub.h
minichlink/minichgdb.c
+6
-0
6 additions, 0 deletions
minichlink/minichgdb.c
minichlink/minichlink.exe
+0
-0
0 additions, 0 deletions
minichlink/minichlink.exe
with
28 additions
and
16 deletions
minichlink/microgdbstub.h
+
22
−
16
View file @
ae0c7203
...
...
@@ -29,6 +29,7 @@ void RVDebugExec( void * dev, int halt_reset_or_resume );
int
RVReadMem
(
void
*
dev
,
uint32_t
memaddy
,
uint8_t
*
payload
,
int
len
);
int
RVHandleBreakpoint
(
void
*
dev
,
int
set
,
uint32_t
address
);
int
RVWriteRAM
(
void
*
dev
,
uint32_t
memaddy
,
uint32_t
length
,
uint8_t
*
payload
);
void
RVCommandResetPart
(
void
*
dev
);
void
RVHandleDisconnect
(
void
*
dev
);
void
RVHandleGDBBreakRequest
(
void
*
dev
);
void
RVHandleKillRequest
(
void
*
dev
);
...
...
@@ -61,7 +62,7 @@ typedef struct pollfd { SOCKET fd; SHORT events; SHORT revents; };
#define POLLIN 0x0001
#define POLLERR 0x008
#define POLLHUP 0x010
int
WSAAPI
WSAPoll
(
struct
pollfd
*
fdArray
,
ULONG
fds
,
INT
timeout
);
int
WSAAPI
WSAPoll
(
struct
pollfd
*
fdArray
,
ULONG
fds
,
INT
timeout
);
#endif
#define poll WSAPoll
#define socklen_t uint32_t
...
...
@@ -171,22 +172,27 @@ void HandleGDBPacket( void * dev, char * data, int len )
{
case
'q'
:
if
(
StringMatch
(
data
,
"Attached"
)
)
SendReplyFull
(
"1"
);
//Attached to an existing process.
SendReplyFull
(
"1"
);
//Attached to an existing process.
else
if
(
StringMatch
(
data
,
"Supported"
)
)
SendReplyFull
(
"PacketSize=f000;qXfer:memory-map:read+"
);
SendReplyFull
(
"PacketSize=f000;qXfer:memory-map:read+"
);
else
if
(
StringMatch
(
data
,
"C"
)
)
// Get Current Thread ID. (Can't be -1 or 0. Those are special)
SendReplyFull
(
"QC1"
);
SendReplyFull
(
"QC1"
);
else
if
(
StringMatch
(
data
,
"fThreadInfo"
)
)
// Query all active thread IDs (Can't be 0 or 1)
SendReplyFull
(
"m1"
);
else
if
(
StringMatch
(
data
,
"sThreadInfo"
)
)
// Query all active thread IDs, continued
SendReplyFull
(
"l"
);
SendReplyFull
(
"l"
);
else
if
(
StringMatch
(
data
,
"Rcmd,7265736574"
)
)
// "monitor reset"
{
RVCommandResetPart
(
dev
);
// Force reset
SendReplyFull
(
"+"
);
}
else
if
(
StringMatch
(
data
,
"Xfer:memory-map"
)
)
{
int
mslen
=
strlen
(
MICROGDBSTUB_MEMORY_MAP
)
+
32
;
char
map
[
mslen
];
struct
InternalState
*
iss
=
(
struct
InternalState
*
)(((
struct
ProgrammerStructBase
*
)
dev
)
->
internal
);
snprintf
(
map
,
mslen
,
MICROGDBSTUB_MEMORY_MAP
,
iss
->
flash_size
,
iss
->
sector_size
,
iss
->
ram_size
);
SendReplyFull
(
map
);
SendReplyFull
(
map
);
}
else
{
...
...
@@ -620,16 +626,16 @@ int MicroGDBStubStartup( void * dev )
{
#if defined( WIN32 ) || defined( _WIN32 )
{
WORD
wVersionRequested
;
WSADATA
wsaData
;
int
err
;
wVersionRequested
=
MAKEWORD
(
2
,
2
);
err
=
WSAStartup
(
wVersionRequested
,
&
wsaData
);
if
(
err
!=
0
)
{
fprintf
(
stderr
,
"WSAStartup failed with error: %d
\n
"
,
err
);
return
1
;
}
WORD
wVersionRequested
;
WSADATA
wsaData
;
int
err
;
wVersionRequested
=
MAKEWORD
(
2
,
2
);
err
=
WSAStartup
(
wVersionRequested
,
&
wsaData
);
if
(
err
!=
0
)
{
fprintf
(
stderr
,
"WSAStartup failed with error: %d
\n
"
,
err
);
return
1
;
}
}
#endif
...
...
This diff is collapsed.
Click to expand it.
minichlink/minichgdb.c
+
6
−
0
View file @
ae0c7203
...
...
@@ -71,6 +71,12 @@ void RVCommandEpilogue( void * dev )
MCF
.
WriteReg32
(
dev
,
DMDATA0
,
0
);
}
void
RVCommandResetPart
(
void
*
dev
)
{
MCF
.
HaltMode
(
dev
,
HALT_MODE_HALT_AND_RESET
);
RVCommandPrologue
(
dev
);
}
void
RVNetConnect
(
void
*
dev
)
{
// ??? Should we actually halt?
...
...
This diff is collapsed.
Click to expand it.
minichlink/minichlink.exe
+
0
−
0
View file @
ae0c7203
No preview for this file type
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