version.h: Remove from platform.h files

- Consolidate ident string generation
- Recompile only needed files
This commit is contained in:
Uwe Bonnes 2020-12-01 14:39:06 +01:00 committed by UweBonnes
parent dd6aadc54d
commit 07c3699225
11 changed files with 19 additions and 31 deletions

@ -1 +1 @@
Subproject commit 89074d6a13ed7febba04d3c421ce7bf2b7972156 Subproject commit 505ac65c05b776af031dac3c15b69573b5709850

View File

@ -34,6 +34,7 @@
#endif #endif
#include "usbuart.h" #include "usbuart.h"
#include "serialno.h" #include "serialno.h"
#include "version.h"
#include <libopencm3/cm3/nvic.h> #include <libopencm3/cm3/nvic.h>
#include <libopencm3/usb/usbd.h> #include <libopencm3/usb/usbd.h>
@ -400,6 +401,9 @@ static char serial_no[13];
static char serial_no[9]; static char serial_no[9];
#endif #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[] = { static const char *usb_strings[] = {
"Black Sphere Technologies", "Black Sphere Technologies",
BOARD_IDENT, BOARD_IDENT,

View File

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

View File

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

View File

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

View File

@ -21,12 +21,8 @@
#include <libopencm3/usb/usbd.h> #include <libopencm3/usb/usbd.h>
#include "timing.h" #include "timing.h"
#include "version.h"
#define BOARD_IDENT "Black Magic Probe (Launchpad ICDI), (Firmware " FIRMWARE_VERSION ")" #define PLATFORM_IDENT "(Launchpad ICDI) "
#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"
extern uint8_t running_status; extern uint8_t running_status;

View File

@ -38,10 +38,7 @@ extern bool debug_bmp;
int usbuart_debug_write(const char *buf, size_t len); int usbuart_debug_write(const char *buf, size_t len);
#endif #endif
#define BOARD_IDENT "Black Magic Probe" #define PLATFORM_IDENT " "
#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 UPD_IFACE_STRING "@Internal Flash /0x08000000/8*001Kg" #define UPD_IFACE_STRING "@Internal Flash /0x08000000/8*001Kg"
/* Important pin mappings for STM32 implementation: /* Important pin mappings for STM32 implementation:

View File

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

View File

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

View File

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

View File

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