I've updated to Digispark/Arduino version 1.5.8B and have been having some trouble getting sketches using the DigiJoystick library to compile.
I've received the following compilation errors:
Arduino: 1.5.8 (Windows XP), Board: "Digispark (Default - 16.5mhz)"
Build options changed, rebuilding all
Using library DigiJoystick in folder: C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick (legacy)
C:\Program Files\Digistump_Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=158 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\cores\tiny -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\variants\digispark -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build4163437216677249869.tmp\dualSnes.cpp -o C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build4163437216677249869.tmp\dualSnes.cpp.o
In file included from C:\Program Files\Digistump_Arduino\hardware\digistump\avr\cores\tiny/pins_arduino.h:31:0,
from C:\Program Files\Digistump_Arduino\hardware\digistump\avr\cores\tiny/WProgram.h:13,
from C:\Program Files\Digistump_Arduino\hardware\digistump\avr\cores\tiny/Arduino.h:4,
from C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick/DigiJoystick.h:15,
from dualSnes.ino:4:
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick/DigiJoystick.h:58:46: error: variable 'gcn64_usbHidReportDescriptor' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
unsigned char gcn64_usbHidReportDescriptor[] PROGMEM = {
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick/DigiJoystick.h:96:32: error: variable 'usbDescrDevice' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
unsigned char usbDescrDevice[] PROGMEM = { /* USB device descriptor */
^
In file included from dualSnes.ino:4:0:
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick/DigiJoystick.h: In member function 'void DigiJoystickDevice::setButton(unsigned char, unsigned char)':
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick/DigiJoystick.h:270:15: error: 'buttonByte' was not declared in this scope
setButtons(buttonByte, (byte) 0);
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick/DigiJoystick.h:275:27: error: 'buttonByte' was not declared in this scope
setButtons((byte) 0, buttonByte);
^
Error compiling.
The compilation errors seem to be related to statements with PROGMEM.
I tried to resolve the issue by creating a backup of the DigiJoystick library (the folder C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\) and modifying the header file DigiJoystick.h to the file attached (search for mybook4 to see changes).
After making the changes above, I compiled again and noticed the following errors reported for usbdrv.c:
Arduino: 1.5.8 (Windows XP), Board: "Digispark (Default - 16.5mhz)"
Using library DigiJoystick in folder: C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick (legacy)
C:\Program Files\Digistump_Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=158 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\cores\tiny -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\variants\digispark -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build4163437216677249869.tmp\dualSnes.cpp -o C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build4163437216677249869.tmp\dualSnes.cpp.o
C:\Program Files\Digistump_Arduino/hardware/tools/avr/bin/avr-gcc -c -g -x assembler-with-cpp -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=158 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\cores\tiny -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\variants\digispark -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\utility C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrvasm.S -o C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build4163437216677249869.tmp\DigiJoystick\usbdrvasm.S.o
C:\Program Files\Digistump_Arduino/hardware/tools/avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=158 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\cores\tiny -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\variants\digispark -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\utility C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\oddebug.c -o C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build4163437216677249869.tmp\DigiJoystick\oddebug.c.o
C:\Program Files\Digistump_Arduino/hardware/tools/avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=158 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\cores\tiny -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\variants\digispark -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\utility C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\osccal.c -o C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build4163437216677249869.tmp\DigiJoystick\osccal.c.o
C:\Program Files\Digistump_Arduino/hardware/tools/avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=158 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\cores\tiny -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\variants\digispark -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick -IC:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\utility C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c -o C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build4163437216677249869.tmp\DigiJoystick\usbdrv.c.o
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:70:14: error: variable 'usbDescriptorString0' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
PROGMEM char usbDescriptorString0[] = { /* language descriptor */
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:70:14: error: conflicting types for 'usbDescriptorString0'
In file included from C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:12:0:
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.h:504:6: note: previous declaration of 'usbDescriptorString0' was here
char usbDescriptorString0[];
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:80:14: error: variable 'usbDescriptorStringVendor' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
PROGMEM int usbDescriptorStringVendor[] = {
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:80:14: error: conflicting types for 'usbDescriptorStringVendor'
In file included from C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:12:0:
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.h:510:5: note: previous declaration of 'usbDescriptorStringVendor' was here
int usbDescriptorStringVendor[];
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:89:14: error: variable 'usbDescriptorStringDevice' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
PROGMEM int usbDescriptorStringDevice[] = {
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:89:14: error: conflicting types for 'usbDescriptorStringDevice'
In file included from C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:12:0:
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.h:516:5: note: previous declaration of 'usbDescriptorStringDevice' was here
int usbDescriptorStringDevice[];
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:98:13: error: variable 'usbDescriptorStringSerialNumber' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
PROGMEM int usbDescriptorStringSerialNumber[] = {
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:98:13: error: conflicting types for 'usbDescriptorStringSerialNumber'
In file included from C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:12:0:
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.h:522:5: note: previous declaration of 'usbDescriptorStringSerialNumber' was here
int usbDescriptorStringSerialNumber[];
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:111:14: error: variable 'usbDescriptorDevice' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
PROGMEM char usbDescriptorDevice[] = { /* USB device descriptor */
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:111:14: error: conflicting types for 'usbDescriptorDevice'
In file included from C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:12:0:
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.h:486:6: note: previous declaration of 'usbDescriptorDevice' was here
char usbDescriptorDevice[];
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:142:14: error: variable 'usbDescriptorConfiguration' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
PROGMEM char usbDescriptorConfiguration[] = { /* USB configuration descriptor */
^
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:142:14: error: conflicting types for 'usbDescriptorConfiguration'
In file included from C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.c:12:0:
C:\Program Files\Digistump_Arduino\hardware\digistump\avr\libraries\DigiJoystick\usbdrv.h:492:6: note: previous declaration of 'usbDescriptorConfiguration' was here
char usbDescriptorConfiguration[];
^
Error compiling.
I tried resolving these issues by making the changes to usbdrv.c (see attached file) (again, search for mybook4 to see the changes):
After these changes, the sketch compiled successfully, and the digispark was flashed. However, after flash and reset, the Digispark did not report itself to the host PC as a USB HID joystick. I did not troubleshoot deeper (yet), as I'm new to Digispark debugging.