Arduino programming on Mac OS X with Xcode 5? - macos

Is there a good reference on how to set up an Arduino programming environment with Xcode?
An ideal answer would be along the lines of, "Oh yes, there's an active project on Google Code, just download the .dmg, copy the ${Xcode magic config file} to ${somewhere in ~Library}, restart Xcode and select "New Arduino Project" from the File menu. Click Build with your Arduino plugged in and it uploads it direct to the hardware."
Google gives a couple of hits, but they're kind of vague and out-of-date (specifically, the way Xcode does project templates changed between Xcode 3 and 4 and I can't find an Xcode 4 template.) I've officially outgrown Processing and I'd prefer not to blight my home life with Eclipse if at all possible.

You can actually use the arduino GUI to compile and upload, and set the editor to external in the preferences. That way, you can edit the C++ (PDE) files from xcode, and have arduino generate the actual CPP and build the whole shebang.
You can also use XCode to write plain C++/C for the arduino, using the avr-gcc compiler.
Have a look at: https://stackoverflow.com/a/8192762/153835
You can then use the plain avrdude upload tool to program the arduino. Have a look at: http://www.ladyada.net/library/arduino/bootloader.html
It used to be that the protocol spoken by Arduino was a modification of the STK500 protocol, and that only the avrdude bundled with arduino could speak it. I don't know if the mainstream avrdude was upgraded, or if you still have to resort to the avrdude inside the Arduino folder.

I have just come across embedXcode which does exactly what I want.

Alternatively, if you are looking for a solution that is independent of XCode (or just another solution), check out CrossPack for AVR Development. Essentially, it is an AVR toolchain for OSX
This will allow you to develop outside of the Arduino IDE with C/C++. It is terminal line only.
https://www.obdev.at/products/crosspack/index-de.html
However, the instructable below gives steps for using it with the Eclipse IDE (well, the Eclipse IDE using it).
http://www.instructables.com/id/Setup-AVR-programming-on-OS-X-using-Eclipse/?ALLSTEPS

I also asked around on the Arduino forums and they're at the point where someone's posted a Makefile which works for me, but the templating system for Xcode4 is vastly different to Xcode3 and apparently still in some state of flux.
So as of May 2011 the answer I wanted to hear still doesn't exist but we're getting closer.

Related

Arduino IDE Alternatives for Mac OS X

I'm trying to find an alternative to the arduino text editor for obvious reasons. I can't seem to get sublime text to work with Stino (a sublime package), I think it's because I'm using arduino 1.6.4. Are there any alternatives or am I stuck with the arduino IDE? Or has anyone managed to get Stino working on sublime?
Several months ago, I ran into an issue with not being able to use the Arduino IDE very well for different reasons. I did some research and found codebender.cc.
Codebender works as a plugin to Chrome or Firefox, and is completely cross platform. I have used it on Windows 7,8, OSX, and on Chrome OS.
I hope you have luck with your project in whatever environment you use, Good Luck!

Good GUI library for program that connects to a microcontroller?

I'm trying to find a good GUI library I could use to create a program on the computer that connects to a microcontroller by USB. I've never done any GUI work before but I have done a lot of webpage design/tools. We are going to program the microcontroller with C but I don't think the GUI will need to be C. It needs to work on Windows, so probably compile on Windows too. I've also never done any USB transmission but I'm hoping to take it one step at a time.
Right now I'm looking at using GTK but it needs a bunch of other things to download with it. I'm also going to look at QT and someone else suggested making a Windows Forms Application. There's a lot of options out there so I'm having trouble figuring it out.
As for my requirement, it just needs to be a very simple GUI that has a few control buttons, a display area (info from microcontroller), a notification area (basically error messages go here), and maybe a graph. I've included a prototype GUI help give you an idea of what I'm doing.
Edit: It needs to run and compile on Windows. We don't really have a budget for it, free open source is preferred. I don't need something elaborate and fancy, I just want to get it done as fast as possible.
We are using a TTL-232R cable, UART interface. I know nothing about USB transmission, school has crushed me.
From what you've specified, I would set base-camp up at Java.
Java in Eclipse to write the code.
Java Swing libraries (helped by the WindowBuilder plugin for Eclipse) to "draw" the GUI. It is very easy to create "Windowsy" GUIs using these.
JFreeGraph libaries to allow you to create graphs very easily, again from within Eclipse.
RXTX library for "virtual COM port" serial communication within Java (it doesn't sound like you're using proper USB, but just RS232 with a USB adapter).
Your created GUI would run on any machine with Java installed, which is not a big ask for the end user. You can even create a Windows executable/installer from the resulting Java files if you wanted it to be a (apparently) native Windows application.
And - bonus - all the tools mentioned are free as a bird.
It will kind of depend on what kind of compiler, IDE, etc you will settle on. If you are going to windows cold, and
money is an issue, then open source is always a good thing to look at. I have enjoyed using eclipse and Code::Blocks IDEs. For C/C++, I use minGW. In terms of GUI plug-ins, HERE are some conversation with GUI recommendations specifically for use with Code::Blocks.
If money is not an issue, I have use National Instruments LabWindows/CVI full dev kit forever. It is one of the easiest ANSI C compilers/IDE I have ever used. It is only ANSI C, but has extensions to make using instrumentation easy. I have written a little USB stuff (not much), sockets, instrumentation, and many GUI apps.
Please comment what tools you currently prefer, I may have other suggestions.
Lazarus CodeTyphon has cross platform native compiler with GUI working on every supported platform. It supports 8 OS-CPU host layers (Win32, Win64, Linux32, Linux64, FreeBSD32, FreeBSD64, Solaris32 and Solaris64), and 25+ OS-CPU target layers. It also incorporates many graphical widgets and SCADA like behaviour with PascalSCADA and other components. There are wrappers for LibUSB.
I would use Microsoft Visual Studio to develop the GUI. They offer a free version called Express. I would use the C# language but MSVS supports other languages as well so just choose whichever you're most comfortable with. The best thing about MSVS is that there are millions of developers out there, which means that you will be able to search for and find lots of examples for how to use an RS-232 COM port or USB interface. I'm guessing that you'll be able to find GUI objects for graphing and other objects as well. (The basic stuff like buttons and edit boxes is all built into MSVS.)
BTW, you need to sort out whether you're using an RS-232 COM port or a USB interface. They're both serial interfaces but they're not the same thing. Either could work.

