Merge pull request #493 from UweBonnes/weak
Remove weak attribute for less hassle with windows compiles
This commit is contained in:
commit
c19ca20e36
|
@ -16,4 +16,4 @@ tags
|
||||||
*.b#*
|
*.b#*
|
||||||
blackmagic_upgrade
|
blackmagic_upgrade
|
||||||
*.exe
|
*.exe
|
||||||
|
.vscode
|
||||||
|
|
|
@ -64,12 +64,12 @@ ifndef TARGET
|
||||||
TARGET=blackmagic
|
TARGET=blackmagic
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef SWD_HL
|
ifdef NO_OWN_LL
|
||||||
SRC += swdptap.c swdptap_generic.c
|
SRC += jtagtap_generic.c swdptap_generic.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef JTAG_HL
|
ifndef OWN_HL
|
||||||
SRC += jtag_scan.c jtagtap.c jtagtap_generic.c
|
SRC += jtag_scan.c jtagtap.c swdptap.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OBJ = $(SRC:.c=.o)
|
OBJ = $(SRC:.c=.o)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#ifndef __GDB_IF_H
|
#ifndef __GDB_IF_H
|
||||||
#define __GDB_IF_H
|
#define __GDB_IF_H
|
||||||
|
|
||||||
#if !defined(LIBFTDI)
|
#if !defined(PC_HOSTED)
|
||||||
#include <libopencm3/usb/usbd.h>
|
#include <libopencm3/usb/usbd.h>
|
||||||
void gdb_usb_out_cb(usbd_device *dev, uint8_t ep);
|
void gdb_usb_out_cb(usbd_device *dev, uint8_t ep);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
# error "Include 'general.h' instead"
|
# error "Include 'general.h' instead"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LIBFTDI)
|
#if defined(PC_HOSTED)
|
||||||
void platform_init(int argc, char **argv);
|
void platform_init(int argc, char **argv);
|
||||||
#else
|
#else
|
||||||
void platform_init(void);
|
void platform_init(void);
|
||||||
|
|
|
@ -27,7 +27,9 @@ int swdptap_init(void);
|
||||||
bool swdptap_bit_in(void);
|
bool swdptap_bit_in(void);
|
||||||
void swdptap_bit_out(bool val);
|
void swdptap_bit_out(bool val);
|
||||||
|
|
||||||
/* High level functions, provided as weak in swdptap_generic.c */
|
/* Low level functions, provided in swdptap_generic.c from the primitives
|
||||||
|
(indicate NO_OWN_LL in the Makefile.inc or libopencm specific in
|
||||||
|
platforms/common*/
|
||||||
uint32_t swdptap_seq_in(int ticks);
|
uint32_t swdptap_seq_in(int ticks);
|
||||||
bool swdptap_seq_in_parity(uint32_t *data, int ticks);
|
bool swdptap_seq_in_parity(uint32_t *data, int ticks);
|
||||||
void swdptap_seq_out(uint32_t MS, int ticks);
|
void swdptap_seq_out(uint32_t MS, int ticks);
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
#if defined(LIBFTDI)
|
#if defined(PC_HOSTED)
|
||||||
platform_init(argc, argv);
|
platform_init(argc, argv);
|
||||||
#else
|
#else
|
||||||
(void) argc;
|
(void) argc;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SYS = $(shell $(CC) -dumpmachine)
|
SYS = $(shell $(CC) -dumpmachine)
|
||||||
CFLAGS += -DLIBFTDI -DENABLE_DEBUG
|
CFLAGS += -DPC_HOSTED -DENABLE_DEBUG
|
||||||
LDFLAGS += -lftdi1
|
LDFLAGS += -lftdi1
|
||||||
ifneq (, $(findstring mingw, $(SYS)))
|
ifneq (, $(findstring mingw, $(SYS)))
|
||||||
LDFLAGS += -lusb-1.0 -lws2_32
|
LDFLAGS += -lusb-1.0 -lws2_32
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
TARGET=blackmagic_stlinkv2
|
TARGET=blackmagic_stlinkv2
|
||||||
SYS = $(shell $(CC) -dumpmachine)
|
SYS = $(shell $(CC) -dumpmachine)
|
||||||
CFLAGS += -DLIBFTDI -DSTLINKV2 -DJTAG_HL -DENABLE_DEBUG
|
CFLAGS += -DPC_HOSTED -DSTLINKV2 -DJTAG_HL -DENABLE_DEBUG
|
||||||
CFLAGS +=-I ./target
|
CFLAGS +=-I ./target
|
||||||
LDFLAGS += -lusb-1.0
|
LDFLAGS += -lusb-1.0
|
||||||
ifneq (, $(findstring mingw, $(SYS)))
|
ifneq (, $(findstring mingw, $(SYS)))
|
||||||
|
@ -11,5 +11,4 @@ LDFLAGS += -lws2_32
|
||||||
endif
|
endif
|
||||||
VPATH += platforms/pc
|
VPATH += platforms/pc
|
||||||
SRC += timing.c stlinkv2.c
|
SRC += timing.c stlinkv2.c
|
||||||
SWD_HL = 1
|
OWN_HL = 1
|
||||||
JTAG_HL = 1
|
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
#define STLINK_SWD_AP_WDATA_ERROR 0x18
|
#define STLINK_SWD_AP_WDATA_ERROR 0x18
|
||||||
#define STLINK_SWD_AP_STICKY_ERROR 0x19
|
#define STLINK_SWD_AP_STICKY_ERROR 0x19
|
||||||
#define STLINK_SWD_AP_STICKYORUN_ERROR 0x1a
|
#define STLINK_SWD_AP_STICKYORUN_ERROR 0x1a
|
||||||
|
#define STLINK_BAD_AP_ERROR 0x1d
|
||||||
#define STLINK_JTAG_UNKNOWN_CMD 0x42
|
#define STLINK_JTAG_UNKNOWN_CMD 0x42
|
||||||
|
|
||||||
#define STLINK_CORE_RUNNING 0x80
|
#define STLINK_CORE_RUNNING 0x80
|
||||||
|
@ -455,6 +456,9 @@ static int stlink_usb_error_check(uint8_t *data, bool verbose)
|
||||||
if (verbose)
|
if (verbose)
|
||||||
DEBUG("STLINK_SWD_AP_STICKYORUN_ERROR\n");
|
DEBUG("STLINK_SWD_AP_STICKYORUN_ERROR\n");
|
||||||
return STLINK_ERROR_FAIL;
|
return STLINK_ERROR_FAIL;
|
||||||
|
case STLINK_BAD_AP_ERROR:
|
||||||
|
/* ADIV5 probe 256 APs, most of them are non exisitant.*/
|
||||||
|
return STLINK_ERROR_FAIL;
|
||||||
case STLINK_JTAG_UNKNOWN_CMD :
|
case STLINK_JTAG_UNKNOWN_CMD :
|
||||||
if (verbose)
|
if (verbose)
|
||||||
DEBUG("STLINK_JTAG_UNKNOWN_CMD\n");
|
DEBUG("STLINK_JTAG_UNKNOWN_CMD\n");
|
||||||
|
@ -1055,7 +1059,7 @@ bool adiv5_ap_setup(int ap)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void div5_ap_cleanup(int ap)
|
void adiv5_ap_cleanup(int ap)
|
||||||
{
|
{
|
||||||
uint8_t cmd[16] = {
|
uint8_t cmd[16] = {
|
||||||
STLINK_DEBUG_COMMAND,
|
STLINK_DEBUG_COMMAND,
|
||||||
|
|
|
@ -390,9 +390,8 @@ static bool adiv5_component_probe(ADIv5_AP_t *ap, uint32_t addr, int recursion,
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
bool adiv5_ap_setup(int i);
|
||||||
bool __attribute__((weak)) adiv5_ap_setup(int i) {(void)i; return true;}
|
void adiv5_ap_cleanup(int i);
|
||||||
void __attribute__((weak)) adiv5_ap_cleanup(int i) {(void)i;}
|
|
||||||
|
|
||||||
ADIv5_AP_t *adiv5_new_ap(ADIv5_DP_t *dp, uint8_t apsel)
|
ADIv5_AP_t *adiv5_new_ap(ADIv5_DP_t *dp, uint8_t apsel)
|
||||||
{
|
{
|
||||||
|
@ -528,6 +527,11 @@ void adiv5_dp_init(ADIv5_DP_t *dp)
|
||||||
#define ALIGNOF(x) (((x) & 3) == 0 ? ALIGN_WORD : \
|
#define ALIGNOF(x) (((x) & 3) == 0 ? ALIGN_WORD : \
|
||||||
(((x) & 1) == 0 ? ALIGN_HALFWORD : ALIGN_BYTE))
|
(((x) & 1) == 0 ? ALIGN_HALFWORD : ALIGN_BYTE))
|
||||||
|
|
||||||
|
#if !defined(JTAG_HL)
|
||||||
|
|
||||||
|
bool adiv5_ap_setup(int i) {(void)i; return true;}
|
||||||
|
void adiv5_ap_cleanup(int i) {(void)i;}
|
||||||
|
|
||||||
/* Program the CSW and TAR for sequencial access at a given width */
|
/* Program the CSW and TAR for sequencial access at a given width */
|
||||||
static void ap_mem_access_setup(ADIv5_AP_t *ap, uint32_t addr, enum align align)
|
static void ap_mem_access_setup(ADIv5_AP_t *ap, uint32_t addr, enum align align)
|
||||||
{
|
{
|
||||||
|
@ -567,8 +571,7 @@ static void * extract(void *dest, uint32_t src, uint32_t val, enum align align)
|
||||||
return (uint8_t *)dest + (1 << align);
|
return (uint8_t *)dest + (1 << align);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak))
|
void adiv5_mem_read(ADIv5_AP_t *ap, void *dest, uint32_t src, size_t len)
|
||||||
adiv5_mem_read(ADIv5_AP_t *ap, void *dest, uint32_t src, size_t len)
|
|
||||||
{
|
{
|
||||||
uint32_t tmp;
|
uint32_t tmp;
|
||||||
uint32_t osrc = src;
|
uint32_t osrc = src;
|
||||||
|
@ -598,8 +601,7 @@ adiv5_mem_read(ADIv5_AP_t *ap, void *dest, uint32_t src, size_t len)
|
||||||
extract(dest, src, tmp, align);
|
extract(dest, src, tmp, align);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak))
|
void adiv5_mem_write_sized(ADIv5_AP_t *ap, uint32_t dest, const void *src,
|
||||||
adiv5_mem_write_sized(ADIv5_AP_t *ap, uint32_t dest, const void *src,
|
|
||||||
size_t len, enum align align)
|
size_t len, enum align align)
|
||||||
{
|
{
|
||||||
uint32_t odest = dest;
|
uint32_t odest = dest;
|
||||||
|
@ -634,16 +636,14 @@ adiv5_mem_write_sized(ADIv5_AP_t *ap, uint32_t dest, const void *src,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak))
|
void adiv5_ap_write(ADIv5_AP_t *ap, uint16_t addr, uint32_t value)
|
||||||
adiv5_ap_write(ADIv5_AP_t *ap, uint16_t addr, uint32_t value)
|
|
||||||
{
|
{
|
||||||
adiv5_dp_write(ap->dp, ADIV5_DP_SELECT,
|
adiv5_dp_write(ap->dp, ADIV5_DP_SELECT,
|
||||||
((uint32_t)ap->apsel << 24)|(addr & 0xF0));
|
((uint32_t)ap->apsel << 24)|(addr & 0xF0));
|
||||||
adiv5_dp_write(ap->dp, addr, value);
|
adiv5_dp_write(ap->dp, addr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t __attribute__((weak))
|
uint32_t adiv5_ap_read(ADIv5_AP_t *ap, uint16_t addr)
|
||||||
adiv5_ap_read(ADIv5_AP_t *ap, uint16_t addr)
|
|
||||||
{
|
{
|
||||||
uint32_t ret;
|
uint32_t ret;
|
||||||
adiv5_dp_write(ap->dp, ADIV5_DP_SELECT,
|
adiv5_dp_write(ap->dp, ADIV5_DP_SELECT,
|
||||||
|
@ -651,6 +651,7 @@ adiv5_ap_read(ADIv5_AP_t *ap, uint16_t addr)
|
||||||
ret = adiv5_dp_read(ap->dp, addr);
|
ret = adiv5_dp_read(ap->dp, addr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void adiv5_mem_write(ADIv5_AP_t *ap, uint32_t dest, const void *src, size_t len)
|
void adiv5_mem_write(ADIv5_AP_t *ap, uint32_t dest, const void *src, size_t len)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,8 +24,7 @@
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "jtagtap.h"
|
#include "jtagtap.h"
|
||||||
|
|
||||||
void __attribute__((weak))
|
void jtagtap_tms_seq(uint32_t MS, int ticks)
|
||||||
jtagtap_tms_seq(uint32_t MS, int ticks)
|
|
||||||
{
|
{
|
||||||
while(ticks--) {
|
while(ticks--) {
|
||||||
jtagtap_next(MS & 1, 1);
|
jtagtap_next(MS & 1, 1);
|
||||||
|
@ -33,8 +32,7 @@ jtagtap_tms_seq(uint32_t MS, int ticks)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak))
|
void jtagtap_tdi_tdo_seq(uint8_t *DO, const uint8_t final_tms, const uint8_t *DI, int ticks)
|
||||||
jtagtap_tdi_tdo_seq(uint8_t *DO, const uint8_t final_tms, const uint8_t *DI, int ticks)
|
|
||||||
{
|
{
|
||||||
uint8_t index = 1;
|
uint8_t index = 1;
|
||||||
while(ticks--) {
|
while(ticks--) {
|
||||||
|
@ -50,8 +48,7 @@ jtagtap_tdi_tdo_seq(uint8_t *DO, const uint8_t final_tms, const uint8_t *DI, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak))
|
void jtagtap_tdi_seq(const uint8_t final_tms, const uint8_t *DI, int ticks)
|
||||||
jtagtap_tdi_seq(const uint8_t final_tms, const uint8_t *DI, int ticks)
|
|
||||||
{
|
{
|
||||||
uint8_t index = 1;
|
uint8_t index = 1;
|
||||||
while(ticks--) {
|
while(ticks--) {
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "swdptap.h"
|
#include "swdptap.h"
|
||||||
|
|
||||||
uint32_t __attribute__((weak))
|
uint32_t swdptap_seq_in(int ticks)
|
||||||
swdptap_seq_in(int ticks)
|
|
||||||
{
|
{
|
||||||
uint32_t index = 1;
|
uint32_t index = 1;
|
||||||
uint32_t ret = 0;
|
uint32_t ret = 0;
|
||||||
|
@ -35,8 +34,7 @@ swdptap_seq_in(int ticks)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool __attribute__((weak))
|
bool swdptap_seq_in_parity(uint32_t *ret, int ticks)
|
||||||
swdptap_seq_in_parity(uint32_t *ret, int ticks)
|
|
||||||
{
|
{
|
||||||
uint32_t index = 1;
|
uint32_t index = 1;
|
||||||
uint8_t parity = 0;
|
uint8_t parity = 0;
|
||||||
|
@ -55,8 +53,7 @@ swdptap_seq_in_parity(uint32_t *ret, int ticks)
|
||||||
return parity;
|
return parity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak))
|
void swdptap_seq_out(uint32_t MS, int ticks)
|
||||||
swdptap_seq_out(uint32_t MS, int ticks)
|
|
||||||
{
|
{
|
||||||
while (ticks--) {
|
while (ticks--) {
|
||||||
swdptap_bit_out(MS & 1);
|
swdptap_bit_out(MS & 1);
|
||||||
|
@ -64,8 +61,7 @@ swdptap_seq_out(uint32_t MS, int ticks)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((weak))
|
void swdptap_seq_out_parity(uint32_t MS, int ticks)
|
||||||
swdptap_seq_out_parity(uint32_t MS, int ticks)
|
|
||||||
{
|
{
|
||||||
uint8_t parity = 0;
|
uint8_t parity = 0;
|
||||||
|
|
||||||
|
|
|
@ -314,7 +314,7 @@ void target_detach(target *t)
|
||||||
{
|
{
|
||||||
t->detach(t);
|
t->detach(t);
|
||||||
t->attached = false;
|
t->attached = false;
|
||||||
#if defined(LIBFTDI)
|
#if defined(PC_HOSTED)
|
||||||
# include "platform.h"
|
# include "platform.h"
|
||||||
platform_buffer_flush();
|
platform_buffer_flush();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue