VERSION is always v1.2-345-gxxxxxxx, fix version format on left border

get a fixed string format for USB version string parsing
fix left border ver display for v1.2-3-g.., 1.2-34-g.. and 1.2-3456-g..
changes to make dfu (build *.dfu) and make flash (switch to dfu mode)

Signed-off-by: Martin <Ho-Ro@users.noreply.github.com>
pull/38/head
Martin 3 years ago
parent 90ce6ca744
commit de54612654

@ -65,8 +65,13 @@ endif
# Build global options # Build global options
############################################################################## ##############################################################################
# format va.b-n-gxxxxxxx
# or va.b-nn-gxxxxxxx
# or va.b-nnn-gxxxxxxx
# or ...
ifeq ($(VERSION),) ifeq ($(VERSION),)
VERSION="$(PROJECT)_$(shell git describe --tags)" VERSION="$(PROJECT)_$(shell git describe --tags --long)"
endif endif
############################################################################## ##############################################################################
@ -297,15 +302,19 @@ clean:
rm -f -rf build/tinySA4.* build/lst/*.* build/obj/*.* rm -f -rf build/tinySA4.* build/lst/*.* build/obj/*.*
else else
clean: clean:
rm -f -rf build/tinySA.* rm -f -rf build/$(PROJECT).*
endif endif
flash: build/ch.bin flash: build/$(PROJECT).bin
dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D build/ch.bin -@printf "reset dfu\r" >/dev/cu.usbmodem401 # mac
-@printf "reset dfu\r" >/dev/ttyACM0 # linux
sleep 2
dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D $<
dfu: build/$(PROJECT).hex
-@#c:/work/dfu/HEX2DFU $< build/$(PROJECT).dfu # win
-@hex2dfu -i $< -o build/$(PROJECT).dfu # mac / linux
dfu:
c:/work/dfu/HEX2DFU build/ch.hex build/ch.dfu
-@printf "reset dfu\r" >/dev/cu.usbmodem401
TAGS: Makefile TAGS: Makefile
ifeq ($(TARGET),F303) ifeq ($(TARGET),F303)

@ -4386,13 +4386,23 @@ redraw_cal_status:
// Version // Version
y += YSTEP + YSTEP/2 ; y += YSTEP + YSTEP/2 ;
#ifdef TINYSA4 #ifdef TINYSA4 // 'tinySA4_v1.2-[0-9]*-gxxxxxxx'
strncpy(buf,&TINYSA_VERSION[9], BLEN+1); strncpy(buf,&TINYSA_VERSION[9], BLEN+1); // '1.2-...'
#else #else // 'tinySA_v1.2-[0-9]*-gxxxxxxx'
strncpy(buf,&TINYSA_VERSION[8], BLEN+1); strncpy(buf,&TINYSA_VERSION[8], BLEN+1); // '1.2-...'
#endif #endif
if (buf[7]=='-') { if (buf[5]=='-' ) { // '1.2-n-g...'
buf[3] = buf[4]; if (buf[4]=='0') // '1.2-0-g...'
buf[3] = 0; // -> '1.2'
else {
buf[5] = buf[4]; // -> '1.200n'
buf[4] = '0';
buf[3] = '0';
}
} else if (buf[6]=='-' ) { // 1.2-nn-g...
buf[3] = '0'; // -> '1.20nn'
} else { // 1.2-345-g... (or 1.2-3456...)
buf[3] = buf[4]; // -> '1.2345'
buf[4] = buf[5]; buf[4] = buf[5];
buf[5] = buf[6]; buf[5] = buf[6];
} }

@ -178,10 +178,11 @@ static const uint8_t vcom_string2[] = {
#ifdef TINYSA4 #ifdef TINYSA4
/* /*
* Serial Number string. VERSION = 'tinySA4_v1.3-nnn-gxxxxxxx' * Serial Number string. VERSION = 'tinySA4_v1.3-nnn-gxxxxxxx'
* 0123456789012345678901234 * 01234567890123456789012
* skip last two 'xx' char due to 'tinySA4_v1.3-n-gxxxxxxx'
*/ */
static const uint8_t vcom_string3[] = { static const uint8_t vcom_string3[] = {
USB_DESC_BYTE(36), /* bLength. */ USB_DESC_BYTE(32), /* bLength. */
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */ USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
VERSION[8], 0, /* 'v' */ VERSION[8], 0, /* 'v' */
VERSION[9], 0, /* '1' */ VERSION[9], 0, /* '1' */
@ -198,16 +199,15 @@ static const uint8_t vcom_string3[] = {
VERSION[20], 0, /* 'x' */ VERSION[20], 0, /* 'x' */
VERSION[21], 0, /* 'x' */ VERSION[21], 0, /* 'x' */
VERSION[22], 0, /* 'x' */ VERSION[22], 0, /* 'x' */
VERSION[23], 0, /* 'x' */
VERSION[24], 0 /* 'x' */
}; };
#else #else
/* /*
* Serial Number string. VERSION = 'tinySA_v1.3-nnn-gxxxxxxx' * Serial Number string. VERSION = 'tinySA_v1.3-nnn-gxxxxxxx'
* 012345678901234567890123 * 0123456789012345678901
* skip last two 'xx' char due to 'tinySA_v1.3-n-gxxxxxxx'
*/ */
static const uint8_t vcom_string3[] = { static const uint8_t vcom_string3[] = {
USB_DESC_BYTE(36), /* bLength. */ USB_DESC_BYTE(32), /* bLength. */
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */ USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
VERSION[7], 0, /* 'v' */ VERSION[7], 0, /* 'v' */
VERSION[8], 0, /* '1' */ VERSION[8], 0, /* '1' */
@ -224,8 +224,6 @@ static const uint8_t vcom_string3[] = {
VERSION[19], 0, /* 'x' */ VERSION[19], 0, /* 'x' */
VERSION[20], 0, /* 'x' */ VERSION[20], 0, /* 'x' */
VERSION[21], 0, /* 'x' */ VERSION[21], 0, /* 'x' */
VERSION[22], 0, /* 'x' */
VERSION[23], 0 /* 'x' */
}; };
#endif #endif

Loading…
Cancel
Save

Powered by TurnKey Linux.