Main /
ArduinoYunHow do I run standalone avrdude to program an Arduino Yun?"We are glad you asked! The problem we were having was that under Mac OS X, the Arduino program could successfully download software to the Arduino Yun. However, when we ran The solution
stty -f /dev/tty.usbmodem1421 sleep 1 # Then run the avrdude command avrdude... Getting started with the Mac
We are using the Arduino Yun
avrdude -c avr109 -p m32u4 -v -U lfuse:r:-:i -U hfuse:r:-:i -U efuse:r:-:i -P /dev/tty.usb_path_to_the_device_serial_port So, the makefile gets: PROGRAMMER = -c avr109 FUSES = -U lfuse:w:0x5e:m -U hfuse:w:0x99:m -U efuse:w:0xf3:m
/usr/bin/avr-objcopy -O ihex -R .eeprom main.elf main.hex
Using inoIno has been used to compile and upload to Arduino Yun. Upload has the same issue.
SetupMarch 6, 2014 Download http://arduino.cc/en/Main/Software#toc3. For the mac, I downloaded http://arduino.googlecode.com/files/arduino-1.0.5-macosx.zip See http://arduino.cc/en/Guide/MacOSX for installation. Basically, unzip it in /Applications Generating code to toggle an LEDWhat we want to is create models that use an Arduino-specific Display actor to toggle the LED. This is not that interesting, but gets us started.
$PTII/bin/ptcg -generatorPackageList generic.program.procedural.c.arduino $PTII/ptolemy/cg/adapter/generic/program/procedural/c/arduino/adapters/ptolemy/actor/lib/gui/test/auto/Display.xml
Setting up on the MacIdea: use export PATH=/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin:${PATH} pbl.h: sys/dir.h not foundSolution: #ifndef __CYGWIN__ #ifndef __AVR__ #include <sys/dir.h> #endif #endif For us, the real fix was to edit Problem with InfinityInfinity was not defined, so we did: #ifdef __AVR__ LED_SDF_Director->_stopTime = INFINITY; #else LED_SDF_Director->_stopTime = Infinity; #endif For us, the real fix was to edit #ifdef __AVR__ #define Infinity INFINITY #else #define Infinity HUGE_VAL #endif avr.h not foundSolution: Edit the makefile: ARDUINOINCLUDES=-I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/ LED: LED_Main.c $(PTCG_CFILES) avr-gcc -D__AVR__=1 $(ARDUINOINCLUDES) -D__int64="long long" $(WARNING_CC_FLAGS) $(CC_FLAGS) $(USER_CC_FLAGS) $(DEBUG) $(PTCGINCLUDES) $^ -o LED -lm $(PTCGLIBRARIES) For us, the real fix was to do: cp ./kernel/generic/program/procedural/c/makefile.in ./adapter/generic/program/procedural/c/arduino/ and then edit the new file. io.h: device type not foundMessage: /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/include/avr/io.h:330:6: warning: #warning "device type not defined" Solution: Look in io.h, find the appropriate device. For us on the Arduino Yun, it is Sample Blink Code/* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ // Pin 13 has an LED connected on most Arduino boards. // give it a name: int led = 13; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } pbl.c has include problems.Errors like: commons/pbl.c:52:20: fatal error: memory.h: No such file or directory #include <memory.h> ^ The fix is to edit the master pbl.c. First, find the pbl.c file: bash-3.2$ find $PTII/ptolemy/cg -name pbl.c /Users/cxh/ptII/ptolemy/cg/kernel/generic/program/procedural/c/structures/pbl.c (:source:) Then, edit file, change (:source:) #include <memory.h> to /* The Arduino does not have a memory.h file. */ #ifndef PT_DOES_NOT_HAVE_MEMORY_H #include <memory.h> #endif Then, edit ARDUINO_DEFINES=-D__AVR__ -D__AVR_ATmega32U4__ -DPT_DOES_NOT_HAVE_MEMORY_H The reason to use PT_DOES_NOT_HAVE_MEMORY_H instead of __AVR__ is so that if other platforms do not have a memory.h file, we can just define PT_DOES_NOT_HAVE_MEMORY_H in the makefile for that platform. The makefile.in is a template makefile used when generating Arduino code. The makefile.in gets variable substitutions and $PTII/cg/LED.mk is created. Next stepsRun $PTII/bin/ptcg -generatorPackageList generic.program.procedural.c.arduino $PTII/ptolemy/cg/adapter/generic/program/procedural/c/arduino/adapters/ptolemy/actor/lib/gui/test/auto/Display.xml Then edit the pbl .c and .h files in ptolemy/cg/kernel/generic/program/procedural/c/structures Add defined to those files and to $PTII/ptolemy/cg/adapter/generic/program/procedural/c/arduino/makefile.in May 8 LogThere were a series of issue:
Things we did to get Blink.xml working:
Things that would make this easier the next time:
Things to do
Future fixes
|