Commit 3528dbf4 authored by lcgamboa's avatar lcgamboa

new: support to change debug TCP port

parent cada0fb7
...@@ -75,6 +75,7 @@ board_avr::board_avr(void) ...@@ -75,6 +75,7 @@ board_avr::board_avr(void)
{ {
avr = NULL; avr = NULL;
serial_irq = NULL; serial_irq = NULL;
avr_debug_type=0;
} }
void void
...@@ -367,7 +368,7 @@ board_avr::DebugInit(int dtyppe) ...@@ -367,7 +368,7 @@ board_avr::DebugInit(int dtyppe)
if (avr_debug_type) if (avr_debug_type)
{ {
avr->gdb_port = 1234; avr->gdb_port = Window1.Get_debug_port ();
int ret = avr_gdb_init (avr); int ret = avr_gdb_init (avr);
avr->run = avr_callback_run_gdb_; avr->run = avr_callback_run_gdb_;
avr->sleep = avr_callback_sleep_raw_; avr->sleep = avr_callback_sleep_raw_;
...@@ -378,7 +379,7 @@ board_avr::DebugInit(int dtyppe) ...@@ -378,7 +379,7 @@ board_avr::DebugInit(int dtyppe)
} }
else else
{ {
return !mplabxd_init (this) - 1; return !mplabxd_init (this, Window1.Get_debug_port ()) - 1;
} }
} }
......
...@@ -148,7 +148,7 @@ board_pic::MDumpMemory(const char * fname) ...@@ -148,7 +148,7 @@ board_pic::MDumpMemory(const char * fname)
int int
board_pic::DebugInit(int dtyppe) //argument not used in picm only mplabx 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 void
......
...@@ -59,8 +59,7 @@ WSADATA wsaData; ...@@ -59,8 +59,7 @@ WSADATA wsaData;
#include<stdlib.h> #include<stdlib.h>
#include<string.h> #include<string.h>
#include<unistd.h> #include<unistd.h>
//defines
#define TCP_SERV_PORT 1234
typedef struct sockaddr sockaddr; typedef struct sockaddr sockaddr;
...@@ -154,7 +153,7 @@ static unsigned char *ramsend = NULL; ...@@ -154,7 +153,7 @@ static unsigned char *ramsend = NULL;
static unsigned char *ramreceived = NULL; static unsigned char *ramreceived = NULL;
int int
mplabxd_init(board * mboard) mplabxd_init(board * mboard, unsigned short tcpport)
{ {
struct sockaddr_in serv; struct sockaddr_in serv;
...@@ -186,7 +185,7 @@ mplabxd_init(board * mboard) ...@@ -186,7 +185,7 @@ mplabxd_init(board * mboard)
memset (&serv, 0, sizeof (serv)); memset (&serv, 0, sizeof (serv));
serv.sin_family = AF_INET; serv.sin_family = AF_INET;
serv.sin_addr.s_addr = htonl (INADDR_ANY); 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) if (bind (listenfd, (sockaddr *) & serv, sizeof (serv)) < 0)
{ {
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "../boards/board.h" #include "../boards/board.h"
//mplabx debugger //mplabx debugger
int mplabxd_init(board * mboard); int mplabxd_init(board * mboard, unsigned short tcpport);
int mplabxd_loop(void); int mplabxd_loop(void);
void mplabxd_end(void); void mplabxd_end(void);
int mplabxd_testbp(void); int mplabxd_testbp(void);
......
...@@ -359,6 +359,11 @@ CPWindow1::Configure(CControl * control, const char * home) ...@@ -359,6 +359,11 @@ CPWindow1::Configure(CControl * control, const char * home)
{ {
sscanf (value, "%i", &debug_type); sscanf (value, "%i", &debug_type);
} }
if (!strcmp (name, "debugp"))
{
sscanf (value, "%hu", &debug_port);
}
if (!strcmp (name, "osc_on")) if (!strcmp (name, "osc_on"))
{ {
...@@ -475,23 +480,23 @@ CPWindow1::Configure(CControl * control, const char * home) ...@@ -475,23 +480,23 @@ CPWindow1::Configure(CControl * control, const char * home)
int ret=pboard->DebugInit (debug_type); int ret=pboard->DebugInit (debug_type);
if ( ret < 0) if ( ret < 0)
{ {
statusbar1.SetField (1, status + lxT (" Debug: Error")); statusbar1.SetField (1, status + lxT ("Debug: Error"));
} }
else else
{ {
if(ret) if(ret)
{ {
statusbar1.SetField (1, status + lxT (" Debug: GDB")); statusbar1.SetField (1, status + lxT ("Debug: GDB:")+itoa(debug_port));
} }
else else
{ {
statusbar1.SetField (1, status + lxT (" Debug: MPLABX")); statusbar1.SetField (1, status + lxT ("Debug: MDB:")+itoa(debug_port));
} }
} }
} }
else else
{ {
statusbar1.SetField (1, status + lxT (" Debug: Off")); statusbar1.SetField (1, status + lxT ("Debug: Off"));
} }
#endif #endif
...@@ -590,6 +595,7 @@ CPWindow1::_EvOnDestroy(CControl * control) ...@@ -590,6 +595,7 @@ CPWindow1::_EvOnDestroy(CControl * control)
saveprefs (lxT ("clock"), combo1.GetText ()); saveprefs (lxT ("clock"), combo1.GetText ());
saveprefs (lxT ("debug"), itoa (debug)); saveprefs (lxT ("debug"), itoa (debug));
saveprefs (lxT ("debugt"), itoa (debug_type)); saveprefs (lxT ("debugt"), itoa (debug_type));
saveprefs (lxT ("debugp"), itoa (debug_port));
saveprefs (lxT ("position"), itoa (GetX ()) + lxT (",") + itoa (GetY ())); saveprefs (lxT ("position"), itoa (GetX ()) + lxT (",") + itoa (GetY ()));
saveprefs (lxT ("osc_on"), itoa (pboard->GetUseOscilloscope ())); saveprefs (lxT ("osc_on"), itoa (pboard->GetUseOscilloscope ()));
saveprefs (lxT ("spare_on"), itoa (pboard->GetUseSpareParts ())); saveprefs (lxT ("spare_on"), itoa (pboard->GetUseSpareParts ()));
...@@ -1096,6 +1102,7 @@ CPWindow1::filedialog2_EvOnClose(int retId) ...@@ -1096,6 +1102,7 @@ CPWindow1::filedialog2_EvOnClose(int retId)
saveprefs (lxT ("clock"), combo1.GetText ()); saveprefs (lxT ("clock"), combo1.GetText ());
saveprefs (lxT ("debug"), itoa (debug)); saveprefs (lxT ("debug"), itoa (debug));
saveprefs (lxT ("debugt"), itoa (debug_type)); saveprefs (lxT ("debugt"), itoa (debug_type));
saveprefs (lxT ("debugp"), itoa (debug_port));
saveprefs (lxT ("position"), itoa (GetX ()) + lxT (",") + itoa (GetY ())); saveprefs (lxT ("position"), itoa (GetX ()) + lxT (",") + itoa (GetY ()));
saveprefs (lxT ("osc_on"), itoa (pboard->GetUseOscilloscope ())); saveprefs (lxT ("osc_on"), itoa (pboard->GetUseOscilloscope ()));
saveprefs (lxT ("spare_on"), itoa (pboard->GetUseSpareParts ())); saveprefs (lxT ("spare_on"), itoa (pboard->GetUseSpareParts ()));
......
...@@ -175,6 +175,13 @@ public: ...@@ -175,6 +175,13 @@ public:
int Get_debug_type(void) { int Get_debug_type(void) {
return debug_type; 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 * @brief Return actual power status of microcontroller ON/OFF
...@@ -223,6 +230,10 @@ public: ...@@ -223,6 +230,10 @@ public:
debug_type = dt; debug_type = dt;
}; };
void Set_debug_port(unsigned short dp) {
debug_port = dp;
};
void Set_mcudbg(int pd); void Set_mcudbg(int pd);
void SetPATH(String path) { void SetPATH(String path) {
...@@ -272,6 +283,7 @@ private: ...@@ -272,6 +283,7 @@ private:
int mcudbg; int mcudbg;
int debug; int debug;
int debug_type; int debug_type;
unsigned short debug_port;
int osc_on; int osc_on;
int spare_on; int spare_on;
......
...@@ -396,6 +396,8 @@ mcupwr=1; ...@@ -396,6 +396,8 @@ mcupwr=1;
mcurst=0; mcurst=0;
mcudbg=0; mcudbg=0;
debug=0; debug=0;
debug_type=0;
debug_port=1234;
osc_on= 0; osc_on= 0;
spare_on= 0; spare_on= 0;
status.status=0; status.status=0;
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
//Configuration window //Configuration window
#include <lxrad/cspin.h>
#include"picsimlab3.h" #include"picsimlab3.h"
#include"picsimlab3_d.cc" #include"picsimlab3_d.cc"
...@@ -65,6 +67,8 @@ CPWindow3::button1_EvMouseButtonClick(CControl * control, uint button, uint x, u ...@@ -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_type (combo3.GetText ().compare ("GDB") == 0);
Window1.Set_debug_port (spin1.GetValue ());
#ifdef _USE_PICSTARTP_ #ifdef _USE_PICSTARTP_
if (combo1.GetText () == combo2.GetText ()) if (combo1.GetText () == combo2.GetText ())
{ {
...@@ -117,6 +121,8 @@ CPWindow3::_EvOnShow(CControl * control) ...@@ -117,6 +121,8 @@ CPWindow3::_EvOnShow(CControl * control)
{ {
combo3.SetText ("MPLABX"); combo3.SetText ("MPLABX");
} }
spin1.SetValue (Window1.Get_debug_port ());
} }
......
...@@ -39,6 +39,8 @@ class CPWindow3:public CPWindow ...@@ -39,6 +39,8 @@ class CPWindow3:public CPWindow
CCombo combo2; CCombo combo2;
CLabel label3; CLabel label3;
CCombo combo3; CCombo combo3;
CLabel label4;
CSpin spin1;
/*#Events*/ /*#Events*/
void _EvOnCreate(CControl * control); void _EvOnCreate(CControl * control);
void _EvOnShow(CControl * control); void _EvOnShow(CControl * control);
......
...@@ -79,8 +79,8 @@ CPWindow3::CPWindow3(void) ...@@ -79,8 +79,8 @@ CPWindow3::CPWindow3(void)
button1.SetClass(lxT("CButton")); button1.SetClass(lxT("CButton"));
button1.SetName(lxT("button1")); button1.SetName(lxT("button1"));
button1.SetTag(0); button1.SetTag(0);
button1.SetX(125); button1.SetX(123);
button1.SetY(146); button1.SetY(173);
button1.SetWidth(65); button1.SetWidth(65);
button1.SetHeight(28); button1.SetHeight(28);
button1.SetHint(lxT("")); button1.SetHint(lxT(""));
...@@ -153,10 +153,45 @@ CPWindow3::CPWindow3(void) ...@@ -153,10 +153,45 @@ CPWindow3::CPWindow3(void)
combo3.SetEnable(1); combo3.SetEnable(1);
combo3.SetVisible(1); combo3.SetVisible(1);
combo3.SetPopupMenu(NULL); combo3.SetPopupMenu(NULL);
combo3.SetItems(lxT("MPLABX,GDB,")); combo3.SetItems(lxT("MDB,GDB,"));
combo3.SetText(lxT("MPLABX")); combo3.SetText(lxT("MDB"));
combo3.SetReadOnly(0); combo3.SetReadOnly(1);
CreateChild(&combo3); 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*/ /*#Others*/
//lxrad automatic generated block end, don't edit above! //lxrad automatic generated block end, don't edit above!
}; };
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<X type="int">401</X> <X type="int">401</X>
<Y type="int">215</Y> <Y type="int">215</Y>
<Width type="uint">325</Width> <Width type="uint">325</Width>
<Height type="uint">239</Height> <Height type="uint">256</Height>
<Hint type="String"></Hint> <Hint type="String"></Hint>
<Enable type="bool">1</Enable> <Enable type="bool">1</Enable>
<Visible type="bool">0</Visible> <Visible type="bool">0</Visible>
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
<Class type="String">CButton</Class> <Class type="String">CButton</Class>
<Name type="String">button1</Name> <Name type="String">button1</Name>
<Tag type="int">0</Tag> <Tag type="int">0</Tag>
<X type="int">125</X> <X type="int">123</X>
<Y type="int">146</Y> <Y type="int">173</Y>
<Width type="uint">65</Width> <Width type="uint">65</Width>
<Height type="uint">28</Height> <Height type="uint">28</Height>
<Hint type="String"></Hint> <Hint type="String"></Hint>
...@@ -211,9 +211,63 @@ ...@@ -211,9 +211,63 @@
<EvOnDraw type="Event">FALSE</EvOnDraw> <EvOnDraw type="Event">FALSE</EvOnDraw>
<EvOnFocusIn type="Event">FALSE</EvOnFocusIn> <EvOnFocusIn type="Event">FALSE</EvOnFocusIn>
<EvOnFocusOut type="Event">FALSE</EvOnFocusOut> <EvOnFocusOut type="Event">FALSE</EvOnFocusOut>
<Items type="StringList">MPLABX,GDB,</Items> <Items type="StringList">GDB,MDB,</Items>
<Text type="String">MPLABX</Text> <Text type="String"></Text>
<ReadOnly type="bool">0</ReadOnly> <ReadOnly type="bool">1</ReadOnly>
<EvOnComboChange type="Event">FALSE</EvOnComboChange> <EvOnComboChange type="Event">FALSE</EvOnComboChange>
</combo3> </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> </window3>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment