Xcode is being developed for Arduino

Read this to make sure you understand what I want to do.

  • I want Xcode to compile, but only so that I can debug Xcode.
  • I DO NOT want to use Xcode to compile or upload code to an Arduino board. Instead, I will use the Arduino IDE in Use External Editor mode.

What I did (as well as a future link for people who might want to do the same):

  • In the project settings (click the project file in the left pane)
  • I changed the compiler to GCC to avoid many errors.
  • I added the following paths in the header search path and library search path:

    • /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/lib/gcc/avr/4.3.2/include
    • /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include
    • /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino

(If you installed Arduino.app somewhere other than the Applications folder, you will need to configure the paths accordingly.)

I included in main.cpp <WProgram.h>, but that was not enough. I received undefined identifier errors (for SPCR, SPE, MSTR, SPR1, SPR0) due to the inability to pass the -mmcu=somechipnameflag to the compiler, which the device did not detect and avr/io.hcannot include the file that defines these characters. I bypassed it manually, including <avr/iom328p.h>, which is the corresponding header file for my chip.

How far have I got.

Now I get the following errors:

Undefined symbols for architecture i386:
  "_init", referenced from:
      _main in main.o
  "_setup", referenced from:
      _main in main.o
  "_loop", referenced from:
      _main in main.o
  "_pinMode", referenced from:
      SBSetup()    in main.o
  "_digitalWrite", referenced from:
      SBSetup()    in main.o

The whole main.cpp, including the crime code, is this:

#include <WProgram.h>
#include <avr/iom328p.h>    // Getting around warning "device type not defined"
#define NumLEDs 25
#define clockpin 13 // CI
#define enablepin 10 // EI
#define latchpin 9 // LI
#define datapin 11 // DI

int LEDChannels[NumLEDs][3] = {0};
int SB_CommandMode;
int SB_RedCommand;
int SB_GreenCommand;
int SB_BlueCommand;

void SBSetup(void) {
    pinMode(datapin, OUTPUT);
    pinMode(latchpin, OUTPUT);
    pinMode(enablepin, OUTPUT);
    pinMode(clockpin, OUTPUT);
    SPCR = (1<<SPE)|(1<<MSTR)|(0<<SPR1)|(0<<SPR0);
    digitalWrite(latchpin, LOW);
    digitalWrite(enablepin, LOW);
}

int main(void)
{
    init();
    setup();
    for (;;)
        loop();
    return 0;
}

What I need?

+5
3

, , XCode IDE Arduino.

, , (i386?). , AVR GCC, , IDE Arduino:

\Compiler.java

!

+1

, XCode XCode.

, , .., XCode 3.2

, XCode4 , , .

: https://github.com/timknapen/Arduino-With-XCode

0

All Articles