From acaeb659d02b1981d2f091a6a9a981b52aa223f8 Mon Sep 17 00:00:00 2001 From: Nerd Ralph Date: Wed, 24 Mar 2021 19:44:39 -0300 Subject: [PATCH] change PROGMEM to __flash --- firmware/main.c | 9 ++++----- firmware/usbdrv/usbdrv.c | 12 ++++++------ firmware/usbdrv/usbdrv.h | 16 ++++++++-------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/firmware/main.c b/firmware/main.c index b7783ae..58cbea4 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -13,7 +13,7 @@ #include #include -#include +//#include #include #include "usbasp.h" @@ -115,7 +115,7 @@ static uchar prog_pagecounter; /* For Windows OS Descriptors we need to report that we support USB 2.0 */ -PROGMEM const char usbDescriptorDevice[18] = { /* USB device descriptor */ +__flash const char usbDescriptorDevice[18] = { /* USB device descriptor */ 18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */ USBDESCR_DEVICE, /* descriptor type */ 0x00, 0x02, /* USB version supported */ @@ -137,8 +137,7 @@ PROGMEM const char usbDescriptorDevice[18] = { /* USB device descriptor */ /* OS Extended Compat ID feature descriptor */ -PROGMEM -const char OS_EXTENDED_COMPAT_ID[40] = { +__flash const char OS_EXTENDED_COMPAT_ID[40] = { /* Header */ 0x28, 0x00, 0x00, 0x00, /* OS Extended Compat ID feature descriptor length */ 0x00, 0x01, /* OS Extended Compat ID version */ @@ -154,7 +153,7 @@ const char OS_EXTENDED_COMPAT_ID[40] = { }; #define MS_VENDOR_CODE 0x5D -PROGMEM const char OS_STRING_DESCRIPTOR[18] = { +__flash const char OS_STRING_DESCRIPTOR[18] = { 0x12, /* Length: An unsigned byte and MUST be set to 0x12. */ /* https://docs.microsoft.com/en-us/windows-hardware/drivers/network/mb-interface-model-supplement */ 0x03, /* Type: An unsigned byte and MUST be set to 0x03. */ diff --git a/firmware/usbdrv/usbdrv.c b/firmware/usbdrv/usbdrv.c index 1d80ac6..d81d33e 100644 --- a/firmware/usbdrv/usbdrv.c +++ b/firmware/usbdrv/usbdrv.c @@ -64,7 +64,7 @@ optimizing hints: #if USB_CFG_DESCR_PROPS_STRING_0 == 0 #undef USB_CFG_DESCR_PROPS_STRING_0 #define USB_CFG_DESCR_PROPS_STRING_0 sizeof(usbDescriptorString0) -PROGMEM const char usbDescriptorString0[] = { /* language descriptor */ +__flash const char usbDescriptorString0[] = { /* language descriptor */ 4, /* sizeof(usbDescriptorString0): length of descriptor in bytes */ 3, /* descriptor type */ 0x09, 0x04, /* language index (0x0409 = US-English) */ @@ -74,7 +74,7 @@ PROGMEM const char usbDescriptorString0[] = { /* language descriptor */ #if USB_CFG_DESCR_PROPS_STRING_VENDOR == 0 && USB_CFG_VENDOR_NAME_LEN #undef USB_CFG_DESCR_PROPS_STRING_VENDOR #define USB_CFG_DESCR_PROPS_STRING_VENDOR sizeof(usbDescriptorStringVendor) -PROGMEM const int usbDescriptorStringVendor[] = { +__flash const int usbDescriptorStringVendor[] = { USB_STRING_DESCRIPTOR_HEADER(USB_CFG_VENDOR_NAME_LEN), USB_CFG_VENDOR_NAME }; @@ -83,7 +83,7 @@ PROGMEM const int usbDescriptorStringVendor[] = { #if USB_CFG_DESCR_PROPS_STRING_PRODUCT == 0 && USB_CFG_DEVICE_NAME_LEN #undef USB_CFG_DESCR_PROPS_STRING_PRODUCT #define USB_CFG_DESCR_PROPS_STRING_PRODUCT sizeof(usbDescriptorStringDevice) -PROGMEM const int usbDescriptorStringDevice[] = { +__flash const int usbDescriptorStringDevice[] = { USB_STRING_DESCRIPTOR_HEADER(USB_CFG_DEVICE_NAME_LEN), USB_CFG_DEVICE_NAME }; @@ -92,7 +92,7 @@ PROGMEM const int usbDescriptorStringDevice[] = { #if USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER == 0 && USB_CFG_SERIAL_NUMBER_LEN #undef USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER #define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER sizeof(usbDescriptorStringSerialNumber) -PROGMEM const int usbDescriptorStringSerialNumber[] = { +__flash const int usbDescriptorStringSerialNumber[] = { USB_STRING_DESCRIPTOR_HEADER(USB_CFG_SERIAL_NUMBER_LEN), USB_CFG_SERIAL_NUMBER }; @@ -105,7 +105,7 @@ PROGMEM const int usbDescriptorStringSerialNumber[] = { #if USB_CFG_DESCR_PROPS_DEVICE == 0 #undef USB_CFG_DESCR_PROPS_DEVICE #define USB_CFG_DESCR_PROPS_DEVICE sizeof(usbDescriptorDevice) -PROGMEM const char usbDescriptorDevice[] = { /* USB device descriptor */ +__flash const char usbDescriptorDevice[] = { /* USB device descriptor */ 18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */ USBDESCR_DEVICE, /* descriptor type */ 0x10, 0x01, /* USB version supported */ @@ -136,7 +136,7 @@ PROGMEM const char usbDescriptorDevice[] = { /* USB device descriptor */ #if USB_CFG_DESCR_PROPS_CONFIGURATION == 0 #undef USB_CFG_DESCR_PROPS_CONFIGURATION #define USB_CFG_DESCR_PROPS_CONFIGURATION sizeof(usbDescriptorConfiguration) -PROGMEM const char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ +__flash const char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */ USBDESCR_CONFIG, /* descriptor type */ 18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT3 + diff --git a/firmware/usbdrv/usbdrv.h b/firmware/usbdrv/usbdrv.h index f094120..c3e2e75 100644 --- a/firmware/usbdrv/usbdrv.h +++ b/firmware/usbdrv/usbdrv.h @@ -271,7 +271,7 @@ USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len); #endif /* USB_CFG_HAVE_INTRIN_ENDPOINT */ #if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* simplified interface for backward compatibility */ #define usbHidReportDescriptor usbDescriptorHidReport -/* should be declared as: PROGMEM char usbHidReportDescriptor[]; */ +/* should be declared as: __flash char usbHidReportDescriptor[]; */ /* If you implement an HID device, you need to provide a report descriptor. * The HID report descriptor syntax is a bit complex. If you understand how * report descriptors are constructed, we recommend that you use the HID @@ -484,43 +484,43 @@ extern volatile schar usbRxLen; #ifndef __ASSEMBLER__ extern #if !(USB_CFG_DESCR_PROPS_DEVICE & USB_PROP_IS_RAM) -PROGMEM const +__flash const #endif char usbDescriptorDevice[]; extern #if !(USB_CFG_DESCR_PROPS_CONFIGURATION & USB_PROP_IS_RAM) -PROGMEM const +__flash const #endif char usbDescriptorConfiguration[]; extern #if !(USB_CFG_DESCR_PROPS_HID_REPORT & USB_PROP_IS_RAM) -PROGMEM const +__flash const #endif char usbDescriptorHidReport[]; extern #if !(USB_CFG_DESCR_PROPS_STRING_0 & USB_PROP_IS_RAM) -PROGMEM const +__flash const #endif char usbDescriptorString0[]; extern #if !(USB_CFG_DESCR_PROPS_STRING_VENDOR & USB_PROP_IS_RAM) -PROGMEM const +__flash const #endif int usbDescriptorStringVendor[]; extern #if !(USB_CFG_DESCR_PROPS_STRING_PRODUCT & USB_PROP_IS_RAM) -PROGMEM const +__flash const #endif int usbDescriptorStringDevice[]; extern #if !(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER & USB_PROP_IS_RAM) -PROGMEM const +__flash const #endif int usbDescriptorStringSerialNumber[];