Browse Source

Merge pull request #499 from smunaut/minor_enhancements

Minor enhancements
pull/500/head
UweBonnes 5 years ago
committed by GitHub
parent
commit
c9c8b089f7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      Makefile
  2. 15
      src/Makefile
  3. 2
      src/gdb_packet.c
  4. 2
      src/include/gdb_if.h
  5. 2
      src/platforms/libftdi/Makefile.inc
  6. 2
      src/platforms/pc-stlinkv2/Makefile.inc
  7. 2
      src/target/efm32.c
  8. 18
      src/target/samd.c

7
Makefile

@ -4,15 +4,18 @@ Q := @
endif
PC_HOSTED =
NO_LIBOPENCM3 =
ifeq ($(PROBE_HOST), libftdi)
PC_HOSTED = true
NO_LIBOPENCM3 = true
endif
ifeq ($(PROBE_HOST), pc-stlinkv2)
PC_HOSTED = true
NO_LIBOPENCM3 = true
endif
all:
ifndef PC_HOSTED
ifndef NO_LIBOPENCM3
$(Q)if [ ! -f libopencm3/Makefile ]; then \
echo "Initialising git submodules..." ;\
git submodule init ;\
@ -23,7 +26,7 @@ endif
$(Q)$(MAKE) $(MFLAGS) -C src
clean:
ifndef PC_HOSTED
ifndef NO_LIBOPENCM3
$(Q)$(MAKE) $(MFLAGS) -C libopencm3 $@
endif
$(Q)$(MAKE) $(MFLAGS) -C src $@

15
src/Makefile

@ -8,12 +8,9 @@ MAKEFLAGS += --no-print-dir
Q := @
endif
OPT_FLAGS ?= -O2
CFLAGS += -Wall -Wextra -Werror -Wno-char-subscripts -Wno-cast-function-type \
$(OPT_FLAGS) -std=gnu99 -g3 -MD \
-std=gnu99 -g3 -MD \
-I. -Iinclude -Iplatforms/common -I$(PLATFORM_DIR)
LDFLAGS += $(OPT_FLAGS)
ifeq ($(ENABLE_DEBUG), 1)
CFLAGS += -DENABLE_DEBUG
@ -60,6 +57,10 @@ SRC = \
include $(PLATFORM_DIR)/Makefile.inc
OPT_FLAGS ?= -O2
CFLAGS += $(OPT_FLAGS)
LDFLAGS += $(OPT_FLAGS)
ifndef TARGET
TARGET=blackmagic
endif
@ -72,7 +73,7 @@ ifndef OWN_HL
SRC += jtag_scan.c jtagtap.c swdptap.c
endif
OBJ = $(SRC:.c=.o)
OBJ = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(SRC)))
$(TARGET): include/version.h $(OBJ)
@echo " LD $@"
@ -82,6 +83,10 @@ $(TARGET): include/version.h $(OBJ)
@echo " CC $<"
$(Q)$(CC) $(CFLAGS) -c $< -o $@
%.o: %.S
@echo " AS $<"
$(Q)$(CC) $(CFLAGS) -c $< -o $@
%.bin: %
@echo " OBJCOPY $@"
$(Q)$(OBJCOPY) -O binary $^ $@

2
src/gdb_packet.c

@ -120,7 +120,7 @@ void gdb_putpacket(const char *packet, int size)
}
}
gdb_if_putchar('#', 0);
sprintf(xmit_csum, "%02X", csum);
snprintf(xmit_csum, sizeof(xmit_csum), "%02X", csum);
gdb_if_putchar(xmit_csum[0], 0);
gdb_if_putchar(xmit_csum[1], 1);
#ifdef DEBUG_GDBPACKET

2
src/include/gdb_if.h

@ -21,7 +21,7 @@
#ifndef __GDB_IF_H
#define __GDB_IF_H
#if !defined(PC_HOSTED)
#if !defined(NO_LIBOPENCM3)
#include <libopencm3/usb/usbd.h>
void gdb_usb_out_cb(usbd_device *dev, uint8_t ep);
#endif

2
src/platforms/libftdi/Makefile.inc

@ -1,5 +1,5 @@
SYS = $(shell $(CC) -dumpmachine)
CFLAGS += -DPC_HOSTED -DENABLE_DEBUG
CFLAGS += -DPC_HOSTED -DNO_LIBOPENCM3 -DENABLE_DEBUG
LDFLAGS += -lftdi1
ifneq (, $(findstring mingw, $(SYS)))
LDFLAGS += -lusb-1.0 -lws2_32

2
src/platforms/pc-stlinkv2/Makefile.inc

@ -1,6 +1,6 @@
TARGET=blackmagic_stlinkv2
SYS = $(shell $(CC) -dumpmachine)
CFLAGS += -DPC_HOSTED -DSTLINKV2 -DJTAG_HL -DENABLE_DEBUG
CFLAGS += -DPC_HOSTED -DNO_LIBOPENCM3 -DSTLINKV2 -DJTAG_HL -DENABLE_DEBUG
CFLAGS +=-I ./target
LDFLAGS += -lusb-1.0
ifneq (, $(findstring mingw, $(SYS)))

2
src/target/efm32.c

@ -611,7 +611,7 @@ bool efm32_probe(target *t)
uint32_t ram_size = ram_kib * 0x400;
uint32_t flash_page_size = device->flash_page_size;
sprintf(variant_string, "%c\b%c\b%s %d F%d %s",
snprintf(variant_string, sizeof(variant_string), "%c\b%c\b%s %d F%d %s",
di_version + 48, (uint8_t)device_index + 32,
device->name, part_number, flash_kib, device->description);

18
src/target/samd.c

@ -364,7 +364,7 @@ static void samd_add_flash(target *t, uint32_t addr, size_t length)
target_add_flash(t, f);
}
char variant_string[40];
char variant_string[60];
bool samd_probe(target *t)
{
uint32_t cid = samd_read_cid(t);
@ -390,15 +390,15 @@ bool samd_probe(target *t)
/* Part String */
if (protected) {
sprintf(variant_string,
"Atmel SAMD%d%c%dA%s (rev %c) (PROT=1)",
samd.series, samd.pin, samd.mem,
samd.package, samd.revision);
snprintf(variant_string, sizeof(variant_string),
"Atmel SAMD%d%c%dA%s (rev %c) (PROT=1)",
samd.series, samd.pin, samd.mem,
samd.package, samd.revision);
} else {
sprintf(variant_string,
"Atmel SAMD%d%c%dA%s (rev %c)",
samd.series, samd.pin, samd.mem,
samd.package, samd.revision);
snprintf(variant_string, sizeof(variant_string),
"Atmel SAMD%d%c%dA%s (rev %c)",
samd.series, samd.pin, samd.mem,
samd.package, samd.revision);
}
/* Setup Target */

Loading…
Cancel
Save