Txtzyme
Txtzyme copied to clipboard
Compilation problems with AVR 4.6.2
I needed to define a constant and make the usb descriptors into constants to compile with my avr:
Txtzyme drf$ avr-gcc --version
avr-gcc (GCC) 4.6.2
Txtzyme drf$ git diff txtzyme.c
diff --git a/txtzyme.c b/txtzyme.c
index 360b4cc..45d919c 100644
--- a/txtzyme.c
+++ b/txtzyme.c
@@ -24,6 +24,7 @@
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <stdint.h>
+#define __DELAY_BACKWARD_COMPATIBLE__
#include <util/delay.h>
#include "usb_serial.h"
#include "analog.h"
Txtzyme drf$ git diff usb_serial.c |sed 's/^/ /'
diff --git a/usb_serial.c b/usb_serial.c
index 7589421..16b4a6d 100644
--- a/usb_serial.c
+++ b/usb_serial.c
@@ -144,7 +144,7 @@ static const uint8_t PROGMEM endpoint_config_table[] = {
// in here should only be done by those who've read chapter 9 of the USB
// spec and relevant portions of any USB class specifications!
-static uint8_t PROGMEM device_descriptor[] = {
+static const uint8_t PROGMEM device_descriptor[] = {
18, // bLength
1, // bDescriptorType
0x00, 0x02, // bcdUSB
@@ -162,7 +162,7 @@ static uint8_t PROGMEM device_descriptor[] = {
};
#define CONFIG1_DESC_SIZE (9+9+5+5+4+5+7+9+7+7)
-static uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
+static const uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
// configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10
9, // bLength;
2, // bDescriptorType;
@@ -246,22 +246,22 @@ struct usb_string_descriptor_struct {
uint8_t bDescriptorType;
int16_t wString[];
};
-static struct usb_string_descriptor_struct PROGMEM string0 = {
+static const struct usb_string_descriptor_struct PROGMEM string0 = {
4,
3,
{0x0409}
};
-static struct usb_string_descriptor_struct PROGMEM string1 = {
+static const struct usb_string_descriptor_struct PROGMEM string1 = {
sizeof(STR_MANUFACTURER),
3,
STR_MANUFACTURER
};
-static struct usb_string_descriptor_struct PROGMEM string2 = {
+static const struct usb_string_descriptor_struct PROGMEM string2 = {
sizeof(STR_PRODUCT),
3,
STR_PRODUCT
};
-static struct usb_string_descriptor_struct PROGMEM string3 = {
+static const struct usb_string_descriptor_struct PROGMEM string3 = {
sizeof(STR_SERIAL_NUMBER),
3,
STR_SERIAL_NUMBER
@@ -269,7 +269,7 @@ static struct usb_string_descriptor_struct PROGMEM string3 = {
// This table defines which descriptor data is sent for each specific
// request from the host (in wValue and wIndex).
-static struct descriptor_list_struct {
+static const struct descriptor_list_struct {
uint16_t wValue;
uint16_t wIndex;
const uint8_t *addr;
I'm happy to take this as a pull request. Thanks.