Eierlegendewollmilchsau trifft auf Arduino Uno R3
Hallo,
der letzte Beitrag in diesem Thread ist nun schon fast zwei Jahre her, da wird es Zeit...
Für mein neues Projekt habe ich mir einen Arduino Uno R3 zugelegt. Den Arduino-Editor finde ich nicht so dolle und habe deshalb probiert, den Arduino mit der Eierlegendenwollmilchsau zu programmieren. Das ist mir z.T. auch gelungen, aber ich bin daran gescheitert, die mitgelieferten Bibliotheken des Arduino einzubinden. Dazu war es mir wichtig, die Verzeichnisstruktur der Arduino-Software (incl. Compiler) unverändert zu lassen. Auf diesem Wege könnte ich die originale IDE weiterhin nutzen und ohne Probleme auch Updates einspielen.
Hat sich jemand daran schon probiert?
Ulli
Liste der Anhänge anzeigen (Anzahl: 1)
Hi Ulli,
die Libraries kannst Du über den Makefile einbinden.
Anhang 25218
Gruss,
Osser
Mit dem Kopf durch die Wand ...
Hallo Osser,
um überhaupt erst man ein Erfolgserlebnis zu bekommen, habe ich Deinen Ratschlag befolgt und bin dabei ganz einfach mit dem Kopf durch die Wand.
Ich habe mir mein Beispielprogramm:
Zitat:
// Blink: Turns on an LED on for one second, then off for one second...
# include "Arduino.h"
// Pin 13 has an LED connected on most Arduino boards.
int led = 13; // give it a name:
// the setup routine runs once when you press reset:
void setup()
{
pinMode(led, OUTPUT); // initialize the digital pin as an 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
}
mit der original Arduino-IDE 1.0 compilieren lassen. Die Compilermeldungen habe ich ganz einfach in den pn-Editor kopiert, die entsprechenden Befehle extrahiert, den Rest gelöscht und die AsuroFlash-Variablen eingefügt. Herausgekommen ist folgendes:
Zitat:
@set path=%AF_PRGDIR%\Arduino\hardware\tools\avr\bin\;% path%
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_PRJDIR%\%AF_SOURCE_FILES% -o%AF_PRJDIR%\%AF_SOURCE_FILES%.o
avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\WInterrupts.c -o%AF_PRJDIR%\WInterrupts.c.o
avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\wiring.c -o%AF_PRJDIR%\wiring.c.o
avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\wiring_analog.c -o%AF_PRJDIR%\wiring_analog.c.o
avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\wiring_digital.c -o%AF_PRJDIR%\wiring_digital.c.o
avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\wiring_pulse.c -o%AF_PRJDIR%\wiring_pulse.c.o
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_PRJDIR%\%AF_SOURCE_FILES% -o%AF_PRJDIR%\%AF_SOURCE_FILES%.o
avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\WInterrupts.c -o%AF_PRJDIR%\WInterrupts.c.o
avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\wiring.c -o%AF_PRJDIR%\wiring.c.o
avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\wiring_analog.c -o%AF_PRJDIR%\wiring_analog.c.o
avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\wiring_digital.c -o%AF_PRJDIR%\wiring_digital.c.o
avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\wiring_pulse.c -o%AF_PRJDIR%\wiring_pulse.c.o
avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\wiring_shift.c -o%AF_PRJDIR%\wiring_shift.c.o
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\CDC.cpp -o%AF_PRJDIR%\CDC.cpp.o
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\HID.cpp -o%AF_PRJDIR%\HID.cpp.o
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\HardwareSerial.cpp -o%AF_PRJDIR%\HardwareSerial.cpp.o
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\IPAddress.cpp -o%AF_PRJDIR%\IPAddress.cpp.o
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\Print.cpp -o%AF_PRJDIR%\Print.cpp.o
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\Stream.cpp -o%AF_PRJDIR%\Stream.cpp.o
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\Tone.cpp -o%AF_PRJDIR%\Tone.cpp.o
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\USBCore.cpp -o%AF_PRJDIR%\USBCore.cpp.o
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\WMath.cpp -o%AF_PRJDIR%\WMath.cpp.o
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\WString.cpp -o%AF_PRJDIR%\WString.cpp.o
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I%AF_ARDCORES% -I%AF_ARDTYPES% %AF_ARDCORES%\main.cpp -o%AF_PRJDIR%\main.cpp.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\WInterrupts.c.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\wiring.c.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\wiring_analog.c.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\wiring_digital.c.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\wiring_pulse.c.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\wiring_shift.c.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\CDC.cpp.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\HID.cpp.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\HardwareSerial.cpp.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\IPAddress.cpp.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\Print.cpp.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\Stream.cpp.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\Tone.cpp.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\USBCore.cpp.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\WMath.cpp.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\WString.cpp.o
avr-ar rcs %AF_PRJDIR%\core.a %AF_PRJDIR%\main.cpp.o
avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o %AF_PRJDIR%\%AF_SOURCE_FILES%.elf %AF_PRJDIR%\%AF_SOURCE_FILES%.o %AF_PRJDIR%\core.a -L%AF_PRJDIR% -lm
avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 %AF_PRJDIR%\%AF_SOURCE_FILES%.elf %AF_PRJDIR%\%AF_SOURCE_FILES%.eep
avr-objcopy -O ihex -R .eeprom %AF_PRJDIR%\%AF_SOURCE_FILES%.elf %AF_PRJDIR%\%AF_SOURCE_FILES%.hex
Eingetragen habe ich diesen Befehlsblock im Config-Menue unter Make all. Ein makefile ist dann nicht mehr notwendig. Das Fenster Make file im Config-Menue bleibt also leer.
Das Aufräumen erfolgt durch einige wenige Befehle im Fenster Make clean im Config-Menue:
Zitat:
del %AF_PRJDIR%\*.o
del %AF_PRJDIR%\*.a
del %AF_PRJDIR%\*.eep
del %AF_PRJDIR%\*.elf
Zusätzlich zu den Standardvariablen zeigt
AF_ARDCORES in den Arduino-Ordner ..\hardware\arduino\cores\arduino und
AF_ARDTYPES in den Arduino-Ordner ..\hardware\arduino\variants\standard (Uno-Board!)
Die Arduino-Installation befindet sich im Verzeichnis von AsuroFlash im Unterordner Arduino.
Das ganze Verfahren ist sicher alles andere als professionell, aber immerhin ein Ansatz, der schon mal funktioniert.
An der makefile-Vorlage, die ich weiter oben erwähnt habe, bin ich bislang gescheitert.
Gruss
Ulli
Nachtrag: Projekt-Pfadnamen mit Leerzeichen
Wenn der Pfadname eines Projektes Leerzeichen enthält, ist in make_all und make_clean
AF_PRJDIR
komplett (!) durch
"AF_PRJDIR"
zu ersetzen. Sonst gibt der Compiler Fehlermeldungen aus.
Alle anderen Installationsverzeichnisse enthalten bei mir keine Leerzeichen.
Hier müssen u.U. ebenfalls Anpassungen vorgenommen werden.
Ulli