remote.c: Compile only relevant functions.
Do no compile firmware functions when compiling pc-hosted.
This commit is contained in:
parent
16967b4328
commit
05adcd9bf5
|
@ -45,6 +45,7 @@ SRC = \
|
|||
nrf51.c \
|
||||
nxpke04.c \
|
||||
platform.c \
|
||||
remote.c \
|
||||
sam3x.c \
|
||||
sam4l.c \
|
||||
samd.c \
|
||||
|
@ -72,11 +73,16 @@ endif
|
|||
|
||||
ifndef OWN_HL
|
||||
SRC += jtag_scan.c jtagtap.c swdptap.c
|
||||
SRC += remote.c
|
||||
else
|
||||
CFLAGS += -DOWN_HL
|
||||
endif
|
||||
|
||||
ifdef PC_HOSTED
|
||||
CFLAGS += -DPC_HOSTED=1
|
||||
else
|
||||
CFLAGS += -DPC_HOSTED=0
|
||||
endif
|
||||
|
||||
OBJ = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(SRC)))
|
||||
|
||||
$(TARGET): include/version.h $(OBJ)
|
||||
|
|
|
@ -60,7 +60,7 @@ static bool cmd_target_power(target *t, int argc, const char **argv);
|
|||
static bool cmd_traceswo(target *t, int argc, const char **argv);
|
||||
#endif
|
||||
static bool cmd_heapinfo(target *t, int argc, const char **argv);
|
||||
#if defined(PLATFORM_HAS_DEBUG) && !defined(PC_HOSTED)
|
||||
#if defined(PLATFORM_HAS_DEBUG) && (PC_HOSTED == 0)
|
||||
static bool cmd_debug_bmp(target *t, int argc, const char **argv);
|
||||
#endif
|
||||
|
||||
|
@ -85,14 +85,14 @@ const struct command_s cmd_list[] = {
|
|||
#endif
|
||||
#endif
|
||||
{"heapinfo", (cmd_handler)cmd_heapinfo, "Set semihosting heapinfo" },
|
||||
#if defined(PLATFORM_HAS_DEBUG) && !defined(PC_HOSTED)
|
||||
#if defined(PLATFORM_HAS_DEBUG) && (PC_HOSTED == 0)
|
||||
{"debug_bmp", (cmd_handler)cmd_debug_bmp, "Output BMP \"debug\" strings to the second vcom: (enable|disable)"},
|
||||
#endif
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
bool connect_assert_srst;
|
||||
#if defined(PLATFORM_HAS_DEBUG) && !defined(PC_HOSTED)
|
||||
#if defined(PLATFORM_HAS_DEBUG) && (PC_HOSTED == 0)
|
||||
bool debug_bmp;
|
||||
#endif
|
||||
long cortexm_wait_timeout = 2000; /* Timeout to wait for Cortex to react on halt command. */
|
||||
|
@ -135,7 +135,7 @@ bool cmd_version(target *t, int argc, char **argv)
|
|||
(void)t;
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
#if defined PC_HOSTED
|
||||
#if PC_HOSTED == 1
|
||||
gdb_outf("Black Magic Probe, PC-Hosted for " PLATFORM_IDENT
|
||||
", Version " FIRMWARE_VERSION "\n");
|
||||
#else
|
||||
|
@ -389,7 +389,7 @@ static bool cmd_traceswo(target *t, int argc, const char **argv)
|
|||
}
|
||||
}
|
||||
}
|
||||
#if defined(PLATFORM_HAS_DEBUG) && !defined(PC_HOSTED) && defined(ENABLE_DEBUG)
|
||||
#if defined(PLATFORM_HAS_DEBUG) && (PC_HOSTED == 0) && defined(ENABLE_DEBUG)
|
||||
if (debug_bmp) {
|
||||
#if TRACESWO_PROTOCOL == 2
|
||||
gdb_outf("baudrate: %lu ", baudrate);
|
||||
|
@ -412,7 +412,7 @@ static bool cmd_traceswo(target *t, int argc, const char **argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_HAS_DEBUG) && !defined(PC_HOSTED)
|
||||
#if defined(PLATFORM_HAS_DEBUG) && (PC_HOSTED == 0)
|
||||
static bool cmd_debug_bmp(target *t, int argc, const char **argv)
|
||||
{
|
||||
(void)t;
|
||||
|
|
|
@ -47,7 +47,7 @@ int gdb_getpacket(char *packet, int size)
|
|||
packet[0] = gdb_if_getchar();
|
||||
if (packet[0]==0x04) return 1;
|
||||
} while ((packet[0] != '$') && (packet[0] != REMOTE_SOM));
|
||||
#ifndef OWN_HL
|
||||
#if PC_HOSTED == 0
|
||||
if (packet[0]==REMOTE_SOM) {
|
||||
/* This is probably a remote control packet
|
||||
* - get and handle it */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#ifndef __GDB_IF_H
|
||||
#define __GDB_IF_H
|
||||
|
||||
#if !defined(NO_LIBOPENCM3)
|
||||
#if PC_HOSTED == 0
|
||||
#include <libopencm3/usb/usbd.h>
|
||||
void gdb_usb_out_cb(usbd_device *dev, uint8_t ep);
|
||||
#endif
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
# error "Include 'general.h' instead"
|
||||
#endif
|
||||
|
||||
#if defined(PC_HOSTED)
|
||||
#if PC_HOSTED == 1
|
||||
void platform_init(int argc, char **argv);
|
||||
#else
|
||||
void platform_init(void);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
#if defined(PC_HOSTED)
|
||||
#if PC_HOSTED == 1
|
||||
platform_init(argc, argv);
|
||||
#else
|
||||
(void) argc;
|
||||
|
|
|
@ -59,7 +59,7 @@ static char morse_repeat;
|
|||
|
||||
void morse(const char *msg, char repeat)
|
||||
{
|
||||
#if defined(PC_HOSTED)
|
||||
#if PC_HOSTED == 1
|
||||
if (msg)
|
||||
DEBUG("%s\n", msg);
|
||||
(void) repeat;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SYS = $(shell $(CC) -dumpmachine)
|
||||
CFLAGS += -DPC_HOSTED -DNO_LIBOPENCM3 -DENABLE_DEBUG
|
||||
CFLAGS += -DENABLE_DEBUG
|
||||
CFLAGS += $(shell pkg-config --cflags libftdi1)
|
||||
LDFLAGS += $(shell pkg-config --libs libftdi1)
|
||||
ifneq (, $(findstring mingw, $(SYS)))
|
||||
|
@ -10,3 +10,4 @@ endif
|
|||
VPATH += platforms/pc
|
||||
SRC += timing.c cl_utils.c utils.c
|
||||
CFLAGS +=-I ./target -I./platforms/pc
|
||||
PC_HOSTED = 1
|
|
@ -1,6 +1,6 @@
|
|||
TARGET=blackmagic_hosted
|
||||
SYS = $(shell $(CC) -dumpmachine)
|
||||
CFLAGS += -DPC_HOSTED -DNO_LIBOPENCM3 -DENABLE_DEBUG
|
||||
CFLAGS += -DENABLE_DEBUG
|
||||
CFLAGS +=-I ./target -I./platforms/pc
|
||||
ifneq (, $(findstring mingw, $(SYS)))
|
||||
SRC += serial_win.c
|
||||
|
@ -13,3 +13,4 @@ SRC += serial_unix.c
|
|||
endif
|
||||
VPATH += platforms/pc
|
||||
SRC += cl_utils.c timing.c utils.c
|
||||
PC_HOSTED = 1
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
TARGET=blackmagic_stlinkv2
|
||||
SYS = $(shell $(CC) -dumpmachine)
|
||||
CFLAGS += -DPC_HOSTED -DNO_LIBOPENCM3 -DSTLINKV2 -DJTAG_HL -DENABLE_DEBUG
|
||||
CFLAGS += -DSTLINKV2 -DJTAG_HL -DENABLE_DEBUG
|
||||
CFLAGS +=-I ./target -I./platforms/pc
|
||||
LDFLAGS += -lusb-1.0
|
||||
ifneq (, $(findstring mingw, $(SYS)))
|
||||
|
@ -11,3 +11,4 @@ endif
|
|||
VPATH += platforms/pc
|
||||
SRC += timing.c stlinkv2.c cl_utils.c utils.c
|
||||
OWN_HL = 1
|
||||
PC_HOSTED = 1
|
||||
|
|
|
@ -263,7 +263,7 @@ enum {
|
|||
int rdi_write(int fn, const char *buf, size_t len)
|
||||
{
|
||||
(void)fn;
|
||||
#if defined(PLATFORM_HAS_DEBUG) && !defined(PC_HOSTED)
|
||||
#if defined(PLATFORM_HAS_DEBUG)
|
||||
if (debug_bmp)
|
||||
return len - usbuart_debug_write(buf, len);
|
||||
#else
|
||||
|
|
|
@ -56,6 +56,7 @@ uint64_t remotehston(uint32_t limit, char *s)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if PC_HOSTED == 0
|
||||
static void _respond(char respCode, uint64_t param)
|
||||
|
||||
/* Send response to far end */
|
||||
|
@ -274,3 +275,4 @@ void remotePacketProcess(uint8_t i, char *packet)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef PC_HOSTED
|
||||
#if PC_HOSTED == 1
|
||||
|
||||
/*
|
||||
* pc-hosted semihosting does keyboard, file and screen i/o on the system
|
||||
|
@ -1067,7 +1067,7 @@ static bool cortexm_vector_catch(target *t, int argc, char *argv[])
|
|||
#define SYS_WRITEC 0x03
|
||||
#define SYS_WRITE0 0x04
|
||||
|
||||
#if !defined(PC_HOSTED)
|
||||
#if PC_HOSTED == 0
|
||||
/* probe memory access functions */
|
||||
static void probe_mem_read(target *t __attribute__((unused)), void *probe_dest, target_addr target_src, size_t len)
|
||||
{
|
||||
|
@ -1104,7 +1104,7 @@ static int cortexm_hostio_request(target *t)
|
|||
DEBUG("syscall 0"PRIx32"%"PRIx32" (%"PRIx32" %"PRIx32" %"PRIx32" %"PRIx32")\n",
|
||||
syscall, params[0], params[1], params[2], params[3]);
|
||||
switch (syscall) {
|
||||
#if defined(PC_HOSTED)
|
||||
#if PC_HOSTED == 1
|
||||
|
||||
/* code that runs in pc-hosted process. use linux system calls. */
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ void target_detach(target *t)
|
|||
{
|
||||
t->detach(t);
|
||||
t->attached = false;
|
||||
#if defined(PC_HOSTED)
|
||||
#if PC_HOSTED == 1
|
||||
# include "platform.h"
|
||||
platform_buffer_flush();
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue