Merge commit '98b4ec58bc566591943c9123dd4ca0c8dcfd521e' into sam-update

# Conflicts:
#	libopencm3
This commit is contained in:
Jason Kotzin 2022-08-10 19:08:25 -07:00
commit 336797363b
25 changed files with 56 additions and 65 deletions

@ -1 +1 @@
Subproject commit 6232f8d0357055021e18325efa083a88ded30107
Subproject commit 63398ff8000f88aed1e44fc8714c6f907c6c3982

View File

@ -2,7 +2,7 @@
#
# stm32_mem.py: STM32 memory access using USB DFU class
# Copyright (C) 2011 Black Sphere Technologies
# Copyright (C) 2017 Uwe Bonnes (bon@elektron.ikp.physik.tu-darmstadt.de)
# Copyright (C) 2017, 2020 Uwe Bonnes (bon@elektron.ikp.physik.tu-darmstadt.de)
# Written by Gareth McMullin <gareth@blacksphere.co.nz>
#
# This program is free software: you can redistribute it and/or modify
@ -121,9 +121,9 @@ def stm32_scan(args, test):
print("Found multiple devices:\n")
for dev in bmp_devs:
dfudev = dfu.dfu_device(*dev)
man = dfudev.handle.getString(dfudev.dev.iManufacturer, 30)
product = dfudev.handle.getString(dfudev.dev.iProduct, 96)
serial_no = dfudev.handle.getString(dfudev.dev.iSerialNumber, 30)
man = dfudev.handle.getString(dfudev.dev.iManufacturer, 30).decode('utf8')
product = dfudev.handle.getString(dfudev.dev.iProduct, 96).decode('utf8')
serial_no = dfudev.handle.getString(dfudev.dev.iSerialNumber, 30).decode('utf8')
print("Device ID:\t %04x:%04x" % (dfudev.dev.idVendor, dfudev.dev.idProduct))
print("Manufacturer:\t %s" % man)
print("Product:\t %s" % product)
@ -134,9 +134,9 @@ def stm32_scan(args, test):
for dev in bmp_devs:
dfudev = dfu.dfu_device(*dev)
man = dfudev.handle.getString(dfudev.dev.iManufacturer, 30)
product = dfudev.handle.getString(dfudev.dev.iProduct, 96)
serial_no = dfudev.handle.getString(dfudev.dev.iSerialNumber, 30)
man = dfudev.handle.getString(dfudev.dev.iManufacturer, 30).decode('utf8')
product = dfudev.handle.getString(dfudev.dev.iProduct, 96).decode('utf8')
serial_no = dfudev.handle.getString(dfudev.dev.iSerialNumber, 30).decode('utf8')
if args.serial_target:
if man == "Black Sphere Technologies" and serial_no == args.serial_target:
break
@ -150,7 +150,7 @@ def stm32_scan(args, test):
print("Serial:\t\t %s" % serial_no)
if args.serial_target and serial_no != args.serial_target:
print("Serial number doesn't match!\n")
print("Serial number doesn't match %s vs %s!\n" % (serial_no, args.serial_target))
exit(-2)
return dfudev
@ -203,11 +203,11 @@ if __name__ == "__main__":
bin = file.read()
product = dfudev.handle.getString(dfudev.dev.iProduct, 64)
product = dfudev.handle.getString(dfudev.dev.iProduct, 64).decode('utf8')
if args.address :
start = int(args.address, 0)
else :
if b"F4" in product:
if "F4" in product or "STLINK-V3" in product:
start = 0x8004000
else:
start = 0x8002000

View File

