Can you use
--mpu=arm, etc. and
avrdude to program an Arduino Due (Arm Cortex M3)?
Can you use
theoretically possible or practically possible?– BrettAMFeb 15, 2015 at 18:45
1It's actually the other way round: C/C++ is a subset of Objective C (or more accurately, Objective C is based on C/C++).– Peter BloomfieldFeb 15, 2015 at 19:40
1OK So programming directly in Obj-C is not a good idea, but if you where dead set on doing it you could look at a tool which translates the Obj-C into C/C++ and then compile the output. There are/were tools like this around I had to use one to do C++ to C many years ago.– Code GorillaSep 15, 2016 at 8:02
Simple version: No, you cannot program Arduino using Objective-C.
Long version: The Arduino IDE uses avr-gcc as it's compiler, and avr-gcc is a C/C++ compiler, not an Object-C compiler. The Arduino libraries are written in C/C++.
There are other compilers that exist for AVR processors, and so it is possible to use other languages for the AVR.
However, if you switch to a different compiler for your code, you will not be able to use the Arduino libraries with it, because they are written in C/C++ for the avr-gcc compiler. (It may be possible to compile the Arduino libraries with avr-gcc, and then link them to your code using external language linking methods, but that could be a significant challenge.)
Also, I do not know of any existing Objective-C compilers for AVR; it's possible one may exist, but after a quick web search, I didn't find any.
Theoretically, many things are possible. There is an easy way to code Arduino on Xcode with EmbedXCode (http://playground.arduino.cc/Main/EmbedXcode), but in C and CPP.
You need a compiler that will compile your Objective-C to for the AVR (if you are using an AVR-based Arduino), this may be difficult to find. Once your code is compiled, then you need to upload it to the Arduino.
So in any reasonable means, it is at least very challenging.
It can be done, however, it is inadvisable. In order to implement this, one must implement the Objective-C runtime, which, though not insurmountable, is very near insurmountable as far as difficulty is concerned. Perhaps someday some brave soul will see fit to grace the world with their custom Arduino Objective-C runtime, but until that day, the rest of us mere mortals have naught to do but wait for the coming of the Objective-C prophet.
If there are any brave souls in the audience who wish to take on this ultimate challenge, then let them. But otherwise, keep the code in C and hold your peace.