Arduino on Xcode Project — Official Thread

I'm sorry not to be able to help you on your specific case.

I don't understand why the blink.ino file isn't inside the folder of the Xcode project:

MyProject/
. MyProject.xcode
. MyProject/
. . blink.ino
. . main.cpp
. . and other files

Please find the new release of embedXcode

  • Oct 26, 2012 release 18 • Support for Arduino Due
  • Oct 28, 2012 release 19 • Support for StellarPad
  • Nov 09, 2012 release 20 • Support for Teensy 3.0

The user manual has been updated too

  • Nov 09, 2012 release 16 • Updated with new boards

Please note the Arduino 1.5, Energia for StellarPad and Teensy 3.0 softwares are in development.

I've tested build, link and upload successfully for all boards except for the Arduino Due I don't own.

Website: http://embedxcode.weebly.com
Download: http://embedxcode.weebly.com/download
User guide: http://embedxcode.weebly.com/tutorial

Enjoy :wink:

ok, I got it to work. (The directory structure was correct, it was just as you mentioned it should be, above, btw).
The problem was that apparently from Arduino 1.0.1 (?) but definitely in 1.0.2 there is a library WiFi in the libraries path in the applications folder, which is included automatically by the makefiles (the APP_LIB_PATH directory seems to be parsed in step2.mk).
Uncommenting the BOARD_TAG and and other variables in the root makefile and running a "make build" from the Terminal gave me that clue.
(btw, is there any way to make XCode give you the verbose build output. It would give better clues, sometimes).

The triggering error was actually

/Applications/Arduino.app/Contents/Resources/Java/libraries/WiFi/WiFiClient.cpp: In member function 'uint8_t WiFiClient::getFirstSocket()':
/Applications/Arduino.app/Contents/Resources/Java/libraries/WiFi/WiFiClient.cpp:177: error: 'SOCK_NOT_AVAIL' was not declared in this scope
make: *** [Builds/libs/WiFi/WiFiClient.o] Error 1

SOCK_NOT_AVAIL is some preprocessor definition in a utility header from that WiFi library, which probably was not parsed.
The duplicates appeared then because it probably messed up the whole preprocessing.

I worked around this by just adding WiFi to the EXCLUDE_NAMES tag definition of step1.mk.
The build target then went straight through without any errors or warnings.

I tried to manually copy the WiFi library to the project folder and included it to all targets in XCode, but that did not work. You probably understand why :wink: and may want to add that library to the next release (or could it not be parsed, anyway?).

Thanks for the tool, it looks great and I will now try out my real projects with it :slight_smile:

I'm glad it works for you now.

matzrh:
Uncommenting the BOARD_TAG and and other variables in the root makefile and running a "make build" from the Terminal gave me that clue.

The BOARD_TAG variable is defined when you select the board on Info pane.
Please refer to section 4.2. Change the Board on the User Manual.

matzrh:
(btw, is there any way to make XCode give you the verbose build output. It would give better clues, sometimes).

All the build, link and upload commands as well as the error messages are available on the Issue navigator.
Please refer to section 5.4. Error Messages on the User Manual.

Xcode is a professional IDE and requires some learning. I strongly recommend Xcode 4 Unleashed by Fritz F. Anderson I bought thanks to contributions I've received.

Please find the new release of embedXcode

Nov 13, 2012 release 21 • Stability enhancement and better information

• Stability enhancement, especially for Arduino Due and StellarPad linking
• Better information in a more structured presentation

As always,

• Website: http://embedxcode.weebly.com
• Download: http://embedxcode.weebly.com/download
• User guide: http://embedxcode.weebly.com/tutorial

Enjoy :wink:

Please find the new release of embedXcode

Nov 17, 2012 release 22 • New Make and Fast optimised targets

embedXcode release 22 includes two new targets: Make and Fast.

The Make and Fast targets feature an optimisation for the build of the foundation libraries.

The new targets are much faster than the corresponding Build and All targets. This is especially important for the ARM-based boards.

Learn more.

As always,
• Website: http://embedxcode.weebly.com
• Download: http://embedxcode.weebly.com/download
• User guide: http://embedxcode.weebly.com/tutorial

Enjoy :wink:

Context - OSX MountainLion, Xcode4.5.2

I have installed embeddedXcode and I can (after some messing about ) generate an Arduino (Uno) project.

I find I cannot compile it here is the error report - the Arduino is not connected and I have not editted the code created

