Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
picsimlab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
picsimlab
Commits
3528dbf4
Commit
3528dbf4
authored
Jul 13, 2020
by
lcgamboa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new: support to change debug TCP port
parent
cada0fb7
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
141 additions
and
23 deletions
+141
-23
src/boards/board_avr.cc
src/boards/board_avr.cc
+3
-2
src/boards/board_pic.cc
src/boards/board_pic.cc
+1
-1
src/devices/mplabxd.cc
src/devices/mplabxd.cc
+3
-4
src/devices/mplabxd.h
src/devices/mplabxd.h
+1
-1
src/picsimlab1.cc
src/picsimlab1.cc
+11
-4
src/picsimlab1.h
src/picsimlab1.h
+12
-0
src/picsimlab1_d.cc
src/picsimlab1_d.cc
+2
-0
src/picsimlab3.cc
src/picsimlab3.cc
+6
-0
src/picsimlab3.h
src/picsimlab3.h
+2
-0
src/picsimlab3_d.cc
src/picsimlab3_d.cc
+40
-5
src/picsimlab_3.lxrad
src/picsimlab_3.lxrad
+60
-6
No files found.
src/boards/board_avr.cc
View file @
3528dbf4
...
...
@@ -75,6 +75,7 @@ board_avr::board_avr(void)
{
avr
=
NULL
;
serial_irq
=
NULL
;
avr_debug_type
=
0
;
}
void
...
...
@@ -367,7 +368,7 @@ board_avr::DebugInit(int dtyppe)
if
(
avr_debug_type
)
{
avr
->
gdb_port
=
1234
;
avr
->
gdb_port
=
Window1
.
Get_debug_port
()
;
int
ret
=
avr_gdb_init
(
avr
);
avr
->
run
=
avr_callback_run_gdb_
;
avr
->
sleep
=
avr_callback_sleep_raw_
;
...
...
@@ -378,7 +379,7 @@ board_avr::DebugInit(int dtyppe)
}
else
{
return
!
mplabxd_init
(
this
)
-
1
;
return
!
mplabxd_init
(
this
,
Window1
.
Get_debug_port
()
)
-
1
;
}
}
...
...
src/boards/board_pic.cc
View file @
3528dbf4
...
...
@@ -148,7 +148,7 @@ board_pic::MDumpMemory(const char * fname)
int
board_pic
::
DebugInit
(
int
dtyppe
)
//argument not used in picm only mplabx
{
return
!
mplabxd_init
(
this
)
-
1
;
return
!
mplabxd_init
(
this
,
Window1
.
Get_debug_port
()
)
-
1
;
}
void
...
...
src/devices/mplabxd.cc
View file @
3528dbf4
...
...
@@ -59,8 +59,7 @@ WSADATA wsaData;
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
//defines
#define TCP_SERV_PORT 1234
typedef
struct
sockaddr
sockaddr
;
...
...
@@ -154,7 +153,7 @@ static unsigned char *ramsend = NULL;
static
unsigned
char
*
ramreceived
=
NULL
;
int
mplabxd_init
(
board
*
mboard
)
mplabxd_init
(
board
*
mboard
,
unsigned
short
tcpport
)
{
struct
sockaddr_in
serv
;
...
...
@@ -186,7 +185,7 @@ mplabxd_init(board * mboard)
memset
(
&
serv
,
0
,
sizeof
(
serv
));
serv
.
sin_family
=
AF_INET
;
serv
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
serv
.
sin_port
=
htons
(
TCP_SERV_PORT
);
serv
.
sin_port
=
htons
(
tcpport
);
if
(
bind
(
listenfd
,
(
sockaddr
*
)
&
serv
,
sizeof
(
serv
))
<
0
)
{
...
...
src/devices/mplabxd.h
View file @
3528dbf4
...
...
@@ -29,7 +29,7 @@
#include "../boards/board.h"
//mplabx debugger
int
mplabxd_init
(
board
*
mboard
);
int
mplabxd_init
(
board
*
mboard
,
unsigned
short
tcpport
);
int
mplabxd_loop
(
void
);
void
mplabxd_end
(
void
);
int
mplabxd_testbp
(
void
);
...
...
src/picsimlab1.cc
View file @
3528dbf4
...
...
@@ -359,6 +359,11 @@ CPWindow1::Configure(CControl * control, const char * home)
{
sscanf
(
value
,
"%i"
,
&
debug_type
);
}
if
(
!
strcmp
(
name
,
"debugp"
))
{
sscanf
(
value
,
"%hu"
,
&
debug_port
);
}
if
(
!
strcmp
(
name
,
"osc_on"
))
{
...
...
@@ -475,23 +480,23 @@ CPWindow1::Configure(CControl * control, const char * home)
int
ret
=
pboard
->
DebugInit
(
debug_type
);
if
(
ret
<
0
)
{
statusbar1
.
SetField
(
1
,
status
+
lxT
(
"
Debug: Error"
));
statusbar1
.
SetField
(
1
,
status
+
lxT
(
"Debug: Error"
));
}
else
{
if
(
ret
)
{
statusbar1
.
SetField
(
1
,
status
+
lxT
(
"
Debug: GDB"
));
statusbar1
.
SetField
(
1
,
status
+
lxT
(
"
Debug: GDB:"
)
+
itoa
(
debug_port
));
}
else
{
statusbar1
.
SetField
(
1
,
status
+
lxT
(
"
Debug: MPLABX"
));
statusbar1
.
SetField
(
1
,
status
+
lxT
(
"
Debug: MDB:"
)
+
itoa
(
debug_port
));
}
}
}
else
{
statusbar1
.
SetField
(
1
,
status
+
lxT
(
"
Debug: Off"
));
statusbar1
.
SetField
(
1
,
status
+
lxT
(
"Debug: Off"
));
}
#endif
...
...
@@ -590,6 +595,7 @@ CPWindow1::_EvOnDestroy(CControl * control)
saveprefs
(
lxT
(
"clock"
),
combo1
.
GetText
());
saveprefs
(
lxT
(
"debug"
),
itoa
(
debug
));
saveprefs
(
lxT
(
"debugt"
),
itoa
(
debug_type
));
saveprefs
(
lxT
(
"debugp"
),
itoa
(
debug_port
));
saveprefs
(
lxT
(
"position"
),
itoa
(
GetX
())
+
lxT
(
","
)
+
itoa
(
GetY
()));
saveprefs
(
lxT
(
"osc_on"
),
itoa
(
pboard
->
GetUseOscilloscope
()));
saveprefs
(
lxT
(
"spare_on"
),
itoa
(
pboard
->
GetUseSpareParts
()));
...
...
@@ -1096,6 +1102,7 @@ CPWindow1::filedialog2_EvOnClose(int retId)
saveprefs
(
lxT
(
"clock"
),
combo1
.
GetText
());
saveprefs
(
lxT
(
"debug"
),
itoa
(
debug
));
saveprefs
(
lxT
(
"debugt"
),
itoa
(
debug_type
));
saveprefs
(
lxT
(
"debugp"
),
itoa
(
debug_port
));
saveprefs
(
lxT
(
"position"
),
itoa
(
GetX
())
+
lxT
(
","
)
+
itoa
(
GetY
()));
saveprefs
(
lxT
(
"osc_on"
),
itoa
(
pboard
->
GetUseOscilloscope
()));
saveprefs
(
lxT
(
"spare_on"
),
itoa
(
pboard
->
GetUseSpareParts
()));
...
...
src/picsimlab1.h
View file @
3528dbf4
...
...
@@ -175,6 +175,13 @@ public:
int
Get_debug_type
(
void
)
{
return
debug_type
;
};
/**
* @brief Return the selected debugger port
*/
unsigned
short
Get_debug_port
(
void
)
{
return
debug_port
;
};
/**
* @brief Return actual power status of microcontroller ON/OFF
...
...
@@ -223,6 +230,10 @@ public:
debug_type
=
dt
;
};
void
Set_debug_port
(
unsigned
short
dp
)
{
debug_port
=
dp
;
};
void
Set_mcudbg
(
int
pd
);
void
SetPATH
(
String
path
)
{
...
...
@@ -272,6 +283,7 @@ private:
int
mcudbg
;
int
debug
;
int
debug_type
;
unsigned
short
debug_port
;
int
osc_on
;
int
spare_on
;
...
...
src/picsimlab1_d.cc
View file @
3528dbf4
...
...
@@ -396,6 +396,8 @@ mcupwr=1;
mcurst
=
0
;
mcudbg
=
0
;
debug
=
0
;
debug_type
=
0
;
debug_port
=
1234
;
osc_on
=
0
;
spare_on
=
0
;
status
.
status
=
0
;
...
...
src/picsimlab3.cc
View file @
3528dbf4
...
...
@@ -25,6 +25,8 @@
//Configuration window
#include <lxrad/cspin.h>
#include"picsimlab3.h"
#include"picsimlab3_d.cc"
...
...
@@ -65,6 +67,8 @@ CPWindow3::button1_EvMouseButtonClick(CControl * control, uint button, uint x, u
Window1
.
Set_debug_type
(
combo3
.
GetText
().
compare
(
"GDB"
)
==
0
);
Window1
.
Set_debug_port
(
spin1
.
GetValue
());
#ifdef _USE_PICSTARTP_
if
(
combo1
.
GetText
()
==
combo2
.
GetText
())
{
...
...
@@ -117,6 +121,8 @@ CPWindow3::_EvOnShow(CControl * control)
{
combo3
.
SetText
(
"MPLABX"
);
}
spin1
.
SetValue
(
Window1
.
Get_debug_port
());
}
...
...
src/picsimlab3.h
View file @
3528dbf4
...
...
@@ -39,6 +39,8 @@ class CPWindow3:public CPWindow
CCombo
combo2
;
CLabel
label3
;
CCombo
combo3
;
CLabel
label4
;
CSpin
spin1
;
/*#Events*/
void
_EvOnCreate
(
CControl
*
control
);
void
_EvOnShow
(
CControl
*
control
);
...
...
src/picsimlab3_d.cc
View file @
3528dbf4
...
...
@@ -79,8 +79,8 @@ CPWindow3::CPWindow3(void)
button1
.
SetClass
(
lxT
(
"CButton"
));
button1
.
SetName
(
lxT
(
"button1"
));
button1
.
SetTag
(
0
);
button1
.
SetX
(
12
5
);
button1
.
SetY
(
1
46
);
button1
.
SetX
(
12
3
);
button1
.
SetY
(
1
73
);
button1
.
SetWidth
(
65
);
button1
.
SetHeight
(
28
);
button1
.
SetHint
(
lxT
(
""
));
...
...
@@ -153,10 +153,45 @@ CPWindow3::CPWindow3(void)
combo3
.
SetEnable
(
1
);
combo3
.
SetVisible
(
1
);
combo3
.
SetPopupMenu
(
NULL
);
combo3
.
SetItems
(
lxT
(
"M
PLABX
,GDB,"
));
combo3
.
SetText
(
lxT
(
"M
PLABX
"
));
combo3
.
SetReadOnly
(
0
);
combo3
.
SetItems
(
lxT
(
"M
DB
,GDB,"
));
combo3
.
SetText
(
lxT
(
"M
DB
"
));
combo3
.
SetReadOnly
(
1
);
CreateChild
(
&
combo3
);
//label4
label4
.
SetFOwner
(
this
);
label4
.
SetClass
(
lxT
(
"CLabel"
));
label4
.
SetName
(
lxT
(
"label4"
));
label4
.
SetTag
(
0
);
label4
.
SetX
(
31
);
label4
.
SetY
(
132
);
label4
.
SetWidth
(
109
);
label4
.
SetHeight
(
20
);
label4
.
SetHint
(
lxT
(
""
));
label4
.
SetEnable
(
1
);
label4
.
SetVisible
(
1
);
label4
.
SetColor
(
lxT
(
"#000001"
));
label4
.
SetPopupMenu
(
NULL
);
label4
.
SetText
(
lxT
(
"DBG TCP Port:"
));
label4
.
SetAlign
(
1
);
CreateChild
(
&
label4
);
//spin1
spin1
.
SetFOwner
(
this
);
spin1
.
SetClass
(
lxT
(
"CSpin"
));
spin1
.
SetName
(
lxT
(
"spin1"
));
spin1
.
SetTag
(
0
);
spin1
.
SetX
(
143
);
spin1
.
SetY
(
129
);
spin1
.
SetWidth
(
139
);
spin1
.
SetHeight
(
26
);
spin1
.
SetHint
(
lxT
(
""
));
spin1
.
SetEnable
(
1
);
spin1
.
SetVisible
(
1
);
spin1
.
SetColor
(
lxT
(
"#000001"
));
spin1
.
SetPopupMenu
(
NULL
);
spin1
.
SetValue
(
1234
);
spin1
.
SetMin
(
0
);
spin1
.
SetMax
(
65535
);
CreateChild
(
&
spin1
);
/*#Others*/
//lxrad automatic generated block end, don't edit above!
};
src/picsimlab_3.lxrad
View file @
3528dbf4
...
...
@@ -5,7 +5,7 @@
<X type="int">401</X>
<Y type="int">215</Y>
<Width type="uint">325</Width>
<Height type="uint">2
39
</Height>
<Height type="uint">2
56
</Height>
<Hint type="String"></Hint>
<Enable type="bool">1</Enable>
<Visible type="bool">0</Visible>
...
...
@@ -85,8 +85,8 @@
<Class type="String">CButton</Class>
<Name type="String">button1</Name>
<Tag type="int">0</Tag>
<X type="int">12
5
</X>
<Y type="int">1
46
</Y>
<X type="int">12
3
</X>
<Y type="int">1
73
</Y>
<Width type="uint">65</Width>
<Height type="uint">28</Height>
<Hint type="String"></Hint>
...
...
@@ -211,9 +211,63 @@
<EvOnDraw type="Event">FALSE</EvOnDraw>
<EvOnFocusIn type="Event">FALSE</EvOnFocusIn>
<EvOnFocusOut type="Event">FALSE</EvOnFocusOut>
<Items type="StringList">
MPLABX,G
DB,</Items>
<Text type="String">
MPLABX
</Text>
<ReadOnly type="bool">
0
</ReadOnly>
<Items type="StringList">
GDB,M
DB,</Items>
<Text type="String"></Text>
<ReadOnly type="bool">
1
</ReadOnly>
<EvOnComboChange type="Event">FALSE</EvOnComboChange>
</combo3>
<label4>
<Class type="String">CLabel</Class>
<Name type="String">label4</Name>
<Tag type="int">0</Tag>
<X type="int">31</X>
<Y type="int">132</Y>
<Width type="uint">109</Width>
<Height type="uint">20</Height>
<Hint type="String"></Hint>
<Enable type="bool">1</Enable>
<Visible type="bool">1</Visible>
<Color type="String">#000001</Color>
<PopupMenu type="PopupMenu">NULL</PopupMenu>
<EvMouseMove type="Event">FALSE</EvMouseMove>
<EvMouseButtonPress type="Event">FALSE</EvMouseButtonPress>
<EvMouseButtonRelease type="Event">FALSE</EvMouseButtonRelease>
<EvMouseButtonClick type="Event">FALSE</EvMouseButtonClick>
<EvMouseButtonDoubleClick type="Event">FALSE</EvMouseButtonDoubleClick>
<EvKeyboardPress type="Event">FALSE</EvKeyboardPress>
<EvKeyboardRelease type="Event">FALSE</EvKeyboardRelease>
<EvOnDraw type="Event">FALSE</EvOnDraw>
<EvOnFocusIn type="Event">FALSE</EvOnFocusIn>
<EvOnFocusOut type="Event">FALSE</EvOnFocusOut>
<Text type="String">DBG TCP Port:</Text>
<Align type="CAlign">1</Align>
</label4>
<spin1>
<Class type="String">CSpin</Class>
<Name type="String">spin1</Name>
<Tag type="int">0</Tag>
<X type="int">143</X>
<Y type="int">129</Y>
<Width type="uint">139</Width>
<Height type="uint">26</Height>
<Hint type="String"></Hint>
<Enable type="bool">1</Enable>
<Visible type="bool">1</Visible>
<Color type="String">#000001</Color>
<PopupMenu type="PopupMenu">NULL</PopupMenu>
<EvMouseMove type="Event">FALSE</EvMouseMove>
<EvMouseButtonPress type="Event">FALSE</EvMouseButtonPress>
<EvMouseButtonRelease type="Event">FALSE</EvMouseButtonRelease>
<EvMouseButtonClick type="Event">FALSE</EvMouseButtonClick>
<EvMouseButtonDoubleClick type="Event">FALSE</EvMouseButtonDoubleClick>
<EvKeyboardPress type="Event">FALSE</EvKeyboardPress>
<EvKeyboardRelease type="Event">FALSE</EvKeyboardRelease>
<EvOnDraw type="Event">FALSE</EvOnDraw>
<EvOnFocusIn type="Event">FALSE</EvOnFocusIn>
<EvOnFocusOut type="Event">FALSE</EvOnFocusOut>
<Value type="int">1234</Value>
<Min type="int">0</Min>
<Max type="int">65535</Max>
<EvOnChangeSpin type="Event">FALSE</EvOnChangeSpin>
</spin1>
</window3>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment