Fix the procedure to put VID:PID. Apply the procedure to regnual.

This commit is contained in:
NIIBE Yutaka
2018-01-23 10:11:35 +09:00
parent 6c0c510347
commit d4c776e308
5 changed files with 23 additions and 8 deletions

View File

@@ -1,3 +1,13 @@
2018-01-23 NIIBE Yutaka <gniibe@fsij.org>
* src/Makefile (build/gnuk-vidpid.elf): Supply FILE here.
* src/configure (output_vendor_product_serial_strings): For
generating put-vid-pid-ver.sh, don't set FILE.
* regnual/regnual.c (regnual_device_desc): Make this array as a
template.
* regnual/Makefile (regnual.elf): Substitute VID:PID.
2018-01-22 NIIBE Yutaka <gniibe@fsij.org> 2018-01-22 NIIBE Yutaka <gniibe@fsij.org>
* src/openpgp.c (USER_PASSWD_MINLEN): New. * src/openpgp.c (USER_PASSWD_MINLEN): New.

View File

@@ -1,6 +1,6 @@
# Makefile for reGNUal # Makefile for reGNUal
PROJECT = regnual PROJECT = regnual-no-vidpid
OBJS = regnual.o usb-stm32f103.o reset.o OBJS = regnual.o usb-stm32f103.o reset.o
@@ -41,11 +41,15 @@ regnual.hex: regnual.elf
$(OBJCOPY) -Obinary regnual.elf regnual.bin $(OBJCOPY) -Obinary regnual.elf regnual.bin
$(OBJCOPY) -Oihex regnual.elf regnual.hex $(OBJCOPY) -Oihex regnual.elf regnual.hex
regnual.elf: regnual-no-vidpid.elf
cp -p regnual-no-vidpid.elf regnual.elf
env FILE="regnual.elf" PATH="../src:$$PATH" bash put-vid-pid-ver.sh
usb-stm32f103.o: ../chopstx/mcu/usb-stm32f103.c usb-stm32f103.o: ../chopstx/mcu/usb-stm32f103.c
$(CC) $(CFLAGS) -c -o usb-stm32f103.o ../chopstx/mcu/usb-stm32f103.c $(CC) $(CFLAGS) -c -o usb-stm32f103.o ../chopstx/mcu/usb-stm32f103.c
regnual.elf: $(OBJS) $(LDSCRIPT) regnual-no-vidpid.elf: $(OBJS) $(LDSCRIPT)
$(CC) $(LDFLAGS) -o regnual.elf $(OBJS) $(CC) $(LDFLAGS) -o regnual-no-vidpid.elf $(OBJS)
clean: clean:
-rm -f $(OBJS) regnual.elf regnual.hex regnual.bin *.lst -rm -f $(OBJS) regnual.elf regnual.hex regnual.bin *.lst

View File

@@ -1,7 +1,7 @@
/* /*
* regnual.c -- Firmware installation for STM32F103 Flash ROM * regnual.c -- Firmware installation for STM32F103 Flash ROM
* *
* Copyright (C) 2012, 2013, 2015, 2016, 2017 * Copyright (C) 2012, 2013, 2015, 2016, 2017, 2018
* Free Software Initiative of Japan * Free Software Initiative of Japan
* Author: NIIBE Yutaka <gniibe@fsij.org> * Author: NIIBE Yutaka <gniibe@fsij.org>
* *
@@ -57,7 +57,9 @@ static const uint8_t regnual_device_desc[] = {
0x00, /* bDeviceSubClass */ 0x00, /* bDeviceSubClass */
0x00, /* bDeviceProtocol */ 0x00, /* bDeviceProtocol */
0x40, /* bMaxPacketSize0 */ 0x40, /* bMaxPacketSize0 */
#include "../src/usb-vid-pid-ver.c.inc" 0x00, 0x00, /* idVendor (will be replaced) */
0x00, 0x00, /* idProduct (will be replaced) */
0x00, 0x00, /* bcdDevice (will be replaced) */
1, /* Index of string descriptor describing manufacturer */ 1, /* Index of string descriptor describing manufacturer */
2, /* Index of string descriptor describing product */ 2, /* Index of string descriptor describing product */
3, /* Index of string descriptor describing the device's serial number */ 3, /* Index of string descriptor describing the device's serial number */

View File

@@ -79,7 +79,7 @@ distclean: clean
ifeq ($(EMULATION),) ifeq ($(EMULATION),)
build/gnuk-vidpid.elf: build/gnuk.elf binary-edit.sh put-vid-pid-ver.sh build/gnuk-vidpid.elf: build/gnuk.elf binary-edit.sh put-vid-pid-ver.sh
cp -p build/gnuk.elf build/gnuk-vidpid.elf cp -p build/gnuk.elf build/gnuk-vidpid.elf
bash put-vid-pid-ver.sh env FILE="build/gnuk-vidpid.elf" bash put-vid-pid-ver.sh
$(OBJCOPY) -O ihex build/gnuk-vidpid.elf build/gnuk-vidpid.hex $(OBJCOPY) -O ihex build/gnuk-vidpid.elf build/gnuk-vidpid.hex
$(OBJCOPY) -O binary build/gnuk-vidpid.elf build/gnuk-vidpid.bin $(OBJCOPY) -O binary build/gnuk-vidpid.elf build/gnuk-vidpid.bin
else else

3
src/configure vendored
View File

@@ -408,8 +408,7 @@ output_vendor_product_serial_strings () {
(echo "#! /bin/bash" (echo "#! /bin/bash"
echo echo
echo 'FILE="build/gnuk-vidpid.elf"' echo 'source "binary-edit.sh"') > put-vid-pid-ver.sh
echo '. "binary-edit.sh"') > put-vid-pid-ver.sh
if !(IFS=" " if !(IFS=" "
while read -r VIDPID VERSION PRODUCT VENDOR; do while read -r VIDPID VERSION PRODUCT VENDOR; do