fix rndis response to get mac address

- remove cflags -fshort-enums
- clean up webserver descriptor
This commit is contained in:
hathach
2020-03-23 15:21:22 +07:00
parent 00eabbac35
commit 76a27cf49a
3 changed files with 8 additions and 6 deletions

View File

@@ -155,15 +155,16 @@ static uint16_t _desc_str[32];
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
(void)langid;
(void) langid;
unsigned chr_count = 0;
uint8_t chr_count = 0;
if (STR_LANGID == index)
{
memcpy(&_desc_str[1], string_desc_arr[0], 2);
chr_count = 1;
}
#if CFG_TUD_NET == OPT_NET_ECM
else if (STR_MAC == index)
{
// Convert MAC address into UTF-16
@@ -174,6 +175,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
_desc_str[1+chr_count++] = "0123456789ABCDEF"[(tud_network_mac_address[i] >> 0) & 0xf];
}
}
#endif
else
{
// Convert ASCII string into UTF-16
@@ -186,7 +188,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
chr_count = strlen(str);
if ( chr_count > (TU_ARRAY_SIZE(_desc_str) - 1)) chr_count = TU_ARRAY_SIZE(_desc_str) - 1;
for (unsigned i=0; i<chr_count; i++)
for (uint8_t i=0; i<chr_count; i++)
{
_desc_str[1+i] = str[i];
}

View File

@@ -30,7 +30,7 @@ INC += $(TOP)/src
#
CFLAGS += $(addprefix -I,$(INC))
LDFLAGS += $(CFLAGS) -fshort-enums -Wl,-T,$(TOP)/$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nosys.specs -specs=nano.specs
LDFLAGS += $(CFLAGS) -Wl,-T,$(TOP)/$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nosys.specs -specs=nano.specs
ASFLAGS += $(CFLAGS)
# Assembly files can be name with upper case .S, convert it to .s