Compile-Error when wanting to use Adadruits SSD1331 with Teensy 3.0

local_dani_21

Well-known member
Hi all

Since adafruits 0.96"-OLED-Module http://learn.adafruit.com/096-mini-color-oledworks with 3.3V I thought to give the new teensy 3.0 a try. When trying to compile her test-application that comes with the library (File->Examples->Adafruit_SSD1331->test) on http://learn.adafruit.com/096-mini-color-oled/downloads:,
the beta10 of Paul's Arduino 1.0.3 port (Mac, 10.6.8) stops with the following errors (I can't post all of the code because of forum-restrictions):
.
.
.

/Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/tools/arm-none-eabi/bin/arm-none-eabi-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mcpu=cortex-m4 -DF_CPU=96000000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=103 -mthumb -nostdlib -D__MK20DX128__ -fno-rtti -felide-constructors -std=gnu++0x -DUSB_SERIAL -DLAYOUT_GERMAN_SWISS -I/Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/teensy/cores/teensy3 /Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/Print.cpp -o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/Print.cpp.o
/Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/tools/arm-none-eabi/bin/arm-none-eabi-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mcpu=cortex-m4 -DF_CPU=96000000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=103 -mthumb -nostdlib -D__MK20DX128__ -fno-rtti -felide-constructors -std=gnu++0x -DUSB_SERIAL -DLAYOUT_GERMAN_SWISS -I/Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/teensy/cores/teensy3 /Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/Stream.cpp -o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/Stream.cpp.o
/Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/tools/arm-none-eabi/bin/arm-none-eabi-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mcpu=cortex-m4 -DF_CPU=96000000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=103 -mthumb -nostdlib -D__MK20DX128__ -fno-rtti -felide-constructors -std=gnu++0x -DUSB_SERIAL -DLAYOUT_GERMAN_SWISS -I/Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/teensy/cores/teensy3 /Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/usb_inst.cpp -o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/usb_inst.cpp.o
/Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/tools/arm-none-eabi/bin/arm-none-eabi-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mcpu=cortex-m4 -DF_CPU=96000000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=103 -mthumb -nostdlib -D__MK20DX128__ -fno-rtti -felide-constructors -std=gnu++0x -DUSB_SERIAL -DLAYOUT_GERMAN_SWISS -I/Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/teensy/cores/teensy3 /Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/WMath.cpp -o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/WMath.cpp.o
/Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/tools/arm-none-eabi/bin/arm-none-eabi-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mcpu=cortex-m4 -DF_CPU=96000000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=103 -mthumb -nostdlib -D__MK20DX128__ -fno-rtti -felide-constructors -std=gnu++0x -DUSB_SERIAL -DLAYOUT_GERMAN_SWISS -I/Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/teensy/cores/teensy3 /Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/WString.cpp -o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/WString.cpp.o
/Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/tools/arm-none-eabi/bin/arm-none-eabi-gcc -Os -Wl,--gc-sections -mcpu=cortex-m4 -mthumb -T/Users/toddd/Downloads/Arduino-1.0.3-teensy3beta10.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/mk20dx128.ld -o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/test.cpp.elf /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/test.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/Adafruit_GFX/glcdfont.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/Adafruit_GFX/Adafruit_GFX.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/Adafruit_SSD1131/Adafruit_SSD1331.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/SPI/SPI.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/analog.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/eeprom.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/keylayouts.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/mk20dx128.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/nonstd.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/pins_teensy.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/serial1.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/serial2.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/serial3.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/touch.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/usb_desc.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/usb_dev.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/usb_joystick.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/usb_keyboard.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/usb_mem.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/usb_midi.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/usb_mouse.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/usb_seremu.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/usb_serial.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/yield.c.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/HardwareSerial1.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/HardwareSerial2.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/HardwareSerial3.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/IPAddress.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/main.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/Print.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/Stream.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/usb_inst.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/WMath.cpp.o /var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp/WString.cpp.o -L/var/folders/SY/SYq1F2y22RWFOU+1YsXSWU+++TQ/-Tmp-/build7534551861965232338.tmp -lm
Adafruit_SSD1131/Adafruit_SSD1331.cpp.o: In function `Adafruit_GFX':
/Users/toddd/Documents/Arduino/libraries/Adafruit_GFX/Adafruit_GFX.h:28: undefined reference to `vtable for Adafruit_GFX'
collect2: ld returned 1 exit status

Do you have any idea what I would have to change to get it to run? Thanks!

Dani
 
Thanks, Paul.

I tried to insert the posted edits but don't know what to do with the mentioned
Code:
In Makefile add
Code:
-DARDUINO=100
since I don't know what file is meant by that when using the Arduino IDE.

Doing everything except the above, the errors change to:
Code:
In file included from test.pde:39:
/Users/toddd/Documents/Arduino/libraries/Adafruit_SSD1131/Adafruit_SSD1331.h:17: warning: "swap" redefined
/Users/toddd/Documents/Arduino/libraries/Adafruit_GFX/Adafruit_GFX.h:26: note: this is the location of the previous definition
In file included from test.pde:38:
/Users/toddd/Documents/Arduino/libraries/Adafruit_GFX/Adafruit_GFX.h:27: error: expected class-name before '(' token
test:49: error: cannot allocate an object of abstract type 'Adafruit_SSD1331'
/Users/toddd/Documents/Arduino/libraries/Adafruit_SSD1131/Adafruit_SSD1331.h:67: note:   because the following virtual functions are pure within 'Adafruit_SSD1331':
/Users/toddd/Documents/Arduino/libraries/Adafruit_GFX/Adafruit_GFX.h:37: note: 	virtual void Adafruit_GFX::drawPixel(int16_t, int16_t, uint16_t)
test:49: error: cannot declare variable 'display' to be of abstract type 'Adafruit_SSD1331'
/Users/toddd/Documents/Arduino/libraries/Adafruit_SSD1131/Adafruit_SSD1331.h:67: note:   since type 'Adafruit_SSD1331' has pure virtual functions
test.pde: In function 'void lcdTestPattern()':
test.pde:310: warning: large integer implicitly truncated to unsigned type
test.pde:312: warning: large integer implicitly truncated to unsigned type
test.pde:313: warning: large integer implicitly truncated to unsigned type
test.pde:314: warning: large integer implicitly truncated to unsigned type
test.pde:315: warning: large integer implicitly truncated to unsigned type
test.pde:316: warning: large integer implicitly truncated to unsigned type

Thanks for interpreting,

Dani

PS: The meantioned line 27 in the header file is where it has
Code:
virtual ~Adafruit_GFX() {} // force inclusion of vtable.
 
I changed the position of the line (see attached header-file)
Code:
virtual ~Adafruit_GFX() {} // force inclusion of vtable.
to pack into the class Adafruit_GFX. Nevertheless, I still get compile-errors:
Code:
Cannot allocate an object of abstract type 'Adafruit_SSD1331'

In file included from test.pde:39:
/Users/toddd/Documents/Arduino/libraries/Adafruit_SSD1131/Adafruit_SSD1331.h:17: warning: "swap" redefined
/Users/toddd/Documents/Arduino/libraries/Adafruit_GFX/Adafruit_GFX.h:26: note: this is the location of the previous definition
test:49: error: cannot allocate an object of abstract type 'Adafruit_SSD1331'
/Users/toddd/Documents/Arduino/libraries/Adafruit_SSD1131/Adafruit_SSD1331.h:67: note:   because the following virtual functions are pure within 'Adafruit_SSD1331':
/Users/toddd/Documents/Arduino/libraries/Adafruit_GFX/Adafruit_GFX.h:37: note: 	virtual void Adafruit_GFX::drawPixel(int16_t, int16_t, uint16_t)
test:49: error: cannot declare variable 'display' to be of abstract type 'Adafruit_SSD1331'
/Users/toddd/Documents/Arduino/libraries/Adafruit_SSD1131/Adafruit_SSD1331.h:67: note:   since type 'Adafruit_SSD1331' has pure virtual functions

Thanks for going over it.
Dani

PS: This is the line 49 in test.ino that causes the error:
Code:
Adafruit_SSD1331 display = Adafruit_SSD1331(cs, dc, rst);
 

Attachments

  • Adafruit_GFX.h.zip
    1.7 KB · Views: 249
Last edited:
So, this library and the given code:

Code:
Adafruit_SSD1331 display = Adafruit_SSD1331(1, 2, 3);

compiles fine for me with the modifications described in the previous thread. I *think* the -DARDUINO=100 should already be done by the Arduino IDE; I don't use it so someone else will have to comment.

I've made a fork of their repo here which contains the fix.

-c
 
Great and many thanks especially for the repository!
I seem to have messed up something while trying to follow the instructions in the previous thread.

So in conclusion: Teensy 3.0 works perfectly with Adafruits 96x64 Pixel RGB OLED Display SSD1331 and can be used without any additional hardware components.
Dani
 
setup.jpgDoes anyone have an idea, why drawing images to SSD1331 takes a lot more time than when working with an arduino?
I set my teensy 3.0 to 96Mhz (with 24Mhz it's even slower). Is there anything that has to be done to get the full speed SPI? Does it matter which CS of the five available are used to read from the SD card?
Thanks, Dani
 
Last edited:
I measured that reading from the SD card is the process that takes so long (80%). Is there anything special about choosing the CS? Are CS0 to CS4 equivalent? [Edit]According to the datasheet, it seems as if in master mode they behave all the same... Are there any known issues about reading from an SD card?[/Edit]

Thanks for pointing out.

Dani
 
Last edited:
Paul, you mentioned that you bought a few of adafruits displays. Have you ever gotten around to check their speed-issue with teensy 3.0? I would be very interested in your results. Thanks, Dani
 
Hi Paul

I just realized that with the newest drivers from adafruit, the display shows the images very fast!

Sorry to bother you, Dani
 
Last edited:
Back
Top