Commit c1e0f05e authored by lcgamboa's avatar lcgamboa

chg: support to set debug port !minor

parent ba2fe1d1
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
void setblock(int sock_descriptor); void setblock(int sock_descriptor);
void setnblock(int sock_descriptor); void setnblock(int sock_descriptor);
char * serial_list(void);
#ifndef _WIN_ #ifndef _WIN_
#include<sys/types.h> #include<sys/types.h>
...@@ -68,7 +69,7 @@ board_qemu_stm32::MInit(const char * processor, const char * fname, float freq) ...@@ -68,7 +69,7 @@ board_qemu_stm32::MInit(const char * processor, const char * fname, float freq)
char buff[100]; char buff[100];
int n; int n;
char fname_[300]; char fname_[300];
char cmd[500]; char cmd[600];
#ifdef _WIN_ #ifdef _WIN_
...@@ -152,9 +153,9 @@ board_qemu_stm32::MInit(const char * processor, const char * fname, float freq) ...@@ -152,9 +153,9 @@ board_qemu_stm32::MInit(const char * processor, const char * fname, float freq)
//verify if qemu executable exists //verify if qemu executable exists
#ifdef _WIN_ #ifdef _WIN_
if( ! lxFileExists (Window1.GetSharePath () + lxT ("/../qemu-stm32.exe" ))) if (!lxFileExists (Window1.GetSharePath () + lxT ("/../qemu-stm32.exe")))
#else #else
if((!lxFileExists("/usr/bin/qemu-stm32"))&&(!lxFileExists("/usr/local/bin/qemu-stm32"))) if ((!lxFileExists ("/usr/bin/qemu-stm32"))&&(!lxFileExists ("/usr/local/bin/qemu-stm32")))
#endif #endif
{ {
Message ("qemu-stm32 not found!"); Message ("qemu-stm32 not found!");
...@@ -162,15 +163,22 @@ board_qemu_stm32::MInit(const char * processor, const char * fname, float freq) ...@@ -162,15 +163,22 @@ board_qemu_stm32::MInit(const char * processor, const char * fname, float freq)
return -1; return -1;
} }
#ifdef _WIN_ char * resp = serial_list ();
snprintf (cmd, 499, "qemu-stm32 -M stm32-f103c8-picsimlab -qmp tcp:localhost:2500,server,nowait -pflash \"%s\"",
fname_ //verify if serial port exists
); if (strstr (resp, SERIALDEVICE))
#else {
snprintf (cmd, 499, "qemu-stm32 -M stm32-f103c8-picsimlab -serial %s -qmp tcp:localhost:2500,server,nowait -pflash \"%s\"", snprintf (cmd, 599, "qemu-stm32 -M stm32-f103c8-picsimlab -serial %s -qmp tcp:localhost:2500,server,nowait -gdb tcp::%i -pflash \"%s\"",
SERIALDEVICE ,fname_ SERIALDEVICE, Window1.Get_debug_port (), fname_);
);
#endif }
else
{
snprintf (cmd, 599, "qemu-stm32 -M stm32-f103c8-picsimlab -qmp tcp:localhost:2500,server,nowait -gdb tcp::%i -pflash \"%s\"",
Window1.Get_debug_port (), fname_ );
}
free(resp);
printf ("%s\n", (const char *) cmd); printf ("%s\n", (const char *) cmd);
#ifdef _WIN_ #ifdef _WIN_
...@@ -248,7 +256,7 @@ board_qemu_stm32::MEnd(void) ...@@ -248,7 +256,7 @@ board_qemu_stm32::MEnd(void)
Window1.filedialog1.SetFileName (lxT ("untitled.hex")); Window1.filedialog1.SetFileName (lxT ("untitled.hex"));
Window1.filedialog1.SetFilter (lxT ("Hex Files (*.hex)|*.hex;*.HEX")); Window1.filedialog1.SetFilter (lxT ("Hex Files (*.hex)|*.hex;*.HEX"));
//Wait for qemu shutdown //Wait for qemu shutdown
#ifdef _WIN_ #ifdef _WIN_
Sleep (1000); Sleep (1000);
#else #else
...@@ -286,8 +294,7 @@ board_qemu_stm32::CpuInitialized(void) ...@@ -286,8 +294,7 @@ board_qemu_stm32::CpuInitialized(void)
} }
void void
board_qemu_stm32::DebugLoop(void) { board_qemu_stm32::DebugLoop(void) { }
}
String String
board_qemu_stm32::MGetPinName(int pin) board_qemu_stm32::MGetPinName(int pin)
......
...@@ -91,7 +91,7 @@ board_ucsim::MInit(const char * processor, const char * fname, float freq) ...@@ -91,7 +91,7 @@ board_ucsim::MInit(const char * processor, const char * fname, float freq)
sprintf (fbuff, "%i", (int) freq); sprintf (fbuff, "%i", (int) freq);
int ret = ucsim_init (processor, fbuff, fname, SERIALDEVICE); int ret = ucsim_init (processor, fbuff, fname, SERIALDEVICE, Window1.Get_debug_port ());
return ret; return ret;
} }
......
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