embedXcode

----------------------------------

Embedded Computing on Xcode 4

Copyright © Rei VILO, 2010-2012

Licence CC = BY NC SA

References and contribution

----------------------------------

See About folder

include $(MAKEFILE_PATH)/Avrdude.mk

ifneq ($(MAKECMDGOALS),boards)
ifneq ($(MAKECMDGOALS),build)
ifneq ($(MAKECMDGOALS),make)
ifneq ($(MAKECMDGOALS),document)
ifneq ($(MAKECMDGOALS),clean)
ifeq ($(AVRDUDE_PORT),)
$(error Serial port not available)
endif
endif
endif
endif
endif
endif

I would like to be more explicit - but I simply dont know what to say - except that I would expect it to be able to compile a 'null program'! Earlier attempts encountered other errors ( like 'init()' not defined) - but these have now gone away!

Any help will be much appreciated before I am forced to use VisualStudio!

Thank-you

What target have you selected?

Thank-you for such a quick response!

The only option I can have is All->My Mac 32bit.

The Project Targets/All Build Settings show
Debug Board Port as tty.usbmodem*, and the Debug Board Tag as uno

davidhux:
Thank-you for such a quick response!

You're welcome!

davidhux:
The only option I can have is All->My Mac 32bit.

Strange, you should have also Build, which builds and links without uploading, and many other options as shown is my previous post.

davidhux:
The Project Targets/All Build Settings show
Debug Board Port as tty.usbmodem*, and the Debug Board Tag as uno

I the case your genuine Arduino Uno board —and not a compatible board that may use another driver to upload— is connected, open the Terminal and type

ls /dev/tty.usb*

It might be the serial port is managed by /dev/tty.usbserial* instead of the default /dev/tty.usbmodem*

  • Arduino Uno rev 2 board = /dev/tty.usbmodem411
  • Compatible Uno board = /dev/tty.usbserial-A40084mc

In such a case, just edit the the Arduino UNO.xcconfig file with the USB port.

Thank-you all for your attention.

I have run Blink under OSX Arduino - on port tty.usbmodem*, (As reported by /dev/tty) and no problem.

It would appear that I need to have the Arduino plugged in when I use XCode (?)

I then returned to Xcode and set the Option to BUILD (as suggested) and got 30 plus failures concerned with wiFi.cpp - e.g. wifi_drv.h no such file or directory. No Serial Port error reported.

davidhux:
I have run Blink under OSX Arduino - on port tty.usbmodem*, (As reported by /dev/tty) and no problem.

It would appear that I need to have the Arduino plugged in when I use XCode (?)

As mentioned page 49 of the User Manual, each target has a specific agenda:

• All cleans the files from a previous compilation, compiles and links, uploads and opens a serial window in Terminal.

So you need the board to be plugged-in to upload.

• Build compiles all the files, changed and unchanged, and links them.

No plugged-in board is required.

davidhux:
I then returned to Xcode and set the Option to BUILD (as suggested) and got 30 plus failures concerned with wiFi.cpp - e.g. wifi_drv.h no such file or directory. No Serial Port error reported.

Please, you're going too fast...

If the blink example works on the Arduino IDE, have you tried it on Xcode before trying a more complex example?

You need to validate each step, with one single change per step.

About the WiFi, I guess some specific libraries need to be installed. Have you installed them? Does the sketch compile on the Arduino IDE? Have you check the sketchbook is correctly defined —page 9 sq., ibid.? Have you restricted some libraries for faster compilation —page 51, ibid.?

oops - I will slow down -

Blink runs in Arduino under OSX

Now I understand the Build Options - I get a clean build but when I try to UPLOAD the Blink app I get:

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -D -patmega328p -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -carduino -b115200 -P/dev/tty.usbmodem26421 -Uflash:w:Builds/embeddedcomputing.hex:i

Avrdude: can't open input file Builds/embeddedcomputing.hex: No such file or directory

Looks as though I have not done something!

My thanks and apologies for any confusion.

The target UPLOAD requires the file Builds/embeddedcomputing.hex to be ready.

Have you checked that the file Builds/embeddedcomputing.hex is available?

Use instead the target ALL = CLEAN + BUILD the sketch + ULPOAD to the board + SERIAL console.

It might be easier to use the contact form to send me the content of the Log Navigator.

The maintenance of the embedXcode template is really difficult due to Apple secrecy around and lack of documentation on Xcode.