@ -149,16 +149,18 @@ int command_process(target *t, char *cmd)
return target_command(t, argc, argv);
}
#define BOARD_IDENT "Black Magic Probe" PLATFORM_IDENT FIRMWARE_VERSION
bool cmd_version(target *t, int argc, char **argv)
{
(void)t;
(void)argc;
(void)argv;
gdb_out(BOARD_IDENT);
#if PC_HOSTED == 1
gdb_outf("Black Magic Probe, PC-Hosted for " PLATFORM_IDENT()
", Version " FIRMWARE_VERSION "\n");
gdb_outf("\n for %s, %s\n", info.manufacturer, info.product);
#else
gdb_outf("Black Magic Probe (Firmware " FIRMWARE_VERSION ") (Hardware Version %d)\n", platform_hwversion());
gdb_outf(", Hardware Version %d\n", platform_hwversion());
#endif
gdb_out("Copyright (C) 2015 Black Sphere Technologies Ltd.\n");
gdb_out("License GPLv3+: GNU GPL version 3 or later "

View File

@ -34,6 +34,7 @@
#endif
#include "usbuart.h"
#include "serialno.h"
#include "version.h"
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/usb/usbd.h>
@ -394,12 +395,15 @@ static const struct usb_config_descriptor config = {
.interface = ifaces,
};
#if defined(STM32L0) || defined(STM32F3) || defined(STM32F4)
static char serial_no[13];
#if defined(DUSE_ST_SERIAL)
char serial_no[13];
#else
static char serial_no[9];
#endif
#define BOARD_IDENT "Black Magic Probe" PLATFORM_IDENT FIRMWARE_VERSION
#define DFU_IDENT "Black Magic Firmware Upgrade" PLATFORM_IDENT FIRMWARE_VERSION
static const char *usb_strings[] = {
"Black Sphere Technologies",
BOARD_IDENT,

View File

@ -17,9 +17,9 @@ LDFLAGS_BOOT = -lopencm3_stm32f4 \
ifeq ($(BMP_BOOTLOADER), 1)
$(info Load address 0x08004000 for BMPBootloader)
LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8004000
CFLAGS += -DUSE_BMP_SERIAL
else
LDFLAGS = $(LDFLAGS_BOOT)
LDFLAGS += $(LDFLAGS_BOOT)
CFLAGS += -DUSE_ST_SERIAL
endif
VPATH += platforms/stm32

View File

@ -27,7 +27,7 @@
#include "usbuart.h"
#include "morse.h"
#include <libopencm3/stm32/f4/rcc.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/cm3/scb.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/exti.h>

View File

@ -27,14 +27,11 @@
#include "gpio.h"
#include "timing.h"
#include "timing_stm32.h"
#include "version.h"
#include <setjmp.h>
#define PLATFORM_HAS_TRACESWO
#define BOARD_IDENT "Black Magic Probe (F4Discovery), (Firmware " FIRMWARE_VERSION ")"
#define BOARD_IDENT_DFU "Black Magic Firmware Upgrade (F4Discovery)"
#define DFU_IDENT "Black Magic Firmware Upgrade (F4Discovery)"
#define PLATFORM_IDENT "(F4Discovery) "
/* Important pin mappings for STM32 implementation:
*

View File

@ -20,7 +20,6 @@
*/
#include "general.h"
#include "gdb_if.h"
#include "version.h"
#include "platform.h"
#include "target.h"

View File

@ -38,6 +38,7 @@
/* Only two devices PIDS tested so long */
#define USB_VID_SEGGER_0101 0x0101
#define USB_VID_SEGGER_0105 0x0105
#define USB_VID_SEGGER_1020 0x1020
static void jlink_print_caps(bmp_info_t *info)
{
@ -175,7 +176,8 @@ int jlink_init(bmp_info_t *info)
if (desc.idVendor != USB_PID_SEGGER)
continue;
if ((desc.idProduct != USB_VID_SEGGER_0101) &&
(desc.idProduct != USB_VID_SEGGER_0105))
(desc.idProduct != USB_VID_SEGGER_0105) &&
(desc.idProduct != USB_VID_SEGGER_1020))
continue;
int res = libusb_open(dev, &jl->ul_libusb_device_handle);
if (res != LIBUSB_SUCCESS)

View File

@ -10,7 +10,7 @@
char *platform_ident(void);
void platform_buffer_flush(void);
#define PLATFORM_IDENT() "NONE"
#define PLATFORM_IDENT "(PC-Hosted) "
#define SET_IDLE_STATE(x)
#define SET_RUN_STATE(x)

View File

@ -5,7 +5,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
CFLAGS += -Istm32/include -mcpu=cortex-m4 -mthumb \
-mfloat-abi=hard -mfpu=fpv4-sp-d16 \
-DSTM32F4 -DHYDRABUS -I../libopencm3/include \
-Iplatforms/stm32
-Iplatforms/stm32 -DUSE_ST_BOOTLOADER
LDFLAGS = -lopencm3_stm32f4 \
-Wl,-T,platforms/stm32/f4discovery.ld -nostartfiles -lc -lnosys \

View File

@ -27,7 +27,7 @@
#include "usbuart.h"
#include "morse.h"
#include <libopencm3/stm32/f4/rcc.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/cm3/scb.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/exti.h>

View File

@ -28,14 +28,11 @@
#include "gpio.h"
#include "timing.h"
#include "timing_stm32.h"
#include "version.h"
#include <setjmp.h>
#define PLATFORM_HAS_TRACESWO
#define BOARD_IDENT "Black Magic Probe (HydraBus), (Firmware " FIRMWARE_VERSION ")"
#define BOARD_IDENT_DFU "Black Magic (Upgrade) for HydraBus, (Firmware " FIRMWARE_VERSION ")"
#define DFU_IDENT "Black Magic Firmware Upgrade (HydraBus)"
#define PLATFORM_IDENT " (HydraBus))"
/* Important pin mappings for STM32 implementation:
*

View File

@ -21,12 +21,8 @@
#include <libopencm3/usb/usbd.h>
#include "timing.h"
#include "version.h"
#define BOARD_IDENT "Black Magic Probe (Launchpad ICDI), (Firmware " FIRMWARE_VERSION ")"
#define BOARD_IDENT_DFU "Black Magic (Upgrade) for Launchpad, (Firmware " FIRMWARE_VERSION ")"
#define DFU_IDENT "Black Magic Firmware Upgrade (Launchpad)"
#define DFU_IFACE_STRING "lolwut"
#define PLATFORM_IDENT "(Launchpad ICDI) "
extern uint8_t running_status;

View File

@ -27,14 +27,14 @@
#include "usbuart.h"
#include "morse.h"
#include <libopencm3/stm32/f1/rcc.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/cm3/scb.h>
#include <libopencm3/cm3/scs.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/exti.h>
#include <libopencm3/stm32/usart.h>
#include <libopencm3/usb/usbd.h>
#include <libopencm3/stm32/f1/adc.h>
#include <libopencm3/stm32/adc.h>
static void adc_init(void);
static void setup_vbus_irq(void);
@ -97,7 +97,7 @@ void platform_init(void)
initialise_monitor_handles();
#endif
rcc_clock_setup_in_hse_8mhz_out_72mhz();
rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSE8_72MHZ]);
/* Enable peripherals */
rcc_periph_clock_enable(RCC_USB);

View File

@ -38,10 +38,7 @@ extern bool debug_bmp;
int usbuart_debug_write(const char *buf, size_t len);
#endif
#define BOARD_IDENT "Black Magic Probe"
#define BOARD_IDENT_DFU "Black Magic Probe (Upgrade)"
#define BOARD_IDENT_UPD "Black Magic Probe (DFU Upgrade)"
#define DFU_IDENT "Black Magic Firmware Upgrade"
#define PLATFORM_IDENT " "
#define UPD_IFACE_STRING "@Internal Flash /0x08000000/8*001Kg"
/* Important pin mappings for STM32 implementation:

View File

@ -44,7 +44,7 @@ int main(void)
dfu_protect(false);
rcc_clock_setup_in_hse_8mhz_out_72mhz();
rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSE8_72MHZ]);
systick_set_clocksource(STK_CSR_CLKSOURCE_AHB_DIV8);
systick_set_reload(900000);

View File

@ -52,7 +52,7 @@ void platform_init(void)
void initialise_monitor_handles(void);
initialise_monitor_handles();
#endif
rcc_clock_setup_in_hse_8mhz_out_72mhz();
rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSE8_72MHZ]);
if (rev == 0) {
led_idle_run = GPIO8;
srst_pin = SRST_PIN_V1;

View File

@ -27,10 +27,9 @@
#include "gpio.h"
#include "timing.h"
#include "timing_stm32.h"
#include "version.h"
#include <libopencm3/cm3/common.h>
#include <libopencm3/stm32/f1/memorymap.h>
#include <libopencm3/stm32/memorymap.h>
#include <libopencm3/usb/usbd.h>
#ifdef ENABLE_DEBUG
@ -40,9 +39,7 @@ extern bool debug_bmp;
int usbuart_debug_write(const char *buf, size_t len);
#endif
#define BOARD_IDENT "Black Magic Probe (STLINK), (Firmware " FIRMWARE_VERSION ")"
#define BOARD_IDENT_DFU "Black Magic (Upgrade) for STLink/Discovery, (Firmware " FIRMWARE_VERSION ")"
#define DFU_IDENT "Black Magic Firmware Upgrade (STLINK)"
#define PLATFORM_IDENT "(STLINK/V2) "
/* Hardware definitions... */
#define TDI_PORT GPIOA

View File

@ -65,7 +65,7 @@ int main(void)
dfu_jump_app_if_valid();
dfu_protect(false);
rcc_clock_setup_in_hse_8mhz_out_72mhz();
rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSE8_72MHZ]);
systick_set_clocksource(STK_CSR_CLKSOURCE_AHB_DIV8);
systick_set_reload(900000);

View File

@ -18,6 +18,8 @@
*/
#include "general.h"
#include "version.h"
#include <libopencm3/stm32/desig.h>
#include <string.h>
@ -124,10 +126,11 @@ const struct usb_config_descriptor config = {
static char serial_no[9];
static char if_string[] = DFU_IFACE_STRING;
#define BOARD_IDENT_DFU(BOARD_TYPE) "Black Magic Probe DFU " PLATFORM_IDENT "" FIRMWARE_VERSION
static const char *usb_strings[] = {
"Black Sphere Technologies",
BOARD_IDENT_DFU,
BOARD_IDENT_DFU(PLATFORM_IDENT),
serial_no,
/* This string is used by ST Microelectronics' DfuSe utility */
if_string,

View File

@ -27,13 +27,13 @@
#include "cdcacm.h"
#include "usbuart.h"
#include <libopencm3/stm32/f1/rcc.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/cm3/scb.h>
#include <libopencm3/cm3/scs.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/usart.h>
#include <libopencm3/usb/usbd.h>
#include <libopencm3/stm32/f1/adc.h>
#include <libopencm3/stm32/adc.h>
uint32_t led_error_port;
uint16_t led_error_pin;
@ -54,8 +54,7 @@ void platform_init(void)
void initialise_monitor_handles(void);
initialise_monitor_handles();
#endif
rcc_clock_setup_in_hse_8mhz_out_72mhz();
rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSE8_72MHZ]);
rev = detect_rev();
/* Enable peripherals */
rcc_periph_clock_enable(RCC_AFIO);

View File

@ -28,7 +28,6 @@
#include "gpio.h"
#include "timing.h"
#include "timing_stm32.h"
#include "version.h"
#ifdef ENABLE_DEBUG
# define PLATFORM_HAS_DEBUG
@ -37,9 +36,7 @@ extern bool debug_bmp;
int usbuart_debug_write(const char *buf, size_t len);
#endif
#define BOARD_IDENT "Black Magic Probe (SWLINK), (Firmware " FIRMWARE_VERSION ")"
#define BOARD_IDENT_DFU "Black Magic (Upgrade), SWLINK, (Firmware " FIRMWARE_VERSION ")"
#define DFU_IDENT "Black Magic Firmware Upgrade (SWLINK)"
#define PLATFORM_IDENT "(SWLINK) "
/* Hardware definitions... */
#define TMS_PORT GPIOA

View File

@ -77,7 +77,7 @@ int main(void)
dfu_protect(false);
rcc_clock_setup_in_hse_8mhz_out_72mhz();
rcc_clock_setup_pll(&rcc_hse_configs[RCC_CLOCK_HSE8_72MHZ]);
systick_set_clocksource(STK_CSR_CLKSOURCE_AHB_DIV8);
systick_set_reload(900000);

View File

@ -24,6 +24,7 @@
#include "swdptap.h"
#include "jtagtap.h"
#include "gdb_if.h"
#include "platform.h"
#include "version.h"
#include "exception.h"
#include <stdarg.h>
@ -299,11 +300,11 @@ void remotePacketProcessGEN(uint8_t i, char *packet)
#endif
break;
#if !defined(BOARD_IDENT) && defined(PLATFORM_IDENT)
# define BOARD_IDENT() PLATFORM_IDENT
#if !defined(BOARD_IDENT) && defined(BOARD_IDENT)
# define PLATFORM_IDENT() BOARD_IDENT
#endif
case REMOTE_START:
_respondS(REMOTE_RESP_OK, BOARD_IDENT " " FIRMWARE_VERSION);
_respondS(REMOTE_RESP_OK, PLATFORM_IDENT "" FIRMWARE_VERSION);
break;
default: