Hosted: Allow command line interaction.
This commit is contained in:
parent
ee316431f5
commit
c3a3f7737f
|
@ -1,7 +1,8 @@
|
||||||
TARGET=blackmagic_hosted
|
TARGET=blackmagic_hosted
|
||||||
SYS = $(shell $(CC) -dumpmachine)
|
SYS = $(shell $(CC) -dumpmachine)
|
||||||
CFLAGS += -DPC_HOSTED -DNO_LIBOPENCM3 -DENABLE_DEBUG
|
CFLAGS += -DPC_HOSTED -DNO_LIBOPENCM3 -DENABLE_DEBUG -I
|
||||||
CFLAGS += $(shell pkg-config --cflags libftdi1)
|
CFLAGS += $(shell pkg-config --cflags libftdi1)
|
||||||
|
CFLAGS +=-I ./target -I./platforms/pc
|
||||||
LDFLAGS += $(shell pkg-config --libs libftdi1)
|
LDFLAGS += $(shell pkg-config --libs libftdi1)
|
||||||
ifneq (, $(findstring mingw, $(SYS)))
|
ifneq (, $(findstring mingw, $(SYS)))
|
||||||
LDFLAGS += -lusb-1.0 -lws2_32
|
LDFLAGS += -lusb-1.0 -lws2_32
|
||||||
|
@ -10,4 +11,4 @@ else ifneq (, $(findstring cygwin, $(SYS)))
|
||||||
LDFLAGS += -lusb-1.0 -lws2_32
|
LDFLAGS += -lusb-1.0 -lws2_32
|
||||||
endif
|
endif
|
||||||
VPATH += platforms/pc
|
VPATH += platforms/pc
|
||||||
SRC += timing.c \
|
SRC += cl_utils.c timing.c
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "cl_utils.h"
|
||||||
|
|
||||||
/* Allow 100mS for responses to reach us */
|
/* Allow 100mS for responses to reach us */
|
||||||
#define RESP_TIMEOUT (100)
|
#define RESP_TIMEOUT (100)
|
||||||
|
|
||||||
|
@ -93,29 +95,20 @@ int set_interface_attribs (int fd, int speed, int parity)
|
||||||
|
|
||||||
void platform_init(int argc, char **argv)
|
void platform_init(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int c;
|
BMP_CL_OPTIONS_t cl_opts = {0};
|
||||||
|
cl_opts.opt_idstring = "Blackmagic Debug Probe Remote";
|
||||||
|
cl_init(&cl_opts, argc, argv);
|
||||||
char construct[PLATFORM_MAX_MSG_SIZE];
|
char construct[PLATFORM_MAX_MSG_SIZE];
|
||||||
char *serial = NULL;
|
|
||||||
while((c = getopt(argc, argv, "s:")) != -1) {
|
|
||||||
switch(c)
|
|
||||||
{
|
|
||||||
case 's':
|
|
||||||
serial = optarg;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\nBlack Magic Probe (" FIRMWARE_VERSION ")\n");
|
printf("\nBlack Magic Probe (" FIRMWARE_VERSION ")\n");
|
||||||
printf("Copyright (C) 2019 Black Sphere Technologies Ltd.\n");
|
printf("Copyright (C) 2019 Black Sphere Technologies Ltd.\n");
|
||||||
printf("License GPLv3+: GNU GPL version 3 or later "
|
printf("License GPLv3+: GNU GPL version 3 or later "
|
||||||
"<http://gnu.org/licenses/gpl.html>\n\n");
|
"<http://gnu.org/licenses/gpl.html>\n\n");
|
||||||
|
|
||||||
assert(gdb_if_init() == 0);
|
f=open(cl_opts.opt_serial,O_RDWR|O_SYNC|O_NOCTTY);
|
||||||
|
|
||||||
f=open(serial,O_RDWR|O_SYNC|O_NOCTTY);
|
|
||||||
if (f<0)
|
if (f<0)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"Couldn't open serial port %s\n",serial);
|
fprintf(stderr,"Couldn't open serial port %s\n", cl_opts.opt_serial);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +117,7 @@ void platform_init(int argc, char **argv)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
c=snprintf(construct,PLATFORM_MAX_MSG_SIZE,"%s",REMOTE_START_STR);
|
int c=snprintf(construct,PLATFORM_MAX_MSG_SIZE,"%s",REMOTE_START_STR);
|
||||||
platform_buffer_write((uint8_t *)construct,c);
|
platform_buffer_write((uint8_t *)construct,c);
|
||||||
c=platform_buffer_read((uint8_t *)construct, PLATFORM_MAX_MSG_SIZE);
|
c=platform_buffer_read((uint8_t *)construct, PLATFORM_MAX_MSG_SIZE);
|
||||||
|
|
||||||
|
@ -135,6 +128,13 @@ void platform_init(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Remote is %s\n",&construct[1]);
|
printf("Remote is %s\n",&construct[1]);
|
||||||
|
if (cl_opts.opt_mode != BMP_MODE_DEBUG) {
|
||||||
|
int ret = cl_execute(&cl_opts);
|
||||||
|
close(f);
|
||||||
|
exit(ret);
|
||||||
|
} else {
|
||||||
|
assert(gdb_if_init() == 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool platform_target_get_power(void)
|
bool platform_target_get_power(void)
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This file allows pc-hosted BMP platforms to erase and flash a
|
/* This file allows pc-hosted BMP platforms to erase or read/verify/flash a
|
||||||
* binary file from the command line.
|
* binary file from the command line.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue