Arduino compile

Discussion of issues related specifically to writing code for native mode devices. This includes ZBasic code as well as assembly language code and C code, both inline and standalone.
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Arduino compile

Post by GTBecker »

Don, I am having difficulty compiling an Arduino-built .cpp.

Code: Select all

.../Arduino/ssd1306_128x32_i2c.cpp:20:
C:/ZBasic_Projects/Arduino/OLED/Adafruit_GFX.h:75: error: conflicting return type specified for 'virtual void Adafruit_GFX::write(uint8_t)'
C:/ZBasic_Projects/Arduino/Print.h:48: error:   overriding 'virtual size_t Print::write(uint8_t)'
C:/ZBasic_Projects/Arduino/ssd1306_128x32_i2c.cpp:48: warning: only initialized variables can be placed into program memory area
are back-end build errors from ZBasic IDE v1.6.5, compiler v4.1.6 (run under Wine) targeted for ZX-24n.

The Arduino build seems error-free [after prefixing const to two static defines to satisfy my compiler (Debian gcc v4.7.2 in LMDE)].

I can't make sense of the error. Can you help?
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Arduino compile

Post by dkinzer »

GTBecker wrote:I can't make sense of the error.
What Arduino build are you using? I can't determine what the cause of the error is from what you've posted. If you can send me the ZBasic project files and the original Arduino code I may be able to figure it out.
- Don Kinzer
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

At line 71 of Adafruit_GFX.h, you'll find the following code:

Code: Select all

#if ARDUINO >= 100
  virtual size_t write(uint8_t);
#else
  virtual void   write(uint8_t);
#endif
That code is there to deal with the fact that the signature of the write() method of the Print class (from which the Adafruit_GFX class is derived) changed with Arduino 1.0.0. I had overlooked the fact that the Arduino IDE apparently defines ARDUINO to reflect the version, e.g. v1.0.0 -> 100, v1.0.1 -> 101, etc. Since the ZBasic/Arduino code is based on v1.0.3, you can add the text near the end of the Arduino.h file so that it looks like this:

Code: Select all

#if defined(ZBASIC_APP)
    #define ARDUINO 103		// to indicate Arduino 1.0.3
    #include "zbasic_arduino.h"
#endif
You'll find the Arduino.h file in the main directory of the ZBasic/Arduino compatibility code.

When I made this change, I was able to compile the source code for your OLED application with no errors.
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

Better, thanks. Still have the last error remaining here, though:

Code: Select all

C:/ZBasic_Projects/Arduino/ssd1306_128x32_i2c.cpp:48: warning: only initialized variables can be placed into program memory area
That points to:

Code: Select all

const static unsigned char PROGMEM logo16_glcd_bmp[] =
{ B00000000, B11000000,
  B00000001, B11000000,
  B00000001, B11000000,
  B00000011, B11100000,
  B11110011, B11100000,
  B11111110, B11111000,
  B01111110, B11111111,
  B00110011, B10011111,
  B00011111, B11111100,
  B00001101, B01110000,
  B00011011, B10100000,
  B00111111, B11100000,
  B00111111, B11110000,
  B01111100, B11110000,
  B01110000, B01110000,
  B00000000, B00110000 };
... which seems initialized to me. [Again, I had to add the const to humor my gcc.]

Odd that you don't see that.
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

GTBecker wrote:Odd that you don't see that.
I did see that - it is only a warning, annoying though it may be. The same warning will appear if you compile this simple "sketch" in the Arduino IDE if you tick the "Show verbose output during compilation" checkbox in the Preferences dialog:

Code: Select all

void setup()
{
}

void loop()
{
}
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

The ZBasic Compile/Go (F5) produces a .zxb but does not download it to the processor- and a manual attempt (File/Download) yields "... ArduinoOLED.zxb" is not a valid download file." The -24n continues to run the previous Blink code.

Where from here?
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

GTBecker wrote:"... ArduinoOLED.zxb" is not a valid download file."
Odd, that. Does the .zxb content look correct? It should begin thus:

Code: Select all

// ZXC
// Target Device:    ZX24n
// Flash Page Size:  256
// Compiler Version: 4.1.7
// Generated:        Thu Jun 13 08:22:03 2013
// Code size:        10307 (words), 2843 (hex)
// Code CRC:         636f (hex)
S00000000055a5832346e63f9
F0000000100
...
It may be that there was a late linker error that prevented the production of a .zxb file. Delete it, use F7 to compile/link again and take a look at the content. If it looks reasonable, try downloading it with F5.
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

Expecting the file to be binary, I never looked at its content but now see that it is, in fact, empty. Deleted several times, same empty file result on recompile.
Tom
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

FWIW, the compile ends with 'Error: one or more errors occurred in the back-end build process for "ArduinoOLED.zxb"'. Should there be "warning" instead of error in that summary?
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

GTBecker wrote:FWIW, the compile ends with 'Error: one or more errors occurred in the back-end build process for "ArduinoOLED.zxb"'.
That means that there was a link (or, possibly, a compile) error. Since you have --verbose in your project file you should be able to see the invocation of the commands for the back-end build process and any output from those commands. Among that output should be a clue. Perhaps you could copy/paste and send me the output.
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

Earlier you indicated that you had a successful compile after changing ARDUINO=103 in Arduino.h - while my compile still fails. That puzzles me. I guess I need to boot XP and see if this is a Wine issue.
Tom
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

Success! I just needed to include some additional files in the project.

The Adafruit Arduino 128x32 OLED I2C demo works on the ZX-24n - with the Linux-native Arduino IDE and Wine-supported ZBasic IDE, and an FTDI USB-serial adapter on /dev/ttyUSB0 that looks like Com1 in Wine.

Fantastic. Thanks for the tools and the assistance, Don.
Tom
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

Tom
kranenborg
Posts: 57
Joined: 27 July 2009, 14:20 PM
Location: Groningen, The Netherlands
Contact:

Post by kranenborg »

Tom,

I have an issue with Arduino libs for LCD displays (currently discussing with Don) and it might be instructive as well to have a look at your files. However the dropbox links above do not work, would it be possible to give some fresh links?

Best regards,
Jurjen
http://www.kranenborg.org/electronics
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

> ... fresh links?

I've restored the .jpg so the first Dropbox link now works.

https://dl.dropboxusercontent.com/u/917 ... CN1138.JPG

I think the second link was just a short movie which wouldn't help you, so I've zipped my work folder of that project and called it OLED_Demo2 so the link will now yield a ~1.5MB zip, despite the lack of a file name extension. Download the file and rename it to OLED_Demo2.zip and you should have a working Arduino sketch, albeit for Adafruit's small OLED that's surely different from your LCD, but perhaps helpful. Good luck.

https://dl.dropboxusercontent.com/u/91727438/OLED_demo2
Tom
Post Reply