Go Down

Topic: Arduino bundle for TextMate (Read 5 times) previous topic - next topic

bigengineer

#30
Sep 15, 2007, 11:52 am Last Edit: Sep 15, 2007, 11:56 am by bigengineer Reason: 1
I am still having trouble with the Makefile and libraries. The LCD4Bit works with the -I mentioned some posts above. But the twi lib doesn't work. In Wire.cpp I changed   #include "twi.h" to   #include "utility/twi.h" (line 24), this gets me a little bit further but it still doesn't compile. This is the make output:

Code: [Select]

applet/core.a(Wire.o): In function `TwoWire::begin()':
Wire.cpp:(.text+0x38): undefined reference to `twi_init'
applet/core.a(Wire.o): In function `TwoWire::begin(unsigned char)':
Wire.cpp:(.text+0x44): undefined reference to `twi_setAddress'
Wire.cpp:(.text+0x4a): undefined reference to `twi_attachSlaveTxEvent'
Wire.cpp:(.text+0x50): undefined reference to `twi_attachSlaveRxEvent'
applet/core.a(Wire.o): In function `TwoWire::requestFrom(unsigned char, unsigned char)':
Wire.cpp:(.text+0x76): undefined reference to `twi_readFrom'
applet/core.a(Wire.o): In function `TwoWire::endTransmission()':
Wire.cpp:(.text+0xae): undefined reference to `twi_writeTo'
applet/core.a(Wire.o): In function `TwoWire::send(unsigned char)':
Wire.cpp:(.text+0x10c): undefined reference to `twi_transmit'
applet/core.a(Wire.o): In function `TwoWire::send(unsigned char*, unsigned char)':
Wire.cpp:(.text+0x15c): undefined reference to `twi_transmit'
make: *** [applet/i2c_test.elf] Error 1


I made a very simple example:

Code: [Select]

#include <Wire.h>
void setup()
{
     
     
     Wire.begin();
     
     Wire.beginTransmission(0x1D);
     Wire.send(0x20);
     Wire.send(0x87);
     Wire.endTransmission();
     
}
void loop()
{
}


This compiles with the arduino IDE.  The modifications to the makefile:


ARDUINO = $(INSTALL_DIR)/lib/targets/arduino
ARDUINOLIBS = $(INSTALL_DIR)/lib/targets/libraries
AVR_TOOLS_PATH = $(INSTALL_DIR)/tools/avr/bin
SRC =  $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
$(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
$(ARDUINO)/wiring_pulse.c $(ARDUINO)/wiring_serial.c \
$(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(ARDUINO)/WRandom.cpp \
$(ARDUINOLIBS)/Wire/Wire.cpp
FORMAT = ihex


# Name of this Makefile (used for "make depend").
MAKEFILE = Makefile

# Debugging format.
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
DEBUG = stabs

OPT = s

# Place -D or -U options here
CDEFS = -DF_CPU=$(F_CPU)
CXXDEFS = -DF_CPU=$(F_CPU)

# Place -I options here
CINCS = -I$(ARDUINO) -I$(ARDUINOLIBS)/Wire -I$(INSTALL_DIR)/lib/targets/wiring
CXXINCS = -I$(ARDUINO)  

mellis

You need to add twi.c to your SRC variable (e.g. $(ARDUINOLIBS)/Wire/utility/twi.c).

bigengineer


rahji aka rob

If anyone is using TextMate to write straight C code using avr glibc, this might help:

http://www.rahji.com/wordpress/2007/09/27/textmate-syntax-highlighting-for-avr-libc/

Good luck,
rob

xSmurf

Neat! Thank Rahji! I've got to try that out :D
"Pilots believe in a clean living... they never drink wisky from a dirty glass."

nay

hi all, just got my arduino today! before finding this thread (which i admit i only skimmed over) i added a 'run in arduino' command to my the processing textmate bundle that i got through the getbundle bundle. the 'run in processing' command needed to be changed as per this thread:
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Collaboration;action=di splay;num=1174403295

so i just copied the 'run in processing' command  but changed the code to this:
osascript <<EOF
tell application "Arduino 09" to run
tell application "Arduino 09" to activate
tell application "Arduino 09" to open POSIX file "${TM_FILEPATH}"
delay 1
tell application "System Events" to tell process "Arduino"
keystroke "u" using command down
end tell
EOF

this works but it would be great if someone came up with an arduino bundle (just by copying the processing bundle) for getbundle so that all the syntax highlighting would be correct. i don't know how but maybe if no one beats me to it i'll get around to it...

lamadio

I've been working on a TextMate bundle.  I just updated it to support the -10 release. (There are lots of warnings generated by the compiler, which I'd be happy to fix and check in.

Feedback welcome.

You can download from this blog post:
http://www.ooeygui.com/?p=46

nay

thanks - look forward to trying it out - but the download link on your page is wrong. need to remove /wp-admin form the url

lamadio

#38
Nov 24, 2007, 07:25 pm Last Edit: Nov 24, 2007, 07:50 pm by lamadio Reason: 1
I'd be willing to check the code into a public Arduino repository, so we can get other people hacking on it. So far, I've got the following features implemented:

Menu to Choose the microcontroller architecture - Atmega 8, Atmega 168, and the Make Controller (forthcoming).
Menu item to Compile and upload to the Microcontroller
Menu to Show a Serial Monitor.

The serial monitor is a sepaate binary which reads from the serial port and outputs using the OSX terminal. This does mean you can use ANSI codes - I hope to add support to the serial library for making this easier.

The plugin also includes an output window which collects the output from the compiler and uploader.

Future enhancements:
- User specified makefile (something that gets included into the build process instead of manually walking the tree).
- Make controller support.
- Hot Keys for building
- Don't leak so much
- Ability to specify upload port
- Multiple controller support.
- Non-blocking calls to external binaries

NOTE: This was built on an Intel machine running Leopard. It has not been tested on Tiger or PowerPC; Would be interested to know how it works.

Good luck, and enjoy!


(Thanks for the note about the broken link. Wordpress has been messing with my posts.)

xSmurf

#39
Nov 25, 2007, 12:53 am Last Edit: Nov 25, 2007, 01:12 am by xSmurf Reason: 1
w00t, I'll be trying this right away! :D

It'd be nice if it was in the repository :)
"Pilots believe in a clean living... they never drink wisky from a dirty glass."

peeloo

Here is another Textmate Arduino bundle I've done this afternoon:

http://github.com/alx/arduino.tmbundle/tree/master

Once installed, you just have to press Command+Shift+A to make and upload your program on the Arduino.

Be sure your Arduino program is installed in /Applications/arduino-0011/

It's working with Blink.pde, I'm not sure yet it'd be working with something else, but as I'll use it a lot this week our Reprap project - http://www.reprap.org - you'll be sure to see some updates on the repository.
If you have some patches, you can clone/fork the repository, I'll be glad to add your particpation in this bundle :)

Go Up