Sign up ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

Can you use clang, with --mpu=arm, etc. and avrdude to program an Arduino Due (Arm Cortex M3)?

share|improve this question
    
theoretically possible or practically possible? –  BrettAM Feb 15 at 18:45
1  
It'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 R. Bloomfield Feb 15 at 19:40

3 Answers 3

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.

share|improve this answer

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.

share|improve this answer
up vote 0 down vote accepted

I would like to thank everyone for answering, but after recently examining the way Objective-C works, I have found it would require many extra libraries, because Objective-C links at the runtime, and libobjc is about 4 Megabytes, much to large for an Arduino to handle. Also, it would require me to write a dynamic linker(Probably), and would also require me to implement libc, and probably would require me to patch the libobjc source to support Arduino, which doesn't have a OS, which would probably be slight problem.

Thanks to one and all who answered, and so sorry to have bothered you.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.