Show Posts
|
|
Pages: 1 ... 11 12 [13]
|
|
182
|
Forum 2005-2010 (read only) / Interfacing / Re: Using libraries with Eclipse
|
on: September 19, 2010, 12:30:30 pm
|
Here's the console output from the build: **** Build of configuration Release for project servo-test ****
make all Building file: C:/Program Files/arduino-0018/libraries/Servo/Servo.cpp Invoking: AVR C++ Compiler avr-g++ -I"C:\Program Files\arduino-0018\hardware\arduino\cores\arduino" -I"C:\Program Files\arduino-0018\libraries\Servo" -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -funsigned-char -funsigned-bitfields -fno-exceptions -mmcu=atmega328p -DF_CPU=16000000UL -MMD -MP -MF"Servo.d" -MT"Servo.d" -c -o"Servo.o" "C:/Program Files/arduino-0018/libraries/Servo/Servo.cpp" Finished building: C:/Program Files/arduino-0018/libraries/Servo/Servo.cpp Building file: ../main.cpp Invoking: AVR C++ Compiler avr-g++ -I"C:\Program Files\arduino-0018\hardware\arduino\cores\arduino" -I"C:\Program Files\arduino-0018\libraries\Servo" -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -funsigned-char -funsigned-bitfields -fno-exceptions -mmcu=atmega328p -DF_CPU=16000000UL -MMD -MP -MF"main.d" -MT"main.d" -c -o"main.o" "../main.cpp" Finished building: ../main.cpp Building target: servo-test.elf Invoking: AVR C++ Linker avr-g++ --cref -s -Os -o"servo-test.elf" ./Servo.o ./main.o -lcore328P -lm -Wl,-Map,servo-test.map,--cref -L"C:\Documents and Settings\jim-g\eclipse\workspace\core328P\Release" -mmcu=atmega328p Finished building target: servo-test.elf Invoking: AVR Create Extended Listing avr-objdump -h -S servo-test.elf >"servo-test.lss" Finished building: servo-test.lss Create Flash image (ihex format) avr-objcopy -R .eeprom -O ihex servo-test.elf "servo-test.hex" Finished building: servo-test.hex Invoking: Print Size avr-size --format=avr --mcu=atmega328p servo-test.elf AVR Memory Usage ---------------- Device: atmega328p
Program: 3550 bytes (10.8% Full) (.text + .data + .bootloader)
Data: 56 bytes (2.7% Full) (.data + .bss + .noinit)
Finished building: sizedummy
|
|
|
|
|
183
|
Forum 2005-2010 (read only) / Interfacing / Re: Using libraries with Eclipse
|
on: September 19, 2010, 12:24:52 pm
|
Can you build the following?: #include <WProgram.h> #include <Servo.h>
Servo servo; int pin1 = 1;
void setup() { servo.attach( pin1 ); servo.read(); }
void loop(){ }
int main(void) { init(); setup(); for (;;) loop(); return 0; } This builds without error on my Eclipse/AVR installation. FWIW, I am using a core.a library that is built in Eclipse, but that shouldn't make a difference. Jim
|
|
|
|
|
184
|
Forum 2005-2010 (read only) / Interfacing / Re: Using libraries with Eclipse
|
on: September 19, 2010, 12:18:55 am
|
|
Set up your project and add main.cpp and other source files.
Then add the Servo library by linking the Servo.cpp file into your project: (right click) -> New -> File -> Advanced -> Link to file in the file system -> Browse -> ".../libraries/Servo.cpp"
Or, you can import Servo.cpp into your project and keep a local, duplicate copy of Servo.cpp in your Eclipse workspace.
Now tell Eclipse where to find Servo.h: (right click) - > Properties -> C/C++ Build -> Settings -> AVR C++ Compiler -> Directories -> add Include path ".../libraries/Servo"
You can also import Servo.h into your project and keep a local, duplicate copy, just as can for Servo.cpp. If you do this, then add an Include path to your project workspace instead of the arduino libraries folder.
Jim
|
|
|
|
|
185
|
Forum 2005-2010 (read only) / Development / Re: Eclipse large HEX file size
|
on: September 13, 2010, 11:53:16 pm
|
|
Those settings worked for me as well, but....
I also had to compile/archive a new Arduino libcore.a that had the same optimizations (-ffunction-sections -fdata-sections). After making a new core library using Eclipse/WinAVR, the HEX file from Eclipse for my sample was actually a few bytes smaller than that created using the Arduino IDE.
I will also pass along a particularly helpful (at least with regard to getting the Eclipse command line settings right) feature of the Arduino IDE: if you hold the shift key while compiling, the IDE will create a command line listing in the console window. Using this listing you can duplicate the Arduino environment as closely as you'd like in Eclipse.
Jim
|
|
|
|
|
191
|
Forum 2005-2010 (read only) / Development / Licensing Q's -- in general, and for LiquidCrystal
|
on: September 04, 2010, 08:28:59 pm
|
|
I'm new here, so I apologize in advance if this subject has already been beaten to death (I did search first).
First, I think I understand from the LGPL that if I wish to embed code developed using the Arduino core/libraries into a commercial product that I'll need to make (at minimum) object files available so a user can link in new library versions. Seems reasonable.
My question, though, is how the heck do I do that? And how does someone who buys my gizmo go about linking the proprietary object files with a new version of a library? To comply with the LGPL, how easy does that have to be?
Second question: there are no licensing or copyright notices in the LiquidCrystal source files (at least in version 0018). Is this library in the public domain?
Jim
|
|
|
|
|
193
|
Forum 2005-2010 (read only) / Interfacing / Re: MAX6675 Thermocouple Interface
|
on: February 10, 2010, 01:12:56 pm
|
Ryan - Wish I had seen your post first, but I didn't so I tackled this without the benefit of your experience. I downloaded the Spi library and used it without tweaking. // Demo application to read MAX6675 chip using // Serial Peripheral Interface (SPI)
#include <Spi.h>
// Pin connections to Arduino: // chip select = 10 = SS_PIN // clock = 13 = SCK_PIN // MAX6675 output = 12 = MISO_PIN
#define DESELECT digitalWrite( SS_PIN, HIGH ) #define SELECT digitalWrite( SS_PIN, LOW )
void setup() { DESELECT; // deselect the MAX6675 Spi.mode( ( ( 1 << SPR1 ) | ( 1 << CPHA )) ); // set SPI interface mode 1, 2Mhz clock Serial.begin( 9600 ); }
void loop() { unsigned char highByte = 0; unsigned char lowByte = 0; float tempF; short ivalue; delay(500);
// select the device, wait > 100nS, read two bytes, deselect SELECT; delayMicroseconds(1); highByte = Spi.transfer( 0 ); lowByte = Spi.transfer( 0 ); DESELECT;
// if bit 3 is high thermocouple is unconnected if (lowByte & (1<<2)) { Serial.print("Not connected "); Serial.print(highByte, HEX); Serial.print(" "); Serial.println(lowByte, HEX); } else { // temperature value is in bits 6-0 of highByte and 7-2 of lowByte ivalue = ( highByte << 5 | lowByte >> 3 ); tempF = ivalue * 0.25 * 1.8 + 32.0; Serial.println( tempF ); } }
The only problem I've run into is the self-heating of the MAX6675, on the order of 10C or more at room temperature. Connecting the t/c leads at a point that matches the chip temperature is going to be a challenge. Jim
|
|
|
|
|