So I'm considering switching from Xcode to another IDE.

Here's an open letter to Apple Xcode team. Feel free to send it to members of the Apple Xcode team you know.

Thank you for your help :slight_smile:

Open Letter to Apple Xcode Team:
Dear Xcode Team,

Xcode offers superior features and ergonomics compared with other IDEs running on OS X.
Unfortunately, its restricted documentation prevents from using many of its features.

I'm using Xcode as a development tool for embedded computing platforms.
As at today, the embedXcode template supports Arduino, Diligent chipKIT with MPIDE, Texas Instruments' Launchpad with Energia, Leaflab Maple, Teensy, Wiring, and has received a warm welcome from the embedded computing community.

The issues I'm currently facing are mostly linked to the lack of available documentation.
The books available on Xcode focus on how to use the tool, not on how to customise it. Similarly, Apple doesn't provide any clues about its inner structure.
For example, keywords used by the templates are not documented. Neither is using other tool-chains, albeit the specific Toolchains folder.

Is Xcode solely limited OS X and iOS development?
By just releasing some documentation on Xcode inner organisation and customisation, Apple can easily make Xcode the best choice for developers.

Otherwise, I'd have no option but to switch to another IDE and to abandon OS X.

Looking forward to hearing from you,
Best regards,

--- Rei Vilo
http://embedxcode.weebly.com

Please find the new release of embedXcode

**embedXcode • Nov 24, 2012 release 23 • Fixed WiFi issue on Arduino 1.0.2 and 1.5.x **
User Manual • Nov 24, 2012 release 17 • New section Dealing with Issues

embedXcode release 23 includes the additional optional parameter EXCLUDE_LIBS in the main makefile to black-list libraries.

Issues have been reported for the WiFi library on Arduino 1.0.2 and the Firmata library with Teensy 3.0.

Edit the makefile on you project and add the names of the libraries to exclude:

# List the libraries to be excluded
# For example, WiFi may crash on Arduino 1.0.2
# For example, Firmata may crash on Teensy 3.0
#
EXCLUDE_LIBS = Firmata WiFi WiFi/utility

The user manual includes a check-list when facing an issue on embedXcode.

As always,
• Website: http://embedxcode.weebly.com
• Download: http://embedxcode.weebly.com/download
• User guide: http://embedxcode.weebly.com/tutorial

Enjoy :wink:

Please find the new release of embedXcode

embedXcode • Dec 10, 2012 release 23 • Fixed MAPLE_IDE variable and added Energia 9 support for Stellaris
User Manual • Dec 10, 2012 release 18 • New section Dealing with Issues

The user manual includes check-lists when facing an issue on embedXcode.

As always,
• Website: http://embedxcode.weebly.com
• Download: http://embedxcode.weebly.com/download
• User guide: http://embedxcode.weebly.com/tutorial

Enjoy :wink:

Please find the new releases of embedXcode

embedXcode • Dec 14, 2012 release 25 • New target for distribution
User Manual • Dec 14, 2012 release 19 • New target for distribution

The new Distribute target creates a specific folder Distribution which contains:
• all the headers and code files,
• documentation in PDF if available,
• and main sketch —.pde or .ino— in a folder with the appropriate name.

As always,
• Website: http://embedxcode.weebly.com
• Download: http://embedxcode.weebly.com/download
• User guide: http://embedxcode.weebly.com/tutorial

Enjoy :wink:

I'm having issues getting my sketch to compile in Xcode for the Uno. It works fine in the Arduino IDE.

When I run a compile, I get the error:

/Applications/Arduino.app/Contents/Resources/Java/libraries/Esplora/Esplora.cpp:54: error: 'A11' was not declared in this scope
make: *** [Builds/libs/Esplora/Esplora.o] Error 1

I've attached the full error log.

I get this same error with a fresh embedxcode project too. Any ideas where I've gone wrong?

error.log (47.7 KB)

This is strange as your target is UNO.

I suggest you to edit the makefile on you project and add the names of the libraries to exclude:

# List the libraries to be excluded
# For example, WiFi may crash on Arduino 1.0.2
# For example, Esplora may crash on Arduino 1.0.3
# For example, Firmata may crash on Teensy 3.0
#
EXCLUDE_LIBS = Firmata WiFi WiFi/utility Esplora

It seems the Processing IDE is reaching its limits with the new Arduino products.

Thank you for reporting this issue. Please keep me informed of the result as I'm focused on the 1.5.x release