What does The destination does not support the architecture means?

I have the same problem with Xcode Cannot Run on the Selected Destination
The destination does not support the architecture for which the
selected software is built. Switch to a destination that supports that
architecture in order to run the selected software.
I tried the solutions there and it doesn't work.
So I'll try to do something more reasonable.
What does the error means anyway? What is Xcode trying to say when it says to switch to a destination that supports that architecture? Where is the archtecture specified? What software? What is the problem?
While solutions may be nice what I am looking for is understanding of what it really means.
The project used to work
The project still work in real iPhone but not simulator
I used the newest facebook SDK. However, it run before even after the SDK. It's after I clean project it doesn't work.
While I don't have a solution for your problem, I can answer your question, namely, what does Xcode thinks is wrong and what does the error means.
So, the destination is actually your simulator in this case (could be the iPhone as well, if you're building for it). The architecture is decently explained here. What you need to understand is that in order for a software to run on a specific architecture it needs to be build for it(or assembled for it, to be more precise). That means that for the same software the CPU instructions are not the same for an iPhone (which has an ARM CPU) as they are for your iMac (which is x64).
Now, with the above in mind, what Xcode is trying to say is that you are trying to build the wrong architecture for your simulator and you should switch to a different destination that supports that architecture (as you mentioned, you can build just fine on the iPhone, which is a different architecture) in order for the software to run.
It could be an Xcode bug or a misconfiguration. You're probably better off creating a new project and copy all your classes into it than hunting it down.
You'll be happy to know this problem has a very simple solution. Select Info.plist in your project navigator tree and make sure it is not assigned to a target. I have confirmed this is the correct solution. If building for iOS 6 or earlier you may also need to add armv6 to supported architectures

What tools are needed to build plugins for Photoshop CS5?

I have found plenty of articles and how-tos online about making plugins for Photoshop on a Mac. Trouble is, many are old, apply only to CS1/2/3/4, or refer to tools or APIs that (it appears) are obsolete. Some articles say you must use CodeWarrior, but it seems this no longer even exists in the Mac programming realm.
Today, in 2011, making plugins only for CS5 and only on a Mac running Snow Leopard, what is the proper toolchain and what libraries/APIs/frameworks should I be using?
I've gotten the impression that Carbon (whatever exactly that is) is old and to be avoided, but it's not clear if that's true for plugins. I am not clear as to whether I should use Cocoa (whatever that is) or not. I do think I will need Core Foundation (whatever...) Is there a choice about 64 vs. 32 bit or is CS5 purely 64 bit and that's that? (I prefer 64 bit, of course.) I do have the Photoshop CS5 SDK, and Photoshop CS5 itself installed.
Can XCode can be used as an IDE? I'll hand-code a makefile and compile at the command line, if that's easier or the only way possible. If XCode can be used, which project template to use? What is this "Mach-O" I read about, and how does that apply to PS plugins?
It's especially confusing since I'm a total noob at Mac programming of any kind, though many years experienced on Linux and other platforms.
Mission accomplished! (Months ago.. I just realized I had this question sitting here.)
Cocoa is useful for GUI settings windows and other things - it's a huge gob of stuff - but I ended up using it only for the "About" popup window for my plugin.
Completely forget about Carbon for the combination of CS5 or later, OSX 10.6 or later, and 64 bit. Apparently parts of Carbon had been made 64 bit in the past, but should be ignored now.
XCode is a fine editor. Start with a "dylib" project using C. C++ and Obj-C source files can be added without any fuss. There's no way getting around just needing to use XCode for some simple toy projects to gain familiarity with how it organizes things and builds apps and libraries. This is the only real "tool" needed; the rest is APIs - header files and libraries (or "frameworks" in the Apple world). While toying with XCode, get to know what a "bundle" is - a folder containing the executable and other files needed by the app.
Paths need to be set up to the Photoshop CS5 API, there being two or three specific directories to be listed. You may need to copy certain common source files out of the Photoshop example plugins directory, and there was a bit of trouble with a file named MachOMacrezXcode.h about which see What is the meaning of exit code 3 from Rez?
Unfortunately there were no truly useful examples of well-written plugins for CS5 on 64-bit. A combination of the Dissolve example, the SimpleFormat file read/write plugin, browsing source for plugins at http://www.telegraphics.com.au/sw/product/FilterFoundry and asking questions on the Adobe Photoshop SDK forum.
Pay no attention to the clumsy process of using some "Plugin Suite" for obtaining memory. It's like Microsoft's old 16-bit Windows API where you needed "memory handles" and thick malarky that is now several times obsolete. These days, good ol' malloc/free or new/delete are fine.
With all the arrowhead wounds I now have in my back, maybe I should write a book or something...

actionscript development on mac

I know of FlashDevelop for windows but how about developing actionscript or haxe on a mac? besides flex plugin for eclipse, flex builder and FDT is there anny good IDE out there for actionscript development on mac? I would really like to se a good plugin for netbeans but it looks like all the projects on making something like this has halted.
I have tried using MacVim with various plugins but i never get it to work and it looks to be a hard learning curve to get starting using vim.
What is people using to develop actionscript/haxe on a mac?
I use TextMate with the ActionScript bundle. But, that is a far cry from a decent development environment.
FlashBuilder or FDT are probably the best options. I've spent a lot of time looking for a good free option - though I haven't done a check in the last 6 months, or so. The actual Flash IDE might be the best no-additional-cost option, if you use Flash.
There is supposedly a way to set up your environment to use XCode, a stand-alone compiler, and one or two other things, but I could never find good documentation or evidence of someone actually getting things working.
There is, or was, a Mac version of SePy, but it was horrible, as of a year and a half ago when I gave up on it.
I've been using FlashBuilder on my work machine for Flex work, but I think I'll start using it on my personal machine for Flash work. Just haven't come across anything else that even approaches a modern dev environment for Flash.
Sorry I don't have more helpful information. Would love to hear someone say different.
UPDATE: Found some so-so info on setting up various elements of a full development environment on Mac, using free tools. Doesn't look like a lot has happened on this front in the last two years.
OpenCode - AS2 and AS3 language definitions for XCode. This goes back to 2006, but may still be completely useful.
Xcode and the Flex SDK - A tutorial on setting up a code and compile environment with XCode and the mxml compiler. Author notes that the information may not be 100% accurate and lost interest once he started using FlexBuilder.
Make Xcode a Full Featured Actionscript IDE - FlaXIDE - A tutorial on setting up a full dev environment with opensource tools. Last updated in 2006. Could be modified to work with current tools (i.e. haxe instead of mtasc).
Flex Support for Xcode 3 - Somewhat more recent info on using Xcode as an AS editor. Posted November of 2007.
Core SWF: Flex/AS3 for Xcode - Even more recent info. This seems to be the latest thing going for using open source or free tools to build an AS dev environment on the Mac. Posted July of 2008. This project is up on Google Code and contributors are welcomed.
I have heard good things about IntelliJ IDEA lately but haven't really tried it out myself. I use TextMate, the AS3 bundle and Flash CS4.
The best thing would probably be if FlashDevelop was ported to Mac, but as I understand it, that is not about to happen, despite years of requests for it.
Check out the "sugar-hx" textmate bundle. There's an overview here:
http://haxe.org/com/ide/textmate/sugar_hx_textmate
It includes the compiler-based contextual autocompletion, import helpers, build helpers, and output embedding for swf and js.
I know this is old, but I stumbled upon it, so I suppose other people might as well.
I'm using Sublime Text 2 for AS3 development, and I'm quite happy with it. I use alongside the Flash IDE.
http://www.sublimetext.com/
It's a very powerful and customizable text editor. It's similar to TextMate but much faster and modern... and also cross platform. Many people (like me) got fed up waiting for TextMate 2, and started using ST2.
ST2 is way too deep to number all it's features, but here's a good introduction:
https://tutsplus.com/course/improve-workflow-in-sublime-text-2/
Instead of bundles or plugins, there are packages. ST2 includes a basic AS3 package, but many people are developing their own. Here's mine (still in beta):
https://github.com/PierBover/as3-utils
For Haxe, I'm using gedit on both Mac and Ubuntu. There is a plugin for Haxe which includes syntax highlighting and code completion.
For installing the plug-in on Mac, put the folder
"haxecodecompletion" and the file "haxecodecompletion.gedit-plugin" inside "/Applications/gedit.app/Contents/Resources/lib/gedit-2/plugins".
Similar for the syntax highlight but a different folder.
There is Flasm (which is a working AS2 Disassembler) and perhaps with permission by its creator, who is not updating, re-produce it into an AS3 Disassembler?
I have had this working, and was for me as close to RABCDAsm / Yogda as I could get.

Resources