@defragster Great. So here is what works so far, and what I am thinking to do.
The code snipped below, works. So, the idea is modify the above script to add the following to define the serial number string for each compilation.
(i.e., to the -Dstuff that it already does, just append the following -DthisPRODUCT_SERIAL_NUMBER=something -DthisPRODUCT_SERIAL_NUMBER _LEN=itslengths)
What do you think?
Code:
#define thisMANUFACTURER_NAME {'s','o','m','e','_','v','e','n','d','o','r','x'}
#define thisMANUFACTURER_NAME_LEN 12
#define thisPRODUCT_NAME {'s','o','m','e','p','r','o','d','u','c','t','x'}
#define thisPRODUCT_NAME_LEN 12
#ifndef thisPRODUCT_SERIAL_NUMBER
#define thisPRODUCT_SERIAL_NUMBER { '0','0','0','0','0','0','0','0','0','0','0','0' }
#define thisPRODUCT_SERIAL_NUMBER_LEN 12
#endif
extern "C"
{
struct usb_string_descriptor_struct_manufacturer
{
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t wString[thisMANUFACTURER_NAME_LEN];
};
usb_string_descriptor_struct_manufacturer usb_string_manufacturer_name = {
2 + thisMANUFACTURER_NAME_LEN * 2,
3,
thisMANUFACTURER_NAME
};
struct usb_string_descriptor_struct_product
{
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t wString[thisPRODUCT_NAME_LEN];
};
usb_string_descriptor_struct_product usb_string_product_name = {
2 + thisPRODUCT_NAME_LEN * 2,
3,
thisPRODUCT_NAME
};
struct usb_string_descriptor_struct_serial_number
{
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t wString[thisPRODUCT_SERIAL_NUMBER_LEN];
};
usb_string_descriptor_struct_serial_number usb_string_serial_number =
{
2 + thisPRODUCT_SERIAL_NUMBER_LEN * 2,
3,
thisPRODUCT_SERIAL_NUMBER
};
}